« Back to channel list

#ruby - 09 November 2017

« Back 1 day Forward 1 day »
[00:00:29] nymous: but i mostly dislike russian communities for such things
[00:01:24] orbyt_: has joined #ruby
[00:01:42] KeyJoo: I saw your github-profile, and why you have zero friends???
[00:02:41] nymous: i am a sysadmin, not a dev, mostly patching things
[00:04:12] jphase: has joined #ruby
[00:04:28] cdg: has joined #ruby
[00:05:22] KeyJoo: nymous: well, then understand the interest in different programming languages and to that project (dsl) as the idea of solving a narrowly focused problem
[00:09:34] RickHull: my advice would be to nail down the lib side first -- have you coded all the functionality you need? for example the different types of rendering (?)
[00:10:06] RickHull: then make sure you can write reasonable scripts against the lib -- don't get too crazy with UX stuff like runners and DSLs necessarily
[00:10:20] nymous: actually no, because i don't know which types would be
[00:10:24] RickHull: and then finally polish with runners and DSLs if everything is happy
[00:10:35] nymous: i just pull collected data to routines supplied by user
[00:10:59] nymous: besides that, i think i have implemented enough for using this lib myself
[00:11:22] nymous: in kind of production environment
[00:11:32] RickHull: what's an example of the rendering problem for the different backends (?) like zabbix etc
[00:11:48] cschneid_: has joined #ruby
[00:12:14] nymous: you might want to render collected data with something top-like
[00:12:31] nymous: i mean draw tables, refresh them etc
[00:12:37] RickHull: would you call graphite, zabbix, collectd "back ends" ?
[00:12:44] nymous: or you might just puts them out
[00:12:55] RickHull: or subscribers?
[00:13:10] nymous: you know, most of them are just "form a proper string and send me"
[00:13:20] nymous: with exception to zabbix though
[00:13:44] RickHull: I would start with the most universal, common representation, nailed down in the lib
[00:13:56] Coldblackice: has joined #ruby
[00:13:58] nymous: it has complex stages like discover metrics, then get metrics one by one
[00:14:01] RickHull: and have system-specific stuff in the lib where appropriate
[00:14:08] RickHull: where a system is (collectd, zabbix, etc)
[00:14:16] jphase: has joined #ruby
[00:14:44] nymous: have you seen my gist?
[00:14:47] RickHull: and allow the script to override the representation if need be
[00:14:51] nymous: check the render bit
[00:15:09] RickHull: yes, that does not look user friendly
[00:15:15] nymous: it is mostly enough for everything, just add some network code to pull to graphite
[00:15:18] RickHull: i can't imagine a new user writing that
[00:15:41] RickHull: i don't know what root, k, g, m, v are
[00:15:47] nymous: collectd doesn't need even network code
[00:15:57] nymous: well, my bad
[00:16:13] RickHull: i mean, it's shorthand with short variables, fair enough
[00:16:22] nymous: metrics are combined into groups
[00:16:29] Coldblackice: has joined #ruby
[00:16:33] nymous: groups can be nested
[00:16:45] nymous: root is a root of the group tree
[00:16:58] RickHull: probably you want to have that loop / structure inside the lib -- it looks like a universal and common procedure
[00:17:45] sucks: has joined #ruby
[00:17:53] RickHull: and allow the script to override if needed
[00:17:59] nymous: i was thinking about that, but it doesn't go deep into the tree and also it won't be good for top-like renderer, if anyone would want to write one
[00:18:13] RickHull: you could have top_render inside the lib
[00:18:17] RickHull: and just call it from the script
[00:18:21] PaulWasher: has joined #ruby
[00:18:30] Freshnuts: has joined #ruby
[00:18:35] nymous: currently i just yield that block :)
[00:18:43] RickHull: if the metrics infinitely nest, then you would want the universal procedure to recurse
[00:18:56] PaulWasher: Jesus Christ came into the world to save sinners and you have know idea what that means. It's not just that you've sinned. You've never done anything but sin.
[00:18:57] RickHull: possibly with some stop condition or sanity check like levels=10
[00:19:16] Technodrome: has joined #ruby
[00:19:43] nymous: it's up to user, they can be nested, or be just top-level groups like in my example
[00:19:50] havenwood: !spam PaulWasher
[00:19:50] ruby[bot]: +bb PaulWasher!*@*$#ruby-banned *!*@ool-457329d1.dyn.optonline.net$#ruby-banned
[00:19:51] ruby[bot]: ruby[bot] kicked PaulWasher: is a bannable offense, see http://ruby-community.com/pages/user_rules
[00:19:53] Azure: has joined #ruby
[00:20:04] safetypin: has joined #ruby
[00:20:46] nymous: so, idk, should i really implement some renderers or just let user decide
[00:21:01] RickHull: when the script calls render, perhaps it supplies a list of groups and a max_depth
[00:21:43] RickHull: if you have some tree-like structure with a root, then the user should not have to write the tree-walking code
[00:22:05] RickHull: the user should just declare what should be rendered and how
[00:22:06] cdg: has joined #ruby
[00:22:31] nymous: what if I want to render an erb using collected data?
[00:22:44] RickHull: the lib should provide render_erb with the same API
[00:22:53] RickHull: i.e. accept a list of groups or whatever
[00:23:03] RickHull: maybe an erb template string
[00:23:23] nymous: you could really write something root["cpu"]["usage"].value
[00:23:31] nymous: i mean now
[00:23:32] the_f0ster: has joined #ruby
[00:23:44] nymous: *smthg like
[00:24:21] zanoni: there an easy way to turn off hidden directories and files using Find.find?
[00:24:57] RickHull: you mean those starting with '.' ?
[00:26:19] zanoni: well here's the deal, with glob hidden directories don't show up, dots do, but with Find.find, hidden files and dirs show, like .git
[00:26:23] moei: has joined #ruby
[00:27:03] zanoni: with glob /**/* doesn't return ignore or hidden, Find seems to
[00:27:11] RickHull: I haven't used it before, but something like: Find.find('~') { |entry| next if entry.starts_with?('.'); ... }
[00:27:48] zanoni: yeah, okay...cool, i though there might be some secret method, the docs at ruby-doc are a bit lacking on it
[00:27:52] nymous: https://ruby-doc.org/stdlib-1.9.3/libdoc/find/rdoc/Find.html#method-c-find
[00:28:14] nymous: isn't example is what you want?
[00:28:31] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/find/rdoc/Find.html
[00:28:33] wolfshappen: has joined #ruby
[00:29:54] zanoni: oh so that is what prune is for
[00:30:58] moei: has joined #ruby
[00:31:02] zanoni: yeah, okay sorry, i think something wasn't registering with me ;) going to try the actual example LOL
[00:31:46] nymous: RickHull: btw, my current test code (besides of rspec) is really like that :) https://gist.github.com/divanikus/3497ae867bbea0cf878506a199b17870
[00:32:18] RickHull: yeah, that's easier to grok :)
[00:32:48] s3nd1v0g1us: has joined #ruby
[00:33:05] s3nd1v0g1us: has joined #ruby
[00:33:34] nymous: you see the end of it - load_state, tick, save_state - that part i want to put into a runner
[00:33:53] nymous: because forcing users to write things like that is not good
[00:35:16] RickHull: has left #ruby: ()
[00:35:23] RickHull: has joined #ruby
[00:35:31] guacamole: has joined #ruby
[00:35:44] RickHull: has joined #ruby
[00:35:49] tcopeland: has joined #ruby
[00:37:09] nymous: well, idk, maybe i have to make some infrastructure for an agent, i mean convention for dir/file naming for code blocks
[00:37:26] nymous: or just don't mind user to require whatever he wants
[00:39:55] ChanServ: +o RickHull
[00:40:43] cseder: has joined #ruby
[00:40:55] ChanServ: -o RickHull
[00:42:53] Jameser: has joined #ruby
[00:43:33] quobo: has joined #ruby
[00:45:56] alveric2: has joined #ruby
[00:46:32] cagomez: has joined #ruby
[00:46:34] nymous: btw, where's the proper place to put an executable into a gem? bin or exe dir?
[00:46:45] nymous: i've seen both
[00:47:10] Radar: fight me :D
[00:47:10] RickHull: make sure you list them in your gemspec
[00:47:21] Radar: `bundle gem` proposes using `exe`
[00:47:23] eclm: has joined #ruby
[00:47:25] RickHull: exe really is the better term
[00:47:42] Radar: `bundle gem` uses `bin` for dev CLI tools, like `bin/console` / `bin/setup`
[00:47:43] RickHull: but muh unix culture
[00:47:54] apeiros: ACTION concurs that exe is the better term, but bin has all the conventions and history
[00:48:20] havenwood: I prefer bin.
[00:48:39] Radar: nymous: spec.bindir = "nymous" go on you know you want to
[00:48:48] havenwood: RubyGems > Bundler ;-)
[00:49:12] nymous: i also prefer bin, but have looked at rake's code and it uses exe
[00:49:40] Radar: railties uses exe too
[00:49:56] Radar: silly me for suggesting that Rails follows sane conventions...
[00:51:15] nymous: i had written a dozen or so utils in ruby already, but never ever used rails lol
[00:51:33] Radar: probably for the best
[00:51:46] havenwood: I think Bundler made a mistake to suggest or assume that adding "./bin" to PATH is sane or okay at all.
[00:51:47] nymous: some people tends to think they are indistinguishable
[00:52:04] Radar: havenwood: where does Bundler do that?
[00:52:17] Radar: havenwood: I thought that was a gem's gemspec that did that.
[00:52:19] havenwood: well, they don't *do it* but I've heard team members encourage that.
[00:53:40] havenwood: Radar: The only reason they defied RubyGems' convention of bin for gem executables afaik is that they wanted to add "./bin" to path to get at the setup stuff. Maybe they literally type bin/ but Andre at least has suggested it as a pattern.
[00:54:49] havenwood: I argued after the talk that it was an anti-pattern. It just seems like a can of worms to me.
[00:55:24] Radar: yeah "gem install blah" <- overrides `<important bash command here>` what could go wrong
[00:56:13] fishcooker: has joined #ruby
[00:56:14] RickHull: i can see where ./bin in PATH would be handy -- but not sure why bundler cares. and what if it were added to the end of PATH so as not to override?
[00:57:00] RickHull: not sure how it would interact with a bash built-in
[00:57:30] havenwood: RickHull: I'll just add the sl command and hope you don't have sl installed for ls typos ;-)
[00:58:03] havenwood: RickHull: yeah, end of path is not nearly as tragic, no doubt
[00:58:37] Exhiled: has joined #ruby
[00:59:45] nymous: ok, thanks for your advices, i have to go off to bed, 4 am here
[01:01:12] cagomez: has joined #ruby
[01:01:13] alnewkirk: has joined #ruby
[01:03:34] Exhiled: Is there a general ruby help channel?
[01:03:50] Exhiled: or just programming in general?
[01:03:59] RickHull: this is it, for ruby
[01:04:22] Exhiled: Is there a general chat channel?
[01:04:40] RickHull: most channels have a specific technical focus
[01:04:49] havenwood: exhiled: As far as Ruby-land, there's a #ruby-offtopic channel for non-Ruby discussion.
[01:04:57] Exhiled: oh cool, thank you havenwood
[01:05:17] havenwood: exhiled: There's a #friendly-coders channel that's entirely general.
[01:09:23] AndBobsYourUncle: has joined #ruby
[01:09:51] chimpanze: has joined #ruby
[01:10:21] alnewkirk: has joined #ruby
[01:11:26] mim1k: has joined #ruby
[01:12:53] cschneid_: has joined #ruby
[01:13:06] veeti: has joined #ruby
[01:15:31] Sparky: RickHull: I did that think that I was trying to do earlier!! I'm so excited!! https://gist.github.com/Dasms/0ad50f7cc1735c1ec9b43c369ccfa37c#file-test-rs
[01:15:35] JsilverT: has joined #ruby
[01:16:21] RickHull: i think you do want to store your prices in a Hash, keyed by the item name
[01:16:35] RickHull: for a toy example like this, it doesn't much matter
[01:17:02] RickHull: but as an exercise, a good next step would be to incorporate the Hash and get the same output
[01:17:20] RickHull: congrats, regardless :)
[01:19:38] Sparky: I tried hash! But it wasn't working for me :(
[01:21:16] RickHull: see here https://gist.github.com/rickhull/0859a68ef88cdd100a4e4a9d6cb433d9
[01:23:45] xall: has joined #ruby
[01:24:02] Sparky: RickHull: You put the balance -= price.. that subtracts the balance from the price, correct? Why didn't I think of that?!
[01:24:22] Sparky: Because I didn't yet know it was a function of ruby, that's why- but now I do
[01:26:14] RickHull: it subtracts the price from the balance
[01:26:32] cschneid_: has joined #ruby
[01:26:33] RickHull: it is a shorthand; it expands to: balance = balance - price
[01:27:10] bmurt: has joined #ruby
[01:27:11] RickHull: that shorthand comes from the C language
[01:27:18] RickHull: and maybe Algol or something before it
[01:27:56] RickHull: something very similar you see often in ruby code is: var ||= 'some value'
[01:28:12] RickHull: it expands to: var = var || 'some value'
[01:28:24] Sparky: I'm having so much fun with this, you have no idea
[01:28:32] RickHull: which means: assign 'some value' to var, only if var has a falsey value
[01:28:35] RickHull: (typically nil)
[01:29:17] RickHull: >> var = nil; var ||= 'some_value'; [var, var ||= 'other value']
[01:29:18] ruby[bot]: RickHull: # => ["some_value", "some_value"] (https://eval.in/895848)
[01:29:51] RickHull: first var is assigned nil; then var is assigned 'some value'; var is not assigned 'other value' because it has a truthy value already
[01:30:25] jphase: has joined #ruby
[01:30:34] RickHull: note that my formulation is a little odd, with an array as the final expression -- this is just to get the bot to give me multiple outputs
[01:31:27] Sparky: So the prices = {} is a hash?
[01:31:48] RickHull: >> {}.class
[01:31:49] Sparky: what is a .key?
[01:31:50] ruby[bot]: RickHull: # => Hash (https://eval.in/895849)
[01:32:05] RickHull: >> { 'foo' => 'bar' }.keys
[01:32:06] ruby[bot]: RickHull: # => ["foo"] (https://eval.in/895850)
[01:32:17] jphase_: has joined #ruby
[01:32:19] RickHull: >> { 'foo' => 'bar' }.values
[01:32:20] ruby[bot]: RickHull: # => ["bar"] (https://eval.in/895851)
[01:32:41] RickHull: >> { 'foo' => 'bar' }.key? 'bar'
[01:33:04] ap4y: has joined #ruby
[01:33:18] alnewkirk: has joined #ruby
[01:33:20] RickHull: { 'foo' => 'bar' }.key? 'foo' #=> true
[01:34:02] jphase__: has joined #ruby
[01:34:15] RickHull: often you will see a test for key existence like: hsh = { 'foo' => 'bar' }; hsh['foo'] # => 'bar'
[01:34:19] milardovich: has joined #ruby
[01:34:35] RickHull: and 'bar' is truthy, so you can assume 'foo' is a key
[01:34:56] RickHull: but with: hsh = { 'foo' => nil }; hsh['foo'] #=> nil
[01:34:57] the_f0ster: has joined #ruby
[01:35:06] RickHull: it looks like 'foo' is not a key, but it really is
[01:35:56] galtgendo: has left #ruby: ()
[01:37:30] AnoHito: has joined #ruby
[01:39:21] RickHull: Sparky: have you used irb?
[01:40:01] RickHull: that is the best place to learn about this stuff. you can try stuff and get instant feedback
[01:40:19] RickHull: though it will not play nicely with gets (IIRC)
[01:41:42] RickHull: what tutorials have you gone through?
[01:41:59] RickHull: this is an oldie but a goodie https://pine.fm/LearnToProgram
[01:42:09] RickHull: last I checked, anyway :)
[01:43:01] Sparky: RickHull: THis is what I'm working from: https://learnrubythehardway.org/book
[01:43:11] RickHull: ok, that's a good one too AFAIK
[01:43:31] fishcooker: has joined #ruby
[01:43:45] Sparky: RickHull: I have a friend who actually OWNS a software company that works in ruby, he told me to do that one
[01:44:06] guardianx: has joined #ruby
[01:45:04] RickHull: how far along are you?
[01:45:32] Sparky: I'm on exercise 13, but uhmm.. the last script I wasn't working on wasn't in the book, I just wanted to do it myself
[01:45:40] Sparky: I was working on*
[01:46:12] RickHull: that's a good attitude -- I wasn't sure if the Hash suggestion was taking you off track :)
[01:46:27] RickHull: does the Hash stuff make sense?
[01:46:35] Sparky: A little bit, but its not like something that I'll be picking up eventually any ways
[01:47:03] Sparky: YES! It does make sense, in a very abstract way right now, but I'm sure the more I work with it the more I will understand it- just like math
[01:47:06] alnewkirk: has joined #ruby
[01:48:13] RickHull: yes, it takes a great deal of "acquiring context" before things start to make intuitive sense
[01:49:26] RickHull: speaking of abstract -- can you see how putting the prices in the hash makes it trivial to add a new item?
[01:49:33] RickHull: take my gist, and add a 4th item
[01:49:41] RickHull: and the program still works
[01:50:39] Sparky: RickHull: I uhmm
[01:51:20] Sparky: https://thepasteb.in/p/Y6hkl6owvr7h7
[01:51:40] RickHull: ha, awesome!
[01:51:49] sucks_: has joined #ruby
[01:51:54] RickHull: google: IEEE float
[01:52:10] RickHull: i mentioned earlier that floats make for poor representation of monetary amounts
[01:52:13] jphase: has joined #ruby
[01:53:23] RickHull: the long and short of it is: a float is a data type for representing non-integers (like 1.23). due to the way computers work, it cannot represent such numbers perfectly. it has other good tradeoffs that make up for this inability
[01:53:54] RickHull: there are other ways to represent non integers that can store the value 1.23 exactly
[01:54:57] RickHull: >> 0.1 + 0.2
[01:54:58] ruby[bot]: RickHull: # => 0.30000000000000004 (https://eval.in/895853)
[01:56:08] RickHull: >> r = Rational(123, 100); [r, r.to_f]
[01:56:09] ruby[bot]: RickHull: # => [(123/100), 1.23] (https://eval.in/895854)
[01:59:42] Exhiled: has joined #ruby
[02:00:52] alnewkirk: has joined #ruby
[02:02:23] sucks: has joined #ruby
[02:05:10] sucks: has joined #ruby
[02:05:47] ruby[bot]: Your numbers don't add up? You get "weird" results? read http://floating-point-gui.de/
[02:06:36] Sparky: RickHull: puts "Your new balance is #{balance.round(2)}"
[02:08:38] RickHull: also: puts format("Your new balance is %0.2f", balance)
[02:09:03] RickHull: the % means: stick a variable here
[02:09:15] RickHull: %i is integer, %s is string, %f is float
[02:09:29] RickHull: but you can modify %f to say, give me only 2 decimal places: %0.2f
[02:10:30] Sparky: So float is more accurate and intiger makes it so people can read it more easily
[02:10:40] RickHull: not exactly
[02:10:57] RickHull: basically, since computers are binary, meaning they deal in powers of 2
[02:11:06] RickHull: whereas decimal values are powers of 10
[02:11:48] apeiros: rare known fact: ieee754 includes specs for a decimal float. just that no popular hardware implements it.
[02:11:54] RickHull: there are some values that are cleanly expressed in powers of 10, that can't be expressed cleanly in powers of 2
[02:12:30] RickHull: and yeah, it's about what is fast and efficient for hardware to execute
[02:12:38] elomatreb: In the CPU architecture class in my first semester of CS they made us calculate IEEE floats by hand, and while it was the most annoying shit at the time, it helped so much in understanding them in hindsight
[02:12:39] RickHull: early computers didn't have floating point processors
[02:12:58] apeiros: elomatreb: yeah, had to help wifey with that this year
[02:13:06] RickHull: but scientific computing demanded floating points to accurately represent rockets and asteroids and stuff
[02:13:25] elomatreb: You can do floating point stuff on CPUs without hardware support for them, it's just a lot slower
[02:13:46] mtkd: has joined #ruby
[02:14:13] elomatreb: And the early computers sometimes did have support for floating point-like operations, as it was the time of highly complex instruction sets offering special instructs for everything
[02:14:33] Sparky: How early? 50s early?
[02:14:36] RickHull: the "floating point" part means it can efficiently represent tiny values as well as massive values
[02:14:43] elomatreb: 60s early, IIRC
[02:14:43] RickHull: like 0.3e23 or 0.3e-23
[02:15:08] milardov_: has joined #ruby
[02:15:12] elomatreb: For perspective: These IEEE floats were only standardized in 85
[02:15:16] RickHull: but it sacrifices a very tiny slice of absolute precision relative to a clean decimal value
[02:15:20] RickHull: for certain decimal values
[02:16:04] milardov_: has joined #ruby
[02:16:43] elomatreb: The further you get from 0 (the closer you get towards the maximum/minimum values) the larger the inaccuracy gets, btw
[02:17:40] apeiros: only in absolute terms. in relation to the magnitude, the inaccuracy stays mostly constant
[02:17:41] RickHull: the alternatives to floating point, as I understand, can reclaim decimal precision, but they sacrifice in terms of the range of values they express, the memory required, and the speed of processing
[02:18:06] Rythen: has joined #ruby
[02:18:59] apeiros: reminds me that I wanted to implement a delta comparison based on that :-/
[02:19:26] RickHull: have you looked at minitest's delta and epsilon comparisons?
[02:19:39] apeiros: does use absolute deltas iirc
[02:19:45] apeiros: or did the implementation change?
[02:20:03] RickHull: there is also an epsilon comparison, which I'm not quite sure exactly what it does
[02:20:10] RickHull: but it must be a relative magnitude thing
[02:21:03] RickHull: actually, pretty straightforward https://github.com/seattlerb/minitest/blob/ca6a71ca901016db09a5ad466b4adea4b52a504a/lib/minitest/assertions.rb#L209
[02:22:09] apeiros: yeah, looks better than in_delta, but I wonder how robust that is
[02:22:34] elomatreb: semi-related: The method definition style without the parentheses around the arguments looks really weird to me
[02:22:38] apeiros: the main reason I never finished mine was that I wasn't sure how to test, or even less prove, how robust it'd be :-/
[02:23:58] apeiros: my idea was to not use the difference but the quotient
[02:24:18] apeiros: and to calculate it, I wanted to "dissect" the float
[02:25:34] apeiros: f.ex., 1.001 vs 1.002 and 0.001 vs 0.002 have the same difference, but the quotient varies wildly. that was the basis.
[02:25:47] apeiros: oh, right, zero values was another issue :D
[02:26:13] c0ncealed: has joined #ruby
[02:26:21] RickHull: those are good test cases ;)
[02:26:41] RickHull: this sort of thing lends itself to TDD I think
[02:26:48] apeiros: iirc I wanted to treat subnormals specially anyway
[02:26:56] apeiros: after all, they work differently
[02:27:03] jrafanie: has joined #ruby
[02:27:58] RickHull: speaking of that kind of uncertainty, I have found some problems with using r2 in minitest/benchmark
[02:28:16] RickHull: where a test on the r2 for a fit doesn't yield the distinction we want
[02:28:51] apeiros: r2 is a testdouble lib?
[02:29:01] RickHull: e.g. f(x) = x**3 gives r^2 > 0.99 for a linear fit
[02:29:04] Exhiled: has joined #ruby
[02:29:17] RickHull: sorry, it's the coefficient of determination
[02:29:41] RickHull: like doing a least squares regression
[02:30:49] RickHull: in minitest/benchmark, one wants to assert_linear_performance 0.99
[02:30:58] RickHull: but if performance is actually x**3 and not x
[02:31:10] RickHull: you can still get a r^2 > 0.99
[02:31:28] apeiros: ACTION had to read up on least squares
[02:31:31] apeiros: I barely remember :(
[02:31:47] RickHull: i had to do a ton of reading when I was working my way through this
[02:31:48] Exhiled: has joined #ruby
[02:32:12] apeiros: I think I remember, you asked in the channel?
[02:32:22] RickHull: i extracted the minitest fit stuff to https://github.com/rickhull/compsci/blob/master/lib/compsci/fit.rb to play with it
[02:33:11] RickHull: see these tests https://github.com/rickhull/compsci/blob/master/test/fit.rb#L95
[02:34:07] RickHull: as I understand the issue, the linear r^2 encodes the linear error divided by the constant error
[02:34:20] jphase: has joined #ruby
[02:34:25] RickHull: it's typically used for a blob of data points, like a scatter plot
[02:34:25] imode: has joined #ruby
[02:34:36] RickHull: and the default assumption is no relationship between x and y
[02:34:45] RickHull: and thus the y_bar or mean is the default predictor
[02:35:07] RickHull: so we can calculate the "constant" error, which is deviations from y_bar or the mean
[02:35:28] RickHull: then we can calculate the linear error, for e.g. y = mx + b predictor
[02:35:30] jphase_: has joined #ruby
[02:35:41] apeiros: ACTION still reads a bit the WP article
[02:35:50] RickHull: for f(x) = x**3, the constant error is huge
[02:35:50] apeiros: but I think it's the wrong topic at 0335 XD
[02:35:55] RickHull: and it swamps the linear error
[02:36:01] RickHull: so the linear r^2 looks good
[02:36:12] RickHull: x**3 is really not a blob of scattered points
[02:36:17] RickHull: it's a very steep slope
[02:36:44] RickHull: the linear r^2 doesn't tell us whether it's x**2 or x**3 or just x. it just says, it's not a uniform blob
[02:37:20] RickHull: anyways... :)
[02:38:30] apeiros: yeah, quite woosh atm, sorry :D
[02:38:41] apeiros: and pillow time for over 3h now :-S
[02:41:00] Sparky: Sweet! One of my study drills for this lesson is to play Zork, I don't know what it has to do with coding, but let;s go
[02:43:56] cdg: has joined #ruby
[02:45:09] kishmesh: has joined #ruby
[02:45:53] kishmesh: hi. anybody using rspec for testing? how do I get my specs to see my "models" without having to "manually require" them in the spec file?
[02:46:10] RickHull: what's the problem with require ?
[02:46:48] RickHull: one thing that I suspect is underappreciated is manipulating the LOAD_PATH with `ruby -I lib`
[02:47:02] Technodrome: has joined #ruby
[02:47:12] RickHull: for my rspec tests, I don't use the `spec` runner -- I just `ruby -I lib test/my_file.rb`
[02:47:17] RickHull: from the project root
[02:47:34] bob_f: has joined #ruby
[02:47:49] RickHull: and these days, Rake::TestTask will make sure your project lib is in the LOAD_PATH
[02:48:06] RickHull: all that said, what is the problem with require ?
[02:48:14] Xiti`: has joined #ruby
[02:48:43] nofxx1: has joined #ruby
[02:48:49] MrBusiness3: has joined #ruby
[02:48:59] p0p0pr37_: has joined #ruby
[02:48:59] p0p0pr37_: has joined #ruby
[02:49:56] kishmesh: RickHull: the problem with require ... just trying to save that extra work that is necessary to insert the relevant relative path (e.g. of a model)
[02:50:20] RickHull: you shouldn't need require_relative for files that are in your project lib/
[02:50:30] RickHull: or any strange paths to pass to require
[02:50:35] alnewkirk: has joined #ruby
[02:50:59] cdg: has joined #ruby
[02:51:06] nowhere_man: has joined #ruby
[02:51:18] RickHull: the only time I use require_relative is for stuff I need to require outside of lib/ like a test/spec_helper.rb
[02:51:43] RickHull: in general, I suspect the "extra work" you are doing is unnecessary
[02:51:53] RickHull: can you show me an example?
[02:52:02] RickHull: do you have a git repo with this extra work?
[02:52:07] ErhardtMundt: has joined #ruby
[02:52:10] RickHull: er, github, or similar
[02:52:42] matti: has joined #ruby
[02:52:42] matti: has joined #ruby
[02:52:45] chihhsin: has joined #ruby
[02:52:54] PaulePanter: has joined #ruby
[02:53:02] hxegon: has joined #ruby
[02:53:05] lucas: has joined #ruby
[02:53:08] kishmesh: i have a file "lib/models/search_result.rb" .. and a test in "spec/models/search_result_spec.rb" when I try to run the spec with "rspec" from root path I get "uninitialized constant SearchResult"
[02:53:15] reaVer: has joined #ruby
[02:53:23] badeball: has joined #ruby
[02:53:38] RickHull: ok, at the top of search_result_spec.rb, you should have: require 'models/search_result'
[02:53:40] Axsuul: has joined #ruby
[02:53:48] RickHull: is that so?
[02:53:50] ineb: has joined #ruby
[02:53:58] JsilverT: has joined #ruby
[02:54:08] Exhiled: has joined #ruby
[02:54:26] dinfuehr: has joined #ruby
[02:54:28] zenspider: has joined #ruby
[02:54:31] bokayio: has joined #ruby
[02:54:31] RickHull: it should not be a require_relative, nor should it have a complicated path argument
[02:54:33] jnollette: has joined #ruby
[02:54:36] kishmesh: RickHull: nope that was missing.
[02:54:41] kishmesh: RickHull: it works now
[02:54:51] kishmesh: RickHull: is there a way to "autorequire"?
[02:54:53] mmasaki: has joined #ruby
[02:54:54] RickHull: that is the proper way
[02:55:06] RickHull: any .rb file should declare what it needs, via require
[02:55:14] RickHull: or require_relative if need be
[02:55:14] kishmesh: RickHull: ok I agree
[02:55:18] friday: has joined #ruby
[02:55:30] CrazyEddy: has joined #ruby
[02:55:45] kishmesh: so where is defined that "require" looks in lib by default?
[02:56:03] RickHull: good question -- that is the LOAD_PATH manipulation I referred to
[02:56:16] RickHull: ruby spec/models/search_result_spec.rb
[02:56:16] tekk: has joined #ruby
[02:56:21] RickHull: I expect it will fail
[02:56:29] RickHull: it won't know where to find models/search_result
[02:56:29] Archrover: has joined #ruby
[02:56:29] soahccc: has joined #ruby
[02:56:35] brainslug: has joined #ruby
[02:56:35] rileyy: has joined #ruby
[02:56:36] yasu: has joined #ruby
[02:56:37] iNs: has joined #ruby
[02:56:37] d^sh: has joined #ruby
[02:56:42] shoogz: has joined #ruby
[02:56:42] xMopxShell: has joined #ruby
[02:56:45] matthewd: has joined #ruby
[02:56:47] RickHull: next, try: ruby -I lib spec/models/search_result_spec.rb
[02:56:50] govg: has joined #ruby
[02:56:53] RickHull: that should work
[02:57:00] tris: has joined #ruby
[02:57:09] ujjain: has joined #ruby
[02:57:09] ujjain: has joined #ruby
[02:57:12] RickHull: if you are executing your tests via `spec` or `rake` then it is likely they are doing the load path manipulation for you
[02:57:17] RickHull: adding the local lib to LOAD_PATH
[02:57:20] TheRealMattM: has joined #ruby
[02:57:24] jamesaxl: has joined #ruby
[02:57:30] edwardly: has joined #ruby
[02:57:30] edwardly: has joined #ruby
[02:57:32] bmn: has joined #ruby
[02:57:42] rcs: has joined #ruby
[02:57:45] RickHull: make sense?
[02:57:48] kishmesh: in the second case it complains that it can't find RSpec
[02:57:53] kitallis: has joined #ruby
[02:58:00] konsolebox: has joined #ruby
[02:58:06] RickHull: ok, you can add require 'rspec' to your search_result_spec.rb
[02:58:06] Elysia: has joined #ruby
[02:58:11] kishmesh: RickHull: it does make sense. though where is default LOAD_PATH set?
[02:58:38] CustosLimen: has joined #ruby
[02:58:43] kishmesh: yes now it works
[02:58:43] quiller: has joined #ruby
[02:58:48] RickHull: hm, not sure off the top of my head. it interfaces with rubygems
[02:58:57] Muz: has joined #ruby
[02:59:25] RickHull: it's $LOAD_PATH
[02:59:30] RickHull: or I think $:
[02:59:38] RickHull: try it in irb or rails console
[02:59:58] thejoecarroll: has joined #ruby
[03:00:09] RickHull: in my opinion, it is best to not manipulate $LOAD_PATH with ruby code -- do it from outside via e.g. `ruby -I $path`
[03:00:18] kishmesh: RickHull: ok thank you very much
[03:00:29] balo: has joined #ruby
[03:00:34] kishmesh: RickHull: well, when I use rspec I don't need to manipulate LOAD_PATH
[03:00:36] Sparky: Why do I need to $stdin ?
[03:00:41] kishmesh: so I guess it's doing it internally
[03:00:54] RickHull: kishmesh: that's right -- the `rspec` runner handles it
[03:00:57] kishmesh: and I just wanted to understand what is going on under the hood
[03:01:17] RickHull: Sparky: in what situation?
[03:01:31] Sparky: is $stdin literally a standard stream, is that what it is?
[03:01:59] RickHull: $stdin is a global variable that refers to STDIN, which is a constant, that refers to the IO object representing the unix STDIN
[03:02:01] Sparky: a variable.. $stdin.gets.chomp
[03:02:36] RickHull: Sparky: are you familiar with STDIN, STDOUT, STDERR in general, in the unix sense?
[03:02:54] RickHull: ok, now you have something to go research :)
[03:03:08] ltd: has joined #ruby
[03:03:10] RickHull: what it comes down to is, you have a shell, like DOS or bash
[03:03:12] Sparky: This? https://en.wikipedia.org/wiki/Standard_streams
[03:03:46] Cyrus: has joined #ruby
[03:03:55] RickHull: and one of the primary things that makes a shell a shell, is that it has standard ways to get data in and out of a process
[03:04:04] RickHull: standard in, standard out
[03:04:19] RickHull: and also a third thingie, standard error, which is very similar to standard out
[03:04:41] gizmore: has joined #ruby
[03:04:44] octomancer: has joined #ruby
[03:05:39] RickHull: with these standard ways of getting data in and out, programs or processes can talk to each other
[03:05:44] Roa: has joined #ruby
[03:05:46] hurricanehrndz: has joined #ruby
[03:05:47] frojnd: has joined #ruby
[03:05:53] nekomune: has joined #ruby
[03:05:54] kryptoz: has joined #ruby
[03:06:09] evie_hammond: has joined #ruby
[03:06:23] RickHull: that's why #gets is used to get input from the user. it technically comes from STDIN
[03:06:47] RickHull: and $stdin.gets is a more explicit way of doing naked gets
[03:06:58] KeyJoo: has joined #ruby
[03:07:06] Sparky: Naked gets?
[03:07:23] RickHull: https://gist.github.com/rickhull/0859a68ef88cdd100a4e4a9d6cb433d9#file-test-rs-L9
[03:07:24] linduxed: has joined #ruby
[03:07:32] RickHull: as opposed to $stdin.gets.chomp
[03:07:42] RickHull: they have the exact same effect under normal circumstances
[03:08:13] RickHull: it says: get a string from $stdin
[03:08:29] RickHull: and if $stdin doesn't have a string available, the program will wait for it
[03:08:37] RickHull: this is commonly known as "blocking"
[03:08:42] RickHull: or "blocked on input"
[03:08:49] RickHull: that is, the program execution is blocked from proceeding
[03:08:53] Sparky: I'm learning all sorts of stuff today
[03:09:00] RickHull: because you asked for a string, and it needs a string in order to proceed
[03:09:42] Sparky: RickHull: The script I was writing is asking questions and prompting for answers.. maybe that's why?
[03:11:54] jsrtr: has joined #ruby
[03:12:28] live__: has joined #ruby
[03:12:31] cseder_: has joined #ruby
[03:12:59] RickHull: um, why what?
[03:13:58] Sparky: Why I needed to use the $stdin
[03:14:23] RickHull: generally naked gets will ask $stdin
[03:14:37] RickHull: $stdin.gets and gets generally do the same thing
[03:15:13] RickHull: i think gets will read from a file, ARGF style, in some cases
[03:15:32] RickHull: um, so -- i'm not sure why you need $stdin
[03:15:43] RickHull: *do* you need $stdin ?
[03:15:49] sina: has joined #ruby
[03:15:49] Iacobus: has joined #ruby
[03:15:54] micalexander: has joined #ruby
[03:15:55] pwillard: has joined #ruby
[03:15:59] Stan: has joined #ruby
[03:16:24] RickHull: because gets doesn't always read from STDIN, it can be better style to be more explicit and use `$stdin.gets` when that's what you want
[03:16:38] machty: has joined #ruby
[03:17:21] RickHull: that said, outside of toy programs, I hardly use gets -- it can be tricky to use correctly
[03:18:00] RickHull: it's generally only useful for interactive command line programs, which are mostly a relic of another era
[03:18:02] yo61: has joined #ruby
[03:18:40] RickHull: i write a lot command line programs, but all of their user input is specified at invocation, by arguments to the command
[03:19:06] alfiemax: has joined #ruby
[03:19:26] guacamole: has joined #ruby
[03:19:32] bokayio: has joined #ruby
[03:19:34] ujjain: has joined #ruby
[03:20:12] RickHull: $stdin.gets can be often used in modern programs to read many lines, typically from the output of some other program
[03:20:12] davic: has joined #ruby
[03:20:14] Bilge: has joined #ruby
[03:20:16] wogi: has joined #ruby
[03:20:29] creat: has joined #ruby
[03:20:41] RickHull: e.g. find . | grep txt
[03:21:17] tekk: has joined #ruby
[03:21:29] ujjain: has joined #ruby
[03:21:52] RickHull: aha! check this out https://github.com/rickhull/device_input/blob/master/bin/evdump
[03:22:17] kloeri: has joined #ruby
[03:22:52] RickHull: that file is executable command line program
[03:22:59] RickHull: (it's in the bin/ dir)
[03:23:15] RickHull: it calls into files in lib/
[03:23:37] RickHull: evdump does not call gets, nor does it call stuff in lib/ that calls gets
[03:23:46] RickHull: but evdump does deal with $stdin
[03:24:00] RickHull: and it makes a lower level (more primitive) call to $stdin
[03:24:07] RickHull: $stdin.read(num_bytes)
[03:24:42] RickHull: gets wouldn't work for this program because gets looks for a newline as the end of message
[03:24:58] RickHull: this program doesn't expect newlines -- it makes a read of a certain length rather than read-until-char
[03:25:32] RickHull: the actual reading happens inside lib/ here https://github.com/rickhull/device_input/blob/master/lib/device_input.rb#L95
[03:25:59] RickHull: this method is called by bin/evdump here: https://github.com/rickhull/device_input/blob/master/bin/evdump#L47
[03:26:21] uneeb: has joined #ruby
[03:27:14] priodev: has joined #ruby
[03:27:46] Sparky: My friend who does IT says ruby will be extinct in a year or 2, is this true?
[03:28:03] RickHull: your friend is more likely to be extinct ;)
[03:28:18] JsilverT: has joined #ruby
[03:28:36] swgillespie: has joined #ruby
[03:29:16] RickHull: what language do they suggest you learn?
[03:29:35] Sparky: or Python
[03:29:47] teej: has joined #ruby
[03:29:50] RickHull: have you heard of jruby?
[03:29:50] Hanmac: has joined #ruby
[03:30:45] RickHull: ruby is much friendlier than java, and you can use jruby to bridge to the java ecosystem if that's what you prefer
[03:31:23] ramfjord: has joined #ruby
[03:31:39] RickHull: ruby and python are quite similar, and either one is a good first, second, third, etc language
[03:31:57] Sparky: He said Java is ubiquitous
[03:32:26] uZiel: has joined #ruby
[03:32:48] RickHull: there are lots of places using Java, but they are not always the best places to work
[03:32:49] AndBobsYourUncle: has joined #ruby
[03:33:06] RickHull: there are lots of wonderful places using Java, and many other languages in the JVM ecosystem
[03:33:52] RickHull: personally, I would go with ruby for a first language. it doesn't have to be your "pro" language
[03:34:14] RickHull: and BTW ruby is not my favorite language. maybe #3
[03:34:43] RickHull: maybe #5, even. but it's a fantastic first language. tip top #1 spot, no doubt
[03:36:07] the_f0ster: has joined #ruby
[03:38:29] evie_hammond: has joined #ruby
[03:39:21] eclm: has joined #ruby
[03:42:23] ramfjord: has joined #ruby
[03:45:51] duracrisis: has joined #ruby
[03:47:03] creeg: has joined #ruby
[03:47:48] [spoiler]: has joined #ruby
[03:50:47] lucas: has joined #ruby
[03:51:02] eclm: has joined #ruby
[03:51:23] lagweezle: has joined #ruby
[03:52:03] creeg: has joined #ruby
[03:52:10] Nahra: has joined #ruby
[03:52:28] xsdg: has joined #ruby
[03:54:30] lemur: has joined #ruby
[03:54:30] lemur: has joined #ruby
[03:54:58] tw1sted_: has joined #ruby
[03:56:29] majoh_: has joined #ruby
[03:56:39] nertzy: has joined #ruby
[03:57:19] [spoiler]: has joined #ruby
[03:57:36] kishmesh: has joined #ruby
[03:59:02] brixen_: has joined #ruby
[03:59:04] bokayio: has joined #ruby
[03:59:43] ledestin: has joined #ruby
[04:01:32] d^sh: has joined #ruby
[04:07:57] alfiemax_: has joined #ruby
[04:14:21] steph__: has joined #ruby
[04:15:23] steph__: has anyone used flash instances with roda? trying to figure out if roda's flash plugin can be used for flash notices
[04:15:24] steph__: http://roda.jeremyevans.net/rdoc/classes/Roda/RodaPlugins/Flash.html
[04:15:53] steph__: or if i should just use a gem like this one: https://github.com/nakajima/rack-flash
[04:21:59] RickHull: roda appears to be under active development, so I would lean that way
[04:22:06] RickHull: last commit to rack-flash was in 2013
[04:22:11] sucks_: has joined #ruby
[04:22:34] RickHull: that flash method appears to be what you want
[04:23:01] bkxd: has joined #ruby
[04:23:09] RickHull: which is -- of course -- not the Adobe Flash plugin but instead a way to show a notice to a web user
[04:23:17] guacamole: has joined #ruby
[04:24:16] eckhardt: has joined #ruby
[04:26:32] alfiemax: has joined #ruby
[04:28:02] cdg: has joined #ruby
[04:30:52] the_f0ster: has joined #ruby
[04:31:20] fishcooker: has joined #ruby
[04:31:28] steph__: has joined #ruby
[04:39:30] gix: has joined #ruby
[04:39:53] ramfjord: has joined #ruby
[04:40:48] cam27: has joined #ruby
[04:40:49] jenrzzz: has joined #ruby
[04:40:50] jenrzzz: has joined #ruby
[04:43:11] the_f0ster: has joined #ruby
[04:48:43] imode: has joined #ruby
[04:54:46] guacamole: has joined #ruby
[05:00:35] KeyJoo: has joined #ruby
[05:02:29] apeiros: has joined #ruby
[05:03:05] guacamole: has joined #ruby
[05:05:21] AndBobsYourUncle: has joined #ruby
[05:10:08] AndBobsYourUncle: has left #ruby: ()
[05:11:34] nerium: has joined #ruby
[05:13:30] zipkid: has joined #ruby
[05:19:34] sagax: has joined #ruby
[05:25:24] cschneid_: has joined #ruby
[05:29:18] cdg: has joined #ruby
[05:30:49] alfiemax: has joined #ruby
[05:32:36] k3rn31: has joined #ruby
[05:37:11] ahrs: has joined #ruby
[05:38:51] Exhiled: has joined #ruby
[05:40:35] Tagami[m]: has joined #ruby
[05:43:09] apeiros: has joined #ruby
[05:45:13] Exhiled: has joined #ruby
[05:49:54] dionysus69: has joined #ruby
[05:58:36] guardianx: has joined #ruby
[06:05:11] dinfuehr: has joined #ruby
[06:06:50] Hanma[m]: has joined #ruby
[06:06:50] aviraldg: has joined #ruby
[06:06:50] dtcristo: has joined #ruby
[06:06:50] lasenna[m]: has joined #ruby
[06:06:50] M107262[m]: has joined #ruby
[06:06:50] torarne: has joined #ruby
[06:06:50] jonjits[m]: has joined #ruby
[06:06:50] yana[m]: has joined #ruby
[06:06:50] astronavt[m]: has joined #ruby
[06:06:50] Giphy[m]: has joined #ruby
[06:06:51] velu_aon[m]: has joined #ruby
[06:06:51] watzon: has joined #ruby
[06:06:51] haylon: has joined #ruby
[06:06:51] dman[m]: has joined #ruby
[06:06:51] KevinMGranger: has joined #ruby
[06:06:51] turt2live: has joined #ruby
[06:06:57] aagdbl[m]: has joined #ruby
[06:06:57] itmerc[m]: has joined #ruby
[06:06:58] zalipuha[m]: has joined #ruby
[06:06:58] gokul_mr[m]: has joined #ruby
[06:06:58] Matt[m]2: has joined #ruby
[06:06:59] kua[m]: has joined #ruby
[06:07:36] apeiros: has joined #ruby
[06:08:26] garyserj: has joined #ruby
[06:08:56] anisha: has joined #ruby
[06:09:03] garyserj: Is there a shorter way of writing this? xmlanchorlist = doc.css("table[class='abc']")[0].css("tr>td>a")
[06:09:11] nickjj_: has joined #ruby
[06:09:16] garyserj: like do i really need to do .css twice?
[06:10:47] mim1k: has joined #ruby
[06:10:52] ged_: has joined #ruby
[06:10:52] jenrzzz: has joined #ruby
[06:11:19] mahlon__: has joined #ruby
[06:12:56] shaman42_: has joined #ruby
[06:13:45] flori_: has joined #ruby
[06:13:47] irick_: has joined #ruby
[06:13:57] c-c_: has joined #ruby
[06:14:05] miah_: has joined #ruby
[06:14:39] leonthemisfit_: has joined #ruby
[06:14:40] Kilobyte22: has joined #ruby
[06:14:53] mistym-: has joined #ruby
[06:14:56] alfiemax_: has joined #ruby
[06:14:58] Nahra`: has joined #ruby
[06:15:14] coderphive: has joined #ruby
[06:15:18] epochwolf: has joined #ruby
[06:15:19] maxmanders: has joined #ruby
[06:15:21] cosimo_: has joined #ruby
[06:15:40] ged__: has joined #ruby
[06:15:43] kenichi: has joined #ruby
[06:15:46] sjumsa: has joined #ruby
[06:15:54] swgillespie_: has joined #ruby
[06:16:31] Fridtjof: has joined #ruby
[06:16:32] cajone: has joined #ruby
[06:17:26] reber: has joined #ruby
[06:18:26] fuzzyhorns: has joined #ruby
[06:18:55] halt: has joined #ruby
[06:19:46] guardianx: has joined #ruby
[06:19:56] Hexafox[I]: has joined #ruby
[06:20:23] k3rn31: has joined #ruby
[06:20:39] iszak: has joined #ruby
[06:20:39] iszak: has joined #ruby
[06:21:05] bhaak: has joined #ruby
[06:21:36] dinfuehr_: has joined #ruby
[06:22:13] swills: has joined #ruby
[06:22:14] swills: has joined #ruby
[06:23:05] brixen: has joined #ruby
[06:23:46] [spoiler]: has joined #ruby
[06:25:16] Nahra`: has joined #ruby
[06:26:07] segy: has joined #ruby
[06:26:39] alfiemax: has joined #ruby
[06:27:41] bokayio: has joined #ruby
[06:27:44] dinfuehr: has joined #ruby
[06:28:03] halt-: has joined #ruby
[06:29:00] rabajaj: has joined #ruby
[06:29:03] imode: has joined #ruby
[06:29:27] KeyJoo: has joined #ruby
[06:29:30] tekk: has joined #ruby
[06:30:15] qba73: has joined #ruby
[06:31:23] Hanmac: has joined #ruby
[06:31:39] howdoi: has joined #ruby
[06:32:07] dtcristo: has joined #ruby
[06:32:15] torarne: has joined #ruby
[06:32:28] fishcooker: has joined #ruby
[06:33:13] fishcooker: has joined #ruby
[06:34:12] duderonomy: has joined #ruby
[06:35:40] apeiros: has joined #ruby
[06:35:46] guardianx: has joined #ruby
[06:36:56] biberu: has joined #ruby
[06:36:58] AnoHito_: has joined #ruby
[06:41:23] guardianx: has joined #ruby
[06:43:42] AnoHito: has joined #ruby
[06:45:56] guacamole: has joined #ruby
[06:51:10] _whitelogger: has joined #ruby
[06:52:25] apeiros: has joined #ruby
[06:53:46] mjolnird: has joined #ruby
[06:59:16] michael1: has joined #ruby
[07:03:25] DoubleMalt: has joined #ruby
[07:05:45] apeiros: has joined #ruby
[07:06:03] r3QuiEm_cL: has joined #ruby
[07:06:20] k3rn31: has joined #ruby
[07:07:33] ta: has joined #ruby
[07:10:06] doublemalt_: has joined #ruby
[07:11:30] alfiemax: has joined #ruby
[07:12:19] eckhardt: has joined #ruby
[07:16:47] dinfuehr: has joined #ruby
[07:18:25] alex``: has joined #ruby
[07:20:28] anas: has joined #ruby
[07:30:07] Technodrome: has joined #ruby
[07:30:43] apeiros: has joined #ruby
[07:35:01] guille-moe: has joined #ruby
[07:36:58] conta: has joined #ruby
[07:39:20] apeiros: has joined #ruby
[07:40:13] guardianx: has joined #ruby
[07:40:41] fusta: has joined #ruby
[07:41:27] al2o3-cr: morning world its a brand new day!
[07:44:45] Technodrome: has joined #ruby
[07:52:21] andikr: has joined #ruby
[07:53:27] m27frogy: has joined #ruby
[07:54:50] olblak: has joined #ruby
[07:59:04] Guest3: has joined #ruby
[08:08:10] ramfjord: has joined #ruby
[08:10:09] aufi: has joined #ruby
[08:11:40] vondruch: has joined #ruby
[08:13:24] lexruee: has joined #ruby
[08:16:08] vondruch: has joined #ruby
[08:17:09] zautomata: has joined #ruby
[08:18:04] teefbur: has joined #ruby
[08:18:55] dionysus69: has joined #ruby
[08:20:23] Swat2: has joined #ruby
[08:24:20] zipkid: has joined #ruby
[08:24:53] ur5us: has joined #ruby
[08:25:43] Silthias1: has joined #ruby
[08:29:53] claudiuinberlin: has joined #ruby
[08:30:42] mark_66: has joined #ruby
[08:33:15] amosbird: has joined #ruby
[08:33:24] amosbird: hello, why do I get this error https://la.wentropy.com/8Cvz
[08:37:25] teefbur: I just started learning ruby few weeks ago i'm not that fluent on what each error means can you a link to the code ?
[08:38:45] amosbird: um, i don't find the source files. it's a package called fpm I installed in archlinx
[08:42:06] ur5us: has joined #ruby
[08:42:51] fusta: has joined #ruby
[08:45:13] iamarun: has joined #ruby
[08:46:28] nertzy: has joined #ruby
[08:46:53] |ifei5good: has joined #ruby
[08:47:34] |ifei5good: has joined #ruby
[08:49:46] jamesaxl: has joined #ruby
[08:50:14] kies: has joined #ruby
[08:51:24] fishcooker: has joined #ruby
[08:54:51] DrCode: has joined #ruby
[08:56:05] apeiros: has joined #ruby
[08:58:42] jamesaxl: has joined #ruby
[08:59:53] konsolebox: has joined #ruby
[09:01:43] Silthias: has joined #ruby
[09:03:48] jaruga: has joined #ruby
[09:03:49] mim1k: has joined #ruby
[09:04:33] Silthias2: has joined #ruby
[09:05:06] burgestrand: has joined #ruby
[09:05:27] tomphp: has joined #ruby
[09:06:26] ferr: has joined #ruby
[09:07:26] apeiros: has joined #ruby
[09:07:29] yxhuvud: has joined #ruby
[09:10:29] faces: has joined #ruby
[09:15:20] jamesaxl: has joined #ruby
[09:21:08] coffeecupp: has joined #ruby
[09:22:27] InfinityFye: has joined #ruby
[09:26:17] mikecmpbll: has joined #ruby
[09:27:52] apeiros: has joined #ruby
[09:28:18] dn`_: has joined #ruby
[09:29:01] Silthias: has joined #ruby
[09:29:14] ta: has joined #ruby
[09:30:14] Bilge: has joined #ruby
[09:30:46] bier: has joined #ruby
[09:31:00] morfin: has joined #ruby
[09:31:15] Kyle__: has joined #ruby
[09:31:21] morfin: where would you require 'database_cleaner' if have standalone non-rails app?
[09:31:34] morfin: i use it only in tests so in spec_helper?
[09:31:38] thejoecarroll: has joined #ruby
[09:31:44] jamesaxl: has joined #ruby
[09:31:48] chamunks: has joined #ruby
[09:32:52] oz: has joined #ruby
[09:33:04] vdl: has joined #ruby
[09:33:29] spk: has joined #ruby
[09:33:34] diegok: has joined #ruby
[09:34:08] fishcooker: has joined #ruby
[09:34:10] apeiros: has joined #ruby
[09:34:30] bweston92: has joined #ruby
[09:35:18] sjums: has joined #ruby
[09:35:19] lex: has joined #ruby
[09:36:15] Archrover: has joined #ruby
[09:37:10] bmn: has joined #ruby
[09:37:52] tabakhase__: has joined #ruby
[09:38:06] morfin: nvm, i required it in spec/support/database_cleaner.rb
[09:38:07] nausea: has joined #ruby
[09:38:07] nausea: has joined #ruby
[09:38:33] cvander: has joined #ruby
[09:40:28] CustosLimen: has joined #ruby
[09:40:53] tabakhase__: has joined #ruby
[09:42:23] vondruch: has joined #ruby
[09:44:39] _aeris_: hi here ! i post a question here yesterday, but no answer or i don't see it, so i repost here :)
[09:44:41] apeiros: has joined #ruby
[09:44:59] _aeris_: with debian packaged ruby, ruby looks for gem under /vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0
[09:45:08] _aeris_: but with rbenv ruby, in /vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0*-static*
[09:45:20] Silthias1: has joined #ruby
[09:45:39] _aeris_: why this difference ? packaged app with debian ruby doesn't work with rbenv ruby :'(
[09:46:49] vondruch: has joined #ruby
[09:58:30] d_kam_: has joined #ruby
[10:01:29] ltem: has joined #ruby
[10:02:24] bsartek: has joined #ruby
[10:02:42] Beams: has joined #ruby
[10:03:26] romain_t: has joined #ruby
[10:03:42] mikecmpbll: has joined #ruby
[10:04:00] apeiros: has joined #ruby
[10:05:09] ferr: has left #ruby: ("WeeChat 1.9.1")
[10:06:29] Serpent7776: has joined #ruby
[10:08:30] alfiemax: has joined #ruby
[10:15:20] guille-moe: has joined #ruby
[10:22:32] quobo: has joined #ruby
[10:23:42] ur5us: has joined #ruby
[10:25:38] jaruga: has joined #ruby
[10:26:26] Bish: there is no ruby equivalent to: https://github.com/LuminosoInsight/python-ftfy
[10:27:03] zautomata: has joined #ruby
[10:27:16] Bish: what do you guys do with broken encoding?
[10:29:12] heftig: has joined #ruby
[10:29:33] apeiros: has joined #ruby
[10:30:00] d_kam_: Take a guess at the incorrect encoding and convert it to UTF8
[10:30:49] nofxx: has joined #ruby
[10:31:12] Bish: d_kam_: yeah, thats what the libary does, but im afraid there are too many cases
[10:32:00] vifino: has joined #ruby
[10:32:24] workmad3: has joined #ruby
[10:34:51] nofxx1: has joined #ruby
[10:38:27] Bish: also: is there some sort of signaling library or rather: what should i do if one thread signaling the main thread about something
[10:38:33] Bish: doing a queue for that sounds like a hack
[10:39:38] marr: has joined #ruby
[10:42:52] ldnunes: has joined #ruby
[10:43:23] bigkevmcd: has joined #ruby
[10:45:15] ur5us: has joined #ruby
[10:49:20] anas: has joined #ruby
[11:02:21] c0ncealed: has joined #ruby
[11:03:07] charliesome: has joined #ruby
[11:03:44] ledestin: has joined #ruby
[11:06:48] mniip: has joined #ruby
[11:06:58] ur5us: has joined #ruby
[11:10:43] mikecmpbll: has joined #ruby
[11:11:56] matthewd: Bish: https://github.com/brianmario/charlock_holmes maybe?
[11:12:27] matthewd: Didn't read enough to judge whether they actually do the same thing, but they seem to be in vaguely the same problem-space at least
[11:14:33] guille-moe: has joined #ruby
[11:15:27] blackbaba: has joined #ruby
[11:22:10] GodFather: has joined #ruby
[11:25:06] rgr: has joined #ruby
[11:28:29] ur5us: has joined #ruby
[11:31:04] blackbaba: has left #ruby: ("Closing Window")
[11:48:55] mikecmpb_: has joined #ruby
[11:50:03] ur5us: has joined #ruby
[11:54:59] ta: has joined #ruby
[11:56:16] d_kam__: has joined #ruby
[11:57:31] sepp2k: has joined #ruby
[11:59:47] d_kam___: has joined #ruby
[12:01:01] Sammichmaker: has joined #ruby
[12:05:31] eregon: has joined #ruby
[12:11:33] ur5us: has joined #ruby
[12:11:59] hs366: has joined #ruby
[12:12:32] ams__: has joined #ruby
[12:16:45] Bish: matthewd: charlock holmes is great, it does detect encoding and transform corresponding CORRECT encoding to another CORRECT encoding
[12:16:49] Bish: but it doesnt fix broken encoding
[12:17:29] Bish: a.e. ISO-8859-1 which is set to utf-8
[12:18:36] Bish: using charlock holmes already so i for myself dont get such mistakes in my code
[12:19:22] matthewd: Bish: Ah, okay. A quick Google finds https://github.com/dekellum/mojibake, but it doesn't exactly sound new and shiny.
[12:20:00] Bish: that looks more like it
[12:20:24] Bish: well broken encoding is no new issue, it might just be me being unable to google
[12:20:39] Bish: and they write rubinius 2.0 as a possible interpreter, so can't be that old
[12:20:49] Bish: oh shit that was 2015
[12:21:03] matthewd: I just googled 'ruby fix mojibake' -- it didn't hurt that that's what the library's named :)
[12:21:24] Bish: how did u know to google for mojibake
[12:21:41] Bish: is rubinius actually any good by now?
[12:21:49] Bish: should test it some time again
[12:22:11] matthewd: That's the term for encoding-mangled strings
[12:22:21] Bish: really? i didn't know that
[12:22:25] Bish: where does it origin from?
[12:22:42] matthewd: e.g. https://github.com/LuminosoInsight/python-ftfy#mojibake
[12:22:56] Bish: okay, i gonna stop talking or i look more stupid
[12:23:17] Jidoor: has joined #ruby
[12:23:17] matthewd: https://en.wikipedia.org/wiki/Mojibake -- it's a Japanese term, so yes same root as emoji
[12:23:32] Jidoor: has joined #ruby
[12:23:32] Jidoor: has joined #ruby
[12:25:21] workmad3: has joined #ruby
[12:25:42] matthewd: tbh if it hadn't scrolled past while I glanced at the ftfy readme, it probably wouldn't have come to mind when I then went to search
[12:25:53] shinnya: has joined #ruby
[12:27:00] mostlybadfly: has joined #ruby
[12:27:17] johno84: has joined #ruby
[12:29:42] guille-moe: has joined #ruby
[12:33:08] ur5us: has joined #ruby
[12:33:14] hightower2: has joined #ruby
[12:33:17] chrisseaton: Bish: Rubinius removed their JIT, and despite planning to write a new one in a couple of weeks, we still don't have one about a year and a half later
[12:34:03] chrisseaton: Bish: until they put the JIT back in, it's slower than MRI
[12:34:25] Bish: ? wasn't that the cool feature that made it better?
[12:34:49] matthewd: Last I checked you also had to look very hard to find a mention of Ruby
[12:35:12] chrisseaton: Personally I think removing it without a replacement was a mistake, and it was never going to be possible to implement a new JIT in a couple of weeks, but then I don't have to maintain it. I think that was their complaint - they found it too hard to work on the JIT.
[12:35:15] matthewd: ACTION is pretty sure that Evan was actually the cool feature
[12:36:12] chrisseaton: I think there are still people trying - doesn't GitLab have Yorick Peterse working one day a week on it? And there's now a company behind it as well.
[12:36:44] chrisseaton: It's still useful if you are doing things that don't need high performance.
[12:36:52] milardovich: has joined #ruby
[12:37:34] Bish: matthewd: whats special about evan?
[12:37:50] tvw: has joined #ruby
[12:38:01] Bish: chrisseaton: well rubinius was good at maxing all my cpus
[12:38:10] Bish: but was slower in progress
[12:39:27] matthewd: Bish: I just think that the project effectively stalled when he moved on to other things.. it carried on forward for a little while, but lost momentum with [IMO, outside observer, etc] shifting priorities
[12:40:42] Bish: i might be super naive thinking a faster interpreter can't be that hard of a task
[12:40:50] Bish: i feel like it shouldn't be
[12:40:52] matthewd: And IME the person/people at the centre of a project are a major factor in its prospects for the future
[12:41:28] Bish: why is having jit in mri so hard?
[12:41:33] chrisseaton: Bish: a faster interpreter is possible - there is a lot of research into how to do this - but Rubinius is written in Ruby so it needs to be not just a bit faster but a lot faster
[12:41:36] matthewd: Bish: With or without maintaining compatibility with existing behaviour?
[12:42:10] Bish: chrisseaton: well, if you how does the fact that it is written in ruby change anything about speed?
[12:42:15] Bish: about compile-time, sure it does.
[12:42:30] Bish: but the result(byte-code) should be as fast, no matter in what language the compiler is written in
[12:42:44] chrisseaton: Bish: MRI doesn't just need a JIT, it needs an extremely good JIT to optimise Ruby. That's the issue - it's not a linear return on investment, it's a huge cost with no benefit until you have a really sophisticated JIT. I gave a lecture on why this is https://www.youtube.com/watch?v=b1NTaVQPt1E.
[12:42:53] matthewd: Bish: You can't compile ruby.
[12:42:59] Bish: sure i can
[12:43:06] Bish: asm>> puts "hello"
[12:43:06] matthewd: chrisseaton: Yes I know that's a massive oversimplification ;)
[12:43:07] ruby[bot]: Bish: I have disassembled your code, the result is at https://eval.in/896260
[12:43:27] chrisseaton: Bish: but the core library is written in Ruby in Rubinius, so operations that were native C code and now running in the interpreter as well - the interpreter has to do more, so even if it was faster it needs to be a lot faster
[12:43:45] Bish: chrisseaton: okay, you're right
[12:44:18] Bish: ACTION googles crystallang after years
[12:44:44] chrisseaton: I canonical example I give is `[a, b, c].sort[1]` - a normal JIT doesn't help you make that kind of code fast, because it's just calls to other methods. You need. JIT that is powerful enough to see into and through all those method calls, eliminate all those objects, and so on, to do well on Ruby.
[12:45:26] chrisseaton: A JIT that does the usual things like making local variables fast and calls fast isn't good enough for Ruby.
[12:45:33] Bish: wow, crystal looks cool by now
[12:45:38] Bish: do they have threads yet?
[12:46:05] matthewd: Bish: The short answer is that a much faster ruby would be very popular with some very large / deep-pocketed companies. If it's "not that hard of a task", you should do it, and then sell the result.
[12:46:26] Bish: matthewd: well you forgot the part where i said " i might be super naive"
[12:46:40] raatiniemi: has joined #ruby
[12:47:59] Jidoor: has joined #ruby
[12:48:03] Jidoor: If i create a function that takes a lambda as parameter, can I define what parameters the lambda takes in the function definition?
[12:48:31] truenito: has joined #ruby
[12:48:38] apparition: has joined #ruby
[12:49:05] alex``: has joined #ruby
[12:51:32] hightower2: has joined #ruby
[12:54:38] ur5us: has joined #ruby
[12:56:36] Bish: Jidoor: you can check it for arity
[12:57:24] Bish: >> def coolMeth(&b);p b.arity;end; coolMeth { |i,want,four,parameters| }
[12:57:25] ruby[bot]: Bish: # => 4 ...check link for more (https://eval.in/896265)
[12:59:11] Bish: so you could add a check to what you refer to as "function"
[12:59:38] Bish: raise ArgumentError.new "Say whattt?" if b.arity != 4
[13:05:24] nadir: has joined #ruby
[13:05:47] synthroid: has joined #ruby
[13:06:30] Cork: anyone have a recommended for a soap lib that is maintained?
[13:09:49] anas: has joined #ruby
[13:12:48] kryptoz: has joined #ruby
[13:13:54] Bish: Cork: no, soap sucks
[13:14:07] Cork: don't have a choice though :/
[13:14:15] Cork: well except do the api calls manually
[13:14:49] milardov_: has joined #ruby
[13:14:53] Bish: after 283182381238 tries
[13:14:55] Bish: i sticked with savon
[13:14:58] Bish: can't tell you why, though
[13:15:09] Bish: but i thought about it ALOT
[13:15:39] Cork: haven't used soap in ruby since... 1.7?
[13:15:50] Cork: so i'm a bit out of touch with what works :)
[13:16:07] Cork: thx will have a look at savon
[13:16:18] ur5us: has joined #ruby
[13:16:57] Cork: (ah right, i remember this one... SOAP::WSDLDriverFactory ) yup it is what i used...
[13:17:22] Cork: log gone and dead though thanks for that! >_>
[13:17:59] Cork: Bish: ya, savon looks usable thx!
[13:20:04] jamesaxl: has joined #ruby
[13:21:07] d_kam___: has joined #ruby
[13:21:17] milardovich: has joined #ruby
[13:22:34] sagax: has joined #ruby
[13:24:03] d_kam____: has joined #ruby
[13:26:11] bmurt: has joined #ruby
[13:27:49] jphase: has joined #ruby
[13:29:50] zipace: has joined #ruby
[13:33:34] d_kam____: has joined #ruby
[13:35:03] ramfjord: has joined #ruby
[13:37:45] ur5us: has joined #ruby
[13:38:02] d_kam____: has joined #ruby
[13:40:00] Bish: Cork: i think i remember different implementations making things impossible to use without metaprogramming
[13:40:05] Bish: savon never traps you
[13:40:24] Bish: soap is still a pain in the ass, but you can do ALL THE THINGS
[13:40:41] uZiel: has joined #ruby
[13:40:57] Cork: am i reading the documentation correctly and you just give it a hash to message and that's it?
[13:41:33] d_kam____: has joined #ruby
[13:42:21] Bish: yeah but there are some things.. like..
[13:42:37] Bish: ambiguity of tagnames and attributes (it's really old memory, so dont quote me)
[13:42:44] Bish: and even those you can circumvent when thinking a bit
[13:42:57] Cork: ya, i've seen that in one of the examples
[13:43:12] Cork: thx for the tip though, this is A LOT better then what i expected
[13:43:21] Bish: long story short, you can create any soap request
[13:43:41] Bish: Cork: what are you talking with?
[13:43:44] Bish: via soap
[13:43:51] Cork: certificate orders
[13:44:13] Bish: like, ssl?
[13:44:24] Cork: and code signing and things like that ya
[13:44:42] Cork: the order api is in soap
[13:44:56] Cork: and all the documentation is for java and c# so *yay*
[13:45:39] jphase: has joined #ruby
[13:45:41] Bish: fuck c# and java gus
[13:46:28] Cork: i was trying to get around it with just net/http and builder
[13:46:34] ltem: has joined #ruby
[13:46:51] Cork: but it keeps complaining about extra tags around the messages and... ** this
[13:46:52] Bish: been there, done htat
[13:47:00] Bish: went back to savon
[13:47:29] Bish: but either way, my suggestion is to skip soap completely
[13:47:41] Cork: by doing?
[13:47:50] Bish: nuking companies that use it?
[13:47:59] Cork: lol agreed
[13:48:03] d_kam_____: has joined #ruby
[13:48:13] Bish: i mean soap would be great, if everyone agreed to some thing
[13:48:29] Cork: i don't think soap will ever bee grate
[13:48:32] Bish: nope, everyone bulding their own definition of arrays
[13:48:35] Bish: or.. integers..
[13:48:37] Bish: or floats..
[13:48:38] Cork: it is too over complicated
[13:48:40] Bish: or anything
[13:48:56] Bish: no it's super great, if it was standardized how to send data
[13:49:27] raatiniemi: has joined #ruby
[13:49:37] Bish: json is simpler without attributes etc, thats why people tend to not go crazy when using it
[13:50:36] Cork: i prefer when my data structures don't have a forth dimension :D
[13:50:56] Bish: only when working with 3d shadows im happy
[13:52:12] Psybur: has joined #ruby
[13:52:15] Bish: Cork: last time i used soap, i couldn't get it to work, no matter how many docs i read how soap is supposed to look
[13:52:27] Bish: strace'd the shit out of php (because i had php code, doing the same thing)
[13:52:38] Bish: and it did totally different things, than the ones i read about
[13:52:40] Cork: oh, lovely
[13:52:46] cvander: has joined #ruby
[13:53:19] Bish: then used savon to emulate the behaviour shitty php soapclient does
[13:53:27] Bish: which everyone seems to support, because fuck logic
[13:54:00] uZiel: has joined #ruby
[13:54:15] Cork: fuck standards you mean :)
[13:56:39] JJonah__: has joined #ruby
[13:57:43] milardovich: has joined #ruby
[13:58:30] JJonah: has joined #ruby
[13:59:19] ur5us: has joined #ruby
[14:02:22] darkmorph: has joined #ruby
[14:03:00] JJonah: My application has custom errors that look the following, and I'm wondering if there is a good way that I can make a factory (perhaps with Class.new) to generate them in fewer lines, and if so what is the best way to do that:
[14:03:06] Cork: Bish: is there a way to get what xml it generates?
[14:03:09] JJonah: https://www.irccloud.com/pastebin/DJ5GsoKW/
[14:03:11] ruby[bot]: JJonah: we in #ruby do not like irccloud.com, I reposted your paste to gist for you: https://gist.github.com/4797a2430b92870007156747805e0571
[14:03:13] ruby[bot]: JJonah: irccloud.com has no syntax highlighting, distracting formatting and loads slowly for most.
[14:05:55] JJonah: To clarify my question, I'd prefer to write something like `DomainError = CustomError("Some domain specific thing just went wrong")` to create that class.
[14:06:49] matthewd: JJonah: You certainly could do that
[14:07:23] matthewd: JJonah: I wouldn't, personally -- seems not enough gain vs the indirection, breaking default rdoc/yard parsing, etc.
[14:08:19] JJonah: matthewd: Those are good points, but if I have 20 domain errors it's 100 lines of code vs 20 which isn't trivial.
[14:09:10] Cork: Bish: ah, found it
[14:09:20] matthewd: JJonah: def CustomError(msg); Class.new(RuntimeError) { const_set :Message, msg; def initialize; super(self.class::Message); end }; end
[14:09:23] matthewd: Something like that ¯\_(ツ)_/¯
[14:10:04] guille-moe: has joined #ruby
[14:10:12] milardovich: has joined #ruby
[14:10:29] matthewd: (note I switched from to_s to passing it as the message parameter in the initializer -- if you really want to_s, you can do that too, but the above feels less like it's fighting the superclass)
[14:11:43] d_kam______: has joined #ruby
[14:11:56] cvander: has joined #ruby
[14:12:06] cdg: has joined #ruby
[14:12:20] JJonah: matthewd: Ah, ok, thanks. So when you pass it as the message parameter it is automatically used in `to_s`?
[14:15:33] DrCode: has joined #ruby
[14:17:48] cdg_: has joined #ruby
[14:18:25] synthroid: has joined #ruby
[14:20:04] d_kam_______: has joined #ruby
[14:20:22] Bish: Cork: was it that builder stuff? really odd
[14:20:57] ur5us: has joined #ruby
[14:20:59] Cork: client.operation(:method).build(message: data).to_s
[14:22:02] d_kam_______: has joined #ruby
[14:22:15] guardian: hello, is there a quick way given a string to only keep numbers / digits in it?
[14:25:28] the_f0ster: has joined #ruby
[14:28:43] gnufied: has joined #ruby
[14:29:28] tobiasvl: guardian: 'abc123hehe'.gsub(/\D/, '')
[14:29:57] tobiasvl: for example? probably better ways without regex
[14:30:33] DLSteve: has joined #ruby
[14:33:01] anisha: has joined #ruby
[14:33:01] gnufied: has joined #ruby
[14:33:42] anisha: has joined #ruby
[14:34:58] oleo: has joined #ruby
[14:36:05] d_kam_______: has joined #ruby
[14:36:33] apeiros: has joined #ruby
[14:38:39] Sparky: has joined #ruby
[14:41:40] cvander: has joined #ruby
[14:42:27] ur5us: has joined #ruby
[14:43:02] sucks: has joined #ruby
[14:43:20] apeiros: has joined #ruby
[14:43:29] ldnunes: has joined #ruby
[14:44:11] cvander: has joined #ruby
[14:46:03] d_kam________: has joined #ruby
[14:52:44] profetes: has joined #ruby
[14:52:59] hopsoft: has joined #ruby
[14:53:20] truenito: has joined #ruby
[14:55:33] mnemon: guardian: "asd123".delete('^0-9')
[14:56:02] d_kam________: has joined #ruby
[14:56:53] jrafanie: has joined #ruby
[14:57:19] milardovich: has joined #ruby
[14:58:58] guille-moe: has joined #ruby
[14:59:11] jottr: has joined #ruby
[15:00:09] milardov_: has joined #ruby
[15:00:32] polishdub: has joined #ruby
[15:02:18] rippa: has joined #ruby
[15:02:19] ltem: has joined #ruby
[15:04:03] ur5us: has joined #ruby
[15:11:28] d_kam________: has joined #ruby
[15:13:15] Rapture: has joined #ruby
[15:15:01] Technodrome: has joined #ruby
[15:15:20] bkxd: has joined #ruby
[15:17:15] mtkd: has joined #ruby
[15:18:06] d_kam_________: has joined #ruby
[15:19:56] doublemalt_: has joined #ruby
[15:20:21] guille-moe: has joined #ruby
[15:21:26] the_f0ster: has joined #ruby
[15:21:50] knight33: has joined #ruby
[15:23:39] dionysus69: has joined #ruby
[15:25:31] ur5us: has joined #ruby
[15:25:38] bronson: has joined #ruby
[15:32:18] jrafanie_: has joined #ruby
[15:33:24] tao_: has joined #ruby
[15:36:01] cschneid_: has joined #ruby
[15:39:47] netherwolfe: has joined #ruby
[15:41:28] milardovich: has joined #ruby
[15:41:53] iamarun: has joined #ruby
[15:42:07] raynold: has joined #ruby
[15:42:43] rajno: has joined #ruby
[15:44:59] ta: has joined #ruby
[15:47:04] ur5us: has joined #ruby
[15:55:49] truenito: has joined #ruby
[15:58:10] guardian: tobiasvl: thank you!
[15:58:28] VeryBewitching: has joined #ruby
[15:59:13] aScottishBoat: has joined #ruby
[16:00:36] alfiemax: has joined #ruby
[16:01:35] aScottishBoat: Any former Perl hackers? What makes you like Ruby but not quite miss Perl?
[16:03:07] mikecmpbll: has joined #ruby
[16:03:15] orbyt_: has joined #ruby
[16:04:01] Nilium: Mmm, I mostly just learned Ruby to do fox toolkit stuff and ended up writing most of my other stuff in it and forgot Perl after a not using it for long enough.
[16:07:15] aScottishBoat: Fair, I guess it was good for you then.
[16:07:45] octomancer: Ruby is prettier to look at. Actual objects, rather than a lexical hack, so you chain methods. Did I mention that it's prettier? ;-)
[16:08:34] kculpis: has joined #ruby
[16:08:38] ur5us: has joined #ruby
[16:10:39] A124: has joined #ruby
[16:10:53] aScottishBoat: Working on any projects you guys?
[16:11:06] octomancer: I use chef at work so ...
[16:12:31] the_f0ster: has joined #ruby
[16:12:43] cagomez: has joined #ruby
[16:13:41] raynold: Ahh it's a wonderful day
[16:17:46] mikecmpbll: has joined #ruby
[16:19:28] synthroid: has joined #ruby
[16:24:07] havenwood: aScottishBoat: Had any fun with Perl 6? It certainly took some inspiration from Ruby.
[16:25:17] milardovich: has joined #ruby
[16:26:17] Exhiled: has joined #ruby
[16:26:29] Nilium: Only Ruby project I have right now is a little cron job to clean up old disk images out in Google Compute Engine.
[16:27:40] aScottishBoat: havenwood: Not yet. I want to, but I'm being lazy about giving it a go.
[16:27:53] truenito: has joined #ruby
[16:27:56] aScottishBoat: havenwood, what's inspired from Ruby?
[16:28:29] aScottishBoat: Nilium, I'm not working on any Ruby projects atm, but I'm reverse engineering parts of ManageIQ.
[16:28:42] Nilium: Not sure what that is. My current project is Erlang.
[16:29:47] havenwood: aScottishBoat: I'd have to find the quote where they discuss the Ruby influence. It's only fitting since Ruby borrowed from Perl before Perl 6 borrowed from Ruby.
[16:29:49] aScottishBoat: Ooo. Cool. ManageIQ is a cloud management tool; it has the service layer and then the UI layer. Both are rails apps.
[16:30:08] aScottishBoat: havenwood, if you can find it please share. I'd love to read it.
[16:30:17] ur5us: has joined #ruby
[16:30:51] havenwood: aScottishBoat: I think one of the best discussions I heard about it was actually in the #perl6 channel. Let me try to find it because it was interesting!
[16:31:17] MrSparkle: has joined #ruby
[16:31:42] weaksauce: has joined #ruby
[16:31:49] jeffreylevesque: has joined #ruby
[16:32:25] jeffreylevesque: is there a built in function where i can check if a string contains a path as a substring?
[16:32:50] aScottishBoat: jeffreylevesque, not sure but that sounds like a pretty handy function.
[16:32:51] jeffreylevesque: the string should be a result of the linux `echo $PATH`
[16:33:15] troys: has joined #ruby
[16:33:17] havenwood: &ri String#include?
[16:33:17] `derpy: http://ruby-doc.org/core-2.4.1/String.html#method-i-include-3F
[16:33:20] havenwood: &ri String#[]
[16:33:20] `derpy: http://ruby-doc.org/core-2.4.1/String.html#method-i-5B-5D
[16:33:44] havenwood: jeffreylevesque: You can get at that env var from Ruby with: ENV['PATH']
[16:35:05] havenwood: jeffreylevesque: You might consider splitting on the delimiter so you don't have to anchor.
[16:35:20] ramfjord: has joined #ruby
[16:35:44] havenwood: jeffreylevesque: ENV['PATH'].split(':').include? path
[16:35:55] havenwood: (So you don't match a partial path, unless you want that.)
[16:37:26] kinlo: has joined #ruby
[16:38:05] milardovich: has joined #ruby
[16:38:41] aScottishBoat: havenwood, interesting name. How'd you choose it?
[16:38:43] kinlo: does ruby convert strings to symbols when they are used as an index in a hash? I am under the impression that ruby is converting stuff and I don't fully understand the logic behind it...
[16:39:10] the_f0ster: has joined #ruby
[16:39:44] havenwood: aScottishBoat: It was a gaming name from when I was a kid. I liked the outdoors. My real name (Shannon) wasn't available on the Githubs. I wasn't quite early enough.
[16:40:03] havenwood: aScottishBoat: And how did you become a Scottish boat? :-)
[16:40:42] alan_w: has joined #ruby
[16:40:49] alan_w: has left #ruby: ()
[16:41:16] [Butch]: has joined #ruby
[16:41:32] aScottishBoat: Hah. Well, I want a boat. And I wish to be back in Scotland. Just came to mind.
[16:41:50] havenwood: aScottishBoat: here's a reference to the discussion in the perl channel: https://irclog.whitequark.org/ruby/2013-02-02#2877629;
[16:41:59] aScottishBoat: Brilliant, checking
[16:42:25] havenwood: aScottishBoat: It's a meta-discussion that references the real discussion in another channel >.>
[16:44:27] havenwood: I can't seem to dig up what randal schwartz said in he other channel now though
[16:45:56] aScottishBoat: Yeah, I gave it a try at finding.
[16:51:49] ur5us: has joined #ruby
[16:54:10] jeffreylevesque_: has joined #ruby
[16:54:28] hays_: has joined #ruby
[16:54:28] hays_: has joined #ruby
[17:00:36] truenito: has joined #ruby
[17:02:16] dviola: has joined #ruby
[17:03:35] Exhiled: has joined #ruby
[17:11:33] raatiniemi: has joined #ruby
[17:12:03] Sparky: Any one home?
[17:12:23] aScottishBoat: Sparky, hello there.
[17:12:30] havenwood: Sparky: Lots of folk here. If you have a question, ask away!
[17:12:34] Sparky: Could you help me understand what a specific thing in a code does?
[17:12:42] havenwood: Sparky: You'd have to say more.
[17:12:51] havenwood: ?gist Sparky
[17:12:51] ruby[bot]: Sparky: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[17:13:08] Sparky: target = open(filename, 'w')
[17:13:14] ur5us: has joined #ruby
[17:13:17] Sparky: what does the 'w' do?
[17:13:24] conta2: has joined #ruby
[17:13:26] havenwood: Sparky: open the file in writable mode
[17:13:46] Sparky: would it default open in read-only?
[17:14:19] havenwood: Sparky: mode="r" is default
[17:14:33] havenwood: &ri IO::open
[17:14:33] `derpy: http://ruby-doc.org/core-2.4.1/IO.html#method-c-open
[17:15:00] havenwood: &ri Kernel::open
[17:15:00] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/open-uri/rdoc/Kernel.html#method-c-open
[17:16:29] mnemon: Sparky: also, before you truncate all the files, "a" is append "w" will truncate the file before writing.
[17:17:11] tcpdump: has joined #ruby
[17:17:18] tcpdump: Hello everyone
[17:18:02] tcpdump: Anyone have any idea what type of a performance hit checking CSRF authenticity (:verify_authenticity_token) would have on a busy API server?
[17:19:57] cagomez: has joined #ruby
[17:20:04] mnemon: tcpdump: probably pretty minimal unless you end up with a performance problem on the DB side, not doing it is usually bad idea unless you really understand the implications.
[17:21:18] adlerdias: has joined #ruby
[17:22:05] nofxx: has joined #ruby
[17:22:12] tcpdump: mnemon: Thansk its managing to hit my app server logs 530 times a min.
[17:22:50] tcpdump: And I was just trying to determine if evaluating ever single api call for CSRF is causing a perfomance hits.
[17:23:17] greensleeves: has joined #ruby
[17:27:40] impermanence: has joined #ruby
[17:28:28] Sparky: YO! I'm suprised how well I'm learning this stuff- no small thanks to my ability to google things though :P
[17:30:20] imode: has joined #ruby
[17:32:33] cam27: has joined #ruby
[17:33:08] tens0r: has joined #ruby
[17:34:16] SeepingN: has joined #ruby
[17:34:56] ur5us: has joined #ruby
[17:35:10] dionysus69: has joined #ruby
[17:36:48] nofxx1: has joined #ruby
[17:37:05] jeffreylevesque: `ENV['PATH'].split(':').include? path` will return a boolean?
[17:37:36] elomatreb: #include? does, yes
[17:39:42] Sparky: The more I do coding, the better I will get at coding- that's how this works right?
[17:41:37] ltem: has joined #ruby
[17:41:44] mson: has joined #ruby
[17:42:04] weaksauce: has joined #ruby
[17:43:33] aScottishBoat: Anyone with Rails experience? I've an issue that ManageIQ and Rails IRC rooms aren't addressing. Feeling a bit bummed ugh lol
[17:43:37] aScottishBoat: https://pastebin.com/MTKz8HmQ
[17:43:39] ruby[bot]: aScottishBoat: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/6e44bce8e39b0d41e9757440d3f53756
[17:43:39] ruby[bot]: aScottishBoat: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[17:44:03] RickHull: has joined #ruby
[17:44:10] aScottishBoat: https://gist.github.com/anonymous/6e44bce8e39b0d41e9757440d3f53756 (just in case ;))
[17:44:23] Sparky: RickHull: My favorite Rick Hull!!
[17:44:32] RickHull: how's it going?
[17:44:42] greensleeves: Hi all, new to Ruby. I was hoping if I could get some help with this GitHub project. It's about fetching a man page and using a script to generate bash completion files automatically
[17:44:46] Sparky: RickHull: Doing my lessons
[17:44:46] greensleeves: Link: https://github.com/aprescott/skel-complete
[17:45:32] greensleeves: trouble is I am unable to get the correct result i.e. only getting partial list of options from man pages, can someone please help me?
[17:45:34] Sparky: RickHull: I just did a script that opens a text file, turncates it, and re-writes it!! exciting stuff
[17:45:40] greensleeves: the project uses Ruby
[17:46:12] RickHull: greensleeves: it looks like it's written mostly in bash/sh, with a call to ruby. for debugging, I would try to extract the ruby bits to an .rb file
[17:46:48] RickHull: the regular expressions at the top look gnarly and are probably a source of the misbehavior
[17:47:16] RickHull: one thing that helps for debugging regular expressions is to use the //x modifier, and put every "term" on its own line, with comments
[17:47:40] ruskie: has joined #ruby
[17:47:52] cagomez: has joined #ruby
[17:48:13] RickHull: oh, it does use the //x modifier
[17:48:24] RickHull: but probably not to its full advantage
[17:49:22] [Butch]: has joined #ruby
[17:49:55] greensleeves: Thanks Rick. Can you help me with the debugging? I am not good at programming and haven't used regex before. Do I need to copy the regex to a file that ends with .rb? Pardon my ignorance
[17:50:18] RickHull: sorry, this looks like a much deeper pit than I am personally willing to wade into
[17:50:48] RickHull: it's calling ruby -ne 'stuff'
[17:51:00] RickHull: so copy out the 'stuff' to an .rb file and try to see what it's doing
[17:51:23] greensleeves: Ah, okay. Let me try that
[17:52:07] RickHull: if you are new to programming, then this will likely be a fruitless exercise, but maybe worthwhile just to try to understand it
[17:52:07] claudiuinberlin: has joined #ruby
[17:53:18] RickHull: Sparky: opening an input file and rewriting the file or to a different output file -- this is a common pattern and very useful :)
[17:53:26] greensleeves: Could you point me to a link that will help me understand the Ruby part of the shell script?
[17:53:39] mikecmpbll: has joined #ruby
[17:53:47] greensleeves: I am familiar with regex in Perl, but a bit rusty
[17:53:55] RickHull: you should look up what $_ is, and then what String#scan does
[17:54:43] RickHull: here is one reference for those horrible $_ global vars http://xahlee.info/ruby/ruby_predefined_vars.html
[17:54:49] orbyt_: has joined #ruby
[17:55:29] Sparky: RickHull: My current lesson: https://learnrubythehardway.org/book/ex17.html Apparently its copying the contents of one file into another file OOO! I can see many implications for this, maybe adding things to a file- I could seek(new line) and then copy, right? Does it work like that?
[17:56:28] ur5us: has joined #ruby
[17:57:08] bmurt: has joined #ruby
[17:57:26] RickHull: it could, sure. the `evdump` script I posted earlier is kind of similar. it can read a /dev/input/X file (binary data) and spit out human-readable text
[17:58:15] RickHull: there is somewhat of an equivalency between: read from STDIN, or read a file. and write to STDOUT, or write to a file
[17:58:42] RickHull: often, writing to STDOUT is all you need, because it's very easy to redirect that output to a file using shell redirection
[17:58:56] RickHull: e.g. echo "here is the contents" > my_file.txt
[17:59:21] Exhiled: has joined #ruby
[18:08:25] cagomez: has joined #ruby
[18:09:22] Sparky: What did I do wrong, and how do I read the error message? https://gist.github.com/Dasms/fcadf20a636d20f39b732355c8991adc
[18:09:33] cagomez_: has joined #ruby
[18:10:27] jhass: it tells you it wanted to open the file "test1.txt,test2.txt" but it didn't exist
[18:10:45] jhass: I'd guess you failed to put some " or ' into the right places or to .split something
[18:12:13] darkmorph: has joined #ruby
[18:12:30] orbyt_: has joined #ruby
[18:13:48] guille-moe: has joined #ruby
[18:15:50] kies: has joined #ruby
[18:16:12] miah: has joined #ruby
[18:17:13] Sparky: I didn't input the ARGV correct
[18:17:58] ur5us: has joined #ruby
[18:19:04] ruskie: has left #ruby: ("...")
[18:22:47] Sparky: I have a philosophical question....
[18:23:10] jhass: the answer is maybe :P
[18:23:25] Sparky: If you separate a very large script with ; on one line... is it still just one line of code?
[18:23:39] RickHull: only in a trivial sense, not meaningfully
[18:23:53] ur5us: has joined #ruby
[18:24:09] RickHull: it should only be used when dealing with chatbots to keep input and output on a single line of chat
[18:24:28] jhass: mh, I guess everything between \n or ; we call a statement?
[18:25:00] jhass: and usually you would have one statement per line, ; just allows to have more than one
[18:26:00] Sparky: I'm about to learn functions, brb
[18:26:18] RickHull: philosophical question: does ruby have functions?
[18:26:44] jhass: some argue lambda procs are functions
[18:27:25] RickHull: ruby certainly has methods, which are nearly equivalent to functions, and can be made to act and look exactly like functions
[18:27:33] Sparky: Hey so uhmm.. functions, they name code.. like I do with the variables? So I may be getting ahead of myself, but can I assign code to a function like I assign strings to a variable and call them?
[18:28:06] RickHull: >> foo = 'a string'; def bar; 'another string'; end; [foo, bar]
[18:28:07] ruby[bot]: RickHull: # => ["a string", "another string"] (https://eval.in/896478)
[18:28:33] stoopidmunkey: has joined #ruby
[18:28:44] Sparky: What is "def"
[18:28:58] Sparky: def is what I use for .. woah
[18:29:04] orbyt_: has joined #ruby
[18:30:30] jhass: you probably already used a lot of "functions" (we prefer to call them methods in ruby) already, like gets, puts and so on. ruby just also allows you to define your own
[18:30:31] RickHull: Sparky: for now, it's fine to refer to ruby methods as functions -- there is a subtle distinction that doesn't matter right now
[18:31:11] RickHull: so `def` is used to define a function (aka method)
[18:36:14] Puffball: has joined #ruby
[18:37:00] jrp93: has joined #ruby
[18:38:57] stephh: has joined #ruby
[18:39:30] Sparky: RickHull: Like this? https://gist.github.com/Dasms/dc724712d2be4b03f150b97ad2da5e41
[18:40:01] kryptoz: has joined #ruby
[18:40:28] cschneid_: has joined #ruby
[18:40:37] RickHull: one thing -- your last line of the method -- instead of `puts "..."` -- you can just return the string instead of printing it
[18:41:00] RickHull: as your programs get more sophisticated, you will learn that functions should return strings rather than print them
[18:41:16] RickHull: and the *caller* of the function should make the choice whether to print the string that is returned
[18:41:50] jrp93: has left #ruby: ("Leaving")
[18:42:12] RickHull: however, if the book says to print them, then proceed as such -- i'm just giving some larger perspective :)
[18:43:02] stephh: has joined #ruby
[18:43:16] aScottishBoat: RickHull, why return as opposed to printing? I know I should return them (as per community standards), but any reason why?
[18:43:27] RickHull: all that said, if your function is named "print_blah" then yeah, it's fine to print
[18:43:29] aScottishBoat: I mean, it requires one less readable word
[18:43:41] RickHull: aScottishBoat: it's kind of subtle, but I'll take a stab
[18:43:58] RickHull: 1. printing is a side-effect
[18:44:12] RickHull: 2. functions ideally minimize side-effects
[18:44:21] stoopidmunkey: has joined #ruby
[18:44:41] RickHull: if you are reusing some code, where someone else has written an awesome function that does X Y and Z for you
[18:44:57] sucks: has joined #ruby
[18:45:05] RickHull: many times, you want the result, and maybe you want to manipulate it slightly before printing it
[18:45:15] RickHull: or maybe you don't want to print it at all, but shove it in a database
[18:45:44] RickHull: but if the function writer decided that the last line will print the result, and return nil, then the caller of the function is stuck
[18:46:20] RickHull: it's much more flexible to take input as args and return output, and let the caller decide on what gets printed
[18:47:24] eckhardt: has joined #ruby
[18:47:55] Exhiled: has joined #ruby
[18:49:20] truenito: has joined #ruby
[18:49:37] jrafanie: has joined #ruby
[18:52:33] orbyt_: has joined #ruby
[18:52:41] Sembei: has joined #ruby
[18:55:07] quobo: has joined #ruby
[18:55:56] tens0r: has joined #ruby
[18:55:58] _sfiguser: has joined #ruby
[18:57:11] Sparky: RickHull: You were saying that I don't have to "puts" in the function?
[18:58:24] RickHull: >> def handle_args(*args); arg1, arg2 = args; "arg1: #{arg1}, arg2: #{arg2}"; end; handle_args("Idaho", "Potato")
[18:58:25] ruby[bot]: RickHull: # => "arg1: Idaho, arg2: Potato" (https://eval.in/896493)
[18:59:03] baweaver: Sparky: also, what does puts return?
[18:59:15] RickHull: nothing will be printed in that case. if you want to print, you could: puts handle_args("Idaho", "Potato")
[18:59:35] Sparky: baweaver: puts returns the args
[18:59:49] baweaver: >> puts [1,2,3]
[18:59:50] ruby[bot]: baweaver: # => 1 ...check link for more (https://eval.in/896494)
[19:00:00] baweaver: check the actual return on the eval.in :)
[19:00:14] baweaver: It's sneaky
[19:00:28] baweaver: >> puts([1,2,3]).nil?
[19:00:29] ruby[bot]: baweaver: # => 1 ...check link for more (https://eval.in/896495)
[19:01:31] Sparky: So if I got rid of puts "arg1: #{arg1}, arg2: #{arg2}" .......
[19:02:03] Sparky: It just doesn't print it
[19:02:38] Xiti: has joined #ruby
[19:02:54] eckhardt: has joined #ruby
[19:04:02] stoopidmunkey: has joined #ruby
[19:04:18] RickHull: notice in my example, a string is returned
[19:04:24] RickHull: I did not omit the entire line
[19:04:38] RickHull: also, I used ruby's implicit return. you could swap your `puts` for `return`
[19:05:09] krawchyk: has joined #ruby
[19:07:25] Sparky: RickHull: So in RUby there is usually more than 1 way to do the same thing, right?
[19:07:52] eckhardt: has joined #ruby
[19:08:18] RickHull: yes, from ruby's perl heritage: https://en.wiktionary.org/wiki/TMTOWTDI#English
[19:08:49] RickHull: in contrast, python prefers a single obvious way to do it
[19:09:05] ur5us: has joined #ruby
[19:09:23] Sparky: RickHull: So instead of doing handle_args(args*) ....... You could have done: handle_args(arg1, arg2) , right?
[19:09:29] RickHull: ruby is somewhat in the middle. there is usually a preferred way to do it :)
[19:09:46] RickHull: yes -- though your splat is in the wrong place
[19:09:57] Sparky: Is my splat showing?
[19:10:22] RickHull: *args is more flexible -- it means the function will accept any number of args
[19:10:34] RickHull: whereas the 2nd version will reject a call with 1 arg or 3 args
[19:11:07] Sparky: could you not do: handle_args(arg1, arg2, arg3) ?
[19:11:43] conta3: has joined #ruby
[19:11:50] RickHull: yes, though now you don't have the 2 arg function anymore
[19:12:11] cschneid_: has joined #ruby
[19:12:19] RickHull: er -- if you mean to def handle_args(arg1, arg2, arg3) it will overwrite the previous definition
[19:12:28] Sparky: Are you sure it will reject it? in the example I did, I used: https://gist.github.com/Dasms/fb348d10f9fabb064b567f0a4edaaeaf
[19:12:32] RickHull: if you mean to call: handle_args(arg1, arg2, arg3) -- that call will be rejected
[19:13:12] RickHull: i think there is some confusion over the definition of the function vs calling it
[19:13:32] RickHull: which handle_args definition are you asking about? def handle_args(*args) ?
[19:13:44] RickHull: in that definition, you may call it with any number of args
[19:14:25] RickHull: if instead: def handle_args(arg1, arg2) then a call with 3 args will be rejected
[19:14:42] cdg: has joined #ruby
[19:14:43] Sparky: OH! Because it only defines 2
[19:14:50] Sparky: Is that right?
[19:14:55] RickHull: pretty much
[19:15:03] jrp932: has joined #ruby
[19:17:45] FrostCandy: has joined #ruby
[19:18:50] Dimik: has joined #ruby
[19:21:00] cdg: has joined #ruby
[19:23:01] cschneid_: has joined #ruby
[19:23:16] jenrzzz: has joined #ruby
[19:24:42] ramfjord: has joined #ruby
[19:28:27] stephh: has joined #ruby
[19:29:28] troulouliou_dev: has joined #ruby
[19:30:21] cschneid_: has joined #ruby
[19:31:17] cdg_: has joined #ruby
[19:37:27] cdg: has joined #ruby
[19:42:26] tomphp: has joined #ruby
[19:43:43] ramfjord: has joined #ruby
[19:43:47] hays_: has joined #ruby
[19:50:27] stephh: has joined #ruby
[19:53:23] troulouliou_dev: has joined #ruby
[19:56:05] KeyJoo: has joined #ruby
[19:59:32] duckpuppy: has joined #ruby
[20:03:51] tomphp: has joined #ruby
[20:04:19] pche: has joined #ruby
[20:06:41] stoopidmunkey: has joined #ruby
[20:09:47] cagomez: has joined #ruby
[20:14:22] stoopidmunkey: has joined #ruby
[20:16:45] troulouliou_div2: has joined #ruby
[20:18:48] coffeecupp: has joined #ruby
[20:18:52] tcpdump: Anyone know if theres a rails app to show connections, threads, etc in real time
[20:19:22] jenrzzz: has joined #ruby
[20:21:04] coffeecupp: has joined #ruby
[20:25:01] ule: Like NewRelic does?
[20:26:09] RickHull: I would expect there is lots of stuff in the metrics/stats space
[20:27:08] minimalism: has joined #ruby
[20:28:20] ^mtkd: has joined #ruby
[20:29:24] RickHull: as for real time, what kind of latency is acceptable? the lower the latency, the more impact the monitoring itself has, generally
[20:30:42] RickHull: are you ok with stats that refresh on a page load? or do you need constantly updating javascript stuff?
[20:30:46] jrafanie: has joined #ruby
[20:32:15] RickHull: probably you want your production rails machine fairly clean and serving your production app. and something like collectd or statsd gathering metrics and making them available to your monitoring app on another machine
[20:32:21] dkotlica: has joined #ruby
[20:32:52] RickHull: though this implies some amount of latency and batching -- but minimizes impact on the production machine
[20:34:51] nofxx__: has joined #ruby
[20:35:56] impermanence: arr = [ "string1", ... , "stringN" ] ; def installer mod ... exec "command #{mod}" end ; arr.each { |e| installer e }
[20:36:02] impermanence: exec only runs once. why?
[20:36:12] dkotlica: has left #ruby: ("Leaving")
[20:37:42] impermanence: I can post a gist but I figure this is stupidly obvious on my end or something
[20:38:28] JBbanks: has joined #ruby
[20:39:23] jhass: impermanence: exec replaces the current process
[20:39:56] jhass: you're looking for system or backticks
[20:40:02] impermanence: jhass: huh. so subshell then?
[20:40:31] mson: has joined #ruby
[20:42:26] jhass: or maybe spawn
[20:42:47] dminuoso: impermanence: https://i.stack.imgur.com/1Vuvp.png
[20:43:50] impermanence: dminuoso: yeesh, well, that answers what would've been my next question. Thanks!
[20:49:51] michael1: has joined #ruby
[20:50:56] impermanence: it's working :) yay.
[20:53:32] jenrzzz: has joined #ruby
[20:55:07] growp: has joined #ruby
[20:55:27] growp: I️ want to make a mastermind game in ruby
[20:55:53] growp: How can I️ make it so it will display colored pegs in the command line?
[20:58:00] jhass: google for ansi escape codes
[20:59:07] ta: has joined #ruby
[21:02:23] paul0: has joined #ruby
[21:03:43] tomphp: has joined #ruby
[21:04:29] baweaver: or use the Ruby Rainbow gem (which uses them)
[21:06:59] workmad3: has joined #ruby
[21:07:33] jrafanie: has joined #ruby
[21:08:46] cdg: has joined #ruby
[21:09:12] ur5us: has joined #ruby
[21:09:58] cdg_: has joined #ruby
[21:10:32] growp: has joined #ruby
[21:11:16] cagomez: has joined #ruby
[21:11:32] cdg: has joined #ruby
[21:13:04] xco: has joined #ruby
[21:14:57] cagomez: has joined #ruby
[21:18:47] cdg: has joined #ruby
[21:19:26] cdg_: has joined #ruby
[21:20:33] fishcooker: has joined #ruby
[21:22:16] nolakat: has joined #ruby
[21:25:23] selim: has joined #ruby
[21:28:03] orbyt_: has joined #ruby
[21:30:19] alfiemax: has joined #ruby
[21:32:21] nolakat: has joined #ruby
[21:33:53] alex``: has joined #ruby
[21:36:47] camilasan: has joined #ruby
[21:39:46] mostlybadfly: has joined #ruby
[21:44:44] nolakat: has joined #ruby
[21:46:47] waveprop: has joined #ruby
[21:47:06] vipaca: has joined #ruby
[21:48:46] ap4y: has joined #ruby
[21:49:12] Coldbla1: has joined #ruby
[21:53:03] Emmanuel_Chanel: has joined #ruby
[21:54:12] milardovich: has joined #ruby
[21:54:32] stephh: has joined #ruby
[21:54:59] apeiros_: has joined #ruby
[21:57:48] coffeecupp: has joined #ruby
[22:00:18] paul0: has joined #ruby
[22:00:25] SeepingN_: has joined #ruby
[22:01:19] David_H__: has joined #ruby
[22:02:39] charliesome: has joined #ruby
[22:02:52] milardovich: has joined #ruby
[22:03:06] ta: has joined #ruby
[22:04:46] shinnya: has joined #ruby
[22:05:22] ramfjord: has joined #ruby
[22:06:34] hahuang65: has joined #ruby
[22:07:24] enterprisey: has joined #ruby
[22:10:37] ramfjord: has joined #ruby
[22:14:39] ap4y: has joined #ruby
[22:15:39] ap4y1: has joined #ruby
[22:15:53] waveprop: can i ask another Rack question in here
[22:16:06] paul0: has joined #ruby
[22:16:23] ruby[bot]: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[22:16:36] waveprop: thx RickHull
[22:16:44] ruby[bot]: nomnomnomnom
[22:17:27] milardovich: has joined #ruby
[22:19:52] Technodrome: has joined #ruby
[22:20:27] sepp2k: has joined #ruby
[22:20:36] Psybur: has joined #ruby
[22:22:30] jrafanie: has joined #ruby
[22:22:43] sonOfRa: has joined #ruby
[22:23:21] alfiemax: has joined #ruby
[22:23:33] milardovich: has joined #ruby
[22:24:12] waveprop: i have one middleware setting some headers, status, and body like in the last part of the call method here, and it works fine ====>>>> https://gist.github.com/anonymous/e3b079deeec02933b6555a6d20e93231
[22:24:36] jrp93: has left #ruby: ("Leaving")
[22:26:00] tao_: has joined #ruby
[22:26:09] waveprop: but when i do it again in an other middleware, the application just returns an object called Rack::BodyProxy. here's the offending middleware, with the problematic part commented out ====>>>> https://gist.github.com/anonymous/4c927c789208149f05388140f76fb147
[22:27:22] tvw: has joined #ruby
[22:27:31] waveprop: so i searched the fine web, and found this fine document ====>>>> https://rubyplus.com/articles/2121-Web-Development-in-Ruby-Middleware-in-Rack-Apps
[22:28:19] Lytol: has joined #ruby
[22:28:26] kies: has joined #ruby
[22:29:02] waveprop: which says that @response.body is an instance of the Response object
[22:30:10] waveprop: but in the second gist, for encode.rb, with the currently not-commented code, i am able to push strings onto response
[22:30:33] waveprop: why cant i encode(response)
[22:31:51] RickHull: what does @response.finish return?
[22:32:44] waveprop: it returns the rack triplet, [200, {header, another_header}, [<i'm_the_body />]]
[22:32:59] RickHull: ok -- I haven't messed with rack in a while
[22:33:14] waveprop: it's pretty cool
[22:34:27] RickHull: encode(response) would call response.to_json right?
[22:34:38] waveprop: yeah that's right
[22:34:49] RickHull: so is that a problem, or ?
[22:34:51] steph__: has joined #ruby
[22:35:56] waveprop: sorry, so it's working as is. but in encode.rb, i need to also set a header, for Content-Type, with the string containing "application/" and "json" in this case
[22:36:13] waveprop: which is why i have to use the @response.set_header method
[22:36:31] waveprop: and when you use that one, you have to also call @response.finish
[22:37:00] waveprop: and that handles sending the triplete, so i'll have to comment out the lines which currently manually return the triplet
[22:37:16] RickHull: is that a problem? why are you bypassing the @response thing?
[22:38:32] stephh: has joined #ruby
[22:38:50] waveprop: becaus when i bypass @response, it works. that's one way to do it with rack, you can just manually return the triplet. The problem is that in encode.rb, the app returns an object called Rack::BodyProxy when i _dont_ bypass the @response way. make sense?
[22:38:58] aScottishBoat: has joined #ruby
[22:39:27] waveprop: and this is confusing because the exact same @resposne code works in the other middleware
[22:39:38] RickHull: so your first gist works fine by returning @response.finish
[22:39:54] waveprop: so it seems like i cant encode response because it is some sort of object?
[22:39:57] RickHull: but your second gist behaves differently when @response is used similarly?
[22:40:01] waveprop: thats correct
[22:40:26] RickHull: what is `response` (not `@response`)
[22:40:47] RickHull: return value from @app.call
[22:40:50] xco: has joined #ruby
[22:40:56] RickHull: is it a string?
[22:41:12] waveprop: i think its an array, let me inspect
[22:41:14] RickHull: a Response object?
[22:41:35] waveprop: could be a Response object, i suspect if it is then thas the prob?
[22:41:55] kryptoz: has joined #ruby
[22:43:17] stephh: has joined #ruby
[22:43:49] mim1k: has joined #ruby
[22:44:01] waveprop: its a hash, or a string, depending what the app at the bottom of the middleware stack does
[22:44:17] RickHull: the most common thing to call .to_json on is a Hash
[22:44:36] RickHull: rarely does it make sense to call it on a string, and sometimes an array
[22:44:43] jottr: has joined #ruby
[22:44:52] waveprop: okay. i could have the app at the bottom of the stack just always return a hash
[22:45:09] RickHull: well... i don't quite know what all of this is doing
[22:45:34] RickHull: what is that app doing?
[22:45:34] waveprop: it's just a simple database auth server which returns false or a hash of user data
[22:45:49] waveprop: which speaks json and i want to add yaml and xml
[22:46:05] RickHull: ok, probably you should stick to a single format for the return value
[22:46:11] RickHull: or else make sure you are checking for that false
[22:46:32] RickHull: it can be kind of tricky to decide on the right error handling strategy or what qualifies as an error
[22:46:45] waveprop: good idea. i'll just nest the user data hash
[22:46:49] RickHull: but if you intend to send the failed auth thingie back to the json client, then probably send a hash.to_json
[22:47:02] waveprop: yeah that's my intent
[22:47:32] RickHull: btw, if you want a fun json client: https://github.com/rickhull/mudbug/
[22:47:45] RickHull: also has provisional support for yaml
[22:47:46] ledestin: has joined #ruby
[22:48:19] David_H_Smith: has joined #ruby
[22:48:23] waveprop: thanks RickHull. i'll see if always returning a hash helps. i still need to read up on BodyProxy. i'm confused about why it's being mentioned, i thought you had to manually use that method...
[22:48:35] waveprop: very cool, i'll look at your client! thanks
[22:49:20] RickHull: oops, no provisional yaml support
[22:49:24] RickHull: wrong project :)
[22:49:33] mkroman: has joined #ruby
[22:49:44] mkroman: has joined #ruby
[22:51:46] ta: has joined #ruby
[22:51:59] aScottishBoat: has joined #ruby
[22:55:55] jottr: has joined #ruby
[22:58:08] selim: has joined #ruby
[22:58:42] milardovich: has joined #ruby
[22:59:40] coffeecupp: has joined #ruby
[22:59:55] Technodrome: has joined #ruby
[23:01:13] Psybur: has joined #ruby
[23:02:16] mtkd: has joined #ruby
[23:02:54] jphase: has joined #ruby
[23:03:36] jrafanie: has joined #ruby
[23:04:50] vipaca: has joined #ruby
[23:05:28] thinkpad: has joined #ruby
[23:06:24] charliesome: has joined #ruby
[23:10:54] bmurt: has joined #ruby
[23:14:27] jphase: has joined #ruby
[23:18:01] jphase_: has joined #ruby
[23:19:01] aScottishBoat: I just want to say that I love Ruby, and I am very fond of our community. Thanks for being great y'all
[23:20:24] RickHull: I blame tenderlove <3
[23:24:22] jphase: has joined #ruby
[23:24:26] Psybur: has joined #ruby
[23:26:52] jackjackdripper: has joined #ruby
[23:27:16] SeepingN: has joined #ruby
[23:32:42] naprimer2: has joined #ruby
[23:34:17] coffeecupp: has joined #ruby
[23:35:50] jphase: has joined #ruby
[23:37:40] jphase_: has joined #ruby
[23:47:22] wolfshappen: has joined #ruby
[23:50:58] ramfjord: has joined #ruby
[23:51:51] tomphp: has joined #ruby
[23:54:19] baweaver: I blame _why
[23:55:22] orbyt_: has joined #ruby
[23:57:56] ramfjord: has joined #ruby