« Back to channel list

#ruby - 19 February 2019

« Back 1 day Forward 1 day »
[00:00:01] mitescugd: has left #ruby: ("C-x k")
[00:08:33] orbyt_: has joined #ruby
[00:20:11] s3nd1v0g1us: has joined #ruby
[00:34:22] cd: has joined #ruby
[00:42:31] blackmesa: has joined #ruby
[00:43:22] priodev: has joined #ruby
[00:47:25] blackmesa: has joined #ruby
[00:52:34] blackmesa1: has joined #ruby
[01:05:48] Matadoer: has joined #ruby
[01:10:50] blackmesa: has joined #ruby
[01:14:16] Macrobiotic: has joined #ruby
[01:14:40] blackmesa: has joined #ruby
[01:21:00] blackmesa: has joined #ruby
[01:30:47] knight33: has joined #ruby
[01:31:42] al2o3-cr: has joined #ruby
[01:42:56] crankharder: has joined #ruby
[01:43:30] xlegoman: has joined #ruby
[01:43:36] awkwords: has joined #ruby
[01:46:56] tdy: has joined #ruby
[02:01:11] blackmesa: has joined #ruby
[02:05:14] jokester: has joined #ruby
[02:28:27] blackmesa: has joined #ruby
[02:30:36] blackmesa1: has joined #ruby
[02:53:01] cagomez: has joined #ruby
[02:55:02] Renich_: has joined #ruby
[02:55:51] cagomez: has joined #ruby
[03:32:03] maryo: has joined #ruby
[03:37:08] knight33: has joined #ruby
[03:54:08] marz_d`ghostman: has joined #ruby
[03:55:09] marz_d`ghostman: Anyone using Nokogiri, how do I extract a part of an xml file using the value like <cf>AVERAGE</cf><pdp_per_row>6</pdp_per_row>? I'd like to extract everyhing under that xml tags?
[03:55:26] wolfshappen: has joined #ruby
[04:00:13] mozzarella: marz_d`ghostman: not sure I understand the question
[04:01:59] marz_d`ghostman: mozzarella: https://termbin.com/atf1 I want to extract all data under <cf>AVERAGE</cf><pdp_per_row>6</pdp_per_row>. Is there a way I can filter other than using xml attributes?
[04:02:29] marz_d`ghostman: mozzarella: wrong link, this is the one: https://termbin.com/37wm
[04:09:54] braincrash: has joined #ruby
[04:12:23] mozzarella: marz_d`ghostman: you could probably do it using xpath, or just navigating the tree using ruby and a couple of css selectors
[04:14:44] Jello_Raptor: has joined #ruby
[04:16:51] marz_d`ghostman: mozzarella: yep, currently trying to do it via NOkogiri
[04:18:05] [spoiler]: has joined #ruby
[04:22:50] al2o3-cr: marz_d`ghostman: what particular part are you interested in?
[04:23:22] marz_d`ghostman: al2o3-cr: everything under <cf>AVERAGE</cf><pdp_per_row>6</pdp_pepr_row>.
[04:26:47] marz_d`ghostman: I'm trying out Nokogiri::XML::Node, I don't know what argument it's requiring with this 'name' and document. I'm getting `new': wrong argument type String (expected Data) (TypeError) https://gist.github.com/marzdgzmn/f3172fc544b5d9158250b764ecef8699
[04:29:45] al2o3-cr: marz_d`ghostman: hows about this: Nokogiri::XML(open("blah.xml")).css('rra')[1].text.split
[04:31:32] marz_d`ghostman: al2o3-cr: Wow. I'll work on this one. Thanks
[04:32:21] mozzarella: that's assuming the input will always be the same
[04:32:26] mozzarella: doc.css('rra').select { |x| x.css('cf')[0].inner_text == 'AVERAGE' && x.css('pdp_per_row')[0].inner_text == '6' }
[04:34:14] al2o3-cr: mozzarella: he just said he wanted everything after :P
[04:34:32] mozzarella: I thought he meant the content?
[04:35:01] al2o3-cr: yeah, i think their graphing something.
[04:35:24] marz_d`ghostman: We're trying to sort out a graph from rrd :)
[04:35:47] marz_d`ghostman: parsing xml using other languages is a pain, good thing I found out about Nokogiri :)
[04:38:55] prestorium: has joined #ruby
[04:41:07] al2o3-cr: marz_d`ghostman: i'd go for mozzarella's way, it's far more sane.
[04:41:37] skyikot: has joined #ruby
[04:50:44] marz_d`ghostman: al2o3-cr: mozzarella thanks guys
[04:51:19] al2o3-cr: marz_d`ghostman: np ;)
[04:54:16] laaron: has joined #ruby
[05:06:32] laaron: has joined #ruby
[05:09:57] v01d4lph4: has joined #ruby
[05:10:15] eckhardt: has joined #ruby
[05:10:16] Renich: has joined #ruby
[05:12:23] tdy: has joined #ruby
[05:14:26] cagomez: has joined #ruby
[05:14:46] Swyper: has joined #ruby
[05:14:50] Swyper: https://dpaste.de/QEJp
[05:14:57] Swyper: how do I sort a hash based on value
[05:15:43] sagax: how to hot reload code without rerun script?
[05:17:13] govg: has joined #ruby
[05:18:35] DTZUZO_: has joined #ruby
[05:24:10] DTZUZO_: has joined #ruby
[05:26:13] al2o3-cr: Swyper: do you want the highest value first?
[05:27:18] wilbert: has joined #ruby
[05:29:19] Swyper: I ended up getting it
[05:29:54] Swyper: though I'll post the code
[05:29:58] Swyper: if you have improvments
[05:31:37] Swyper: x = hash.sort_by {|k, v| v }
[05:31:47] Swyper: these are the only lines in the code, same method
[05:32:04] Swyper: apart from naming the variable x which is bad, do you have anything else you think I could have done to improve code quality
[05:33:06] al2o3-cr: seems ok to me.
[05:37:56] al2o3-cr: this is what i had: h.sort_by { |_, v| -v }[0][0] # sort in decsending order so it looks like eyes ;)
[05:38:17] al2o3-cr: johnny five is alive :p
[05:48:12] al2o3-cr: &>> h = {a: 234, b: 23423, c: 4567}; h.keys.max_by &h
[05:48:14] rubydoc: # => :b (https://carc.in/#/r/6ajw)
[05:48:31] al2o3-cr: theres my two cent.
[05:53:00] jcarl43: has joined #ruby
[05:58:34] al2o3-cr: &>> [{a: "hello", b: 0}, {a: "world", c: 1}].each_with_object(:a).map(&:[]) * ' '
[05:58:34] rubydoc: # => "hello world" (https://carc.in/#/r/6ajx)
[05:59:15] al2o3-cr: maybe that should've been good morning.
[06:04:10] conta: has joined #ruby
[06:23:27] salasrod: has joined #ruby
[06:29:07] havenwood: &>> [{a: "hello", b: 0}, {a: "world", c: 1}].map { |a:, **| a }
[06:29:08] rubydoc: # => ["hello", "world"] (https://carc.in/#/r/6ak1)
[06:33:30] sauvin: has joined #ruby
[06:34:41] al2o3-cr: hey, havenwood, Enumerable#tally is this 2.7?
[06:35:50] al2o3-cr: or will it be in previews.
[06:36:35] havenwood: al2o3-cr: 2.7
[06:36:46] havenwood: al2o3-cr: oh, yeah - it'll be in 2.7 previews.
[06:36:54] havenwood: al2o3-cr: it's already landed on nightly
[06:42:32] catbusters: has joined #ruby
[06:56:26] conta: has joined #ruby
[06:58:41] laaron: has joined #ruby
[07:04:51] Nicmavr: has joined #ruby
[07:19:57] aufi: has joined #ruby
[07:38:51] clemens3: has joined #ruby
[07:39:50] laaron-: has joined #ruby
[07:43:37] ByronJohnson: has joined #ruby
[07:46:47] sauvin: has joined #ruby
[07:47:02] Renich_: has joined #ruby
[07:54:32] kapil____: has joined #ruby
[07:56:41] marmotini_: has joined #ruby
[08:04:27] sauvin: has joined #ruby
[08:13:02] bruce_lee: has joined #ruby
[08:16:53] clemens3: has joined #ruby
[08:18:47] BH23: has joined #ruby
[08:21:14] status402: has joined #ruby
[08:22:34] prestorium: has joined #ruby
[09:03:40] segy: has joined #ruby
[09:04:25] mikecmpbll: has joined #ruby
[09:21:37] mangold: has joined #ruby
[09:30:28] z64: havenwood: i've been meaning to write a benchmark purely using zlib, but if you're curious you can see the details of this issue (see the "references" bar) https://github.com/meew0/discordrb/issues/600 ; to put *some* numbers on it, this API requires us to send a PING every 41 seconds. using this streaming zlib method causes us to *drastically* fall behind in processing the incoming flow of events that a safety
[09:30:30] z64: feature that checks for PONG recipts would think our connection silently closed
[09:31:22] z64: whereas requesting the normal compression mode, which sends 99% text frames, we have no trouble at all keeping up
[09:33:27] dionysus69: has joined #ruby
[09:37:35] venmx: has joined #ruby
[09:55:40] wolfshappen: has joined #ruby
[10:00:27] awkwords: has joined #ruby
[10:02:25] lxsameer: has joined #ruby
[10:05:32] BH23: has joined #ruby
[10:08:21] venmx_: has joined #ruby
[10:15:41] fanta7531: has joined #ruby
[10:20:11] venmx: has joined #ruby
[10:32:49] deathwishdave: has joined #ruby
[10:40:48] sina: has joined #ruby
[10:48:18] dionysus69: how do I import this https://www.rubydoc.info/github/rubyworks/facets/Array:median ?
[10:48:22] dionysus69: i get method undefined
[10:51:57] tbuehlmann: require the file
[10:53:43] tbuehlmann: it's even in the readme, read it
[11:06:27] conta1: has joined #ruby
[11:12:45] johnny56_: has joined #ruby
[11:21:56] dionysus69: I was in force majouaour :s
[11:22:23] cgfbee: has joined #ruby
[11:31:33] deathwishdave: has joined #ruby
[11:41:31] drale2k_: has joined #ruby
[11:59:09] AJA4350: has joined #ruby
[12:02:42] fanta7531: has joined #ruby
[12:03:30] BH23: has joined #ruby
[12:25:43] conta1: has joined #ruby
[12:53:22] stryek: has joined #ruby
[12:55:29] lucasb: has joined #ruby
[13:12:12] z64: running this bm shows that sync inflating is only 1.11x slower on my machine.. seems like the issue might be somewhere else :/ https://git.io/fhdRH
[13:12:29] AJA4350: has joined #ruby
[13:17:41] xrexeon: has joined #ruby
[13:24:32] mangold: has joined #ruby
[13:41:20] al2o3-cr: z64: i get "same-ish: difference falls within error" on my machine.
[13:47:05] conta1: has joined #ruby
[13:48:10] z64: yeah. i'm really out of ideas on where to look now. i updated that gist to include WebSocket frames, and additionally testing several payload sizes, and that remains stable
[13:58:48] z64: hm, i should have been testing text frames as well.. and that's kind of more like that we're seeing
[13:59:16] z64: SYNC_FLUSH messages being ~2x slower than TEXT
[14:13:35] orbyt_: has joined #ruby
[14:14:48] sagax: how to `symbolize_keys` total?
[14:15:25] sagax: because when i try `symbolize_keys` will convert as `sym` only first level
[14:15:33] sagax: from hash
[14:16:11] phaul: write a recursive algorithm?
[14:16:38] tbuehlmann: I assume you're talking about rails. if so: #deep_symbolize_keys
[14:17:21] sagax: yes, thanks
[14:17:39] sagax: it is what i need
[14:19:59] BH23: has joined #ruby
[14:31:13] alem0lars: has joined #ruby
[14:33:58] orbyt_: has joined #ruby
[14:35:11] ams__: has joined #ruby
[14:51:43] BH23: has joined #ruby
[14:57:14] rippa: has joined #ruby
[14:57:42] gnufied: has joined #ruby
[15:00:11] jobewan: has joined #ruby
[15:04:04] Rapture: has joined #ruby
[15:06:07] Renich: has joined #ruby
[15:07:03] BH23: has joined #ruby
[15:08:23] code_zombie: has joined #ruby
[15:10:09] MuffinPimp: has joined #ruby
[15:10:37] awkwords: has joined #ruby
[15:26:42] spacesuitdiver: has joined #ruby
[15:32:00] spacesuitdiver: has joined #ruby
[15:35:26] skyikot: has joined #ruby
[15:37:43] awkwords_: has joined #ruby
[15:39:55] polishdub: has joined #ruby
[15:43:42] spacesuitdiver: has joined #ruby
[15:46:14] szulak_: has joined #ruby
[15:51:03] spacesuitdiver: has joined #ruby
[15:53:13] skwurl: has joined #ruby
[15:55:10] iMadper: has joined #ruby
[15:55:58] wolfshappen: has joined #ruby
[15:58:30] orbyt_: has joined #ruby
[15:58:57] spacesuitdiver: has joined #ruby
[15:59:46] dinfuehr: has joined #ruby
[16:04:03] spacesuitdiver: has joined #ruby
[16:04:24] marmotini_: has joined #ruby
[16:12:00] agent_white: has joined #ruby
[16:21:01] spiette: has joined #ruby
[16:24:35] spiette: has joined #ruby
[16:29:29] [Butch]: has joined #ruby
[16:35:08] dviola: has joined #ruby
[16:37:27] xrexeon_: has joined #ruby
[16:46:53] \void: has joined #ruby
[16:54:06] KeyJoo: has joined #ruby
[16:54:55] skryking: has joined #ruby
[16:54:58] AJA4351: has joined #ruby
[16:55:52] dinfuehr: has joined #ruby
[17:01:24] nowhere_man: has joined #ruby
[17:03:24] dinfuehr: has joined #ruby
[17:03:52] skwurl: WWWWOOOOOOOOOOOOOOOOOOOOOOOO!!!!!! YEAh!!!!!!!!!!!!!!!!
[17:03:58] LightStalker: has joined #ruby
[17:08:36] cd: has joined #ruby
[17:10:16] dinfuehr: has joined #ruby
[17:14:42] awkwords: has joined #ruby
[17:16:32] dinfuehr: has joined #ruby
[17:22:22] sgen: has joined #ruby
[17:24:27] knight33: has joined #ruby
[17:29:00] Fusl: has joined #ruby
[17:30:58] dinfuehr: has joined #ruby
[17:31:33] drale2k_: has joined #ruby
[17:32:44] DTZUZO_: has joined #ruby
[17:33:28] tdy: has joined #ruby
[17:45:06] Nicmavr: has joined #ruby
[17:53:30] tdy: has joined #ruby
[18:03:01] AJA4351: has joined #ruby
[18:08:50] szulak_: has joined #ruby
[18:39:15] gix: has joined #ruby
[18:41:08] Creatornator: has joined #ruby
[18:45:21] conta: has joined #ruby
[18:48:40] ramfjord: has joined #ruby
[18:49:57] wilbert: has joined #ruby
[18:53:01] lxsameer: has joined #ruby
[18:54:28] Creatornator: has joined #ruby
[18:57:14] nowhereman: has joined #ruby
[18:58:29] prestorium: has joined #ruby
[19:00:42] orbyt_: has joined #ruby
[19:03:47] Creatornator: has joined #ruby
[19:12:42] AJA4351: has joined #ruby
[19:14:14] xlued: has joined #ruby
[19:20:35] marmotini_: has joined #ruby
[19:32:52] Rapture: has joined #ruby
[19:42:57] orbyt_: has joined #ruby
[19:46:34] szulak_: has joined #ruby
[19:55:23] wilbert: has joined #ruby
[19:59:05] FastJack: has joined #ruby
[20:01:45] hiroaki: has joined #ruby
[20:02:58] kevinburke: has joined #ruby
[20:18:24] wilbert_: has joined #ruby
[20:28:35] clemens3: has joined #ruby
[20:29:23] Creatornator: has joined #ruby
[20:29:32] ur5us: has joined #ruby
[20:30:19] lytol_: has joined #ruby
[20:31:09] agent_white: has joined #ruby
[20:33:40] AJA4350: has joined #ruby
[20:34:41] Creatornator: has joined #ruby
[20:37:12] spacesuitdiver: has joined #ruby
[20:58:22] orbyt_: has joined #ruby
[21:10:10] Creatornator: has joined #ruby
[21:17:46] skyikot: has joined #ruby
[21:28:45] t0xik: has joined #ruby
[21:30:21] wilbert_: has joined #ruby
[21:31:34] AJA4351: has joined #ruby
[21:34:45] ellcs1: has joined #ruby
[21:36:49] Creatornator: has joined #ruby
[21:56:13] wolfshappen_: has joined #ruby
[21:58:24] clemens3_: has joined #ruby
[22:21:05] Renich_: has joined #ruby
[22:28:06] orbyt_: has joined #ruby
[22:28:17] Renich: has joined #ruby
[22:47:45] havenwood: skwurl.squeeze
[22:48:08] havenwood: #=> "WO! YEAh!"
[22:51:11] Creatornator: has joined #ruby
[22:58:06] venmx: has joined #ruby
[22:58:33] orbyt_: has joined #ruby
[23:01:19] phaul: &fake HitchhikersGuideToTheGalaxy.marvin_quote
[23:01:19] rubydoc: You think you've got problems? What are you supposed to do if you are a manically depressed robot? No, don't try to answer that. I'm fifty thousand times...
[23:02:17] phaul: ah. shame. I should increase the allowed message size. Now we never now the punchline
[23:02:45] havenwood: https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf
[23:03:43] cthu|: has joined #ruby
[23:07:57] havenwood: phaul: i'd say we should port this to Ruby, but license "Coming soon!" https://github.com/openai/gpt-2
[23:09:58] phaul: that looks very interesting. I'll read the paper tomorrow and we can disuss it further. atm it's past midnight here, so not today. but I don't have anything for tomorrow
[23:10:05] gigetoo: has joined #ruby
[23:13:30] Creatornator: has joined #ruby
[23:18:46] Anubix: has joined #ruby
[23:19:05] Anubix: Hello, is there some method to change Host and Referrer of net/http request to server?
[23:23:50] havenwood: Anubix: Have you tried setting headers for Referer and X-Forwarded-Host?
[23:24:12] lord4163: has joined #ruby
[23:26:06] havenwood: Anubix: It *should* work if you set those ^ headers with net/http.
[23:26:21] Anubix: havenwood: yea i used this code https://pastebin.com/hEZKKQX3
[23:26:22] ruby[bot]: Anubix: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[23:27:26] havenwood: Anubix: And neither seem to work from Rails?
[23:27:41] havenwood: Anubix: Or host works but referrer doesn't?
[23:27:55] Anubix: not a single one
[23:28:06] Anubix: and it is in rails application
[23:30:34] havenwood: Anubix: Hrm, well I'm assuming it's the same result from Curl or whatever else? I think #rubyonrails might be the right place after all. Sorry for the wild goose chase.
[23:31:29] havenwood: Anubix: Just curious, but have you tried setting Turbolinks-Referrer in addition to X-Forwarded-Host?
[23:31:55] Anubix: i remoed turbolinks from app
[23:32:58] havenwood: Anubix: What are host and referrer showing up as?
[23:33:22] Anubix: origin, localhost
[23:33:34] Anubix: from my dev computer
[23:39:01] havenwood: Anubix: Try adding the port to the X-Forwarded-Host?
[23:43:48] havenwood: It doesn't need the port, it just drops it: https://github.com/rails/rails/blob/5-2-stable/actionpack/lib/action_dispatch/http/url.rb#L234
[23:44:06] AJA4350: has joined #ruby
[23:46:24] havenwood: Anubix: This person seems to think it works, heh: https://github.com/rails/rails/issues/29893
[23:46:32] havenwood: Anubix: I dunno! ¯\_(ツ)_/¯
[23:46:55] havenwood: I'd suggest confirming with Curl to rule out that it's Net::HTTP-specific.
[23:52:07] Anubix: Iam reading that github
[23:55:40] cthulchu: has joined #ruby