« Back to channel list

#ruby - 06 March 2019

« Back 1 day Forward 1 day »
[00:00:03] spacesuitdiver: has joined #ruby
[00:02:08] zenspider: kirun: reduced: https://dpaste.de/n0kU
[00:07:22] mamantoha: has joined #ruby
[00:08:24] awkwords: has joined #ruby
[00:17:29] AJA4350: has joined #ruby
[00:23:16] Tempesta: has joined #ruby
[00:23:18] kirun: zenspider: I filed it... https://bugs.ruby-lang.org/issues/15640
[00:24:06] kirun: Also... time to sleep.
[00:30:02] elphe: has joined #ruby
[00:30:10] johnny56_: has joined #ruby
[00:42:11] _whitelogger: has joined #ruby
[00:48:12] bmurt: has joined #ruby
[00:49:27] bmurt: has joined #ruby
[00:51:22] t0x: has joined #ruby
[00:52:26] mangold: has joined #ruby
[01:08:02] agent_white: has joined #ruby
[01:08:59] al2o3-cr: has joined #ruby
[01:32:12] sgen: has joined #ruby
[01:35:48] ur5us: has joined #ruby
[01:55:33] AJA4350: has joined #ruby
[02:01:12] elphe: has joined #ruby
[02:06:21] conta: has joined #ruby
[02:06:46] eb0t_: has joined #ruby
[02:07:16] DaRock: has joined #ruby
[02:07:55] DaRock: Hey guys - quick question: what is the reasoning behind the header limitations in rack?
[02:09:34] DaRock: I have a multiple header, and it is also (by RFC documentation) further split by semicolons and spaces, and each definition can be defined over multiple lines
[02:10:03] DaRock: so how does that fit with rack's response header limitations?
[02:10:52] DaRock: allegedly, rack cannot handle multiple lines for a single definition
[02:11:51] mangold: has joined #ruby
[02:14:25] DaRock: it also chokes on a \r\n which is also a foundation for http response
[02:14:49] DaRock: I can use \n, but I don't think that's working
[02:19:59] Onwarion_re: has joined #ruby
[02:24:04] ascarter: has joined #ruby
[02:31:34] havenwood: DaRock: I'm not familiar with any \r\n issue. Have a minimal reproduction case?
[02:32:16] DaRock: not really - depends on what you mean by "minimal" :-)
[02:32:55] DaRock: basically the linter invalidates the the string on \r
[02:33:03] DaRock: it will only accept \n
[02:33:47] DaRock: I've got something happening now, but I'm not 100% certain how valid it is, and even so it does make working with the response object harder than I believe it should be
[02:34:33] DaRock: I think there may be some confusion over the interpretation of rfc7230 and valid tokens
[02:36:01] havenwood: What version of Rack are you on?
[02:36:02] DaRock: simply looking at the request header invalidates the interpretation taken by the rack - see the accepts field
[02:36:15] DaRock: no idea :-)
[02:36:37] DaRock: I'm getting my ruby on, and I needed a http server, so I decided to learn it
[02:37:14] DaRock: ruby's 2.4.5
[02:37:18] havenwood: DaRock: Assuming it's a Gemfile-based thing: bundle info rack
[02:38:03] DaRock: haven't got to gemfiles yet - still learning ruby styling
[02:38:18] havenwood: DaRock: gem list rack
[02:38:47] havenwood: or rather: gem list -e rack
[02:39:01] havenwood: or: rackup -v
[02:39:08] DaRock: so gem's a bit like a pip equivalent?
[02:39:19] DaRock: rack (2.0.6)
[02:40:01] havenwood: DaRock: Yeah, like pip or npm.
[02:40:38] havenwood: DaRock: RubyGems/Bundler ship with Ruby and provide packaging and dependency resolution.
[02:40:49] havenwood: DaRock: Actually, a closer to Yarn.
[02:41:18] havenwood: DaRock: https://github.com/rack/rack/blob/7420be230f73ed350fb0aea612d0ea98cb451778/test/spec_lint.rb#L204-L216
[02:42:01] havenwood: I'm curious what the discrepancy is in the reading of 7230.
[02:43:51] DaRock: well the discrepancy is when you look at pretty much any accept header field, which should be following the same spec, right?
[02:44:39] DaRock: it breaks that multiple ways - "text/html,application/xhtml+xm…ml;q=0.9,image/webp,*/*;q=0.8"
[02:45:15] DaRock: actually: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[02:46:21] DaRock: unless token is a smaller value than I read it
[02:47:39] DaRock: and of greater interest to myself is rfc8288 - which is also relevant and is based upon the rfc7230 document, at least the writers are well aware of it
[02:48:00] havenwood: i'm missing the invalid part?
[02:49:09] DaRock: am I reading it wrong then? I see semicolon, asterisk, +, ... as invalid
[02:49:32] DaRock: at least according to the way rack has interpreted it
[02:50:10] havenwood: it looks to me like the spec is saying those are all valid characters
[02:50:53] DaRock: Delimiters are chosen
[02:50:54] DaRock: # from the set of US-ASCII visual characters not allowed in a token
[02:51:42] DaRock: what really got me was the implementation of rfc8288 - where folding can take place using \r\n - and the rack linter choked
[02:52:01] havenwood: DaRock: right, but that's: "(),/:;<=>?@[\]{}
[02:52:32] DaRock: so what's a token as defined by rack then?
[02:52:44] vonfry: has joined #ruby
[02:53:09] Renich_: has joined #ruby
[02:54:27] agent_white: has joined #ruby
[02:54:33] havenwood: it's following 7230 as far as I can tell. maybe i'm just not getting it.
[02:55:25] DaRock: so I set my header back so that the error returned, and this is the error message: invalid header value Link: "<jails/>;\r"
[02:56:00] havenwood: DaRock: \r is an invalid token, right?
[02:56:01] DaRock: the particular area is actually invalid header value Link: "<jails/>;\r\nrel=\"..."
[02:56:23] DaRock: not as I read it and apparently not according to rfc8288
[02:57:19] havenwood: DaRock: mind linking to the part of 8288 you mean?
[02:57:22] DaRock: tokens can be folded using \r\n, which apparently conflicts in interpretations of rfc7230
[02:58:11] DaRock: https://tools.ietf.org/html/rfc8288
[02:58:37] DaRock: https://tools.ietf.org/html/rfc8288#section-3.5
[02:59:09] DaRock: https://tools.ietf.org/html/rfc8288#section-3
[03:01:14] DaRock: I mean I can make it happen apparently, but it seems harder than it should be, and I'm wondering if it may be a bug or at least some reference should be made to it - its been giving me a headache trying to figure out what I did wrong :-)
[03:01:54] DaRock: it was only after some rather extensive searching that I discovered the apparent limitations rack linter has on the header fields
[03:03:28] DaRock: as far as the rfc8288 is concerned, it is only one of the rigid examples that follow this style, I'm sure there are more - accept header is one example, but I can't find specifics on that right now
[03:04:35] havenwood: DaRock: https://tools.ietf.org/html/rfc7230#section-3.2.4
[03:10:52] havenwood: Fun new addition to Rack, Eileen added trailer headers! https://github.com/rack/rack/commit/cf0b8eaf0e373e2a315f7be90ea7b2d3051aaa17
[03:12:58] bambanx: has joined #ruby
[03:13:54] hahuang65: has joined #ruby
[03:14:04] DaRock: so where does that leave us then?
[03:14:34] DaRock: even if I use \s\t it fails miserably
[03:15:31] havenwood: DaRock: "This specification deprecates such line folding"
[03:15:48] DaRock: AFAIU the purpose is for "human readability", but bunching together isn't all that "human readable"
[03:16:16] DaRock: yes but rfc8288 was implemented _after_ rfc7230 :-)
[03:16:29] DaRock: rfc7230 - 2014
[03:16:35] DaRock: rfc8288 - 2017
[03:16:57] DaRock: and prev rfc8288 was rfc5988
[03:17:26] DaRock: do _they_ know what they are doing?
[03:18:14] awkwords: has joined #ruby
[03:20:08] blackmesa: has joined #ruby
[03:20:56] DaRock: looks like there's very little anyone in ruby can do, so I'll thank you for your help and grin and move on. I think I can do what I need now, so that's what matters - leave the politics to some other fools to figure out :-D
[03:22:38] havenwood: DaRock: Maybe RFC 1796 explains it :P "Not All RFCs are Standards"
[03:23:52] DaRock: does make you wonder if any read their own rfc'sthough...
[03:24:25] havenwood: DaRock: maybe they're trying to avoid proposed standards relying on other proposed standards?
[03:24:56] DaRock: can you imagine how that would work in practice though?
[03:25:26] havenwood: DaRock: yeah, it's chaos. here, Rack is targeting 7239 since Rack version 1.6.
[03:25:34] DaRock: standards for a nut not relying on the standards for a bolt? lol
[03:25:35] havenwood: It's 7230**
[03:26:14] havenwood: DaRock: now we need a standard for the nut/bolt adapter
[03:26:20] DaRock: its all good - got to start somewhere. As long as there's a way around it might as well stick to it :-)
[03:26:52] DaRock: leave it to the philosophers at the top then :-)
[03:28:00] DaRock: well thanks again havenwood - I guess I better eat something...
[03:28:13] [Butch]: has joined #ruby
[03:29:00] havenwood: application/text+plain; charset=utf-8; \r\nContent-Length:0\r\n\r\nHTTP/1.1 200 OK\r\n
[03:29:03] hahuang65: has joined #ruby
[03:29:12] havenwood: DaRock: thanks for the interesting question - have good eats!
[03:32:38] arekushi: has joined #ruby
[03:37:22] dellavg__: has joined #ruby
[03:45:23] Renich: has joined #ruby
[03:56:38] dviola: has joined #ruby
[04:10:21] braincrash: has joined #ruby
[04:10:30] blackmesa: has joined #ruby
[04:11:03] ascarter: has joined #ruby
[04:22:42] sgen: has joined #ruby
[04:24:13] kapil____: has joined #ruby
[04:25:15] marmotini_: has joined #ruby
[04:36:22] ascarter: has joined #ruby
[04:36:53] v01d4lph4: has joined #ruby
[04:49:53] elphe: has joined #ruby
[04:51:43] laaron: has joined #ruby
[05:00:07] sagax: i can't understand, `Dir` - what this method? Example why `Dir["/"]` work but Dir ["/"] or Dir(["/"]) don't work ?
[05:00:14] tdy: has joined #ruby
[05:01:06] leftylink: Dir is https://ruby-doc.org/core-2.5.1/Dir.html
[05:03:30] leftylink: since Dir is a class and not a function, `Dir ["/"]` and `Dir(["/"])` do not work. Both of those forms attempt to call a function named Dir with a single argument, ["/"]
[05:03:53] havenwood: sagax: It's syntactic sugar for: Dir.[]("/")
[05:04:31] havenwood: sagax: Or you can omit the parens: Dir.[] "/"
[05:05:01] havenwood: sagax: More succinctly: Dir["/"]
[05:05:19] sagax: Dir["/"] see like as magic
[05:05:24] havenwood: sagax: You can define your own #[] or #[]=
[05:06:30] havenwood: &was >> module Sagax; def self.[] n; n.digits.join.to_i end end; Sagax[42]
[05:06:30] rubydoc: parser error at position 0 around `w'
[05:06:36] havenwood: &>> module Sagax; def self.[] n; n.digits.join.to_i end end; Sagax[42]
[05:06:38] rubydoc: # => 24 (https://carc.in/#/r/6fdz)
[05:06:49] sagax: wow, thanks
[05:10:32] elphe: has joined #ruby
[05:12:27] bambanx: has joined #ruby
[05:24:45] laaron: has joined #ruby
[05:27:36] laaron: has joined #ruby
[05:31:15] elphe: has joined #ruby
[05:40:01] duckpuppy: has joined #ruby
[05:48:41] mjacob: is there a way to get the concatenation of the regexps? e.g. /a/ and /b/ -> /ab/
[05:49:12] cyberRodent: has joined #ruby
[05:50:00] mozzarella: mjacob: Regexp.union
[05:50:33] mjacob: mozzarella: maybe i'm missing something, but that would give me the union, doesn't it?
[05:50:52] mozzarella: so you want a literal concatenation?
[05:51:57] elphe: has joined #ruby
[05:52:01] bambanxx: has joined #ruby
[05:52:03] mjacob: what do you mean by "literal" concatenation?
[05:52:54] luminousnine: has joined #ruby
[05:53:26] bambanxx: has joined #ruby
[05:53:33] mjacob: i mean https://en.wikipedia.org/wiki/Concatenation#Concatenation_of_sets_of_strings
[05:53:51] havenwood: mjacob: /a#{/b/}/
[05:54:47] bambanxx: has joined #ruby
[05:56:02] leftylink: one must be careful if one of the two regexes to be concatenated contains |, since the first approach someone might think of won't do the trick there. but perhaps some parentheses can solve that problem
[05:56:37] leftylink: &>> r1 = /a|b/; r2 = /c/; rcat = /#{r1.source}#{r2.source}/; rcat.match?('a') # but you would think this should be false
[05:56:39] rubydoc: # => true (https://carc.in/#/r/6fe2)
[05:57:39] leftylink: so perhaps some parens, possibly with ?: if preventing capture is important
[05:57:46] rafadc: has joined #ruby
[05:57:50] mjacob: havenwood: i think that one is correct
[05:58:21] mjacob: /#{/a|b/}#{/c/}/ -> /(?-mix:a|b)(?-mix:c)/
[05:58:55] mjacob: is there a way to get rid of the redundant options?
[05:58:55] leftylink: ah, that is fortunate.
[05:59:15] havenwood: mjacob: yeah, and a bit shorter than: Regexp.compile "#{/a|b/}#{/b/}"
[05:59:51] mozzarella: what's your use case mjacob? just curious
[06:00:16] havenwood: mjacob: no, I don't know of a way to remove the options
[06:01:13] mjacob: mozzarella: i have a prefix tree and want to regenerate the corresponding regex
[06:15:19] havenwood: this reminds me of the `o` option for interpolating only once: https://gist.github.com/havenwood/422e9fc9926328a3a192875aff519ddd
[06:18:39] conta: has joined #ruby
[06:31:18] iNs: has joined #ruby
[06:41:06] reber: has joined #ruby
[06:47:39] marmotini_: has joined #ruby
[06:52:43] elphe: has joined #ruby
[07:08:42] za1b1tsu: has joined #ruby
[07:12:34] aufi: has joined #ruby
[07:16:23] keden: has joined #ruby
[07:24:11] teclator: has joined #ruby
[07:25:57] aupadhye: has joined #ruby
[07:37:10] clemens3_: has joined #ruby
[07:37:11] keden: has joined #ruby
[07:38:44] Dbugger: has joined #ruby
[07:53:28] elphe: has joined #ruby
[08:02:38] sagax: `defined? foo.method` it's good way to check that method exists?
[08:05:04] sagax: or `respond_to?` better?
[08:07:37] laaron-: has joined #ruby
[08:14:13] elphe: has joined #ruby
[08:14:19] clemens3_: has joined #ruby
[08:18:39] Sylario: has joined #ruby
[08:22:49] eightfold: has joined #ruby
[08:30:19] havenwood: sagax: the latter is better: foo.respond_to?(:method)
[08:35:11] elphe: has joined #ruby
[08:40:45] ellcs: has joined #ruby
[08:49:55] lxsameer: has joined #ruby
[08:53:41] jmcgnh: has joined #ruby
[08:58:59] ur5us: has joined #ruby
[09:03:37] keden: has joined #ruby
[09:03:45] szulak_: has joined #ruby
[09:09:50] keden: has joined #ruby
[09:15:02] elphe: has joined #ruby
[09:18:00] Swyper: has joined #ruby
[09:28:38] Furai: has joined #ruby
[09:30:24] Swyper: has joined #ruby
[09:33:12] blackmesa: has joined #ruby
[09:35:17] dionysus70: has joined #ruby
[09:36:55] Swyper: has joined #ruby
[09:44:57] Nicmavr: has joined #ruby
[09:47:48] cisco: has joined #ruby
[09:58:49] hightower2: has joined #ruby
[10:06:04] rizwan_: has joined #ruby
[10:06:08] Emmanuel_Chanel: has joined #ruby
[10:06:26] rizwan_: I am trying to use Ruby console on my linux machine and am experiencing an error I do not know how to solve, I have been googling but can't find the right info on stackoverflow etc
[10:06:49] rizwan_: This is my error: https://dpaste.de/5nV3
[10:07:02] rizwan_: may someone please help me?
[10:09:31] tbuehlmann: rizwan_: you probably don't have bundler installed. try running `gem install bundler`
[10:09:46] rizwan_: I tried using 'gem' and it doesnt work on my computer
[10:09:52] rizwan_: apt-get and npm do
[10:09:59] rizwan_: will it work with those?
[10:10:22] rizwan_: i am currently installing bundler using npm
[10:11:52] rizwan_: Hi tbuehlmann I am still having the same problem: https://dpaste.de/0SHC
[10:12:46] tbuehlmann: npm has nothing to do with ruby, don't do that
[10:13:18] tbuehlmann: what exactly happens when you run `gem install bundler`?
[10:14:39] rizwan_: ill uninstall bundler with npm
[10:14:41] rizwan_: then try gem again
[10:14:43] rizwan_: one second
[10:15:37] rizwan_: oh - installing bundler worked!
[10:15:42] rizwan_: I remember trying it before and it not working
[10:15:49] rizwan_: i used 'gem install bundler' this time :)
[10:16:40] rizwan_: hi, the command worked but I am still getting an error message: https://dpaste.de/hMwU
[10:17:08] rizwan_: https://dpaste.de/dc2a <- please see this one instead
[10:17:31] tbuehlmann: you're running `ruby console`, you probably mean `rails console`
[10:18:45] rizwan_: i ran rails console too (See my last link https://dpaste.de/dc2a)
[10:20:15] tbuehlmann: even after installing bundler?
[10:20:24] kapil____: has joined #ruby
[10:20:52] rizwan_: after installing bundler
[10:21:15] rizwan_: see this: https://dpaste.de/2578
[10:21:20] rizwan_: (and thanks for this btw :) )
[10:33:08] keden: has joined #ruby
[10:37:24] DTZUZO: has joined #ruby
[10:38:26] j416: has joined #ruby
[10:39:08] rizwan_: hi, is anyone there?
[10:39:26] rizwan_: I also ran gem update --system but that didn't work either
[10:40:07] zenspider: mjacob: I've got: re.join("|").to_s.gsub(/-mix/, "")
[10:40:16] ellcs: has joined #ruby
[10:40:18] zenspider: so... no GOOD way. :P
[10:40:50] eblip: has joined #ruby
[10:50:57] j416: has joined #ruby
[10:53:19] c-c: rizwan_: ok you still need help?
[10:53:28] rizwan_: i still need help yes
[10:53:32] rizwan_: thing is, i am new to linux
[10:53:38] c-c: lets start with your ruby and gem install
[10:53:43] rizwan_: so a lot of these errors really stump me and the solutoions online are too hard tou nderstand
[10:53:46] rizwan_: thanks c-c :)
[10:53:50] c-c: How did you install ruby? B)
[10:54:14] rizwan_: sudo apt-get
[10:54:20] rizwan_: then i installed bundler via gem install bundler
[10:54:24] rizwan_: but im still getting error messages
[10:54:36] rizwan_: my dpaste links in this chatroom highlight it all
[10:54:44] rizwan_: ive opened and closed my command line multiple times
[10:54:48] c-c: so, bundler doesn't run? Or, gem install doesn't run?
[10:55:08] rizwan_: c-c i am getting these error messages: https://dpaste.de/2578
[10:55:32] c-c: Lets ignore bundler for a while.
[10:55:48] rizwan_: c-c when i try to run rails in my console i get this: https://dpaste.de/Jrft
[10:55:54] rizwan_: and i am trying to run rails console
[10:56:02] c-c: Lets check your ruby and gem install. Or, I'll try to show you how you can do that. Ignore rails, too, for now.
[10:56:08] rizwan_: thank you :)
[10:56:40] c-c: So, in your shell you have environment var $PATH, that is for searching for commands in dirs.
[10:57:33] c-c: Also, $GEM_HOME and $GEM_PATH are needed for gems
[10:57:47] rizwan_: i dont know what a gem is
[10:57:52] rizwan_: ill look it up
[10:57:54] c-c: its the gem command
[10:58:06] rizwan_: ah it is a packaging manager
[10:58:10] rizwan_: oh yes i see
[10:58:28] c-c: yes, gem is for ruby, what npm is for js
[10:58:30] rizwan_: when i echo $PATH this is the output btw https://dpaste.de/bXmN
[10:59:02] c-c: Ok, now you know the first thing: check path!
[10:59:08] Swyper: has joined #ruby
[10:59:30] c-c: second thing: whats gem doing. try looking at its paths: $ gem environment
[11:00:13] rizwan_: https://dpaste.de/wkjB
[11:00:22] rizwan_: c-c i ran the command
[11:00:46] c-c: you already have the $, no need to retype it ;)
[11:00:52] c-c: so, try without
[11:01:01] rizwan_: with $echo PATH I have to
[11:01:15] c-c: when you see $ before command, you know its supposed to be run in a shell or term
[11:01:31] rizwan_: c - c here it is: https://dpaste.de/1WQP
[11:01:34] rizwan_: ah i see, thanks :)
[11:01:49] c-c: ACTION suggest you take a piece of paper and write the $ and path stuff down in large weird letters
[11:02:42] rizwan_: c-c why is it a good idea for me take a piece of paper and write $ and path stuff down in large weird letters?
[11:02:46] c-c: also try (and write in note) $ which ruby
[11:03:09] c-c: rizwan_: because writing it down will cause your brain to process it, and that will cause it to be memorized in your brain!
[11:03:12] rizwan_: sorry c-c, i dont understand what you mean y writing in note
[11:03:22] c-c: it means: make notes
[11:04:04] rizwan_: just to memorise the output of gem environment/
[11:04:08] rizwan_: copy it all out onto paper/
[11:04:12] c-c: all of this
[11:05:17] rizwan_: to be honest thats a pretty big thing to do
[11:05:20] rizwan_: i might do it later
[11:05:25] c-c: ACTION has to go, but will be back in 30
[11:05:34] rizwan_: right now i need rails console to run so that I can install and run a git repo
[11:06:01] c-c: rizwan_: you need to get this stuff right first, the path vars in your shell env
[11:09:32] v01d4lph4: has joined #ruby
[11:14:09] mangold: has joined #ruby
[11:30:27] v01d4lph4: has joined #ruby
[11:30:34] kke: does someone use ThreadGroup for something and why?
[11:36:50] ldnunes: has joined #ruby
[11:37:59] elphe: has joined #ruby
[11:41:21] c-c: kke: is it for gwtting your threads stopped etc at the same time
[11:46:14] kke: c-c: compared to a regular array, it only seems to give threads `Thread.current.group` accessor. group = []; group << Thread.new(group) { |group| Thread.current[:group] = group; # do stuff };
[11:47:26] kke: it could somehow interface with ThreadsWait but it doesn't.
[11:49:08] conta: has joined #ruby
[11:50:37] donofrio: has joined #ruby
[12:00:55] opya: has joined #ruby
[12:06:16] c-c: kke: well then you know where your threads are
[12:10:17] havenwood: kke: It automatically adds threads spawned by threads already in the group.
[12:10:19] marmotini_: has joined #ruby
[12:10:51] havenwood: Or threads spawned by threads spawned by threads, and so on.
[12:10:53] havenwood: group = ThreadGroup.new; group.add Thread.new { Thread.new { Thread.new { sleep }; sleep }; sleep }; group.list.size #=> 3
[12:11:49] opya: has left #ruby: ()
[12:12:21] kke: ok that makes sense
[12:13:14] kke: i would still expect the group to have some methods like group.alive? instead of having to do group.list.any?(&:alive?)
[12:14:44] AJA4350: has joined #ruby
[12:17:12] c-c: Whats alive do on a thread anyway?
[12:20:36] bvdw: has joined #ruby
[12:35:40] lucasb: has joined #ruby
[13:00:09] Swyper: has joined #ruby
[13:03:05] tuor: has joined #ruby
[13:10:54] c-c: ok, it does exist on a thread instance to check if sleeping
[13:12:14] akem: has joined #ruby
[13:19:16] AJA4351: has joined #ruby
[13:25:38] keden: has joined #ruby
[13:30:11] alem0lars: has joined #ruby
[13:30:28] merijn: has joined #ruby
[13:31:24] merijn: Is there some sort of quickstart "how to read rubydocs in 10 minutes" style crash course?
[13:40:01] jcalla: has joined #ruby
[13:49:00] c-c: merijn: install ri, run $ ri <cmd>
[13:49:11] c-c: Thats less than a minute!
[13:53:06] c-c: hm, '<cmd>' isn't right, maybe that should be '<keyword>'
[13:57:39] keden: has joined #ruby
[14:00:32] yokel: has joined #ruby
[14:14:40] Swyper: has joined #ruby
[14:15:32] duderonomy: has joined #ruby
[14:17:41] eightfold: has joined #ruby
[14:24:32] blackmesa: has joined #ruby
[14:26:18] AJA4351: has joined #ruby
[14:26:45] ljarvis: has joined #ruby
[14:27:03] merijn: c-c: No, I didn't mean how to display them, I meant "how do I learn enough Ruby to understand wtf any of this means"
[14:28:19] xrexeon: has joined #ruby
[14:30:07] phaul: merijn: I recommend reading an introductory book
[14:31:03] phaul: merijn: https://ruby-community.com/pages/links
[14:31:47] merijn: phaul: I don't want an introductory book, I want a short and dense overview for experienced programmers
[14:32:12] merijn: phaul: Too many introductory links waste a lot of time on basics of programming, I just want a syntax + semantics summary
[14:34:48] al2o3-cr: merijn: https://learnxinyminutes.com/docs/ruby/
[14:42:02] merijn: al2o3-cr: That covers most syntax, afaict, but doesn't at all define the semantics, just handwavey examples
[14:43:18] ryouba: is there a rubylicious way to achieve https://gist.github.com/sixtyfive/66da90ae299c032c58d4712d2ddbff7d ?
[14:48:14] bmurt: has joined #ruby
[14:55:41] cyberarm: has joined #ruby
[14:56:55] ellcs: &>> {:blah=>"blah", :foobar=>{:lalala=>"lalala", :lipsum=>"lipsum"}}.flatten
[14:56:58] rubydoc: # => [:blah, "blah", :foobar, {:lalala=>"lalala", :lipsum=>"lipsum"}] (https://carc.in/#/r/6fj4)
[14:57:26] ryouba: ellcs: you hadn't seen the underscores at first? :)
[14:58:14] ryouba: also i just discovered Enumerable#each_with_object ... seems like it's the much better choice, rather than #map.
[14:58:38] ellcs: Also #reduce would seem better, doesnt it?
[14:58:49] Rapture: has joined #ruby
[15:00:02] xrexeon: has joined #ruby
[15:03:19] ellcs: what about a level deeper?
[15:03:26] ellcs: a hash in a hash in a hash
[15:12:25] ljarvis: &>> {:blah=>"blah", :foobar=>{:lalala=>"lalala", :lipsum=>"lipsum"}}.map { |k, v| v.is_a?(Hash) ? v.map { |vk, vv| ["#{k}_#{vk}", vv] } : [[k, v]] }.flatten(1).to_h
[15:12:26] rubydoc: # => {:blah=>"blah", "foobar_lalala"=>"lalala", "foobar_lipsum"=>"lipsum"} (https://carc.in/#/r/6fj7)
[15:12:42] ryouba: ellcs: i build the hash myself, so i know it's only 2 levels deep, ever
[15:14:09] ryouba: ljarvis: thank you! :D
[15:14:19] ryouba: i also like the "vk,vv" naming
[15:14:33] ljarvis: it's lazy tbh, I hope it's not production code ;)
[15:14:44] ryouba: ljarvis: so you do think that #map is the best method to use for this, and neither #each_with_object nor #reduce?
[15:15:16] skryking: has joined #ruby
[15:15:24] ljarvis: yeah, reduce doesn't work for me because you're not really reducing, and each_with_object is nice except that you *always* want to append to this new enumerable object you've created, so it seems superfluous to me
[15:15:32] ryouba: ljarvis: production, schmoduction. it's a script that converts an excel file into an sqlite database. if for some reason it should ever fail, i'm the only user and i'm the only fixer.
[15:15:44] tdy: has joined #ruby
[15:15:55] ryouba: okay, then map it is.
[15:17:13] ryouba: i do think i'll monkey-patch this into Hash, though. it does seem useful enough to use every once in a while :)
[15:17:38] ljarvis: ACTION runs
[15:17:58] ryouba: Hash#underscorize_hierarchy or so
[15:18:18] ryouba: heheheheheh you don't like the name?
[15:19:58] al2o3-cr: i'd prefer flat_map there ;)
[15:20:20] ljarvis: there's always someone.. (agree though)
[15:20:30] ryouba: as a name?
[15:20:37] ryouba: oh, wait ... /me googles
[15:21:18] ljarvis: you can remove the is_a?(Hash) too if you're creative
[15:21:22] ljarvis: but I think we've done enough damage
[15:21:25] al2o3-cr: ACTION does and hides
[15:22:01] ryouba: okay, googling Hash#flat_map brought me to https://money.stackexchange.com/questions/105885/can-i-become-debt-free-or-should-i-file-for-bankruptcy-how-do-i-manage-my-debt ... for whatever reason. you guys may laugh now.
[15:22:17] ljarvis: "Ruby flap_map"
[15:23:34] ryouba: not much gain over your original solution
[15:24:31] notZarthus: are people actually that bad at accounting?
[15:24:41] ljarvis: it creates less objects so it's better for large data
[15:24:49] notZarthus: it's not that hard to think "i need to save money" "let's stop going to restaurants, for one"
[15:24:51] KeyJoo: has joined #ruby
[15:25:01] notZarthus: every college student learns to live on ramen, it's nothing new
[15:25:22] cow[moo]: has joined #ruby
[15:26:02] ryouba: as someone from a country with usually-free education i'm chin-on-floor whenever i read about monetary situation of US students
[15:27:03] skryking: I learned to get really good at cooking grilled cheese on the heater in my dorm room when I was in college
[15:27:05] gnufied: has joined #ruby
[15:27:18] ryouba: i mean, the guy is just 1 year younger than me, makes around 10 times as much as i do, and still has to ask that question, whereas my whole student loan debts are ~25k$US and if i won't have been able to start paying them off in the next 15 years then i'll never have to pay sthem off
[15:28:11] ryouba: well okay, my rent is not 1500$US, either ... that's a HUGE expense. and i don't own a car, don't want to, don't have to, probably never will.
[15:28:35] notZarthus: 1500$ US on a 80k income after taxes is pretty acceptable
[15:28:49] notZarthus: your rent is your most expensive expense, after all
[15:29:25] ryouba: true ... he should be able to live more stress free with those numbers anyways.
[15:29:59] ryouba: first sentence of the first answer is the whole story already
[15:30:07] skryking: Depends on where in the US a person lives
[15:30:21] ryouba: sounds like one of the bigger cities, no?
[15:30:56] skryking: I live way out in suburbs of chicago and 1500 gets a small apartment
[15:32:19] ryouba: i have a nice apartment (80m², balcony, shared garden) in a big German city and it's 550€ per month, water, sewage, electricity, internet, etc. included.
[15:32:42] notZarthus: ryouba: same here, though in the Netherlands and I pay 1100 EUR
[15:32:48] notZarthus: this building was built in 2018 though :)
[15:33:16] ryouba: notZarthus: always thought the netherlands were cheaper than that ... would you say that's mid-range?
[15:33:25] notZarthus: the Netherlands is expensive
[15:33:33] notZarthus: Germany is way cheaper in everything.
[15:33:33] skryking: before I bought my house about 12 years ago I was paying $1400 for an apartment that didn't include water, electricity, internet...
[15:33:34] AJA4351: has joined #ruby
[15:33:56] ryouba: shame, we're wondering whether my gf will do her PhD there or here
[15:33:57] notZarthus: I've lived for 2 years in Germany, would welcome all of it back except for the location/people.
[15:34:15] mustmodify: has joined #ruby
[15:34:26] skryking: I lived in Germany a really long time ago... was nice
[15:34:28] ryouba: skryking: then no wonder there's whole tent cities full of employed (?) citizens in the US
[15:34:37] awkwords: has joined #ruby
[15:34:46] ryouba: notZarthus: sounds like the south west?
[15:35:02] notZarthus: ryouba: Leipzig, Germany and all over the Netherlands.
[15:35:03] mustmodify: How do I represent this character in ruby, so that I can use gsub to remove it? https://www.fileformat.info/info/unicode/char/200b/index.htm
[15:35:24] ryouba: notZarthus: curious. i always thought as a student you'll meet nice people in the eastern states of Germany.
[15:35:32] ryouba: (and i have, so far)
[15:35:43] notZarthus: east-germany is not my kinda thing, personally.
[15:35:53] mustmodify: current guess is "\u200B"
[15:35:55] notZarthus: the students are OK but still woeful at english
[15:35:55] ryouba: it is an acquired taste, yes :)
[15:35:58] ljarvis: mustmodify: "\u200B"
[15:36:03] mustmodify: great thanks
[15:36:20] mustmodify: zero-width space is the dumbest character I've ever considered considering.
[15:36:31] ryouba: notZarthus: don't get me started. my gf is from India. sometimes (read: often) i feel ashamed for my fellow Germans.
[15:36:42] notZarthus: ryouba: I'm still getting nags from Vodafone DE that "I owe them money" for a terminated contract that is fully paid. :|
[15:36:59] notZarthus: they have 0 options for support.
[15:37:00] ryouba: mustmodify: wait until you start having to deal with zero-width joiner and zero-width NON-joiner
[15:37:24] ryouba: notZarthus: okay, stupid you for having chosen Vodafone then ;-)
[15:37:37] notZarthus: ryouba: that is fair, but they were the only ISP with a decent internet bundle
[15:38:22] notZarthus: not all germans are bad, most of my current colleagues are german. But if you walk around in a city, there is no comparison. Dutch people are more friendly.
[15:38:53] notZarthus: If you go inside of a story in Germany they actively don't want to sell you their product, which baffles me a little bit.
[15:38:56] ryouba: hel lekker notZarthus :)
[15:39:11] ryouba: and yeah, feels the same to me
[15:39:47] notZarthus: you guys have amazing lunches though
[15:39:54] ryouba: huh? we do?
[15:40:19] notZarthus: in the Netherlands I pay 11 for a barebones Schnitzel
[15:40:19] ryouba: like what?
[15:40:26] ryouba: oh you mean the prizes
[15:40:26] notZarthus: In Germany this is 5 EUR
[15:40:42] notZarthus: just in general, also the taste.
[15:40:46] ryouba: how's non-meet food in the netherlands?
[15:40:51] ryouba: money-wise?
[15:41:13] notZarthus: food here is decent, but most restaurants open at 4 PM
[15:41:26] ryouba: that seems weird
[15:41:26] notZarthus: price-wise, it's all about double from germany
[15:41:43] ryouba: perhaps we'll just skip europe entirely and move to india instead
[15:41:45] ljarvis: folks, please consider joining #ruby-offtopic for non-Ruby discussion to avoid discouraging new joiners from asking questions
[15:41:55] ryouba: whoops, sorry!
[15:42:09] notZarthus: ryouba: I'll PM instead
[15:42:10] Inline: has joined #ruby
[15:42:19] ljarvis: no worries, do continue your nice conversation though :)
[15:42:27] ryouba: notZarthus: i should continue working anyways :}
[15:42:56] mustmodify: I'm sometimes frustrated by people who figure that because JS is available in all browsers, it must be the superior language for back-ends.
[15:43:01] ljarvis: -o ljarvis
[15:43:11] mustmodify: I mean, it's an option, but to rule out other options because of wide availability... hm...
[15:43:55] comerijn: has joined #ruby
[16:04:55] rippa: has joined #ruby
[16:19:07] mangold: has joined #ruby
[16:20:19] eb0t_: has joined #ruby
[16:26:21] ascarter: has joined #ruby
[16:30:33] zapata: has joined #ruby
[16:38:42] polishdub: has joined #ruby
[16:51:14] marmotini_: has joined #ruby
[16:56:15] conta: has joined #ruby
[17:01:37] mustmodify: has left #ruby: ()
[17:10:34] duderonomy: has joined #ruby
[17:11:45] marmotini_: has joined #ruby
[17:12:12] robotcars: gonna ask a very unexperienced question. :P
[17:12:13] robotcars: https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb
[17:12:41] robotcars: i'm using Shoryuken to poll SQS messages, and pass each to a Sequel.insert
[17:14:08] robotcars: I want to run routine outside that that will check the DB for the IP address of new rows and collect the geo info from a third party api (i've written this part)
[17:14:44] robotcars: but I don't know how/where to add that routine, and have it run every few minutes and not with every single event
[17:16:38] robotcars: i feel like sleep(60) isn't enough… because if shoryuken kicks up multiple threads, then I'm running multiple threads of sleep(60) method()
[17:17:23] robotcars: not really looking for 'the answer', maybe just an article, concept, or ruby idea that might help me get there
[17:33:21] ascarter: has joined #ruby
[17:39:27] v01d4lph4: has joined #ruby
[17:54:24] blackmesa: has joined #ruby
[17:54:56] marmotini_: has joined #ruby
[17:59:45] v01d4lph4: has joined #ruby
[18:01:11] eightfold: has joined #ruby
[18:04:01] sameerynho: has joined #ruby
[18:08:33] Blaguvest: has joined #ruby
[18:09:35] blackmesa: has joined #ruby
[18:12:47] cnsvc_: has joined #ruby
[18:16:37] duderonomy: has joined #ruby
[18:18:08] marmotini_: has joined #ruby
[18:22:57] blackmesa: has joined #ruby
[18:23:18] gix: has joined #ruby
[18:24:16] AJA4350: has joined #ruby
[18:26:04] v01d4lph4: has joined #ruby
[18:26:41] postmodern: has joined #ruby
[18:29:58] lytol_: has joined #ruby
[18:33:19] awkwords: has joined #ruby
[18:38:10] rprimus: has joined #ruby
[18:40:03] jcarl43: has joined #ruby
[18:43:17] orbyt_: has joined #ruby
[18:46:46] jmcgnh: has joined #ruby
[18:48:56] szulak_: has joined #ruby
[18:52:22] coffeejunk: has joined #ruby
[18:55:05] agent_white: has joined #ruby
[18:55:20] Averna: has joined #ruby
[18:56:59] elcontrastador: has joined #ruby
[19:01:57] elcontrastador: What's the most accurate way of determining if a file is open/changing prior to performing an operation on that file? Similarly, what is the most pragmatic way? Using system calls like 'lsof' is very slow but may be my only option...
[19:10:52] t0x: has joined #ruby
[19:12:54] conta: has joined #ruby
[19:18:54] xrexeon: has joined #ruby
[19:22:42] sgen: has joined #ruby
[19:30:58] elcontrastador: Even 'lsof' is not any guarantee...
[19:34:26] al2o3-cr: elcontrastador: is it a file you're opening?
[19:35:36] elcontrastador: al2o3-cr: No, that's an easier problem. I'm just processing files of arbitrary dir that could have files open by any app/process
[19:36:56] al2o3-cr: elcontrastador: you gonna have a hard time then doing that from ruby.
[19:38:02] ravenousmoose: has joined #ruby
[19:38:57] elcontrastador: al2os-cr: yeah, figured that, if possible at all, it would be a syscall or two
[19:39:12] elcontrastador: lsof is unbearably slow
[19:40:04] al2o3-cr: elcontrastador: what syscalls do you have in mind for this?
[19:40:26] elcontrastador: lsof and it's options...looking at FD and such...
[19:40:43] al2o3-cr: oh, system calls?
[19:41:24] al2o3-cr: elcontrastador: i thought you meant syscall.
[19:42:13] elcontrastador: al2os-cr: yeah, sorry...that was confusing. system call
[19:42:40] al2o3-cr: yeah, i was thinking then haha
[19:42:46] elcontrastador: i'm getting pounded with texts and calls...shorthanding it
[19:43:01] al2o3-cr: yeah, no worries.
[19:45:10] makr8100: has joined #ruby
[19:46:27] nowhereman: has joined #ruby
[19:46:45] makr8100: any recommendations on docs for a beginner on ruby deployments with apache? I'm new ot ruby, not to programming in general
[19:50:34] makr8100: I should specify it's ROR
[19:50:35] Averna: has joined #ruby
[19:51:36] al2o3-cr: makr8100: you might be better off asking in #rubyonrails if no one answers here.
[19:52:36] tdy: has joined #ruby
[19:54:52] makr8100: ah, didn't realize it was a separate channel. thanks
[19:55:19] miah: i just put webbrick / puma whatever behind haproxy and only route the dynamic requests to that endpoint. putting it behing apache just adds another layer that isnt helpful
[19:55:37] miah: one haproxy that knows about all your rails endpoints will get amaze performance
[19:55:53] miah: and you can better distribute the load and handle failures.
[19:56:40] miah: https://www.amazon.com/Art-Capacity-Planning-Scaling-Resources/dp/0596518579 is really great if you want to learn all about building stable web sites =)
[19:57:03] miah: sadly its really common to have like 'load balancer -> apache -> rails' rather than 'load balancer -> rails'
[19:57:34] miah: and you can swap apache/nginx in most scenarios. its just another layer of indirection where requests can get lost and tied up waiting for your rails backend to process.
[19:57:45] miah: rather than letting haproxy route things to available rails endpoints
[19:57:55] makr8100: I'm 3 days into working as a php dev in-house at a factory and they sprung this on me. It's an existing system that needs maintenance. First request is that someone actually hard coded the cost per mile into the ruby source, so new install it is?
[19:58:02] miah: i'll shush now, i can rant about this for hours because ive seen it so many times and it frustrates me to no end
[19:58:21] makr8100: I have near 0 ruby experience
[19:58:25] Averna: has joined #ruby
[19:58:29] makr8100: so hurray for that
[20:01:19] mozzarella: has joined #ruby
[20:01:38] Ekho: has joined #ruby
[20:07:16] Renich: has joined #ruby
[20:08:06] havenwood: kirun: zenspider: Nobu already fixed it :) https://github.com/ruby/ruby/commit/7fed9a2df50404c734504e0405ecaa98f0d9147c
[20:10:39] spacesuitdiver: has joined #ruby
[20:12:27] SeepingN: has joined #ruby
[20:14:13] rizwan_: has joined #ruby
[20:20:19] ur5us: has joined #ruby
[20:41:52] skryking: has joined #ruby
[20:42:29] clemens3_: has joined #ruby
[20:46:19] ellcs: has joined #ruby
[21:00:32] v01d4lph4: has joined #ruby
[21:02:10] Renich_: has joined #ruby
[21:02:25] Averna: has joined #ruby
[21:07:54] laaron: has joined #ruby
[21:12:43] al2o3-cr: has joined #ruby
[21:13:31] clemens3: has joined #ruby
[21:14:19] hightower3: has joined #ruby
[21:18:38] jinie: has joined #ruby
[21:37:46] kevinburke: has joined #ruby
[21:38:13] cd: has joined #ruby
[21:40:50] tdy: has joined #ruby
[21:54:53] Tempesta: has joined #ruby
[21:56:30] Renich_: has joined #ruby
[22:20:51] Renich: has joined #ruby
[22:38:38] ellcs: has joined #ruby
[22:43:21] Fusl: has joined #ruby
[22:52:11] blackmesa: has joined #ruby
[23:00:01] TheBloke: has joined #ruby
[23:01:27] v01d4lph4: has joined #ruby
[23:02:17] sgen: has joined #ruby
[23:11:39] ellcs: has joined #ruby
[23:23:56] ivanskie: has joined #ruby
[23:45:09] al2o3-cr: has joined #ruby
[23:49:06] laaron-: has joined #ruby
[23:58:07] angryrobot: has joined #ruby