« Back to channel list

#ruby - 21 November 2017

« Back 1 day Forward 1 day »
[00:03:57] tcopeland: has joined #ruby
[00:04:44] Roa: has joined #ruby
[00:06:53] GodFather: has joined #ruby
[00:07:18] rouge: has joined #ruby
[00:07:21] alveric1: has joined #ruby
[00:08:04] milardovich: has joined #ruby
[00:09:02] workmad3: has joined #ruby
[00:09:21] jaequery: /join #sequel
[00:10:36] jaequery: has joined #ruby
[00:11:32] hutch34_: has joined #ruby
[00:19:51] Psybur: has joined #ruby
[00:35:21] maum: has joined #ruby
[00:36:54] [DO]: has joined #ruby
[00:37:56] confilioblan: has joined #ruby
[00:39:50] Technodrome: has joined #ruby
[00:40:04] confilioblan: I'm getting confused by this conversion from decimal to hex to byte to hex. It seems like it unpacks 1 with big nibble first by it unpacks 33 with little nibble first https://paste.ofcode.org/ruPhk7Eade6KeV7pY3uCkz
[00:45:50] enterprisey: has joined #ruby
[00:48:57] milardovich: has joined #ruby
[00:51:34] muzik: has joined #ruby
[00:56:39] MrBusiness: has joined #ruby
[00:56:49] charliesome: has joined #ruby
[01:02:09] cdg: has joined #ruby
[01:02:41] plexigras: has joined #ruby
[01:03:20] guardianx: has joined #ruby
[01:03:36] jaequery: has joined #ruby
[01:04:51] elphe: has joined #ruby
[01:09:02] jxv: has joined #ruby
[01:11:04] orbyt_: has joined #ruby
[01:14:34] Exhiled: has joined #ruby
[01:18:31] ResidentBiscuit: has joined #ruby
[01:19:54] Psybur: has joined #ruby
[01:23:13] Cohedrin: has joined #ruby
[01:23:14] Technodrome: has joined #ruby
[01:30:22] milardovich: has joined #ruby
[01:30:44] charliesome: has joined #ruby
[01:33:44] uZiel: has joined #ruby
[01:33:57] jaequery: has joined #ruby
[01:48:56] hinbody: has joined #ruby
[01:58:18] cschneid_: has joined #ruby
[01:58:26] Guest70176: has joined #ruby
[01:58:52] s-taka: has joined #ruby
[02:00:21] s-taka: has left #ruby: ()
[02:00:42] millz: has joined #ruby
[02:03:45] segy_: has joined #ruby
[02:05:20] mcr1: @confilioblan is it trying to demonstrate a bug?
[02:05:22] lexruee: has joined #ruby
[02:05:35] mcr1: to_s(16) converts to a string with a particular base.
[02:07:41] Chch: has joined #ruby
[02:07:52] daChch: has joined #ruby
[02:08:32] cdg: has joined #ruby
[02:08:37] michael1: has joined #ruby
[02:09:16] workmad3: has joined #ruby
[02:11:42] milardovich: has joined #ruby
[02:17:50] Cohedrin: has joined #ruby
[02:19:05] xlegoman: has joined #ruby
[02:19:53] Psybur: has joined #ruby
[02:20:42] bdnelson: has joined #ruby
[02:28:26] Cohedrin: has joined #ruby
[02:32:03] jaequery: has joined #ruby
[02:34:35] bdnelson: has joined #ruby
[02:36:43] d^sh: has joined #ruby
[02:39:17] ashkitten: has joined #ruby
[02:39:28] bdnelson: has left #ruby: ()
[02:42:07] bmurt: has joined #ruby
[02:51:20] gizmore: has joined #ruby
[02:55:02] ogres: has joined #ruby
[02:55:26] c0ncealed: has joined #ruby
[02:56:36] BrianOn99: has joined #ruby
[02:57:46] zapata_: has joined #ruby
[02:57:54] safetypin: has joined #ruby
[03:00:36] Guest70176: has joined #ruby
[03:01:27] milardovich: has joined #ruby
[03:05:15] jaequery: has joined #ruby
[03:07:47] milardovich: has joined #ruby
[03:12:13] cschneid_: has joined #ruby
[03:13:24] Cohedrin: has joined #ruby
[03:19:54] Psybur: has joined #ruby
[03:19:57] uZiel: has joined #ruby
[03:21:45] Puffball: has joined #ruby
[03:22:59] Liothen: has joined #ruby
[03:24:19] Cohedrin: has joined #ruby
[03:29:01] Puffball: has joined #ruby
[03:32:09] lembron: has left #ruby: ()
[03:39:16] Eletious: has joined #ruby
[03:44:18] milardovich: has joined #ruby
[03:46:01] neachdainn: has joined #ruby
[03:46:24] neachdainn: Hey all. Pathname is giving me wrong relative paths... Can anyone see what I'm doing wrong? https://pastebin.mozilla.org/9073291
[03:46:29] Exhiled: has joined #ruby
[03:50:52] Technodrome: has joined #ruby
[03:53:28] mson: has joined #ruby
[03:55:13] meadmoon: has joined #ruby
[03:56:41] milardovich: has joined #ruby
[04:09:37] workmad3: has joined #ruby
[04:19:50] Psybur: has joined #ruby
[04:21:32] jamesaxl: has joined #ruby
[04:26:07] govg: has joined #ruby
[04:29:31] cschneid_: has joined #ruby
[04:29:39] eckhardt: has joined #ruby
[04:34:46] greengriminal: has joined #ruby
[04:35:52] greengriminal: Hey all, quick question is there a weird ruby-ism here: https://gist.github.com/davidpatters0n/2584206473cf2196a8a82f1579022e52
[04:37:01] greengriminal: it seems as though the method `defined?` doesn't correctly evaluate if you dynamically fetch the ivar via #instance_variable_get
[04:37:46] ashkitten: has left #ruby: ("User left")
[04:38:13] elphe: has joined #ruby
[04:39:57] LocaMocha: has joined #ruby
[04:40:10] cschneid_: has joined #ruby
[04:40:35] Jameser: has joined #ruby
[04:40:53] armando: has joined #ruby
[04:41:40] bambanx: has joined #ruby
[04:45:13] _whitelogger: has joined #ruby
[04:52:08] Technodrome: has joined #ruby
[04:54:21] gix-: has joined #ruby
[04:56:42] jordanm: has joined #ruby
[05:01:40] Exhiled: has joined #ruby
[05:02:52] Guest70176: has joined #ruby
[05:19:52] Psybur: has joined #ruby
[05:22:57] uZiel: has joined #ruby
[05:23:00] iiiiiiaaaatttt: has joined #ruby
[05:25:25] ramfjord: has joined #ruby
[05:28:43] cschneid_: has joined #ruby
[05:30:53] JsilverT: has joined #ruby
[05:31:52] chouhoulis: has joined #ruby
[05:31:56] Exhiled: has joined #ruby
[05:32:42] cschneid_: has joined #ruby
[05:34:08] BTRE: has joined #ruby
[05:34:34] k3rn31_: has joined #ruby
[05:38:05] iamarun: has joined #ruby
[05:40:07] apeiros: greengriminal: defined? is not a method
[05:40:36] apeiros: and defined?( instance_variable_get(:@ivar)) tests whether that *expression* is defined, not whether @ivar is defined.
[05:40:50] apeiros: and since the method instance_variable_get exists, the expression *is* defined :)
[05:41:02] greengriminal: Thanks for that.
[05:41:10] apeiros: in general you don't want defined? in production code.
[05:45:17] milardovich: has joined #ruby
[05:48:30] greengriminal: agreed, I didn't end up using it in the end
[05:50:16] phate408: has joined #ruby
[05:51:18] apeiros: I think the only place I ever left a defined? in prod was a module where I did `super if defined?(super)`, and that mostly because the alternative way of testing whether current self responds to super is rather annoyingly complex
[05:54:08] aroaminggeek: has joined #ruby
[05:55:53] [DO]: has joined #ruby
[05:58:05] Technodrome: has joined #ruby
[05:59:15] Dimik: has joined #ruby
[05:59:19] minimalism: has joined #ruby
[06:04:09] charliesome: has joined #ruby
[06:04:51] dinfuehr: has joined #ruby
[06:04:58] Guest70176: has joined #ruby
[06:06:29] ShekharReddy: has joined #ruby
[06:09:56] workmad3: has joined #ruby
[06:11:33] ledestin: has joined #ruby
[06:19:52] Psybur: has joined #ruby
[06:21:09] mson: has joined #ruby
[06:22:18] AnoHito_: has joined #ruby
[06:22:23] Tempesta_: has joined #ruby
[06:22:25] Axy: has joined #ruby
[06:22:26] Axy: has joined #ruby
[06:22:45] p0p0pr37_: has joined #ruby
[06:22:46] p0p0pr37_: has joined #ruby
[06:22:46] Illianthe2: has joined #ruby
[06:23:03] sentor: has joined #ruby
[06:23:10] jtdoncas: has joined #ruby
[06:23:57] BioSpider: has joined #ruby
[06:25:36] Nahra: has joined #ruby
[06:28:01] LBRapid: has joined #ruby
[06:32:26] MrSparkle: has joined #ruby
[06:35:57] BrianOn99: has joined #ruby
[06:35:59] aupadhye: has joined #ruby
[06:36:58] Tempesta: has joined #ruby
[06:37:55] Cohedrin: has joined #ruby
[06:42:17] Algebr: has joined #ruby
[06:44:09] Algebr: A library I am using needs to do a require 'json'. This lib apparenlty has a pure implemention called json_pure. How can I write my Gemfile so that json_pure is the one that will be used whenever there is a require 'json'
[06:44:56] milardovich: has joined #ruby
[06:47:39] nicesignal: has joined #ruby
[06:51:12] apeiros: has joined #ruby
[06:53:29] morfin: has joined #ruby
[06:54:32] morfin: how can i reload code in pry?
[06:58:51] apeiros: morfin: it depends
[06:59:13] apeiros: are you in a rails console? is the code from a file? is the code in ruby or native?
[07:00:41] baweaver: Algebr: https://stackoverflow.com/questions/4800721/bundler-what-does-require-false-in-a-gemfile-mean
[07:00:46] baweaver: Gemfile, require aliases
[07:00:59] baweaver: gem 'json_pure', require: 'json'
[07:02:01] sentor`: has joined #ruby
[07:02:29] morfin: reload-code seems to be working
[07:02:54] morfin: i am in console - just running pry to run code directly
[07:04:09] oetjenj: has joined #ruby
[07:06:18] Algebr: baweaver: require aliases isn't running, getting an exception
[07:07:54] Algebr: oh, i think this will work for me: gem 'json_pure', '2.1.0', require: 'json'
[07:08:32] kryptoz: has joined #ruby
[07:09:34] InfinityFye: has joined #ruby
[07:11:02] sentor``: has joined #ruby
[07:11:29] morfin: or not...
[07:11:57] quobo: has joined #ruby
[07:17:10] uZiel: has joined #ruby
[07:18:46] Hanmac: has joined #ruby
[07:19:49] Psybur: has joined #ruby
[07:21:07] snickers: has joined #ruby
[07:26:39] milardovich: has joined #ruby
[07:28:34] userser: has joined #ruby
[07:28:45] Uptime: has joined #ruby
[07:29:03] conta: has joined #ruby
[07:29:33] ur5us: has joined #ruby
[07:31:00] nowhere_man: has joined #ruby
[07:32:04] reber: has joined #ruby
[07:33:02] Exhiled: has joined #ruby
[07:41:27] andikr: has joined #ruby
[07:41:33] ramfjord: has joined #ruby
[07:42:23] milardovich: has joined #ruby
[07:43:21] dionysus69: has joined #ruby
[07:45:46] tAn: has joined #ruby
[07:50:04] TinkerTyper: has joined #ruby
[07:56:24] gnufied: has joined #ruby
[07:57:30] Algebr: has joined #ruby
[07:57:34] Jameser: has joined #ruby
[08:01:22] TomyWork: has joined #ruby
[08:05:23] tAn: has joined #ruby
[08:07:16] Guest70176: has joined #ruby
[08:15:37] milardovich: has joined #ruby
[08:19:17] aufi: has joined #ruby
[08:19:54] Psybur: has joined #ruby
[08:22:10] lexruee: has joined #ruby
[08:23:31] burgestrand: has joined #ruby
[08:26:57] mark_66: has joined #ruby
[08:29:42] claudiuinberlin: has joined #ruby
[08:31:23] milardovich: has joined #ruby
[08:43:18] gone_haywire: has joined #ruby
[08:45:27] mtkd: has joined #ruby
[08:47:16] drowze: has joined #ruby
[08:47:37] Cohedrin: has joined #ruby
[08:48:39] tomphp: has joined #ruby
[08:50:40] GotHyper: has joined #ruby
[08:52:26] Bish: fellow rubyist
[08:52:28] Bish: i need your help
[08:52:39] Bish: i have a piece of code, which i like, but it's performances is horrible
[08:52:45] Bish: https://gist.github.com/anonymous/7391ab1aae8eb2ccbb25bda1c6e9746e
[08:53:11] Bish: this is my own "cronjob" implementation/scheduler
[08:53:29] Bish: i have "recurring events" that happen every X seconds
[08:54:21] Bish: but if a job that needs 30 seconds, is executed every 60 seconds.. it will effectively wait 90 seconds
[08:54:43] Bish: this works well, but as i said, it's horrible
[08:55:54] Bish: ream in this context. is a customer, and i want each "cronjob" to be executed for every customer
[09:00:24] mjolnird: has joined #ruby
[09:00:56] apeiros: Bish: it'd be nice to use .rb with your gists so we get syntax highlights
[09:02:42] BrianOn99: has left #ruby: ()
[09:02:50] mikecmpbll: has joined #ruby
[09:03:33] apeiros: `return proc do` I don't think that even works…
[09:03:54] Bish: https://gist.github.com/anonymous/de29e8929b508df7449bc2ad7a00db74
[09:04:01] apeiros: oh wow indeed. must be because return is syntax and not a method.
[09:04:04] Bish: as i said, this works wlel, but the performance is ugly
[09:04:17] Bish: with 200 customers, this is 100% and all jobs "come to late"
[09:04:18] apeiros: foo proc do … end # << this would not work, the do/end block belongs to foo
[09:04:44] milardovich: has joined #ruby
[09:04:53] apeiros: and how did you identify get_work as the cause of the perf issue?
[09:05:16] Bish: uhm, the "recurring events" are all IO-only
[09:05:30] Bish: they basicially just retrieve and send selects to a database
[09:05:36] Bish: queries* that is
[09:05:58] Bish: i specificially did it that way, because that way i hoped GIL won't fuck me over
[09:06:31] apeiros: so you guessed/assumed it's get_work which is slow?
[09:06:42] Bish: i didn't profile it or similiar
[09:07:14] apeiros: pro-tip: instead of deleting a gist, you can update it. gists are full git repos.
[09:07:14] GotHyper: has joined #ruby
[09:07:56] apeiros: I suggest you measure. and when you're sure it is indeed get_work, measure individual parts of it. figure out which part is the slow part.
[09:08:21] Bish: okay, i will try, kind of hard thing to do, because i don't want this to do this on production
[09:08:41] apeiros: then your first step is to get a reasonable lab together
[09:08:42] Bish: i always assumumed it has to be this, because the CPU is at 100% and none of the jobs does something cpu heavy
[09:09:03] apeiros: otherwise you'll just shoot in the blue
[09:09:15] Guest70176: has joined #ruby
[09:09:28] mikecmpbll: but shooting in the blue is fun
[09:10:24] apeiros: sure. if you want entertainment, go for it. if you want work done however…
[09:11:54] dennisvennink: has joined #ruby
[09:11:55] guille-moe: has joined #ruby
[09:14:02] apeiros: work must not be fun! where'd we get with that!!!1!
[09:14:46] Hobbyboy: has joined #ruby
[09:15:17] Bish: how does one actually profile ruby
[09:15:43] apeiros: profiler comes with ruby but is slow, ruby-prof is a gem which is a lot faster, and there's Benchmark
[09:16:05] apeiros: profiler slows down your code by about factor 100 (not kidding, last tested around ruby 2.0 iirc)
[09:16:18] apeiros: ruby-prof slows it down by about factor 2-3
[09:16:46] mim1k: has joined #ruby
[09:16:49] Bish: well, i assume i wont have it do do for long
[09:16:49] apeiros: Benchmark mostly incurs the overhead of a method call. you can use it to get CPU time a piece of code spent
[09:16:51] Sylario: has joined #ruby
[09:17:12] Bish: does ruby-prof have any drawbacks?
[09:17:25] apeiros: it's a native ext. other than that, none I knew of
[09:18:07] apeiros: oh, and with newer rubies, there's a lot of built-in instrumentation you can also use. look for "Trace" in the docs. TracePoint iirc.
[09:18:08] Bish: and how would i go with that? run it on everything and i will be able tor ead something out of the report?
[09:18:27] mim1k_: has joined #ruby
[09:18:46] apeiros: one way to use it is to run it on the section you assume to be the bottleneck
[09:18:47] Bish: apeiros: so what is better now, ruby native stuff? or something like ruby-prof
[09:18:50] Bish: i have 2.4.2 rubies
[09:19:32] apeiros: I'm afraid, there are no silverbullet answers. I usually use tiny `bench` methods based on Benchmark to verify I'm correct about where a bottleneck is
[09:19:51] Psybur: has joined #ruby
[09:20:07] Bish: well i am not sure about anything here :D it might even be normal
[09:20:10] apeiros: beyond that, it's been a while I actually needed ruby-prof to figure what's exactly going on as I have a usably good grasp of what takes about how much time in ruby (even though that shifts with versions)
[09:20:49] apeiros: it's as with all problems: divide and conquer
[09:20:57] ana__: has joined #ruby
[09:21:18] apeiros: measure large sections first to identify in which area the problem really happens. then narrow down.
[09:21:18] Bish: when i strace the process it does a lot of futex
[09:21:34] Bish: could that mean checking the mutex that often is expensive?
[09:22:20] apeiros: "that often"? anything you do often enough is expensive. and yes, a mutex does have a good bit of overhead.
[09:22:28] icedragon: has joined #ruby
[09:23:03] burgestrand: perftools.rb is fairly useful too, it can show you a call graph with percentages of where time is being spent
[09:24:44] nowhere_man: has joined #ruby
[09:25:11] AlHafoudh: has joined #ruby
[09:26:04] nowhere_man: has joined #ruby
[09:27:41] Bish: installing this and that
[09:27:54] Bish: man docker is useful
[09:28:22] bronson: has joined #ruby
[09:28:29] mim1k_: has joined #ruby
[09:28:53] Bish: > Makefile:242: recipe for target 'perftools.o' failed
[09:32:08] milardovich: has joined #ruby
[09:36:39] jaruga: has joined #ruby
[09:37:43] marr: has joined #ruby
[09:38:20] larcara: has joined #ruby
[09:39:54] dinfuehr: has joined #ruby
[09:41:44] ramfjord: has joined #ruby
[09:43:46] nowhere_man: has joined #ruby
[09:44:31] nowhere_man: has joined #ruby
[09:44:36] tAn: has joined #ruby
[09:45:26] ur5us: has joined #ruby
[09:47:03] Bish: hahaaa im profiling
[09:47:11] Bish: man ruby is slow
[09:47:13] Bish: i hate it
[09:47:54] apeiros: dunno, haven't had too many places where it was too slow
[09:48:09] Bish: what did u do when it was?
[09:48:26] Cohedrin: has joined #ruby
[09:48:32] Bish: as in c extension?
[09:48:33] apeiros: mainly happened with project euler, though. not at work :D
[09:48:47] apeiros: in that case, actually C as in C, not as in native ext
[09:48:56] luminor: has joined #ruby
[09:48:57] apeiros: but yes, I have written native extensions too
[09:49:23] apeiros: one I remember was for generating statistics where I built an ext to intersect integer arrays very fast
[09:50:49] Bish: i will leave the profiling running for a bit and post it
[09:50:59] Bish: i think mutex is pretty expensive,yes
[09:54:21] Bish: so rubys limit is having 200 "user land threads" in form of procs?
[09:54:23] Bish: man that sucks.
[09:56:37] TomyWork: has joined #ruby
[09:56:50] luminor_: has joined #ruby
[10:00:28] hs366: has joined #ruby
[10:01:14] lukeyb: has joined #ruby
[10:01:53] charliesome: has joined #ruby
[10:03:22] Bish: ACTION just removes the locks and lets the gil work its magic
[10:03:54] apeiros: huh? procs have nothing to do with threads
[10:03:59] apeiros: how do you get that idea?
[10:04:18] Bish: well, what i wrote there is some sort of user land scheduler without interruption
[10:04:23] Bish: so in this case, they do
[10:04:27] Bish: thats what i meant
[10:05:04] apeiros: well, it's still a weird assertion. and untangled from procs, no ruby does not have a limit of 200 threads.
[10:05:17] Bish: thats why i wrote user land threads
[10:05:29] Bish: ruby does not have a limit at all if you run it on a infinitely fast computer
[10:05:41] apeiros: though you may want to rethink your design. that many threads don't work well in any language using posix threads underneath.
[10:06:02] Bish: more specific: ruby does not seem to be able to have poorly written user land threads running in quantaties > 200
[10:06:17] Bish: apeiros: i am not talking about ruby's threads
[10:06:59] apeiros: then you're not being very clear.
[10:07:19] Bish: > what i wrote there is some sort of user land scheduler without interruption
[10:07:25] apeiros: and bad code is not a language problem…
[10:07:26] Bish: thats very clear
[10:07:52] apeiros: ok, look: there's zero problem writing code which has thousands of threads in ruby.
[10:07:53] Bish: well, i've done this in other languages, but they're all native
[10:08:12] apeiros: so I pose if you have a problem, it's your code, not ruby.
[10:08:26] apeiros: also using thousands of threads is rarely a good design in any language.
[10:08:27] Bish: well, one could say it's mri though
[10:08:41] Bish: apeiros: again, i am not talking about kernel threads
[10:08:55] apeiros: neither did I.
[10:08:56] Bish: well kernel-managed threads.
[10:10:30] workmad3: has joined #ruby
[10:11:03] Guest70176: has joined #ruby
[10:14:32] Serpent7776: has joined #ruby
[10:19:53] Psybur: has joined #ruby
[10:23:46] JsilverT: has joined #ruby
[10:27:18] Bish: weird, it seems to run better with profiling on
[10:27:20] jeanlinux: has joined #ruby
[10:28:45] Bish: yeah the mutex call seems to be the bottleneck
[10:30:19] Bish: it's double the time it is sleeping which would be 8 * 32 * 60, that it waits before the first job in total
[10:30:40] apeiros: an unconstested mutex call takes 0.000178ms on my machine…
[10:30:55] apeiros: pondering on how to bench contested mutex calls
[10:31:20] Bish: i will try to reduce the amount it's called
[10:31:24] apeiros: (difficulty lies mainly in how to not count the time the threads spend blocking)
[10:31:33] zautomata: has joined #ruby
[10:31:42] milardovich: has joined #ruby
[10:32:04] ldepandis: has joined #ruby
[10:32:11] Bish: it's getting called 2+<amount_of_jobs> times per get_work
[10:32:17] Bish: i could reduce it to 2 times, i think
[10:32:38] apeiros: how many jobs do you have?
[10:33:10] luminor: has joined #ruby
[10:33:34] Bish: it depends on how much time has passed, maxmimum of 20 maybe?
[10:34:45] apeiros: then I'm pretty sure your mutex is not the issue.
[10:35:36] apeiros: in a very contested mutex (10k threads, 10k calls to Mutex#synchronize), the mutex added 10ms CPU time
[10:36:19] apeiros: so ~1µs per synchronize call. I got a feeling like that should *not* be a problem with 20 jobs.
[10:36:49] apeiros: I'll restate that I believe you've got a problem with your code, not with ruby.
[10:37:21] Bish: well. it's 20 jobs per customer
[10:37:29] Bish: which is 215 ish, right now
[10:37:50] apeiros: > how many jobs do you have?
[10:37:59] apeiros: so you really meant ~4000?
[10:38:46] uZiel: has joined #ruby
[10:38:48] apeiros: well, so ~4002 x 1µs is still ~4ms
[10:39:52] apeiros: still doubt that that's your issue.
[10:39:59] apeiros: ACTION afk, lunch
[10:40:14] Bish: i reduced the amount either way.. so i will seen soon
[10:40:39] aupadhye: has joined #ruby
[10:40:49] apeiros: you may want to check how long the mutex is held, though and whether you made the mutex calls atomic enough. i.e. only over actually shared resources.
[10:41:23] Bish: that's what i meant when saying the mutex call is the problem
[10:41:26] Bish: not the call itself
[10:41:38] Bish: wondering why it would make the cpu go through the roof though
[10:41:40] apeiros: i.e. line 2-20 are suspicious and seem to cover non-shared code
[10:41:49] Bish: thanks, yeah i will look into that
[10:41:55] apeiros: anyway, off now
[10:42:06] Bish: i think you're german right?
[10:42:30] luminor_: has joined #ruby
[10:42:34] Bish: don't know an english term for that :D
[10:44:34] ldnunes: has joined #ruby
[10:46:12] DenSchub: has joined #ruby
[10:50:09] Bish: Lock held for 0.049691908 seconds
[10:52:34] veeti: has joined #ruby
[10:56:22] zanoni: has joined #ruby
[10:57:27] Bish: why the ferk isn't a locking hash not part of standard ruby
[10:57:44] larcara: has joined #ruby
[10:59:17] ferr: has joined #ruby
[11:01:40] ferr: has left #ruby: ()
[11:03:12] drowze: has joined #ruby
[11:03:50] leitz: has joined #ruby
[11:04:53] leitz: Are there lightweight, and possibly less complex, web frameworks that integrate with MOngoDB? I looked at Hanami but it only seems to support SQLish DBs. Not sure I'm ready for RoR.
[11:06:39] Bish: leitz: roda all the way
[11:06:59] Bish: not what u search.. i think, though
[11:07:48] Bish: leitz: https://www.youtube.com/watch?v=W8zglFFFRMM
[11:07:50] hfp_work: has joined #ruby
[11:07:55] banisterfiend: has joined #ruby
[11:08:01] Bish: give it a try, i actually dont know webframeworks that are inbetween those 2
[11:08:19] Bish: but this one is certainly lightweight
[11:09:12] apeiros: Bish: I speak german and I'm swiss
[11:09:32] Bish: that is a lie, i sometimes watch your news, with subtitles :p
[11:11:28] Bish: leitz: why mongodb?
[11:12:13] leitz: Bish, I'm wrapping up a class in it. :P
[11:12:27] leitz: Sorry, on-line learning class, not a code class.
[11:12:43] Bish: i see :)
[11:13:20] leitz: Would like to use it in my next project to push myself to continue to learn. From a performance or scale perspective, it makes little difference. The app is a toy.
[11:13:26] milardovich: has joined #ruby
[11:13:43] leitz: Actually, both apps are toys, mildly related.
[11:13:59] apeiros: Bish: an quick and dirty test seems to suggest that even a contested mutex (10k threads) takes a negligible amount of time (less than 0.1% of the total time it took to execute 10k threads each adding 1 to a variable)
[11:14:04] apeiros: copy paste failure
[11:14:09] apeiros: Bish: https://github.com/ruby-concurrency/concurrent-ruby
[11:14:20] Bish: i've done alot of research on ruby on threads
[11:14:22] Bish: i hate it.
[11:14:31] Bish: i know all there is, but thanks
[11:16:34] apeiros: having concurrent-ruby in stdlib would make a lot of sense IMO. but well :)
[11:17:04] Bish: has some crazy dude actually ported ruby to a postgres language
[11:17:07] Bish: oh lol.. someone did
[11:17:27] Bish: https://github.com/knu/postgresql-plruby no way..
[11:18:52] Bish: > Emacs Lisper
[11:18:55] Bish: that explains alot
[11:19:52] Psybur: has joined #ruby
[11:23:08] larcara: has joined #ruby
[11:23:35] rabajaj: has joined #ruby
[11:26:40] drowze: has joined #ruby
[11:27:47] Mortomes|Work: has joined #ruby
[11:29:11] milardovich: has joined #ruby
[11:32:50] hs367: has joined #ruby
[11:36:10] luminor: has joined #ruby
[11:37:01] _hs366: has joined #ruby
[11:41:54] ramfjord: has joined #ruby
[11:42:23] luminor: has joined #ruby
[11:42:27] d^sh: has joined #ruby
[11:42:31] enterprisey: has joined #ruby
[11:43:25] Jameser: has joined #ruby
[11:44:53] bweston92: has joined #ruby
[11:48:39] Guest70176: has joined #ruby
[11:49:04] aupadhye: has joined #ruby
[11:51:38] dviola: has joined #ruby
[11:51:52] thinkpad: has joined #ruby
[12:02:39] milardovich: has joined #ruby
[12:03:51] jtdoncas: has joined #ruby
[12:06:49] banisterfiend: has joined #ruby
[12:09:50] yeticry: has joined #ruby
[12:10:46] workmad3: has joined #ruby
[12:11:27] _merlim_: has joined #ruby
[12:11:29] sspreitz: has joined #ruby
[12:12:01] _merlim_: In edbian, I just installed ruby-full (version 2.1 i guess). Now when I apt-get install rubygems, I see it wants to install ruby 1.8 Is this correct?
[12:12:25] apeiros: ruby 1.9+ includes rubygems
[12:13:07] apeiros: iow, don't apt-get install rubygems. it's not for newer rubies.
[12:13:26] lunarkitty7: has joined #ruby
[12:14:30] drowze: has joined #ruby
[12:15:49] yeticry: has joined #ruby
[12:19:52] Psybur: has joined #ruby
[12:20:43] Bish: oh that guy died.
[12:24:18] _aeris_: has joined #ruby
[12:28:09] milardovich: has joined #ruby
[12:31:15] Bish: apeiros: well, it works pretty well after reducing the lock-count
[12:31:23] Bish: it sleeps now, that never happened before
[12:31:50] biberu: has joined #ruby
[12:31:55] Bish: nevermind i think it deadlocked
[12:32:08] profetes: has joined #ruby
[12:33:57] kryptoz: has joined #ruby
[12:41:49] milardovich: has joined #ruby
[12:45:36] aScottishBoat: has joined #ruby
[12:46:01] nadir: has joined #ruby
[12:46:17] Jameser: has joined #ruby
[12:46:26] osvimer_: has joined #ruby
[12:47:44] milardovich: has joined #ruby
[12:49:13] shinnya: has joined #ruby
[12:49:28] larcara_: has joined #ruby
[12:50:09] mark_66: has joined #ruby
[12:51:29] Guest70176: has joined #ruby
[12:53:14] tcopeland: has joined #ruby
[12:53:45] truenito: has joined #ruby
[12:54:15] dstrunk: has joined #ruby
[12:55:00] Jameser: has joined #ruby
[12:57:51] drowze: has joined #ruby
[12:58:32] VladGh: has joined #ruby
[13:00:09] Bish: apeiros: how would you solve my problem?
[13:00:33] sepp2k: has joined #ruby
[13:01:09] apeiros: in your place? probably by using an existing scheduler.
[13:01:45] Bish: is there something that does that? execute block for every 60 seconds, but dont overlap?
[13:01:54] Bish: what feature of concurrent ruby would that be?
[13:04:02] yeticry: has joined #ruby
[13:04:20] apparition: has joined #ruby
[13:05:05] apeiros: don't overlap? you mean assuming the block takes less than 60s to execute?
[13:05:14] apeiros: or how do you ensure no overlap?
[13:05:53] Bish: next_time_execution = time_execution_took + 60s
[13:06:10] cosimo_: has joined #ruby
[13:06:14] apeiros: so you don't mean every 60s, you mean with a gap of 60s
[13:06:21] Bish: uhm, yes
[13:06:45] Bish: and i need those grouped per customer :( to optimize for database connections
[13:06:46] apeiros: it's fine. I understand this is difficult to express.
[13:07:28] apeiros: where do your threads come into play?
[13:07:46] apeiros: I ask because if it's all sequential, you don't need a mutex
[13:08:09] Bish: at the end of the script there is just (0..8).to_a.map { Thread.new { get_work } }
[13:08:17] Bish: it's not sequential
[13:08:23] burgestrand: Bish what's the data type of @@realms?
[13:08:40] Bish: Burgestrand: it's a model, each customer as a a "realm"
[13:09:32] milardov_: has joined #ruby
[13:09:34] burgestrand: Bish ah, alright, so you have your own implementation of #sample?
[13:09:55] Bish: no. it's an array of realms
[13:10:04] Bish: Enumerable rather
[13:10:45] burgestrand: Bish so it's not a model, and Enumerable doesn't have sample so Array is fine :)
[13:11:03] kryptoz: has joined #ruby
[13:11:04] Bish: sorry, again :D
[13:11:48] burgestrand: Bish how many realms do you have as an order of magnitude? tens? hundreds? more?
[13:12:10] Bish: it's 200 now, we're planning on 1000 by march
[13:12:20] Bish: otherwise the company dies, i guess
[13:15:10] Bish: that's why i am having my thoughts, this wont handle 1000
[13:15:17] Bish: I(very_often) am 90.072294026 too late
[13:15:23] Bish: that job is supposed to run every 60 seconds
[13:15:29] Bish: and is 90 seconds too late :D
[13:16:30] nicesignal: has joined #ruby
[13:17:25] burgestrand: I was trying to understand the execution here, but I think I'll give up it'll take too long and I'm at work ;)
[13:17:36] apeiros: so you have about ~20 jobs per customer. you have a growing number of customers (200 now, 1000 planned, potentially more later). those 20 jobs should be executed as fast as possible, then a break of 60s until next execution of all 20 jobs. the 60s break is per customer. does that fit?
[13:17:59] Bish: 100% correct
[13:18:09] Bish: but i have jobs with different intervals
[13:18:17] apeiros: and all those jobs need access to a limited resource (database connections in your case)?
[13:18:29] Bish: very_often ⇔ 60s, often ⇔ 300s, hourly, daily
[13:19:02] Bish: well i even think i can forget about the database connection thing
[13:19:24] safetypin: has joined #ruby
[13:19:28] Bish: i did that because i thought it is clever because the database connection will be killed, after each job
[13:19:30] burgestrand: I recall there being a in-process job scheduler that used hitimes (as opposed to a background worker)
[13:19:35] apeiros: the design pattern with such problems is you usually pool the limited resource and organize your work around that
[13:19:42] burgestrand: Trying to find it but I can't remember it's name…
[13:19:51] Psybur: has joined #ruby
[13:20:01] dstrunk: has joined #ruby
[13:20:45] apeiros: do the jobs themselves vary? or are they the same for all customers just with different parametrization? i.e. they all take about the same time to run?
[13:20:54] Bish: no they don't vary
[13:21:30] Bish: they do not take the same time to run though, it depends on how much data the customer has
[13:22:20] apeiros: what min/max are we talking about?
[13:22:42] Bish: same job could be 3-160s is the max i thought
[13:22:58] apeiros: (fair warning, lunch break is over so my message may be rather infrequent)
[13:23:09] Bish: all cool, im very grateful either way
[13:23:44] apeiros: so extreme case: 160s job execution, 60s gap time, 160s job exe, 60s gap time, … for a single customer could be a pattern?
[13:23:55] yeticry: has joined #ruby
[13:24:11] [Butch]: has joined #ruby
[13:25:16] burgestrand: I'm also very curious now, it's fun to follow this 20 questions of requirements :D
[13:26:00] plexigras: has joined #ruby
[13:27:58] Bish: apeiros: yes
[13:28:07] Puffball_: has joined #ruby
[13:28:14] Bish: for another customer that 160s could be 2s likewise
[13:28:48] Barrt: has joined #ruby
[13:28:51] apeiros: and a job would be considered "late" if it the gap time exceeds the scheduled 60s? i.e. if the gap time "happens" to be 80s, the job is considered 20s late?
[13:28:54] banisterfiend: has joined #ruby
[13:30:19] burgestrand: I think I was thinking of rufus-scheduler, regarding my gem that I couldn't find, but I'm not entirely sure
[13:31:16] Bish: apeiros: i personally think so, but right now there are no jobs that HAVE to run
[13:31:22] Bish: it's something like "update that reporting"
[13:31:31] Bish: none will notice if the reporting is 20 seconds old
[13:31:53] apeiros: ok, but that's what you labeled as "jobs being late" above?
[13:32:43] bmurt: has joined #ruby
[13:33:30] [Butch]: has joined #ruby
[13:33:54] Bish: it's just so i can actually see that my scheduler fucks up
[13:34:10] Bish: without prints, how would've noticed that it's not working optimal
[13:34:22] milardovich: has joined #ruby
[13:34:24] Bish: would i have noticed
[13:34:48] Bish: so there is no real "being late", but in future there might be time cirtical jobs
[13:34:59] Bish: but actually, they're just cronjobs which i don't want to stall
[13:35:23] Bish: if a job takes 61s and is executed every 60s.. i don't want this to be happening to me
[13:35:52] Bish: reminds me too much of times when i was 11 and dreaming of becoming a php web developer
[13:36:59] apeiros: well, the two strategies there are either yours (using gaps instead of having a fixed interval for the start time), or skipping runs (last one still running? skip this run)
[13:37:30] apeiros: but both only care about a single job. when you have multiple jobs, they still can starve your resources.
[13:37:55] banisterfiend: anyone here know about code signing on osx?
[13:38:04] milardovich: has joined #ruby
[13:39:39] apeiros: so one main question with regards to the "best" design is: do you think your resources (CPU power, IO bandwidth, …) should be easily capable of coping with the demand of your jobs, or do you have to design with starved resources in mind?
[13:39:53] apeiros: 1st variant you'll want to design to run things on time
[13:40:14] apeiros: 2nd variant you'll want to design to run things as soon as possible and as fairly distributed among your customers as possible
[13:40:51] larcara: has joined #ruby
[13:41:24] apeiros: 2nd variant can actually still be a choice even if you have resources to spare (i.e. "the fresher the reports, the happier the customers", so while every 60s would be good, running them even faster would be better)
[13:42:06] ramfjord: has joined #ruby
[13:42:44] Ouchy: has joined #ruby
[13:42:44] Ouchy: has joined #ruby
[13:42:50] fusta: has joined #ruby
[13:43:01] Ouchy`w: has joined #ruby
[13:45:43] davic: has joined #ruby
[13:45:51] apeiros: 2nd variant is mostly a priority queue where the rarer the job, the higher its priority, and you re-enqueue a job after it has been done. and a worker-pool processes the work. you log the delay+starttime+endtime+duration for each processed job and use analytics to figure whether you have to add resources.
[13:46:29] davic: has joined #ruby
[13:46:31] Bish: i like the skipping runs approach
[13:46:34] Bish: seems simple
[13:48:00] Jameser: has joined #ruby
[13:48:07] apeiros: fun, I actually prefer gapping. mostly because with ^ implementation, it's relatively simple.
[13:48:22] apeiros: and it makes gapping completely optional.
[13:48:59] apeiros: ah right, and with ^ impl, you'd measure throughput, not lateness. which seems to fit better with what you describe too.
[13:50:21] gheegh: has joined #ruby
[13:50:24] SirOliver: has joined #ruby
[13:50:54] gheegh: Hey, does anyone know if Net::HTTP supports HTTP2?
[13:51:31] gheegh: I'm running into a problem with Webmock not being able to parse a downloaded file with CURL, and they all seem to be HTTP/2 responses..
[13:52:19] larcara: has joined #ruby
[13:52:50] davic: has joined #ruby
[13:52:52] Bish: apeiros: so how would i go with that, take the concurrent api and just try to implement things you said ?
[13:53:11] SirOliver: has joined #ruby
[13:55:09] milardovich: has joined #ruby
[13:56:36] drowze: has joined #ruby
[14:00:23] Jameser: has joined #ruby
[14:02:19] Barrt: has joined #ruby
[14:02:28] rfoust: has joined #ruby
[14:02:34] JsilverT: has joined #ruby
[14:02:54] mikecmpb_: has joined #ruby
[14:03:18] mtkd: has joined #ruby
[14:04:02] tomphp: has joined #ruby
[14:05:11] najam: has joined #ruby
[14:05:22] ramortegui: has joined #ruby
[14:05:51] najam: has left #ruby: ()
[14:07:11] jonr22: has joined #ruby
[14:08:40] cdg: has joined #ruby
[14:09:45] burgestrand: has joined #ruby
[14:10:13] morfin: has joined #ruby
[14:10:36] morfin: how do i break out of loop from inside of function called in loop?
[14:10:41] kanobt61_: has joined #ruby
[14:11:08] workmad3: has joined #ruby
[14:11:28] Bish: morfin: if you can, use return/next
[14:11:29] Bish: otheriwse
[14:11:34] Bish: throw and catch
[14:12:57] Jameser: has joined #ruby
[14:14:14] guille-moe: has joined #ruby
[14:15:16] mim1k_: has joined #ruby
[14:15:21] Bish: >> lobal = nil;catch(:mr_gorbatschow_turn_down_this_wall) { (0..10).to_a.each { |a| (0..10).to_a.each { |b| global = [a,b];throw(:mr_gorbatschow_turn_down_this_wall) if a == 3 } } };global
[14:15:22] catbusters: has joined #ruby
[14:15:33] Bish: >> lobal = nil;catch(:mr_gorbatschow_turn_down_this_wall) { (0..10).to_a.each { |a| (0..10).to_a.each { |b| global = [a,b];throw(:mr_gorbatschow_turn_down_this_wall) if a == 3 } } };global
[14:15:34] ruby[bot]: Bish: # => undefined local variable or method `global' for main:Object ...check link for more (https://eval.in/904477)
[14:16:07] Bish: >> global = nil;catch(:mr_gorbatschow_turn_down_this_wall) { (0..10).to_a.each { |a| (0..10).to_a.each { |b| global = [a,b];throw(:mr_gorbatschow_turn_down_this_wall) if a == 3 } } };global
[14:16:08] ruby[bot]: Bish: # => [3, 0] (https://eval.in/904478)
[14:16:33] Bish: morfin: keep in mind, this should be the last thing you do
[14:16:58] morfin: yes i remember)
[14:17:54] Bish: haha, youre russian, that makes my example so much more funny
[14:19:50] Psybur: has joined #ruby
[14:20:39] rikkipitt: has joined #ruby
[14:25:21] krawchyk: has joined #ruby
[14:25:40] tomphp: has joined #ruby
[14:26:56] Jameser: has joined #ruby
[14:28:38] polishdub: has joined #ruby
[14:29:24] tlaxkit: has joined #ruby
[14:31:02] DLSteve_: has joined #ruby
[14:31:18] oleo: has joined #ruby
[14:32:46] mson: has joined #ruby
[14:34:03] govg: has joined #ruby
[14:34:51] rouge: has joined #ruby
[14:38:28] apeiros: Bish: some old code slightly reshaped: https://gist.github.com/apeiros/0478ccf738f3df9018c35b33ddce4118
[14:38:39] apeiros: in this example, all jobs are executed as fast as possible
[14:39:22] milardovich: has joined #ruby
[14:39:23] Jameser: has joined #ruby
[14:39:39] apeiros: the difficulty would be in how to reshape this so it serves your case with multiple priorities (the "once a minute, once an hour, daily" part)
[14:40:32] apeiros: the way I'd deal with that depends heavily on how many priorities there are, and what expectations the system should fulfill
[14:40:40] Barrt: has joined #ruby
[14:41:52] cdg: has joined #ruby
[14:41:57] ramfjord: has joined #ruby
[14:43:30] greengriminal: has joined #ruby
[14:43:41] milardov_: has joined #ruby
[14:45:48] tomphp: has joined #ruby
[14:47:25] michael1: has joined #ruby
[14:50:45] Jameser: has joined #ruby
[14:50:48] foooobear: has joined #ruby
[14:52:16] burgestrand: has joined #ruby
[14:54:05] Guest70176: has joined #ruby
[14:56:32] tomphp: has joined #ruby
[14:57:24] mim1k: has joined #ruby
[14:57:58] hs367: has joined #ruby
[14:58:14] soahccc: has joined #ruby
[14:59:11] _hs366: has joined #ruby
[14:59:16] synthroid: has joined #ruby
[15:00:56] daemonwrangler: has joined #ruby
[15:01:24] uZiel: has joined #ruby
[15:02:31] oleo: has joined #ruby
[15:03:23] safetypin: has joined #ruby
[15:03:30] milardovich: has joined #ruby
[15:04:26] Barrt: has joined #ruby
[15:05:33] hs367: has joined #ruby
[15:06:31] _hs366: has joined #ruby
[15:08:36] daemonwrangler: has joined #ruby
[15:08:55] Ouchy`w: has joined #ruby
[15:12:32] herbmillerjr: has joined #ruby
[15:12:48] Jameser: has joined #ruby
[15:13:43] michael1: has joined #ruby
[15:14:18] Technodrome: has joined #ruby
[15:15:29] Guest70176: has joined #ruby
[15:17:35] Rapture: has joined #ruby
[15:19:14] banisterfiend: has joined #ruby
[15:19:52] Psybur: has joined #ruby
[15:22:23] banisterfiend: has joined #ruby
[15:27:02] rippa: has joined #ruby
[15:27:06] cschneid_: has joined #ruby
[15:27:53] SirOliver: has joined #ruby
[15:30:56] drowze: has joined #ruby
[15:31:44] mikecmpbll: has joined #ruby
[15:33:39] snickers: has joined #ruby
[15:36:36] chmurifree: has joined #ruby
[15:39:53] milardovich: has joined #ruby
[15:40:29] kculpis: has joined #ruby
[15:40:54] rikkipitt: has joined #ruby
[15:41:40] notmyrealname: has joined #ruby
[15:41:41] rikkipitt: has joined #ruby
[15:43:07] notmyrealname: Hi! Does anyone know how to format a string so it looks like a heading when printed? I've searched around a bit and couldn't find anything. I'm welcome to any help.
[15:43:37] greengriminal: has joined #ruby
[15:43:45] burgestrand: notmyrealname When printed where?
[15:44:32] burgestrand: notmyrealname What kind of heading? Compass heading? Website heading? Terminal heading? A be-heading?
[15:44:52] apeiros: how does a heading look like?
[15:45:36] burgestrand: Up is a heading!
[15:45:37] notmyrealname: Burgestrand: Real simple. I'm just making a terminal application and I want it to print it's name to the terminal.
[15:46:08] notmyrealname: Burgestrand: Big old heading. :)
[15:46:45] burgestrand: notmyrealname I'm not that old, so I'm not sure what you mean by big old heading; at least my terminal all characters are all the same size so there's not much for room for big there either. Are you talking about boldening the text, maybe?
[15:47:26] havenwood: system 'banner notmyrealname'
[15:47:48] burgestrand: havenwood Oh wow, that is big for sure!
[15:48:36] kickr: has joined #ruby
[15:48:51] burgestrand: Dang it's so large, and vertical, didn't expect that… and a default width of 132 instead of 80, that was a bit surprising.
[15:49:26] burgestrand: notmyrealname Here's a chunk of terminal escape sequences that I found by Googling, perhaps a few of those are to your liking: https://gist.github.com/lnznt/2663516
[15:49:57] apeiros: lol, til `banner`. interesting.
[15:49:58] aef: has joined #ruby
[15:50:06] notmyrealname: Burgestrand: I just realized that to do that you can use asic art.
[15:50:21] burgestrand: notmyrealname \o/
[15:50:54] apeiros: but banner only prints 90° rotated?
[15:51:06] burgestrand: I was a bit surprised by that too
[15:51:29] jaequery: has joined #ruby
[15:51:35] havenwood: apeiros: on Linux it's horizontal, on BSD vertical ¯\_(ツ)_/¯
[15:51:46] apeiros: because reasons. I love it.
[15:53:42] notmyrealname: Burgestrand: Thanks for the gist. I think banner is a little too ostentatious if you catch my drift.
[15:54:15] iamarun: has joined #ruby
[15:54:22] burgestrand: notmyrealname Yeah I catch your heading!
[15:54:44] burgestrand: Anyhow, gotta split, glhf!
[15:55:17] notmyrealname: Ruby irc is just too cool.
[15:55:46] ule: Hey guys.. Is there a different way of doing this:
[15:55:51] ule: Object.const_get(klass).send('new', foo, bar)
[15:55:57] ule: Not sure how bad this looks like
[15:56:09] ule: or if it's ok
[15:56:19] havenwood: ule: you could use #public_send
[15:56:31] ule: let me read about that
[15:56:39] apeiros: though I presume that's an example
[15:56:42] ule: apeiros: ohh symbols.. awesome
[15:56:50] apeiros: because if it's static, just do .new(…)
[15:56:52] ule: apeiros: actually not.. :P
[15:57:04] ule: I can make it static
[15:57:16] apeiros: well, then Object.const_get(name).new(…)
[15:57:26] ule: ohhh got it
[15:58:29] apeiros: public_send only if you need to identify the method via variable. send only if you need to call a private method (bad, don't unless you know what you do :-p)
[15:58:36] apeiros: ACTION afk, laters!
[15:58:50] sammi`: has joined #ruby
[15:58:53] ule: awesome thanks guys!
[16:00:34] larcara: has joined #ruby
[16:03:53] cognoscente: has joined #ruby
[16:04:07] mikecmpbll: has joined #ruby
[16:05:36] snickers: has joined #ruby
[16:07:21] mostlybadfly: has joined #ruby
[16:11:27] workmad3: has joined #ruby
[16:15:25] troys: has joined #ruby
[16:16:49] Guest70176: has joined #ruby
[16:18:29] mikkelsen: has joined #ruby
[16:19:31] aufi: has joined #ruby
[16:19:54] impermanence: has joined #ruby
[16:19:56] Psybur: has joined #ruby
[16:20:11] impermanence: I have an issue on one of my agents that is apparently being caused by my master caching "stuff"
[16:20:22] impermanence: where are these caches typically and can I just delete them?
[16:20:28] impermanence: If not how do I restart a master?
[16:20:39] SirOliver: has joined #ruby
[16:21:40] krawchyk: has joined #ruby
[16:25:34] nofxx: has joined #ruby
[16:29:00] milardovich: has joined #ruby
[16:30:10] nofxx1: has joined #ruby
[16:30:25] Technodrome: has joined #ruby
[16:31:49] gizmore: impermanence: maybe this is not ruby lang related, but rails or something? try #RubyOnRails then
[16:33:14] dn`: has joined #ruby
[16:35:13] orbyt_: has joined #ruby
[16:35:36] aScottishBoat: has joined #ruby
[16:40:13] milardovich: has joined #ruby
[16:43:28] stokachu: has joined #ruby
[16:44:58] synthroid: has joined #ruby
[16:46:27] FahmeF: has joined #ruby
[16:47:03] aScottishBoat: has joined #ruby
[16:51:04] tAn: has joined #ruby
[16:53:54] dviola: has joined #ruby
[16:54:03] bmurt: has joined #ruby
[17:00:43] aroaminggeek: has joined #ruby
[17:01:35] jaruga: has joined #ruby
[17:04:02] raynold: has joined #ruby
[17:06:18] fusta: has joined #ruby
[17:08:03] nowhere_man: has joined #ruby
[17:08:28] dinfuehr: has joined #ruby
[17:09:18] zautomata: has joined #ruby
[17:10:11] milardov_: has joined #ruby
[17:13:04] dionysus69: has joined #ruby
[17:15:13] mikkelsen: has joined #ruby
[17:15:20] eksi_: has joined #ruby
[17:16:16] ldepandis: has joined #ruby
[17:17:13] rouge: has joined #ruby
[17:18:53] helpa: has joined #ruby
[17:19:50] Psybur: has joined #ruby
[17:20:16] tAn: has joined #ruby
[17:21:09] Nitrodist: has left #ruby: ()
[17:24:56] orbyt_: has joined #ruby
[17:25:56] Uptime: has joined #ruby
[17:32:30] nogic: has joined #ruby
[17:32:58] konsolebox: has joined #ruby
[17:35:30] rippa: has joined #ruby
[17:36:48] selim: has joined #ruby
[17:37:04] michael1: has joined #ruby
[17:38:03] zautomata: has joined #ruby
[17:41:19] cognoscente_: has joined #ruby
[17:42:17] mikkelsen: has joined #ruby
[17:44:22] br0d1n: has joined #ruby
[17:49:59] konsolebox_: has joined #ruby
[17:52:35] chouhoulis: has joined #ruby
[17:52:51] FahmeF: has joined #ruby
[17:53:42] claudiuinberlin: has joined #ruby
[17:55:46] hahuang65: has joined #ruby
[17:56:23] Exhiled: has joined #ruby
[17:56:47] jtdoncas: has joined #ruby
[17:57:09] apeiros_: has joined #ruby
[17:57:52] eckhardt: has joined #ruby
[17:58:49] krawchyk: has joined #ruby
[17:59:17] cdg: has joined #ruby
[18:00:22] brixen: has joined #ruby
[18:03:11] mcr1: has joined #ruby
[18:03:31] milardovich: has joined #ruby
[18:05:16] guille-moe: has joined #ruby
[18:06:10] benjen: has joined #ruby
[18:11:43] workmad3: has joined #ruby
[18:12:27] enterprisey: has joined #ruby
[18:16:17] aroaminggeek: has joined #ruby
[18:19:28] Guest70176: has joined #ruby
[18:19:52] Psybur: has joined #ruby
[18:20:48] dcluna: has joined #ruby
[18:22:17] larcara: has joined #ruby
[18:22:44] al2o3-cr: has joined #ruby
[18:23:07] PaulCapestany: has joined #ruby
[18:23:18] eckhardt_: has joined #ruby
[18:23:41] conta2: has joined #ruby
[18:24:50] truenito: has joined #ruby
[18:26:01] silvermine: has joined #ruby
[18:30:12] gr33n7007h: has joined #ruby
[18:32:09] mikecmpbll: has joined #ruby
[18:33:22] tAn: has joined #ruby
[18:34:11] Exhiled: has joined #ruby
[18:36:18] moei: has joined #ruby
[18:38:27] milardov_: has joined #ruby
[18:40:34] gr33n7007h: has joined #ruby
[18:47:37] aroaminggeek: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[18:49:18] Radanisk: has joined #ruby
[18:52:28] Radanisk: has joined #ruby
[18:55:38] yaewa: has joined #ruby
[18:59:03] Rapture: has joined #ruby
[19:02:06] nadir: has joined #ruby
[19:03:24] d10n-work: has joined #ruby
[19:05:51] zacts: has joined #ruby
[19:07:31] moei: has joined #ruby
[19:08:46] jackjackdripper: has joined #ruby
[19:09:00] kapil___: has joined #ruby
[19:09:07] apeiros_: has joined #ruby
[19:09:10] Technodrome: has joined #ruby
[19:09:10] tAn: has joined #ruby
[19:13:13] milardovich: has joined #ruby
[19:13:21] ur5us: has joined #ruby
[19:13:29] nirix: has joined #ruby
[19:13:33] ur5us: has joined #ruby
[19:15:19] ldnunes: has joined #ruby
[19:15:28] nofxx1: has joined #ruby
[19:15:41] ixti: has joined #ruby
[19:15:57] muelleme: has joined #ruby
[19:16:20] Exhiled: has joined #ruby
[19:16:48] rouge: has joined #ruby
[19:18:16] Cohedrin: has joined #ruby
[19:19:51] Psybur: has joined #ruby
[19:20:08] rouge: has joined #ruby
[19:21:02] Guest70176: has joined #ruby
[19:21:09] zautomata: has joined #ruby
[19:21:44] milardov_: has joined #ruby
[19:25:56] graft: has joined #ruby
[19:27:15] Dimik: has joined #ruby
[19:28:02] graft: okay, i'm having some issues with zero division
[19:28:09] graft: >> 0.0 == -0.0
[19:28:11] ruby[bot]: graft: # => true (https://eval.in/904687)
[19:28:19] michael1: has joined #ruby
[19:28:22] graft: >> 1.0/0.0 == 1.0/-0.0
[19:28:23] ruby[bot]: graft: # => false (https://eval.in/904688)
[19:28:45] graft: also, this:
[19:28:49] ruby[bot]: graft: # => divided by 0 (ZeroDivisionError) ...check link for more (https://eval.in/904689)
[19:32:01] snickers: has joined #ruby
[19:32:51] graft: clearly 1/0.0 == Infinity is wrong, just mathematically - is there a way i can make this raise ZeroDivisionError instead of returning Infinity?
[19:33:44] ruby[bot]: Your numbers don't add up? You get "weird" results? read http://floating-point-gui.de/
[19:34:17] ltem: has joined #ruby
[19:34:20] tAn: has joined #ruby
[19:34:45] graft: this doesn't seem to have anything to do with floating point arithmetic... it's just a definition issue
[19:34:53] RickHull: 1/0 #=> ZeroDivisionError is expected
[19:35:06] graft: i agree, that's the correct behavior
[19:35:08] RickHull: the rest of your examples have to do with floating point imprecision
[19:35:24] graft: that's not possible, if 0.0 == -0.0
[19:35:25] ramfjord: has joined #ruby
[19:35:34] oetjenj: has joined #ruby
[19:35:37] graft: it's not calculating Infinity for 1/0.0 using floating point arithmetic
[19:35:39] Immune: has joined #ruby
[19:35:59] RickHull: I don't know any background on Infinity here -- but that is the limit as y approaches 0
[19:36:44] oetjenj_: has joined #ruby
[19:37:07] graft: y = 1/x approaches Infinity as x => 0 and -Infinity as x => -0
[19:37:13] graft: it is undefined at x == 0
[19:37:44] Technodrome: has joined #ruby
[19:37:45] RickHull: 0.0 is not the same as 0
[19:37:59] RickHull: 0.0 approximates 0
[19:38:05] graft: >> 0.0 == 0
[19:38:06] ruby[bot]: graft: # => true (https://eval.in/904697)
[19:38:38] RickHull: yep, in some cases you get == to return true
[19:38:51] synthroid: has joined #ruby
[19:39:04] RickHull: >> [0.1 + 0.2 == 0.3, 0.1 + 0.1 == 0.2]
[19:39:04] moei: has joined #ruby
[19:39:05] ruby[bot]: RickHull: # => [false, true] (https://eval.in/904698)
[19:39:12] hays: has joined #ruby
[19:39:13] hays: has joined #ruby
[19:39:47] graft: this is not a Float issue, 0 is 0
[19:40:23] RickHull: 0.0 is a float; 0 is an int
[19:40:41] graft: they are both unambiguously zero, not floating-point approximations
[19:40:53] graft: even in C, a 0 float is 0, all of the bits are 0
[19:41:17] ramfjord: I belive that the way floating point arithmetic works, any number / 0.0 is Infininity instead of "undefined" as it would be in a mathematical sense, but most languages will throw an error when you try to divide by 0
[19:41:37] ramfjord: and 0.0 is a special case float: all 0's
[19:42:17] ramfjord: so it should be more reliable to check 0.0 == 0 vs other floating point comparisons, though it's a strange case where you would reliably get exactly 0
[19:42:53] ramfjord: won't 0 be cast to a float since it's used in an expression with a float?
[19:43:03] ramfjord: >> [ 1.1 / 1, 1 / 1.1 ]
[19:43:04] ruby[bot]: ramfjord: # => [1.1, 0.9090909090909091] (https://eval.in/904702)
[19:43:55] havenwood: >> class Integer; def / n; return Float::NAN if n.instance_of?(Float) && n.zero?; div n end end; 1 / 0.0 # graft
[19:43:56] ruby[bot]: havenwood: # => Infinity (https://eval.in/904703)
[19:44:11] jackjackdripper: has joined #ruby
[19:44:20] havenwood: On 2.4: NaN
[19:44:58] havenwood: >> class Fixnum; def / n; return Float::NAN if n.instance_of?(Float) && n.zero?; div n end end; 1 / 0.0
[19:44:59] ruby[bot]: havenwood: # => NaN (https://eval.in/904704)
[19:45:46] ramfjord: >> Float.ancestors & Fixnum.ancestors
[19:45:47] ruby[bot]: ramfjord: # => [Numeric, Comparable, Object, Kernel, BasicObject] (https://eval.in/904705)
[19:45:58] ramfjord: maybe Numeric?
[19:46:10] havenwood: ramfjord: I forgot the bot wasn't 2.4.
[19:47:01] havenwood: ramfjord: With Fixnum and Bignum unified to Integer in 2.4 Integer is the place to redefine. But on < 2.4 Integer is lower in the method chain than Fixnum.
[19:47:25] graft: i'm on 2.2.2
[19:47:42] workmad3: has joined #ruby
[19:49:50] ramfjord: havenwood: I was suggesting Numeric as a common ancestor between Float and Fixnum/Integer, since otherwise (1.0 / 0.0) may have different behavior than (1 / 0.0)... But either way monkey patching division on these classes seems like madness
[19:50:12] havenwood: ramfjord: Ah, right. Yeah - it's the common ancestor but the method would never get called.
[19:50:16] greengriminal: has joined #ruby
[19:50:58] havenwood: Since Float, Integer, Rational, etc all define #/.
[19:52:37] synthroid: has joined #ruby
[19:52:59] VeryBewitching: has joined #ruby
[19:53:01] ramfjord: because it's defined on the subclass... right. But would there also be some weird casting logic here? In (1 / 1.1) clearly the "1" is cast to Float before the operation?
[19:53:16] ramfjord: >> class Float ; def / n ; return Float::NAN if n.zero?; div n end end; 1 / 0.0
[19:53:17] ruby[bot]: ramfjord: # => Infinity (https://eval.in/904708)
[19:53:26] ramfjord: hrm... apparently not
[19:54:16] RickHull: ramfjord: a float in any portion of an arithmetic expression tends to "cast" the result to float
[19:54:27] RickHull: not sure on how the internal mechanics work
[19:55:25] RickHull: >> Rational(1, 0.0)
[19:55:26] ruby[bot]: RickHull: # => divided by 0 (ZeroDivisionError) ...check link for more (https://eval.in/904711)
[19:56:34] ruby[bot]: ramfjord: # => divided by 0 (ZeroDivisionError) ...check link for more (https://eval.in/904713)
[19:56:39] ramfjord: pretty inconsistent eh
[19:56:45] ramfjord: but there's no Int::Infinity
[19:57:43] RickHull: Rational tries to keep everything to integer domains -- so the ZDE is reasonably sensible for 1/0.0
[19:58:05] ramfjord: >> (1 / 0.0) - (1 / 0.0)
[19:58:06] ruby[bot]: ramfjord: # => NaN (https://eval.in/904714)
[19:58:09] ramfjord: that's nice
[19:58:43] ramfjord: Yeah, I don't understand why rational types aren't more prevalent for precise computation
[19:58:59] RickHull: as with most things -- because they don't have a good literal representation
[19:59:21] RickHull: it's easy to write: price = 4.99
[19:59:35] yaewa: has joined #ruby
[19:59:36] RickHull: less so: price = Rational(499,100)
[19:59:54] ramfjord: at least not a typable one - with a pen it's pretty easy to represent a fraction
[20:00:16] RickHull: right -- I just mean in terms of mindshare and prevalence in blog posts and tutorials
[20:00:53] RickHull: String, Array, Hash, Float -- these have simple and common literal representations
[20:01:10] RickHull: and they tend to get used even when something clunkier-looking works better
[20:01:29] ramfjord: Alright, I've got it boys! Monkeypatch Float initialization to check if more than two digits of precision were provided, and convert to rational if not
[20:01:34] devchild: has joined #ruby
[20:02:32] Oclair: has joined #ruby
[20:02:45] RickHull: what could possibly go wrong?!
[20:05:35] moei: has joined #ruby
[20:06:59] Chew: has joined #ruby
[20:07:05] jackjackdripper1: has joined #ruby
[20:08:29] bmurt: has joined #ruby
[20:09:39] RickHull: ramfjord: BigDecimal is also handy for precise decimal representation
[20:13:50] chouhoulis: has joined #ruby
[20:14:58] hays: has joined #ruby
[20:14:58] hays: has joined #ruby
[20:15:18] Exhiled: has joined #ruby
[20:17:16] GBrawl: has joined #ruby
[20:17:24] oetjenj: has joined #ruby
[20:19:50] Psybur: has joined #ruby
[20:21:36] greengriminal: has joined #ruby
[20:22:40] Guest70176: has joined #ruby
[20:28:47] apeiros_: has joined #ruby
[20:29:18] larcara: has joined #ruby
[20:31:55] orbyt_: has joined #ruby
[20:32:35] Oclair: has joined #ruby
[20:33:26] apeiros_: has joined #ruby
[20:34:02] truenito: has joined #ruby
[20:38:16] ap4y: has joined #ruby
[20:39:47] mim1k: has joined #ruby
[20:54:46] Prutheus: has joined #ruby
[20:54:53] Prutheus: Hello guys! Me again :D
[20:56:19] Prutheus: I am working with selenium at the moment. Have a webpage where some url's are listed. I want to open them in another tab to get data from there. My problem is: when I let the driver change his tabs via https://bpaste.net/show/4414f02ec6c1 the window gains focus so I can't work on my pc anymore while the bot is running.
[20:56:24] Prutheus: how could I change this?
[20:58:01] Technodrome: has joined #ruby
[20:59:27] muelleme: has joined #ruby
[21:00:12] jaequery: has joined #ruby
[21:02:47] eckhardt: has joined #ruby
[21:04:26] Radanisk: has joined #ruby
[21:05:14] Radanisk: has joined #ruby
[21:06:00] Radanisk: has joined #ruby
[21:06:26] Arney: has joined #ruby
[21:07:31] RickHull: prutheus: not really a Ruby question, but... probably you want to run your selenium tests in an isolated environment
[21:07:56] RickHull: like a dedicated VM without mouse pointer integration
[21:08:17] cognoscente: has joined #ruby
[21:09:06] RickHull: otherwise -- I expect the selenium docs have some insight for handling this. if you are going to just run it on your dev desktop, you may need to stop trying to use it for other work while tests are running
[21:09:07] dviola: has joined #ruby
[21:11:09] greengriminal: has joined #ruby
[21:12:05] greengriminal: has joined #ruby
[21:12:16] deepredsky: has joined #ruby
[21:12:20] Prutheus: I hoped I can somehow prohibit it
[21:13:19] RickHull: via isolation. without knowing selenium specifics, one way to isolate desktop interaction is to use a VM
[21:13:57] Prutheus: yeah VM would be a great opportunity
[21:16:33] DLSteve_: has joined #ruby
[21:17:07] enterprisey: has joined #ruby
[21:19:38] tomphp: has joined #ruby
[21:19:42] milardovich: has joined #ruby
[21:19:50] Psybur: has joined #ruby
[21:20:19] plexigras: how can i do ['some','array'].inject(0) { ... } and get the index inside the block?
[21:20:31] dminuoso: plexigras: Yes.
[21:20:37] baweaver: &ri Enumerable#with_index
[21:20:37] `derpy: No results
[21:20:47] dminuoso: plexigras: Use the fact that if you do not supply a block, that you get an enumerator back.
[21:20:47] baweaver: &ri Enumerator#with_index
[21:20:48] `derpy: http://ruby-doc.org/core-2.4.1/Enumerator.html#method-i-with_index
[21:20:50] RickHull: inject(0).with_index ?
[21:21:59] orbyt_: has joined #ruby
[21:21:59] milardovich: has joined #ruby
[21:23:16] dminuoso: baweaver: Oh man. This is going to suck :(
[21:23:32] dminuoso: Ive just "enhanced" the entirety of Enumerable to.. autocurry.
[21:23:45] Guest70176: has joined #ruby
[21:23:46] baweaver: https://baweaver.gitbooks.io/an-illustrated-guide-to-ruby/content/assets/wizard_lemur.png
[21:23:52] dminuoso: Guess I need some addIndex function now.
[21:24:09] dminuoso: No you can do things like a = coll.select;
[21:24:09] baweaver: (I have an entire army of reaction Lemurs now, 70+ of them)
[21:24:16] dminuoso: or coll.filter(eq('foo'))
[21:24:29] dminuoso: baweaver: Haha neice.
[21:25:27] dminuoso: baweaver: My next trick is to properly patch proc[] to be able to pass 3 arguments to a lambda having an arity of 2.
[21:25:48] dminuoso: *Proc#[] and Proc#call that is
[21:26:23] dminuoso: (So that it applies 2, and recursively applies the remaining to the returned curried lambdas)
[21:26:40] dminuoso: Just so I can program like Haskell in Ruby.
[21:28:23] jackjackdripper: has joined #ruby
[21:29:47] plexigras: how do i use with_index i cant get it to work
[21:35:05] RickHull: plexigras: hm, me too
[21:35:15] RickHull: >> [1,2,3].inject(0) # gives me an enumerator?
[21:35:17] ruby[bot]: RickHull: # => 0 is not a symbol nor a string (TypeError) ...check link for more (https://eval.in/904755)
[21:35:18] baweaver: >> %w(some text).each_with_index.reduce(0) {|a,(w,i)| p a, w, i; a + i }
[21:35:19] ruby[bot]: baweaver: # => 0 ...check link for more (https://eval.in/904756)
[21:35:31] baweaver: shenanigans
[21:35:34] baweaver: anyways, that works
[21:35:45] baweaver: see the eval.in link for what all it did
[21:35:47] RickHull: how come i can't get an enumerator from #inject(0) ?
[21:35:54] synthroid: has joined #ruby
[21:36:01] baweaver: I'd have to look at it, but reduce does odd things in general
[21:36:10] kitsunenokenja: has joined #ruby
[21:36:14] baweaver: &ri Enumerable#reduce
[21:36:14] `derpy: http://ruby-doc.org/core-2.4.1/Enumerable.html#method-i-reduce
[21:36:18] RickHull: er yeah I mean reduce :)
[21:36:37] baweaver: reduce(sym) → obj
[21:36:40] baweaver: that basically
[21:38:14] RickHull: is each.with_index now more "canonical" than each_with_index ?
[21:38:15] plexigras: i dont understand how do i do this?
[21:38:30] baweaver: Look at the code above
[21:38:35] cdg: has joined #ruby
[21:38:39] ap4y: has joined #ruby
[21:39:25] plexigras: so i need to do each_with_index.reduce?
[21:39:40] baweaver: give it a try
[21:40:16] RickHull: >> [1,2,3].each.with_index.reduce(0) { |memo, (obj, idx)| memo + obj * idx }
[21:40:17] ruby[bot]: RickHull: # => 8 (https://eval.in/904757)
[21:42:06] RickHull: >> [:sleeping, :unconscious, :snoozing].each_sniff_windex { |obj, salts| obj.woke(salts) }
[21:42:07] ruby[bot]: RickHull: # => undefined method `each_sniff_windex' for [:sleeping, :unconscious, :snoozing]:Array ...check link for more (https://eval.in/904758)
[21:48:06] mson: has joined #ruby
[21:51:36] Radanisk: has joined #ruby
[21:54:57] eckhardt: has joined #ruby
[21:56:43] graft: has joined #ruby
[21:57:26] br0d1n: has joined #ruby
[21:58:13] ramfjord: has joined #ruby
[22:03:01] FahmeF: has joined #ruby
[22:03:12] Lytol: has joined #ruby
[22:03:41] eightlimbed: has joined #ruby
[22:03:51] Zamyatin: has joined #ruby
[22:07:33] lagweezle: has joined #ruby
[22:07:41] lagweezle: has left #ruby: ()
[22:09:42] Zamyatin: has joined #ruby
[22:12:06] Zamyatin: has joined #ruby
[22:12:53] rikkipitt: has joined #ruby
[22:15:03] cschneid_: has joined #ruby
[22:19:50] Psybur: has joined #ruby
[22:22:21] David_H__: has joined #ruby
[22:23:26] charliesome: has joined #ruby
[22:24:45] leitz: Any idea if the pickaxe book will get an update?
[22:25:39] Guest70176: has joined #ruby
[22:30:21] milardovich: has joined #ruby
[22:31:45] baweaver: Not sure it will
[22:31:52] baweaver: What are you looking to learn?'
[22:32:02] baweaver: Also see the channel topic, I left a book list up there :)
[22:35:54] leitz: baweaver, I'm watching a MongoDB class video. :P
[22:36:36] leitz: I am looking to prepare for the Certification exam. No real reason except to push myself to learn more. Ruby is the first language that made me want to read the refernece docs.
[22:36:54] leitz: Not sure if there's a way to pull paper from the core docs.
[22:37:21] miah: pull paper?
[22:37:57] drewmcmillan: has joined #ruby
[22:40:06] cdg: has joined #ruby
[22:42:05] leitz: miah, I prefer to read physical books vice web pages.
[22:43:33] miah: ok im still confused. do you mean, is there a way to print out the core docs or?
[22:45:03] jaequery: has joined #ruby
[22:48:01] apeiros_: has joined #ruby
[22:49:25] Exhiled: has joined #ruby
[22:52:23] enterprisey: has joined #ruby
[22:52:30] leitz: miah, that's the question. Is there a way to pull the core docs into one huge pdf and take it to the store for printing.
[22:52:59] baweaver: leitz: I'd just get a copy of "The Ruby Way"
[22:53:00] MrBusiness: has joined #ruby
[22:53:12] baweaver: It approaches that level of tome
[22:53:40] leitz: baweaver, have I mentioned that I have sevearl books? :P
[22:53:53] leitz: More books than brain cells, really.
[22:54:04] baweaver: Branching out?
[22:54:29] baweaver: I could never leaf a good book alone
[22:55:06] miah: i used to carry a copy of the Ruby Pocket Reference, it has most of those little questions.. but nowadays Dash does a good job of letting me carry the documentation with me
[22:55:49] baweaver: I use Dash as well, though for the most part I have things on-memory for common functions
[22:56:18] leitz: ACTION falls short on puns today. 
[22:56:21] Sylario: Ok what's the point of this line :$auth_header = '{"Username": "%s", "Password": "%s", "IntegratorKey": "%s"}' %[$username, $password, $integrator_key]
[22:56:24] baweaver: Though I can never remember Net::HTTP
[22:56:43] baweaver: other than being broken?
[22:56:50] baweaver: It's using an alternate string interpolation method
[22:56:56] Sylario: I don't really understand %[] and %s but I guess It put values in the array?
[22:56:59] baweaver: with global variables which is odd
[22:57:08] baweaver: let me see if I can find that, one sec
[22:57:18] Sylario: it's in a rspec of a non rails gem
[22:57:21] baweaver: https://ruby-doc.org/core-2.4.0/String.html#method-i-25
[22:57:40] emilford: has joined #ruby
[22:57:44] miah: guh i swear this test passed yesterday and now everything is failing :(
[22:57:46] baweaver: It's kinda silly honestly, I've not seen that in the wild except for a few edge cases.
[22:57:58] baweaver: miah: Have you tried turning it off and on again?
[22:58:13] baweaver: Joking aside, is it time sensitive at all, data bound, or anything else that's not stubbed?
[22:58:21] baweaver: I swear I always forget 1-2 of those danged things
[22:58:39] miah: its not. im probably doing something silly and just not noticing yet =)
[22:59:15] Sylario: login password is in the code, but hey, not my repo, public repo : https://github.com/docusign/docusign-ruby-client/blob/master/tests/spec/unit_tests_spec.rb#L115
[22:59:18] baweaver: Flaky tests are the best
[22:59:18] rikkipitt: has joined #ruby
[22:59:20] GodFather: has joined #ruby
[22:59:53] baweaver: sylario: mixed indentation D:
[22:59:57] ElDoggo: has joined #ruby
[23:00:00] baweaver: I may go fix this later, that's bothersome
[23:01:00] baweaver: Actually, no, I will fix it.
[23:01:09] Sylario: baweaver: so it's someone taking extra step for giggles ?
[23:01:23] baweaver: More like someone who doesn't know Ruby well is writing it
[23:01:30] baweaver: which isn't a bad thing but leads to some odd code
[23:01:37] baweaver: looks like a Perl programmer
[23:01:53] Sylario: I guess, they just released the ruby gem
[23:02:05] Sylario: thx baweaver
[23:03:02] mikecmpbll: it's not that common to see that for straight string interpolation but you do see it
[23:03:24] baweaver: sylario https://github.com/docusign/docusign-ruby-client/pull/1/files
[23:03:28] baweaver: Someone already tried
[23:04:58] Sylario: let's just say it's raw code
[23:05:03] ledestin: has joined #ruby
[23:06:21] mikecmpbll: were tabs always that huge on github
[23:06:28] thinkpad: has joined #ruby
[23:07:02] RickHull: sylario: the %s is a "format string" as in printf / sprintf
[23:07:31] mikecmpbll: 8 spaces, hmpf
[23:07:42] Sylario: RickHull: I was mainly worried I was missing some strange trick
[23:08:13] mikecmpbll: Kernel#format
[23:08:30] RickHull: and where you you `%[foo, bar, baz]`, it's more typically written with a space: `% [foo, bar, baz]`
[23:08:47] RickHull: and yes, it is a special syntax instead of calling Kernel#format, which is preferred in ruby
[23:09:04] RickHull: >> "%s is %s" % [:foo, :bar]
[23:09:05] ruby[bot]: RickHull: # => "foo is bar" (https://eval.in/904763)
[23:09:31] RickHull: >> format("%s is %s", :foo, :bar)
[23:09:32] ruby[bot]: RickHull: # => "foo is bar" (https://eval.in/904764)
[23:09:57] RickHull: the former, with % and [] matches the default way to inject a variable into a string in Python
[23:10:04] GodFather: has joined #ruby
[23:10:17] jaequery: has joined #ruby
[23:10:20] mikecmpbll: >> "%s is %s" % %w%foo bar%
[23:10:21] ruby[bot]: mikecmpbll: # => "foo is bar" (https://eval.in/904765)
[23:10:26] mikecmpbll: how many percent symbols can i cram into it!!
[23:10:35] mikecmpbll: take a bow, ruby
[23:11:23] mikecmpbll: >> %%s is %s% % %w%foo bar%
[23:11:24] ruby[bot]: mikecmpbll: # => /tmp/execpad-fca8d5284cc8/source-fca8d5284cc8:2: syntax error, unexpected tIDENTIFIER, expecting key ...check link for more (https://eval.in/904766)
[23:11:41] Sylario: Damn i missed the hash is in fact a string
[23:11:51] Sylario: Ok, now i kinda get it
[23:11:54] milardov_: has joined #ruby
[23:12:27] Sylario: It's already the header string
[23:12:32] mikecmpbll: >> %Q\%s is \%s% % %w%foo bar%
[23:12:33] ruby[bot]: mikecmpbll: # => /tmp/execpad-be915d2ea6eb/source-be915d2ea6eb:2: syntax error, unexpected tIDENTIFIER, expecting key ...check link for more (https://eval.in/904767)
[23:13:15] mikecmpbll: >> %Q%\%s is \%s% % %w%foo bar%
[23:13:16] ruby[bot]: mikecmpbll: # => "foo is bar" (https://eval.in/904768)
[23:13:21] RickHull: sylario: % gets used as the mod operator, the string format syntax, but the main use is for special delimeters
[23:13:27] mikecmpbll: that's the best thing i've ever done.
[23:13:38] RickHull: >> %w{words are here and will be parsed into an array}
[23:13:39] ruby[bot]: RickHull: # => ["words", "are", "here", "and", "will", "be", "parsed", "into", "an", "array"] (https://eval.in/904769)
[23:14:09] RickHull: that is, percent-double-u followed by () [] or {}
[23:14:24] mikecmpbll: or any other character
[23:14:26] RickHull: >> %w(more words)
[23:14:27] ruby[bot]: RickHull: # => ["more", "words"] (https://eval.in/904770)
[23:15:00] mikecmpbll: not any, but yeh
[23:15:22] leitz: ACTION heads back to class. Almost done!
[23:15:34] RickHull: yeah, i'm giving more of a "best practices" rather than "what will the language possibly allow"
[23:16:00] RickHull: i.e. "stuff you may see commonly and not want to barf over"
[23:16:12] mikecmpbll: worst practices are more fun :D
[23:16:18] RickHull: not for newbies ;)
[23:16:31] jackjackdripper: has joined #ruby
[23:16:48] Sylario: the %w is often used in config stuff
[23:17:21] hahuang65: has joined #ruby
[23:17:43] Sylario: If you want to save a few chars
[23:18:08] RickHull: my emacs autoindent doesn't play very nicely with it
[23:19:47] ElDoggo: has joined #ruby
[23:19:58] Psybur: has joined #ruby
[23:20:16] ElDoggo: has joined #ruby
[23:20:35] milardovich: has joined #ruby
[23:20:45] bmurt: has joined #ruby
[23:26:40] Guest70176: has joined #ruby
[23:27:44] ElDoggo: has joined #ruby
[23:31:15] ElDoggo: has joined #ruby
[23:32:59] nginxxx: has joined #ruby
[23:34:36] Jameser: has joined #ruby
[23:35:07] naprimer3: has joined #ruby
[23:35:15] nginxxx: Hey i need help. I have wrote a Ruby Resolver. But I want to expand it with ASN. https://gist.github.com/anonymous/87d279ad01eb2e9bffde31033026ff92
[23:35:30] jtdoncas: has joined #ruby
[23:36:14] weaksauce: so i installed did_you_mean gem and now nothing works when i type gem or ruby... the did you mean gem errors out
[23:36:22] weaksauce: is there a way to uninstall it manually?
[23:36:35] astronavt: has joined #ruby
[23:36:41] miah: gem uninstall did_you_mean
[23:37:06] weaksauce: yeah, it fails because gem is broken by that
[23:37:06] miah: start there, if it errors, can you paste output somewhere and share it?
[23:38:00] zotruu: has joined #ruby
[23:38:05] miah: gist is preferred, link in topic.
[23:38:26] weaksauce: https://gist.github.com/fiveNinePlusR/62b3f813f4accf558eb80a48e7f9ccd5
[23:39:04] jaequery: has joined #ruby
[23:39:37] weaksauce: i ran a script to batch update a bunch of gems to pristine because i upgraded to high sierra and did you mean broke ruby and gem
[23:40:27] weaksauce: Ignoring did_you_mean-0.9.8 because its extensions are not built. Try: gem pristine did_you_mean --version 0.9.8
[23:40:31] Technodrome: has joined #ruby
[23:40:42] weaksauce: and a bunch of other ones but that is the one that broke it.
[23:42:55] David_H_Smith: has joined #ruby
[23:44:20] RickHull: weaksauce: what do you get for `which gem` ?
[23:44:31] RickHull: you can make sure to execute the correct gem by providing the full path to it
[23:44:42] weaksauce: RickHull /usr/bin/gem
[23:44:57] RickHull: weaksauce: try `/usr/bin/gem env`
[23:44:59] weaksauce: so ruby and gem both have the same exact error
[23:45:41] weaksauce: RickHull same exact error. gem by itself errors. ruby by itself errors. irb errors. and they are all identical
[23:45:49] selim: has joined #ruby
[23:45:54] miah: ya, so. your gems are at least in ~/.gem which is safe to remove in its entirety, and thats probably where i'd start
[23:46:14] RickHull: weaksauce: please paste the error
[23:46:17] miah: since you're using system ruby and you updated your system you likely have a bunch of stuff compiled against the old libs
[23:46:19] RickHull: use e.g. gist.github.com
[23:46:21] miah: RickHull: they did, see gist above
[23:46:37] weaksauce: i'll try deleting that gem first and then go from there.
[23:47:27] miah: i use bundler to create .gem directories per project, so i run into similar issues all the time but more localized and with less worry about rm'ing the whole thing and starting fresh =)
[23:47:28] weaksauce: deleting that folder worked.
[23:47:46] Guest70176: has joined #ruby
[23:47:46] weaksauce: i use bundler too but for a few system gems that I like to have around
[23:48:00] miah: in this case it looks like you're using a global .gem directory though
[23:48:05] RickHull: nginxxx: if `Net` is not defined, then probably you need to require the correct libs
[23:48:16] miah: with bundler you can pass --path to create a standalone gem directory
[23:48:17] RickHull: e.g. require 'net/http'
[23:48:20] nginxxx: its fine but have another problem
[23:48:24] nginxxx: my resolver works now
[23:48:37] miah: now back to figuring out why my code is fubar :P
[23:48:44] weaksauce: thanks for the help
[23:49:05] nginxxx: But its hard to add ipinfo api :( i dont know how to do... but i am on the right way
[23:49:17] nginxxx: can you look into it and help me to finish it
[23:49:31] RickHull: nginxxx: are you using irb? that is the quickest way to learn, by trial and error
[23:49:46] nginxxx: I get error yes
[23:49:55] nginxxx: But they arent sooo helpful
[23:49:55] RickHull: ha, welcome to the club :)
[23:50:17] nginxxx: https://gist.github.com/Pushergene/066d6429d1e38f192288801933acdcfb
[23:50:33] nginxxx: Help me to finish it :D
[23:51:52] selim: has joined #ruby
[23:51:53] RickHull: L3 does nothing, you can remove it
[23:51:55] jtdoncas: has joined #ruby
[23:52:10] nginxxx: C:/Users/RBN/Documents/phishing_catcher-master/Resolver.rb:10:in `+': no implici t conversion of nil into String (TypeError)
[23:52:24] RickHull: L3 means "line 3"
[23:52:32] RickHull: (line 3 of the code you pasted)
[23:52:38] nginxxx: No this is not the problem.
[23:52:43] nginxxx: I can resolve ipv4 address
[23:52:45] nginxxx: which is good so
[23:53:05] nginxxx: I need help starting at line with target =
[23:53:07] RickHull: i don't know what your problem is -- I'm just telling you facts about your code :)
[23:53:28] RickHull: step 1: remove meaningless code
[23:53:38] weaksauce: nginxxx use string interpolation over concatenation to prevent these errors
[23:53:41] nginxxx: C:\Users\RBN\Documents\phishing_catcher-master>Resolver.rb Address: google.com [#<Resolv::IPv4 172.217.17.142>] C:/Users/RBN/Documents/phishing_catcher-master/Resolver.rb:10:in `+': no implici t conversion of nil into String (TypeError) from C:/Users/RBN/Documents/phishing_catcher-master/Resolver.rb:10:in `b lock in <main>' from C:/Ruby24-x64/lib/ruby/2.4.0/resolv.rb:303:in `open' from C:/Users/RBN/Documents/phi
[23:53:46] RickHull: that makes "step 2: fix the problem" easier
[23:53:56] weaksauce: doesn't change the fact that it's nill but it won't kill your running code
[23:53:58] nginxxx: can you show me a example of this string interpolation
[23:54:21] weaksauce: puts "hostname #{JSON['hostname']}"
[23:54:40] nginxxx: but the problem is
[23:54:45] weaksauce: everything inside #{} gets interpolated by the ruby runtime and put into it
[23:54:53] nginxxx: it doesnt know the ip to resolve
[23:55:30] nginxxx: ipinfo.io is not a hostname resolver
[23:55:36] nginxxx: but when i have the ipv4 i can resolve the ASN
[23:55:41] nginxxx: you understand :D
[23:58:00] RickHull: nginxxx: I don't see a need for global variables here
[23:58:01] weaksauce: your formatting could use a bit of work though. the flow of the code doesn't match the indentation
[23:58:10] RickHull: and if there is a need, then you should reconsider the design
[23:58:29] RickHull: i would make address a local var: `address`
[23:58:34] RickHull: and swap L4 and L5
[23:58:48] RickHull: why print it out before it gets a value?
[23:59:20] Xiti: has joined #ruby
[23:59:24] nginxxx: after i had swap i cant run
[23:59:30] RickHull: L6 defines a block. everything inside the block should be indented 2 spaces
[23:59:37] RickHull: e.g. L7 should begin with 2 spaces