« Back to channel list

#ruby - 27 October 2017

« Back 1 day Forward 1 day »
[00:00:35] axisys: need help with installing rvc.. I am getting nokogiri requires Ruby version >= 2.1.0 .. but then it will break puppet .. on centos 7
[00:00:39] jrabe: has joined #ruby
[00:00:54] axisys: let me know if I should really taking it over to #centos channel
[00:01:02] axisys: s/taking/take/
[00:01:16] vtx: has joined #ruby
[00:02:16] hotpancakes: has joined #ruby
[00:03:58] RickHull: you can use a prior version of Nokogiri maybe, but watch out for CVEs
[00:04:26] RickHull: if you want to avoid Centos system dependencies, you can build out your entire ruby environment pretty easily, for certain values of easily
[00:06:02] RickHull: probably you want to check with #centos first
[00:06:16] RickHull: you won't get much help in here for ruby < 2.2
[00:06:41] latemus: i am writing a rack application. so i'm coding everthing in a class. i'd like to create methods within the class, and use them within the class. is this possible?
[00:07:23] chmurifree: has joined #ruby
[00:07:46] latemus: i can't seem to figure out the convention for calling methods within the class itself so they run when the class is instatniated. what should i look up.
[00:08:11] alnewkirk: has joined #ruby
[00:09:21] axisys: RickHull: yes if I upgrade ruby .. then puppet will fail
[00:09:46] RickHull: axisys: almost certainly the recent versions of puppet run fine on ruby 2.4+
[00:09:59] axisys: puppet for centos 7 based on //yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
[00:10:32] RickHull: you could just run whatever ruby you want, and `gem install puppet`
[00:11:12] RickHull: (presumably) if you want to deal with centos dependencies, then check with #centos
[00:12:39] Ropeney: has joined #ruby
[00:12:57] axisys: hmm.. did not think of `gem install puppet'
[00:13:17] RickHull: well, be careful mixing centos packages with newer gems
[00:13:21] axisys: RickHull: let me try on a centos 7 VM
[00:14:14] fmcgeough: has joined #ruby
[00:17:16] alnewkirk: has joined #ruby
[00:18:09] axisys: so on a fresh new centos 7 VM .. obviously there is no gem
[00:18:31] axisys: so installing yum install -y rubygems installs a olderversion
[00:18:47] axisys: can gem upgrade itself from there? like pip?
[00:20:07] RickHull: gem update --system
[00:20:12] RickHull: or gem install rubygems-update
[00:20:22] RickHull: (last I checked, and sudo as necessary)
[00:20:30] cdg: has joined #ruby
[00:21:11] axisys: btw, this is what I meant.. http://dpaste.com/0CHWEVT.txt
[00:22:52] axisys: ok.. so gem update --system got me to 2.6.14 .. now gem install rvc says missing ruby.h .. do I install the header files with gem or yum?
[00:23:27] RickHull: who owns `which ruby` ?
[00:23:40] RickHull: if it's yum's ruby, then you'll want something like ruby-devel package
[00:23:48] lordpdd: has joined #ruby
[00:23:57] RickHull: i mean, what subsystem
[00:24:09] RickHull: it's possible you installed your own ruby, e.g. with ruby-build or ruby-install
[00:24:16] RickHull: presumably it's yum's ruby
[00:24:56] eckhardt: has joined #ruby
[00:25:37] RickHull: yeah, so try to find the development packages for yum's ruby
[00:25:44] axisys: ruby-devel
[00:26:24] axisys: so back to same error.. nokogiri requires Ruby version >= 2.1.0.
[00:26:27] RickHull: latemus: can you paste your attempts?
[00:26:52] RickHull: and there is no newer ruby for centos 7?
[00:27:05] RickHull: ruby2.2 or something maybe?
[00:27:14] Technodrome: has joined #ruby
[00:27:19] RickHull: what is your ruby --version ?
[00:28:22] axisys: doing a yum upgrade
[00:30:20] lordpdd: what's a good place to ask a question about activerecord?
[00:30:51] alnewkirk: has joined #ruby
[00:30:53] Devalo: has joined #ruby
[00:31:14] axisys: RickHull: still 2.0
[00:33:02] RickHull: lordpdd: here or #rubyonrails
[00:33:14] RickHull: axisys: you will probably want a newer ruby. 2.0 way EOL
[00:34:15] RickHull: you can install one in your homedir pretty easily
[00:34:43] axisys: RickHull: I need to use rvc for a whole team ..
[00:35:02] RickHull: i would upgrade centos or look for a newer ruby package
[00:35:09] axisys: RickHull: I did
[00:35:16] RickHull: i mean, to a newer centos
[00:35:27] axisys: RickHull: yum upgrade does that
[00:35:29] RickHull: ruby 2.0 is like 7 years old maybe?
[00:35:40] RickHull: recent centos should be running 2.4
[00:35:45] RickHull: check on that
[00:35:52] axisys: RickHull: let me check with #centos.. thanks
[00:39:57] alnewkirk: has joined #ruby
[00:47:59] PresidentBiscuit: has joined #ruby
[00:52:32] coderphive: has joined #ruby
[00:54:10] RickHull: ruby 2.0 was released early 2013, it's not *that* old, but it is EOL
[00:57:33] lordpdd: I'm using AR 3.2 and I'm having a problem with `serialize :field, JSON` - it works locally but on other machines/servers I get a JSON parsing error "JSON::ParserError: input must be a string or IO" has anyone had this issue before?
[00:58:03] alnewkirk: has joined #ruby
[00:58:45] zanoni: I'm not that familiar with rack but the error I keep getting shows this GET request, and it's like the two paths are merged, yet I see nothing about the route in it - 2017-10-27 00:54:20 +0000: Rack app error handling request { GET /vagrant/TestRails/MediaExplorer/vagrant/TestRails/Music/Bugg.....}
[01:04:40] alfiemax: has joined #ruby
[01:07:10] alnewkirk: has joined #ruby
[01:14:18] brian_penguin: has joined #ruby
[01:16:20] alnewkirk: has joined #ruby
[01:19:25] Megamosaren: has joined #ruby
[01:25:29] juggler: has joined #ruby
[01:26:55] d^sh: has joined #ruby
[01:28:31] ogres: has joined #ruby
[01:30:03] alnewkirk: has joined #ruby
[01:30:43] coderphive_: has joined #ruby
[01:34:26] thomasv314: has joined #ruby
[01:37:03] uZiel: has joined #ruby
[01:38:04] enterprisey: has joined #ruby
[01:41:18] coderphive: has joined #ruby
[01:41:40] bwilson: has joined #ruby
[01:43:45] halt: has joined #ruby
[01:43:50] alnewkirk: has joined #ruby
[01:44:21] coderphive: has joined #ruby
[01:48:18] gizmore: has joined #ruby
[01:52:39] fullstack: has joined #ruby
[01:57:35] alnewkirk: has joined #ruby
[01:59:53] QualityAddict: has joined #ruby
[02:01:32] joker5bb: has joined #ruby
[02:07:45] Jameser: has joined #ruby
[02:09:39] code_zombie__: has joined #ruby
[02:10:36] orbyt_: has joined #ruby
[02:11:04] alfiemax: has joined #ruby
[02:11:23] alnewkirk: has joined #ruby
[02:15:36] joker5bb: has joined #ruby
[02:16:38] MrBusiness: has joined #ruby
[02:20:13] alfiemax: has joined #ruby
[02:21:17] guardianx: has joined #ruby
[02:22:08] vipaca: has joined #ruby
[02:23:39] mn3m: has joined #ruby
[02:24:49] govg: has joined #ruby
[02:25:56] astrobunny: has joined #ruby
[02:26:15] ArtCorvelay: has joined #ruby
[02:26:22] astrobunny: has joined #ruby
[02:27:36] tastytf: has joined #ruby
[02:28:04] kies: has joined #ruby
[02:29:06] enterprisey: has joined #ruby
[02:29:22] Iambchop: axisys: there is a newer package for ruby in the scl repos: https://www.softwarecollections.org/en/scls/rhscl/rh-ruby23/
[02:38:46] alnewkirk: has joined #ruby
[02:52:30] alnewkirk: has joined #ruby
[03:00:10] cadillac_: has joined #ruby
[03:05:37] jidar: rhel 7.4 defaults to ruby Version : 2.0.0.648, Release : 30.el7
[03:05:46] jidar: where that actually is, I do not know
[03:05:55] jidar: and yea, there's the SCL repos
[03:06:03] alfiemax: has joined #ruby
[03:06:17] alnewkirk: has joined #ruby
[03:06:27] RickHull: is there some Bill Gates like figure at the top of Red Hat we can shake our collective fists at?
[03:07:14] RickHull: jidar: this sort of thing is why (docker, rvm, chruby, etc) exist
[03:07:21] RickHull: debian, arch, etc
[03:07:31] RickHull: fedora too I guess
[03:07:48] cschneid_: has joined #ruby
[03:08:44] RickHull: jidar: what about the epel repos?
[03:09:50] RickHull: ACTION casts package.r(epel)
[03:11:57] DTZUZO: has joined #ruby
[03:14:23] EXCHGR: has joined #ruby
[03:16:28] RickHull: jidar: I would suggest using ruby-install to install some rubies to /opt/rubies, owned by root
[03:16:52] jidar: hurm? I don't have any issue with my versions, I was simply adding information to the conversation ;)
[03:17:05] RickHull: and use sudo gem install from there, and make sure your users update their login environments and paths accordingly
[03:17:26] RickHull: jidar: oh, carry on :)
[03:19:24] Technodrome: has joined #ruby
[03:23:06] gix: has joined #ruby
[03:24:33] alnewkirk: has joined #ruby
[03:33:05] guacamole: has joined #ruby
[03:36:14] uZiel: has joined #ruby
[03:42:53] alnewkirk: has joined #ruby
[03:52:10] bmurt: has joined #ruby
[03:56:39] alnewkirk: has joined #ruby
[04:05:52] alnewkirk: has joined #ruby
[04:06:02] alfiemax_: has joined #ruby
[04:12:50] rideh: has joined #ruby
[04:14:59] alnewkirk: has joined #ruby
[04:20:18] kapil___: has joined #ruby
[04:25:22] RickHull: what's the right way to get sudo gem install working with chruby? sudo bash, then go in root's environment?
[04:26:10] RickHull: like, have a protected set of ruby environments in /opt (or wherever)
[04:26:17] RickHull: only root can update
[04:26:35] RickHull: and users can opt in to *wink*
[04:27:22] RickHull: s/root/wheel group/ # yada yada
[04:28:45] alnewkirk: has joined #ruby
[04:29:31] fullstack: has joined #ruby
[04:29:32] Technodrome: has joined #ruby
[04:31:17] Devalo: has joined #ruby
[04:31:33] nofxx: has joined #ruby
[04:33:48] quobo: has joined #ruby
[04:35:10] cdg: has joined #ruby
[04:42:32] alnewkirk: has joined #ruby
[04:42:57] bruno-_: has joined #ruby
[04:43:21] cschneid_: has joined #ruby
[04:43:29] dminuoso: RickHull: It's just a function (which should have been more appropriately named nth or nthP): def nth(n) -> (e) { e[n] }; end
[04:43:42] dminuoso: Sorry about the delay, apparently the human body requires sleep every 24 hours.
[04:43:57] RickHull: the beatings will continue until morale improves
[04:44:08] dminuoso: So it's basically the array analog of a path.
[04:45:09] RickHull: ah cool. I'm with you that elixir is nicer for this style
[04:45:16] dminuoso: RickHull: You can also define Integer#to_proc instead. It allows for fun things such as: list.map(&0) or list.map(&nth(0)
[04:45:26] dminuoso: RickHull: No its not. Ever tried doing function composition with elixir?
[04:45:50] dminuoso: RickHull: Is there a way as concise as my Proc#* ? :-)
[04:46:00] RickHull: I haven't looked at this in a while: https://github.com/rickhull/conway_deathmatch/tree/elixir
[04:46:12] RickHull: it might not build
[04:47:15] dminuoso: RickHull: |> is basically just a poor mans excuse for having no function composition. ;-)
[04:49:07] dminuoso: Well, we will get it in ruby 2.5 :P
[04:49:26] dminuoso: The less elegant version of it, but we will have a ruby version of |> soon. :)
[04:50:09] dminuoso: Though I really do wish Elixir had the power to compose two functions together easily without creating some helper module R with some function compose, R.compose(A.func, B.func) is just horrid.
[04:52:54] RickHull: on a scale of php to unicorns and rainbows, where is horrid?
[04:53:21] dminuoso: RickHull: Around Perl.
[04:53:29] k3rn31: has joined #ruby
[04:53:51] RickHull: i hear good things about perlnukem 6
[04:54:09] dminuoso: I've even seen fancy ruby constructs such as: R. aFunc . bFunc
[04:54:27] dminuoso: Where method_missing is overloaded to return certain proxy objects
[04:54:41] dminuoso: (Which would compose)
[04:55:16] dminuoso: Which is stronger than Proc#* because you can freely compose methods without having to build procs/lambdas from them
[04:55:40] baweaver: so there's a method to the madness?
[04:56:02] RickHull: the story of ruby
[04:56:09] enterprisey: has joined #ruby
[04:56:16] alnewkirk: has joined #ruby
[04:58:07] armyriad: has joined #ruby
[05:01:34] RickHull: dminuoso: where I'm returning from a block, how can I make the lambda approach work better?
[05:02:18] dminuoso: RickHull: Last night I was sure you could tackle those .each things with transducers more elegantly.
[05:02:55] RickHull: i vaguely understood transducers like 6 months ago
[05:03:18] DarkBushido: has joined #ruby
[05:03:19] DarkBushido: has joined #ruby
[05:03:25] RickHull: haven't thought about that in a while
[05:04:04] rideh: has joined #ruby
[05:04:08] RickHull: i'm not happy with #bf_search and #df_search, they feel rough but sufficient
[05:04:33] dminuoso: RickHull: Let me emphasize again that this was just a personal opinion. Your code looked very clean.
[05:04:48] RickHull: i'm looking for enhancements
[05:04:50] RickHull: PRs welcome :)
[05:04:52] cout: has joined #ruby
[05:05:28] alnewkirk: has joined #ruby
[05:06:43] dminuoso: RickHull: https://medium.com/@roman01la/understanding-transducers-in-javascript-3500d3bd9624
[05:07:04] dminuoso: Ignore the fact that its in JS, its one of the better articles on the subject.
[05:07:17] RickHull: what about monads in ruby, what is the signature?
[05:07:32] dminuoso: RickHull: Something where #flat_map makes sense on.
[05:07:46] RickHull: hm, that's new here
[05:07:48] dminuoso: For Ruby that only applies to Array (which is a full fledged monad)
[05:08:37] RickHull: what is the test for monadry in ruby?
[05:09:02] epochwolf: has joined #ruby
[05:09:05] RickHull: i can see where Array#flat_map makes sense
[05:09:11] dminuoso: RickHull: You identify whether it is indeed a monadic object in the category of endofunctors.
[05:09:22] RickHull: endofunctors? *barf*
[05:10:17] dminuoso: RickHull: Endofunctors are basically things where .map makes sense on. ;-)
[05:10:31] RickHull: Enumerables, kinda?
[05:10:33] dminuoso: (That is a simplified version, but it works well enough for programming)
[05:10:37] cschneid: has joined #ruby
[05:10:58] aphelion: has joined #ruby
[05:11:08] dminuoso: RickHull: the idea of map is not about iterating. its about applying a function to "its content"
[05:11:33] dminuoso: with x and y being functions, yes.
[05:12:20] RickHull: what about f(x) = x^3
[05:12:30] RickHull: is that a map? or an endofucntor?
[05:12:50] dminuoso: RickHull: Neither.
[05:12:56] anisha_: has joined #ruby
[05:13:03] RickHull: seems pretty close
[05:13:10] dminuoso: RickHull: think of an endofunctor as any type of object that can "contain values" in *some* form
[05:13:15] dminuoso: For example: Array can contain many values
[05:13:19] dminuoso: Box can contain one value
[05:13:25] Apocalypse: has joined #ruby
[05:13:27] dminuoso: Maybe *may* contain a value, but perhaps it doesnt.
[05:13:34] dminuoso: Future contains a value (in the future)
[05:14:07] dminuoso: And in each case map would apply a function to "its content", satisfying the special property of the type (array having many, Future having one.. in the future, maybe possibly having none)
[05:14:44] dminuoso: Any such type that can contain values, and apply functions to its content (via map) is basically an endofunctor - or short "functor" (when programmers say functor they always mean endofunctor)
[05:15:35] RickHull: "a generic container class" but not really
[05:15:57] RickHull: what's wrong with that idea?
[05:16:30] aupadhye: has joined #ruby
[05:19:13] alnewkirk: has joined #ruby
[05:19:34] RickHull: f(x) = x^3 is the map part, container class is the endofunctor part
[05:20:13] RickHull: i would think Enumerable is monadic (sp?)
[05:20:25] Dimik: has joined #ruby
[05:20:41] RickHull: what disqualifies Enumerable from monadry?
[05:21:33] LocaMocha: has joined #ruby
[05:24:28] dminuoso: RickHull: In reality there are many more endofunctors, but that is at least one type that we usually concern us ourselves with as programmers.
[05:24:46] dminuoso: RickHull: In addition that #map must follow some axioms
[05:25:08] dminuoso: If * is function composition, then .map(f * g) must be the same as .map(g).map(f) in ruby terms (this is called a covariant functor)
[05:25:37] dminuoso: Or if its a contravariant functor, then .map(f * g) must be the same as .map(f).map(g)
[05:25:54] dminuoso: (Function composition is in reverse direction, so f * g would be `f after g`)
[05:26:23] RickHull: * is multiplication?
[05:26:33] dminuoso: Also .map(&:itself) must produce the same output unchanged.
[05:26:39] dminuoso: RickHull: Function composition
[05:26:57] dminuoso: Technically it should be written as .map(&(f * g)), .map(&f) and .map(&g) because ruby is stupid :P
[05:27:05] RickHull: oh duh, sorry, you said that already :)
[05:27:46] dminuoso: So basically the functor in addition respects the order of functions applied to its contents (whether you chain them through multiple invocations of map, or whether you compose them first, and then use it with map)
[05:28:14] AnoHito: has joined #ruby
[05:29:18] RickHull: so what about Enumerable?
[05:29:36] RickHull: how do we apply monadic theory or definitions?
[05:29:47] dminuoso: RickHull: The reason that `map` doesnt map values but rather the function is shadowed by the fact that ruby's map first maps the function, and immediately applies it to the 'container'
[05:30:24] jphase: has joined #ruby
[05:30:51] dminuoso: RickHull: Monads are kind of like functors, except in addition to #map they also support #flatten and follow some special laws.
[05:30:57] dminuoso: But they are hard to explain, they are far more easily "discovered" by yourself if you are told to do some certain things.
[05:31:32] RickHull: i recall in previous examinations, apply() is a sensible operation
[05:31:40] RickHull: (maybe errantly)
[05:31:56] astrobunny: has joined #ruby
[05:32:09] dminuoso: RickHull: ever done promises in JavaScript?
[05:32:44] RickHull: I've horsed around with them in Ruby or Elixir IIRC
[05:32:55] alnewkirk: has joined #ruby
[05:33:21] astrobun_: has joined #ruby
[05:33:33] aupadhye: has joined #ruby
[05:34:03] Technodrome: has joined #ruby
[05:34:10] LocaMocha: has joined #ruby
[05:36:13] dminuoso: RickHull: The thing about Enumerable is that strictly speaking you could construct classes that don't respect the axioms I mentioned: a.map(&(f * g)) == a.map(&g).map(&g) (or the other way around, but contravariant functors are somewhat rare in programming)
[05:36:15] dminuoso: But are still Enumerable.
[05:36:18] dminuoso: A random example: An unordered list.
[05:36:37] dminuoso: Would be quite enumerable, but it will *not* respect the order of composition in the slightest.
[05:36:47] RickHull: hm, sounds like a Bag
[05:36:56] RickHull: hm, order of composition?
[05:37:09] dminuoso: a.map(&(f * g)) == a.map(&g).map(&g)
[05:37:24] dminuoso: And if a = a.map(&:itself)
[05:37:38] RickHull: a.map(&f).map(&g) ?
[05:37:42] dminuoso: And if a == a.map(&:itself)
[05:37:42] dminuoso: Those are the basic requirements of a functor.
[05:37:55] dminuoso: a.map(&g).map(&f)
[05:38:16] dminuoso: Yours would be one of those really rare contravariant functors.
[05:38:40] dminuoso: (Not rare in mathematics, but rare in programming)
[05:39:07] RickHull: a.map(&:itself) -- no problem there right?
[05:39:24] RickHull: i mean, with a hypothetical Enumerable#itself
[05:39:35] dminuoso: RickHull: I wouldn't know?
[05:39:56] dminuoso: Object#itself exists.
[05:39:57] dminuoso: >> 1.itself
[05:39:58] ruby[bot]: dminuoso: # => 1 (https://eval.in/888040)
[05:39:59] RickHull: well presumably, I would think
[05:40:02] dminuoso: RickHull: The thing is, you could implement #each to call and then perhaps destroy objects.
[05:40:15] dminuoso: RickHull: So no. It doesn't naturally follow that a == a.map(&:itself)
[05:40:21] RickHull: >> [1,2,3].map { |i| i.itself } == [1,2,3]
[05:40:22] ruby[bot]: RickHull: # => true (https://eval.in/888041)
[05:40:45] dminuoso: ruby[bot]: Like I said: Array *is* a functor.
[05:40:45] dminuoso: So it respects that law.
[05:40:53] dminuoso: But you can think of constructions that do not.
[05:42:07] RickHull: so something tighter than Enumerable could be a Monad
[05:42:21] RickHull: and possibly broader or more expressive than an Array
[05:42:31] MrBismuth: has joined #ruby
[05:43:18] RickHull: monads are just arrays, who knew?!
[05:45:19] RickHull: dminuoso: I am being silly of course, somewhat devil's advocate. Thank you very much for this explanation!
[05:46:39] alnewkirk: has joined #ruby
[05:48:30] dminuoso: RickHull: I just thought of one.
[05:49:04] dminuoso: RickHull: Think about ObjectSpace, you could trivially implement Enumerable by defining .each to be .each_object
[05:49:16] RickHull: ACTION nod
[05:49:23] dminuoso: RickHull: And because I'm a bit evil, I define my own itself function like this:
[05:49:45] dminuoso: Or ignore it. Just assume that there's another thread in parallel creating objects.
[05:49:59] dminuoso: RickHull: Or just any unordered list
[05:50:02] Sammichmaker: has joined #ruby
[05:50:23] RickHull: i confused monad for functor or endofunctor above
[05:50:24] dminuoso: If no order is imposed, its random. So you could end up with something like list == list.map(&itself) evaluating to (1,2,3) == (1,3,2)
[05:50:37] RickHull: what is the relationship between these terms?
[05:50:47] dminuoso: RickHull: Every monad is also an endofunctor.
[05:51:27] dminuoso: RickHull: But that's not helpful.
[05:51:41] RickHull: how does endofunctor relate to functor?
[05:51:53] RickHull: might as well be talking ectoplasm ;)
[05:51:55] dminuoso: RickHull: Essentially a monad is an endofunctor equipped with #flatten (sometimes also called join) in addition
[05:52:07] dminuoso: (And following additional axioms wrt to join()
[05:52:16] RickHull: ACTION nod
[05:52:24] dminuoso: RickHull: But that is a really dull definition that is not helpful.
[05:52:33] RickHull: it helps circle in the beast
[05:52:41] dminuoso: The monad interface of Array for example models indeterministic computation.
[05:52:47] dminuoso: (Considering your library I expect you to know what that is)
[05:53:14] RickHull: i know what a NFA is
[05:54:19] RickHull: https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton
[05:54:56] andikr: has joined #ruby
[05:55:09] dminuoso: RickHull: Same idea
[05:55:30] RickHull: what is indeterministic about Array, and in- vs non- ?
[05:55:45] dminuoso: RickHull: It's not array that is indeterministic.
[05:55:57] alex``: has joined #ruby
[05:55:58] Silthias: has joined #ruby
[05:57:14] dminuoso: RickHull: https://gist.github.com/dminuoso/9fed2def767c2a5c7c8ed98ad726f697 is this trivial to understand?
[05:58:43] RickHull: yes, lovely, separate behavior from objectness
[05:58:47] RickHull: verbs from nouns
[05:59:05] ColeHub: has joined #ruby
[05:59:37] dminuoso: RickHull: So assume you have some [initialPosition], you can just call .map(&nextPosition) and you get an entire array of possible next positions.
[05:59:50] RickHull: yeah, a nice general interface
[05:59:53] RickHull: like REST/HTTP
[06:00:04] dminuoso: The idea is that you dont *know* which move the opponent will do, so you have no option but to compute an array of all simultaneously.
[06:00:13] dminuoso: And that is non-deterministic computation
[06:00:24] alnewkirk: has joined #ruby
[06:00:38] RickHull: hm, that is not satisfying. I could check them all in series in some order
[06:00:57] dminuoso: RickHull: Its not about efficiency, its just the concept.
[06:01:13] RickHull: expressing the parallelism of the problem?
[06:01:21] dminuoso: Yeah pretty much.
[06:01:37] dminuoso: RickHull: So until now this is just a functor. However you have a problem.
[06:01:45] dminuoso: What if you want to check all the possible layouts 2 moves from now?
[06:02:12] aufi: has joined #ruby
[06:02:12] dminuoso: Given some initial = [initialPosition], if you did initial.map(&nextPosition) you now have an array of an array of positions.
[06:02:31] dminuoso: So you can't simply to initial.map(&nextPosition).map(&nextPosition)
[06:03:04] dminuoso: So in order to do this, array is equipped with flat_map, (which is just map(...).flatten ), which can do this - thus modelling non deterministic computation
[06:03:29] RickHull: flatten jumbles things?
[06:03:40] dminuoso: RickHull: flatten knows how to peel off one layer
[06:03:51] dminuoso: It turns Array<Array<ChessboardPosition>> into Array<ChessboardPosition>
[06:04:13] RickHull: hm, sounds like curry
[06:05:37] RickHull: FWIW rfold and lfold are dim lightbulbs in the foggy recesses
[06:06:10] dminuoso: Wait, now we are talking about catamorphisms?
[06:06:19] RickHull: no, don't mind my ramblings
[06:07:17] alfiemax: has joined #ruby
[06:07:21] RickHull: I have dipped my toes into functional programming but not recently; been shaking the rust off here :)
[06:08:04] dminuoso: RickHull: What is important, is to understand is that Array is not naturally a functor or monad. It's possible that there's multiple functors or monads you can construct with Array.
[06:08:42] RickHull: that makes sense enough. I can imagine a contract, and Array happens to be able satisfy it in a simple way and possibly others
[06:09:11] dminuoso: Right. But most of the time there is only one useful thing to do.
[06:09:19] RickHull: and if EnumerableFunctor were a mixin like Enumerable but cared enough, it might satisfy all of the reqs
[06:09:36] dminuoso: RickHull: Such a thing would be called: OrderedList.
[06:09:38] imode: has joined #ruby
[06:09:49] dminuoso: Or rather, it would have to be an OrderedEnumerable
[06:09:52] RickHull: to me that is Enumerable in the platonic sense
[06:10:00] dminuoso: RickHull: Consider Set.
[06:10:09] dminuoso: A wildly underused class.
[06:10:20] dminuoso: It's an Enumerable, but unordered.
[06:10:32] RickHull: possibly enumerable rather than necessarily?
[06:10:46] RickHull: isn't the enumeration 0, 1, 2, 3 ... ?
[06:10:55] dminuoso: >> require 'set'; Set.ancestors
[06:10:56] ruby[bot]: dminuoso: # => [Set, Enumerable, Object, Kernel, BasicObject] (https://eval.in/888042)
[06:11:00] dminuoso: RickHull: It is unordered.
[06:11:15] RickHull: it doesn't guarantee an order?
[06:11:20] dminuoso: That's what unordered means.
[06:11:34] dminuoso: You have to assume the order is random everytime you iterate.
[06:11:45] RickHull: i have a sense that Enumerable means top to bottom
[06:11:52] RickHull: we can assign a number to it
[06:11:57] RickHull: and sort on it
[06:12:03] dminuoso: RickHull: Nope, Enumerable just means you can iterate over it.
[06:12:09] dminuoso: RickHull: Which implies you can do things such as filtering
[06:12:14] dminuoso: (Because you can inspect each object)
[06:12:20] RickHull: i mean enumerable in the platonic sense
[06:12:29] RickHull: am I wrong there?
[06:12:33] dminuoso: RickHull: You are.
[06:12:46] RickHull: boo! *shakes fist*
[06:13:38] RickHull: so just countable basically
[06:13:43] RickHull: and we define #each
[06:14:08] alnewkirk: has joined #ruby
[06:14:18] banisterfiend: has joined #ruby
[06:14:35] RickHull: so what about unordered nondeterministic cool things? do they get a cool name?
[06:14:47] dminuoso: RickHull: The best example to get a good grasp of what monads are, is to keep the non-deterministic computation in mind (where your computation function takes an input, and generates an array of results), and then study JavaScript promises.
[06:14:49] RickHull: it seems like a nice property
[06:15:17] dminuoso: Or implement a logger done the functional programming way.
[06:15:26] dminuoso: You will invent the monad yourself.
[06:16:22] cschneid_: has joined #ruby
[06:16:23] RickHull: all of functional programming is just take the problem, split it into parts, solve them (map), and then join back together (reduce)
[06:16:46] RickHull: it's like a burrito, right?
[06:17:26] cschneid_: has joined #ruby
[06:20:02] guacamole: has joined #ruby
[06:20:47] snickers: has joined #ruby
[06:20:58] Silthias1: has joined #ruby
[06:22:36] RickHull: ACTION removes tongue from cheek
[06:22:42] RickHull: it's late, thanks again, cheers!
[06:26:43] ltem: has joined #ruby
[06:31:18] mjolnird: has joined #ruby
[06:33:43] dionysus69: has joined #ruby
[06:34:37] rabajaj: has joined #ruby
[06:34:50] conta: has joined #ruby
[06:37:03] alnewkirk: has joined #ruby
[06:40:45] apeiros_: has joined #ruby
[06:50:48] alnewkirk: has joined #ruby
[06:57:27] mim1k: has joined #ruby
[06:59:26] ajaysingh: has joined #ruby
[06:59:59] alnewkirk: has joined #ruby
[07:06:21] |ifei5g00d: has joined #ruby
[07:13:01] oetjenj: has joined #ruby
[07:13:47] alnewkirk: has joined #ruby
[07:20:49] claudiuinberlin: has joined #ruby
[07:23:02] alnewkirk: has joined #ruby
[07:25:59] rann: has joined #ruby
[07:26:50] mark_66: has joined #ruby
[07:30:55] marr: has joined #ruby
[07:32:46] cschneid_: has joined #ruby
[07:33:31] burgestrand: has joined #ruby
[07:34:06] cschneid_: has joined #ruby
[07:36:10] nofxx: has joined #ruby
[07:36:43] alnewkirk: has joined #ruby
[07:39:19] vondruch: has joined #ruby
[07:41:35] fullstack: has joined #ruby
[07:52:36] mim1k: has joined #ruby
[07:53:26] minimalism: has joined #ruby
[07:55:16] Xeago: has joined #ruby
[07:59:41] alnewkirk: has joined #ruby
[08:01:30] mikecmpbll: has joined #ruby
[08:04:12] ben225: has joined #ruby
[08:04:48] ARCADIVS: has joined #ruby
[08:13:25] alnewkirk: has joined #ruby
[08:19:46] porfa: has joined #ruby
[08:19:48] oetjenj: has joined #ruby
[08:21:22] quiller: has joined #ruby
[08:27:08] alnewkirk: has joined #ruby
[08:29:45] Freshnuts: has joined #ruby
[08:30:44] nicesignal: has joined #ruby
[08:31:44] tvw: has joined #ruby
[08:33:23] Megamosaren: has joined #ruby
[08:36:20] alnewkirk: has joined #ruby
[08:36:55] porfa: has joined #ruby
[08:37:28] drbroiler: has joined #ruby
[08:41:42] oetjenj: has joined #ruby
[08:41:51] 07IABNK87: has joined #ruby
[08:42:23] Serpent7776: has joined #ruby
[08:44:36] oetjenj_: has joined #ruby
[08:45:33] jaruga: has joined #ruby
[08:47:00] biberu: has joined #ruby
[08:50:06] alnewkirk: has joined #ruby
[08:51:11] cdg: has joined #ruby
[08:52:50] Axsuul: has joined #ruby
[08:53:57] Beams: has joined #ruby
[08:55:35] oetjenj: has joined #ruby
[08:56:27] nertzy: has joined #ruby
[08:56:31] dev2: has joined #ruby
[08:57:43] alfiemax: has joined #ruby
[08:59:11] fullstack: has joined #ruby
[09:00:17] vqrs: has joined #ruby
[09:01:18] dhollin3: has joined #ruby
[09:02:20] guille-moe: has joined #ruby
[09:03:59] alnewkirk: has joined #ruby
[09:09:33] Megamosaren: has joined #ruby
[09:09:50] lxsameer: has joined #ruby
[09:14:03] dev2: i need some help
[09:14:10] dev2: with the task
[09:17:08] apeiros: dev_: hi. ok?
[09:17:47] dev2: there is a gist https://gist.github.com/anonymous/32cffed0846d3dd9f6a4c9cb032d772f
[09:18:43] apeiros: that sounds like homework?
[09:18:47] dev2: in the main.rb, compute_price(vehicle), compute_prices functions
[09:19:17] alnewkir1: has joined #ruby
[09:20:49] apeiros: and your problem is?
[09:20:55] dev2: i'm newbie of ruby, if do this task correctly?
[09:21:16] dev2: i have some doubts with functions
[09:21:56] dev2: the generated result to output.json
[09:21:59] nowhereman: has joined #ruby
[09:22:08] apeiros: Date will not include hours/minutes/seconds
[09:22:27] apeiros: there's two other classes which do: DateTime and Time
[09:23:14] apeiros: I think you also don't consider this part of the exercise in your code: "you should consider if it wouldn't be cheaper to take the daily or weekly price instead"
[09:23:44] dev2: but the results are the same with DateTime and Date, i checked
[09:23:50] apeiros: and some cosmetics: don't use parse for a standardized format. the time is given in iso8601, both DateTime and Time have .iso8601 parsing methods explicitly
[09:24:44] dev2: yes i have a problem with how to define this "you should consider if it wouldn't be cheaper to take the daily or weekly price instead", any hints
[09:24:49] apeiros: re results the same: then maybe you're doing something wrong in the calculations too. try to calc by hand and see whether you get the expected result from your code.
[09:25:56] apeiros: another cosmetic issue: result = []; enum.each do … result << value; end --> result = enum.map { … value }
[09:26:18] apeiros: gotta go for lunch now, somebody else can probably help you in the meantime.
[09:26:34] dev2: thank you!
[09:28:29] FahmeF: has joined #ruby
[09:28:32] guacamole: has joined #ruby
[09:28:58] |ifei5g00d: has joined #ruby
[09:31:46] fullstack: has joined #ruby
[09:32:51] FahmeF_: has joined #ruby
[09:34:28] meinside: has joined #ruby
[09:34:56] Jameser`: has joined #ruby
[09:36:26] __Yiota: has joined #ruby
[09:36:49] dev2: any help ?
[09:38:44] hippyphysicist: has joined #ruby
[09:47:33] s2013: has joined #ruby
[09:50:24] FahmeF: has joined #ruby
[09:51:11] porfa: has joined #ruby
[09:58:21] claudiuinberlin: has joined #ruby
[09:59:00] zoras: has joined #ruby
[10:00:55] mikecmpbll: has joined #ruby
[10:02:39] FahmeF_: has joined #ruby
[10:07:04] mim1k_: has joined #ruby
[10:09:58] charliesome: has joined #ruby
[10:10:09] milardovich: has joined #ruby
[10:10:35] cadillac_: has joined #ruby
[10:10:51] rikkipitt: has joined #ruby
[10:11:49] hippyphysicist__: has joined #ruby
[10:14:16] mn3m: has joined #ruby
[10:15:31] nowhereman: has joined #ruby
[10:17:07] tvw: has joined #ruby
[10:23:13] anisha: has joined #ruby
[10:24:39] mn3m: has joined #ruby
[10:26:42] alfiemax: has joined #ruby
[10:27:24] ldnunes: has joined #ruby
[10:29:05] gix: has joined #ruby
[10:29:22] DTZUZO: has joined #ruby
[10:29:29] mn3m_: has joined #ruby
[10:30:15] FahmeF: has joined #ruby
[10:30:22] rikkipitt: has joined #ruby
[10:33:45] nowhereman: has joined #ruby
[10:35:45] milardovich: has joined #ruby
[10:37:11] zanoni: has joined #ruby
[10:38:20] mn3m_: has joined #ruby
[10:41:27] mim1k: has joined #ruby
[10:42:21] fullstack: has joined #ruby
[10:45:18] workmad3: has joined #ruby
[10:49:55] dev2: can someone help with the task?
[10:51:03] voiceftp: has joined #ruby
[10:55:22] jottr: has joined #ruby
[10:56:00] apeiros: dev_: did you make any progress since we last talked?
[10:57:11] duckpuppy: has joined #ruby
[10:59:40] dev2: i'm stuck with "you should consider if it wouldn't be cheaper to take the daily or weekly price instead"
[11:00:19] vqrs: has joined #ruby
[11:02:01] apeiros: dev_: take case with id 1, daily price is 4500, weekly price is 12000 - after how many days is daily price more expensive than weekly?
[11:02:18] apeiros: (and I think case with id = 2 misses a zero in the weekly price…)
[11:03:32] dev2: and i get output
[11:03:34] dev2: {"results":[{"vehicle_id":1,"total_price":9000},{"vehicle_id":2,"total_price":13500}]}
[11:03:46] dev2: i think it is not correct
[11:04:26] apeiros: ok. lets solve one thing after the other. so I'd suggest you start by answering my question.
[11:07:50] apeiros: ok, so after how many days would you therefore switch from daily to weekly price?
[11:10:33] apeiros: yeah, after 2 days, or starting from day 3
[11:10:42] apeiros: so seems to me like you know how to solve that part
[11:11:20] dev2: this i understood, i'm at a loss how to implement it in a code
[11:11:28] apeiros: how did you do it by hand?
[11:11:57] apeiros: that wasn't a yes/no question ;-)
[11:12:10] administrador: has joined #ruby
[11:12:28] apeiros: the naive implementation usually starts with simply translating what you did by hand into program code
[11:12:32] milardovich: has joined #ruby
[11:13:19] dev2: 4500 * 7 / 12000
[11:14:16] apeiros: that looks like an equation you can put into code. no?
[11:14:32] workmad3: has joined #ruby
[11:14:50] apeiros: (note: I would do it differently, but that's an optimization)
[11:14:55] dev2: "total_price": 18625 of id: 1
[11:20:44] Siyfion: has joined #ruby
[11:21:58] milardovich: has joined #ruby
[11:23:50] Bish: has joined #ruby
[11:26:32] Dimik: has joined #ruby
[11:26:47] dev2: i do not know
[11:30:29] oetjenj: has joined #ruby
[11:30:59] apeiros: ok, lets phrase it differently. you'd use weekly price if daily price surpasses the weekly price, right?
[11:31:56] dev2: you see the problem ?
[11:32:08] apeiros: no. care to show it to me?
[11:32:49] mim1k_: has joined #ruby
[11:34:06] tcopeland: has joined #ruby
[11:36:24] biberu: has joined #ruby
[11:40:09] claudiuinberlin: has joined #ruby
[11:41:11] oetjenj: has joined #ruby
[11:45:16] ogres: has joined #ruby
[11:45:53] alfiemax_: has joined #ruby
[11:46:18] oetjenj_: has joined #ruby
[11:46:26] ajaysingh: has joined #ruby
[11:55:52] oetjenj: has joined #ruby
[11:56:35] Defenestrate: has joined #ruby
[11:56:35] Defenestrate: has joined #ruby
[12:02:31] sepp2k: has joined #ruby
[12:03:28] oetjenj: has joined #ruby
[12:17:12] mim1k: has joined #ruby
[12:19:37] shinnya: has joined #ruby
[12:24:43] johno84: has joined #ruby
[12:28:09] s2013: has joined #ruby
[12:29:23] russt: has joined #ruby
[12:29:56] smlx: has joined #ruby
[12:30:12] charliesome: has joined #ruby
[12:30:33] SegFaultAX: has joined #ruby
[12:32:25] bmurt: has joined #ruby
[12:32:53] oetjenj: has joined #ruby
[12:33:38] shoogz: has joined #ruby
[12:33:39] shoogz: has joined #ruby
[12:37:26] guacamole: has joined #ruby
[12:37:48] latemus: i'm getting this "body"=>"#<StringIO:0x00000001cf43f0>" and i dont know what the hell a StringIO class object is
[12:39:18] latemus: oh, i call .gets and .string on it
[12:39:20] cschneid_: has joined #ruby
[12:40:57] claudiuinberlin: has joined #ruby
[12:41:07] cschneid_: has joined #ruby
[12:41:38] porfa: has joined #ruby
[12:41:56] Psybur: has joined #ruby
[12:44:24] apeiros: &ri StringIO latemus
[12:44:24] `derpy: latemus: http://ruby-doc.org/stdlib-2.4.1/libdoc/stringio/rdoc/StringIO.html
[12:44:52] dviola: has joined #ruby
[12:52:56] jphase: has joined #ruby
[12:57:23] oetjenj: has joined #ruby
[12:58:43] Technodrome: has joined #ruby
[13:00:49] s2013: has joined #ruby
[13:05:46] cdg: has joined #ruby
[13:06:22] alnewkirk: has joined #ruby
[13:11:45] ajaysingh: has joined #ruby
[13:15:36] mim1k: has joined #ruby
[13:16:24] oetjenj: has joined #ruby
[13:17:15] claudiuinberlin: has joined #ruby
[13:17:46] oleo: has joined #ruby
[13:18:45] orbyt_: has joined #ruby
[13:20:39] synthroid: has joined #ruby
[13:28:29] thomasv314: has joined #ruby
[13:29:08] chouhoulis: has joined #ruby
[13:29:37] oetjenj: has joined #ruby
[13:29:38] mson: has joined #ruby
[13:30:37] Technodrome: has joined #ruby
[13:37:18] DLSteve: has joined #ruby
[13:50:32] uZiel: has joined #ruby
[13:52:45] govg: has joined #ruby
[13:53:31] oetjenj: has joined #ruby
[13:56:13] chouhoulis: has joined #ruby
[13:59:50] mim1k: has joined #ruby
[14:00:30] yokel: has joined #ruby
[14:03:49] Rapture: has joined #ruby
[14:05:21] jrafanie: has joined #ruby
[14:06:11] _whitelogger_: has joined #ruby
[14:11:19] _whitelogger: has joined #ruby
[14:11:23] cschneid_: has joined #ruby
[14:11:29] bruno-: has joined #ruby
[14:18:49] ResidentBiscuit: has joined #ruby
[14:27:10] _whitelogger: has joined #ruby
[14:28:39] thomasv314: has joined #ruby
[14:32:38] jidar: has joined #ruby
[14:33:28] rt: has joined #ruby
[14:34:54] _whitelogger_: has joined #ruby
[14:35:44] oetjenj: has joined #ruby
[14:45:26] kculpis: has joined #ruby
[14:45:36] chouhoul_: has joined #ruby
[14:45:37] fullstack: has joined #ruby
[14:45:49] oetjenj_: has joined #ruby
[14:47:44] oetjenj__: has joined #ruby
[14:48:44] uZiel: has joined #ruby
[14:50:00] oetjenj: has joined #ruby
[14:50:48] oetjenj: has joined #ruby
[14:51:33] oetjenj: has joined #ruby
[14:52:19] oetjenj: has joined #ruby
[14:52:52] cadillac_: has joined #ruby
[14:53:30] bilal80: has joined #ruby
[14:55:10] alfiemax: has joined #ruby
[14:55:55] alfiemax: has joined #ruby
[14:57:26] FrostCandy: has joined #ruby
[14:58:28] nicesignal: has joined #ruby
[14:59:23] apparition: has joined #ruby
[15:00:42] rippa: has joined #ruby
[15:01:24] chouhoulis: has joined #ruby
[15:03:53] ta: has joined #ruby
[15:09:21] chouhoul_: has joined #ruby
[15:10:38] ldnunes: has joined #ruby
[15:10:38] guacamole: has joined #ruby
[15:11:55] cschneid_: has joined #ruby
[15:23:17] milardovich: has joined #ruby
[15:24:53] nowhereman: has joined #ruby
[15:27:40] JamieD: has joined #ruby
[15:29:02] ta: has joined #ruby
[15:29:50] JamieD: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[15:30:17] sammy: has joined #ruby
[15:30:25] lexruee: has joined #ruby
[15:38:55] __Yiota: has joined #ruby
[15:44:17] shoogz: has joined #ruby
[15:44:17] shoogz: has joined #ruby
[15:45:26] DoubleMalt: has joined #ruby
[15:46:14] |ifei5g00d: has joined #ruby
[15:46:57] claudiuinberlin: has joined #ruby
[15:47:41] dalitom: has joined #ruby
[15:47:43] vipaca: has joined #ruby
[15:47:53] shinnya: has joined #ruby
[15:48:16] dalitom: anyone knows good example of using expect in Ruby
[15:50:21] moei: has joined #ruby
[15:51:56] dionysus69: has joined #ruby
[15:52:46] Technodrome: has joined #ruby
[15:55:04] ARCADIVS: has joined #ruby
[16:01:42] mostlybadfly: has joined #ruby
[16:02:27] lolkikes: has joined #ruby
[16:02:44] DTZUZO: has joined #ruby
[16:08:51] |ifei5g00d: has joined #ruby
[16:12:32] eckhardt: has joined #ruby
[16:16:09] |ifei5good: has joined #ruby
[16:18:59] Xiti: has joined #ruby
[16:19:28] alfiemax_: has joined #ruby
[16:20:00] guacamole: has joined #ruby
[16:22:54] lxsameer: has joined #ruby
[16:23:54] cdg: has joined #ruby
[16:24:06] vipaca: has joined #ruby
[16:27:08] cadillac_: has joined #ruby
[16:28:51] nick123: has joined #ruby
[16:30:12] havenwood: dalitom: Are you talking about RSpec when you say expect?
[16:32:30] dalitom: hi havenwood, well I looking for solution to ssh to server as user and run su commands
[16:32:37] orbyt_: has joined #ruby
[16:32:38] dalitom: interaction with the server
[16:33:34] Devalo: has joined #ruby
[16:34:14] mikecmpbll: has joined #ruby
[16:35:26] lel: has joined #ruby
[16:36:41] guacamole: has joined #ruby
[16:37:16] thomasv314: has joined #ruby
[16:42:01] troys: has joined #ruby
[16:43:11] oetjenj: has joined #ruby
[16:44:23] raynold: has joined #ruby
[16:45:48] eckhardt_: has joined #ruby
[16:48:49] guacamole: has joined #ruby
[16:49:51] dalitom: please guys help... how to do interactive ssh with Ruby
[16:51:22] Devalo: has joined #ruby
[16:56:10] Iambchop: dalitom: an example of using net-ssh to run a command with sudo and provide the password when prompted: https://irb.rocks/execute-sudo-commands-with-net-ssh/
[16:57:07] Silthias: has joined #ruby
[16:59:25] Silthias1: has joined #ruby
[16:59:47] dalitom: Iambchop: Thank you!!!!! Let me check it out
[17:01:10] Iambchop: dalitom: if you have trouble, upload a gist of your code and ask for more help here :)
[17:02:17] dalitom: Iambchop: Thank you so much for support .... let me try example you have sent
[17:04:43] ta: has joined #ruby
[17:05:11] vipaca: has joined #ruby
[17:05:33] cschneid_: has joined #ruby
[17:08:13] mim1k: has joined #ruby
[17:16:08] porfa: has joined #ruby
[17:16:13] SeepingN: has joined #ruby
[17:16:44] dalitom: Iambchop: I do not understand this I am sorry :(
[17:17:11] dalitom: Iambchop: can you please help me
[17:18:06] Iambchop: dalitom: do you have some code you tried?
[17:18:16] Silthias1: has left #ruby: ()
[17:18:31] dalitom: can I paste in here
[17:19:10] matthewd: ?gist dalitom
[17:19:11] ruby[bot]: dalitom: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[17:19:26] claudiuinberlin: has joined #ruby
[17:20:22] thomasv314: has joined #ruby
[17:20:31] dalitom: https://gist.github.com/anonymous/e50d0b02f812ff38e2111bc78533047f
[17:21:25] dalitom: all I want is to ssh as default user and execute root commands
[17:23:35] thomasv314: has joined #ruby
[17:23:47] Iambchop: dalitom: "/n" instead of "\n" do you need to interact with the commands or just run them? capture output?
[17:24:13] milardovich: has joined #ruby
[17:24:26] dalitom: Iambchop: I just need to pass "yum install" commands
[17:25:25] dalitom: Iambchop: It would be nice to capture output but not mandatory
[17:28:04] Megamosaren: has joined #ruby
[17:28:46] MyMind: has joined #ruby
[17:34:48] mtkd: has joined #ruby
[17:34:49] guacamole: has joined #ruby
[17:36:58] ldnunes: has joined #ruby
[17:41:02] EXCHGR: has joined #ruby
[17:43:02] vipaca: has joined #ruby
[17:45:28] thomasv3_: has joined #ruby
[17:48:17] porfa: has joined #ruby
[17:49:30] Iambchop: dalitom: https://gist.github.com/Iambchop/6b8b2c09dfc7fb2765953ffe7080c5a7
[17:51:06] snickers: has joined #ruby
[17:52:21] dalitom: Iambchop: OMG... thank you so much.. let me see if i understand this lol
[17:54:04] ldnunes: has joined #ruby
[17:55:07] orbyt_: has joined #ruby
[17:55:11] sunrunner20: has joined #ruby
[17:55:43] drbroiler: has joined #ruby
[17:57:06] selim: has joined #ruby
[17:59:25] weaksauce: has joined #ruby
[18:02:54] Megamosaren: has joined #ruby
[18:03:40] porfa: has joined #ruby
[18:08:46] dalitom: Iambchop: Sorry to bother you... I took some of your code but still was not sure what to do
[18:08:46] dalitom: https://gist.github.com/anonymous/802b3f2efb1a49c24bf57f58d5f750e3
[18:08:52] dalitom: Iambchop: https://gist.github.com/anonymous/802b3f2efb1a49c24bf57f58d5f750e3
[18:09:08] dalitom: Iambchop: can you please check it out
[18:12:45] vondruch: has joined #ruby
[18:13:39] thomasv314: has joined #ruby
[18:14:28] chouhoulis: has joined #ruby
[18:14:41] jrafanie: has joined #ruby
[18:15:47] porfa: has joined #ruby
[18:17:22] chouhoul_: has joined #ruby
[18:23:46] edward__: has joined #ruby
[18:27:39] duckpupp1: has joined #ruby
[18:31:07] tomphp: has joined #ruby
[18:31:50] nick123: has joined #ruby
[18:32:49] cschneid_: has joined #ruby
[18:33:11] tomphp: has joined #ruby
[18:34:21] thomasv314: has joined #ruby
[18:35:01] synthroid: has joined #ruby
[18:36:42] naprimer: has joined #ruby
[18:36:49] tomphp: has joined #ruby
[18:37:21] lxsameer: has joined #ruby
[18:38:45] imode: has joined #ruby
[18:40:39] edward__: has joined #ruby
[18:40:44] tomphp: has joined #ruby
[18:45:20] s2013: has joined #ruby
[18:45:56] csk157: has joined #ruby
[18:50:08] duckpuppy: has joined #ruby
[18:51:03] orbyt_: has joined #ruby
[18:58:58] workmad3: has joined #ruby
[18:58:59] cschneid_: has joined #ruby
[18:59:43] Immune: has joined #ruby
[19:02:05] fullstack: has joined #ruby
[19:04:28] vipaca: has joined #ruby
[19:08:33] haylon: Are there any native thor tasks for Rubocop? Otherwise would I have to just run it as Thor::RakeCompat?
[19:12:34] imode: has joined #ruby
[19:14:23] Technodrome: has joined #ruby
[19:15:00] nicesignal: has joined #ruby
[19:15:02] thomasv3_: has joined #ruby
[19:16:23] csk157_1: has joined #ruby
[19:17:06] dionysus69: has joined #ruby
[19:17:46] Qommand0r: has joined #ruby
[19:18:14] dev2: smb help me please with calculations https://gist.github.com/anonymous/32cffed0846d3dd9f6a4c9cb032d772f
[19:18:40] dev2: stuck in compute_price method
[19:19:10] dev2: i get {"results":[{"vehicle_id":1,"total_price":9000},{"vehicle_id":2,"total_price":13500}]}
[19:19:21] _main_: has joined #ruby
[19:20:05] dev2: but result should be { "results": [ { "vehicle_id": 1, "total_price": 18625 }, { "vehicle_id": 2, "total_price": 15000 } ] }
[19:20:27] _main_: has joined #ruby
[19:21:03] uZiel: has joined #ruby
[19:21:12] vipaca: has joined #ruby
[19:22:24] _main_0: has joined #ruby
[19:23:34] cschneid_: has joined #ruby
[19:25:03] milardovich: has joined #ruby
[19:25:36] vipaca: has joined #ruby
[19:26:58] milardovich: has joined #ruby
[19:29:34] cdg: has joined #ruby
[19:31:08] guacamole: has joined #ruby
[19:32:20] postmodern: has joined #ruby
[19:34:55] Technodrome: has joined #ruby
[19:36:03] thomasv314: has joined #ruby
[19:36:05] dev2: any help?
[19:37:52] csk157_1: has joined #ruby
[19:38:20] SeepingN: I dont' see any difference aside from strange whitespace
[19:41:00] mostlybadfly: has joined #ruby
[19:41:11] tomphp: has joined #ruby
[19:43:32] al2o3-cr: has joined #ruby
[19:46:26] alfiemax: has joined #ruby
[19:53:34] harfangk: has joined #ruby
[19:54:18] cschneid_: has joined #ruby
[19:55:45] harfangk_: has joined #ruby
[19:56:03] harfangk__: has joined #ruby
[19:56:54] harfangk___: has joined #ruby
[20:02:03] vipaca: has joined #ruby
[20:12:28] Devalo: has joined #ruby
[20:12:36] cschneid_: has joined #ruby
[20:15:28] cschneid_: has joined #ruby
[20:15:49] alfiemax: has joined #ruby
[20:20:26] orbyt_: has joined #ruby
[20:20:32] workmad3: has joined #ruby
[20:20:55] Caius: has joined #ruby
[20:20:55] Caius: has joined #ruby
[20:22:27] mn3m: has joined #ruby
[20:23:33] DoubleMalt: has joined #ruby
[20:25:05] code_zombie: has joined #ruby
[20:25:10] Asher: has joined #ruby
[20:27:57] porfa: has joined #ruby
[20:31:54] Asher1: has joined #ruby
[20:33:08] nowhereman: has joined #ruby
[20:35:49] administrador: has joined #ruby
[20:37:10] dexter1: has joined #ruby
[20:38:57] jxv: has joined #ruby
[20:39:23] dexter1: has joined #ruby
[20:43:43] Asher: has joined #ruby
[20:45:44] sepp2k: has joined #ruby
[20:47:25] Asher1: has joined #ruby
[20:50:11] jottr_: has joined #ruby
[20:52:03] enterprisey: has joined #ruby
[20:52:17] mn3m: has joined #ruby
[20:52:25] cdg: has joined #ruby
[20:54:11] bruno-: has joined #ruby
[20:55:02] TheRock: has joined #ruby
[20:55:20] TheRock: Hello , can i know if iphone 8 can run ruby ?
[20:55:26] TheRock: chinese version
[20:57:09] jottr_: has joined #ruby
[20:58:25] cdg: has joined #ruby
[21:01:04] Devalo: has joined #ruby
[21:02:29] Devalo: has joined #ruby
[21:09:03] mson: has joined #ruby
[21:10:08] chouhoulis: has joined #ruby
[21:15:42] vipaca: has joined #ruby
[21:21:15] Freshnuts: has joined #ruby
[21:21:46] SeepingN: how would you "run ruby" on a phone anyway
[21:21:54] TheRock: because the guy says it can
[21:22:05] SeepingN: oh that guy
[21:22:25] TheRock: You can listen, use translate https://www.youtube.com/watch?v=fhMM1biWi20
[21:23:21] |ifei5g00d: has joined #ruby
[21:23:31] TheRock: so you was wrong
[21:26:38] shinnya: has joined #ruby
[21:30:36] mozzarella: of course you can run ruby on a phone
[21:31:58] Devalo: has joined #ruby
[21:32:25] jottr_: has joined #ruby
[21:33:09] orbyt_: has joined #ruby
[21:33:10] Psybur: has joined #ruby
[21:34:23] Devalo: has joined #ruby
[21:34:23] DebianUser_: has joined #ruby
[21:36:20] DebianUser_: has joined #ruby
[21:38:15] enterprisey: has joined #ruby
[21:40:45] mochiyoda_: has joined #ruby
[21:41:29] SeepingN: and do what though
[21:41:51] SeepingN: a ruby based app? how painfully slow would that be
[21:42:37] mozzarella: wouldn't be any slower than a desktop ruby app… obviously taking into account the difference in hardware
[21:42:42] TheRock: I want to install ruby on iphone 8 china version
[21:43:34] mozzarella: quick before your government blocks it TheRock
[21:43:45] mim1k: has joined #ruby
[21:43:54] SeepingN: can't say I have used even 1 desktop GUI ruby app
[21:44:19] SeepingN: and simulating a command line on iOS in which to run text based ruby things seems very odd.
[21:44:46] TheRock: But i heard ruby is faster than c++ and assembler is that true ???
[21:44:54] mozzarella: usually it's just bindings for gtk/qt (on the desktop)
[21:45:01] havenwood: ?troll TheRock
[21:45:01] ruby[bot]: havenwood: I don't know anything about troll
[21:45:07] havenwood: !troll TheRock
[21:45:08] ruby[bot]: +bb TheRock!*@*$#ruby-banned *!*@x590f844c.dyn.telefonica.de$#ruby-banned
[21:45:08] ruby[bot]: ruby[bot] kicked TheRock: is a bannable offense, see http://ruby-community.com/pages/user_rules
[21:45:21] mozzarella: yeah now he definitely crossed the line
[21:45:48] SeepingN: so yeah, pass. lol
[21:45:55] mozzarella: why can't they be more subtle
[21:46:19] SeepingN: but I want to compile machine language on my iphone 9x
[21:47:45] mochiyoda_: has joined #ruby
[21:48:29] mozzarella: you want an assembler on your phone?
[21:52:19] havenwood: I have our prod rails app running on my phone.
[21:52:32] sagax: has joined #ruby
[21:52:48] DebianUser_: has joined #ruby
[21:53:15] c-c: has joined #ruby
[21:53:49] c-c: So is it impossible to do non-blocking read on pipes in ruby 2.3?
[21:54:47] c-c: I attempted io.read_nonblocking, with and without a begin-resque-select, different getc and read ways. They all behave identically to me on linux.
[21:55:25] c-c: ie. the process sits there and waits until something writes in the pipe
[21:57:08] vipaca: has joined #ruby
[21:57:36] |ifei5g00d: has joined #ruby
[21:58:16] alfiemax: has joined #ruby
[21:59:55] zanoni: What's the best way to see what is going on with Rack middleware? Something is making Thin freeze but I'm not sure how to debug Rack
[22:00:00] voiceftp: has joined #ruby
[22:00:42] porfa: has joined #ruby
[22:05:46] jphase: has joined #ruby
[22:06:34] Heph_: has joined #ruby
[22:07:30] alfiemax: has joined #ruby
[22:11:45] voiceftp: has joined #ruby
[22:12:14] cadillac_: has joined #ruby
[22:13:22] guacamole: has joined #ruby
[22:15:20] mkroman: has joined #ruby
[22:17:14] vipaca: has joined #ruby
[22:19:54] Nicmavr: has joined #ruby
[22:20:40] Guest81114: has joined #ruby
[22:23:41] workmad3: has joined #ruby
[22:23:56] latemus: the following code never runs the second is_a method, why? --->>> val = ( (value.is_a? Hash) || (val.is_a? Array) )
[22:25:59] tcopeland: has joined #ruby
[22:26:43] guacamole: has joined #ruby
[22:28:07] mozzarella: because value.is_a? Hash
[22:28:49] lacour: has joined #ruby
[22:28:59] latemus: mozzarella: i should have mentioned that value = []
[22:29:24] troulouliou_div2: has joined #ruby
[22:29:40] mozzarella: what about val?
[22:30:46] latemus: val is being assigned the boolean result
[22:30:49] DebianUser_: has joined #ruby
[22:31:10] mozzarella: no, in your condition
[22:31:25] mozzarella: on the right side of your ||
[22:32:23] latemus: oh man, thanks
[22:34:20] c-c: Hm, maybe I should turn it around and try not resque the begin block read_nonblock
[22:34:34] c-c: *rescue
[22:34:58] baweaver: also that's an odd way to write parens there latemus
[22:35:09] latemus: baweaver: how so
[22:35:09] baweaver: val = value.is_a?(Hash) || value.is_a?(Array)
[22:35:33] baweaver: Someone's been writing Lisp
[22:36:17] baweaver: well, lisp would be: (or (is_a? value Hash) (is_a? value Array))
[22:36:58] latemus: i was using them to group for boolean flow control. but yes, using them the way you did is cleaner
[22:37:39] latemus: i have corrected my code :)
[22:38:28] latemus: interesting, that's the first time i've seen a problem with not explitictly using parens to pass a value in to a method
[22:38:33] baweaver: Though to be fair you could also: value.is_a?(Enumerable)
[22:38:46] latemus: baweaver: that's even better
[22:39:02] cyberRodent: has joined #ruby
[22:39:30] latemus: i skipped that class in my mind and went straight up to object, wwhoops
[22:39:44] baweaver: well it's not a class so... :P
[22:41:14] latemus: what is it
[22:42:19] latemus: you're a tricky one baweaver
[22:42:35] baweaver: -able is a pretty good hint :D
[22:42:36] c-c: Wow. I got it now.
[22:43:16] baweaver: and if you want some fun with Enumerable these articles are good ones: https://medium.com/@baweaver/reducing-enumerable-the-basics-fa042ce6806
[22:43:31] baweaver: Basically how do you make Enumerable methods using only reduce
[22:43:50] baweaver: probably going to write slice, each_cons, partition, and methods like that this weekend
[22:44:19] c-c: To read from a pipe in a non-blocking fashion: begin; msg = iopipe.read_nonblock(maxbytes); rescue IO::WaitReadable; next; end
[22:44:45] c-c: I wonder if thats "dirty"?
[22:45:49] Papierkorb: That's a busy loop. Yes that's "dirty".
[22:46:04] Papierkorb: Use `IO.select` to wait for it (or many more) to become readable.
[22:46:52] c-c: Papierkorb: I don't want to wait.
[22:47:19] c-c: I want to pass out of the begin-rescue if read_nonblock doesn't return anything.
[22:47:21] Papierkorb: You can also give it a zero-timeout to not wait, but just check
[22:47:33] c-c: In other words - if there is nothing to read_nonblock, continue
[22:47:47] c-c: oh, timeout...
[22:50:06] c-c: Papierkorb: so you're implying: add a row "IO.select([iopipe], 0)" or something like that in there?
[22:50:23] Papierkorb: It's basically how I'd do it, yes
[22:50:41] c-c: ok let me try that
[22:53:56] latemus: ACTION can't wait to get into pipes
[22:56:51] c-c: Whoa nelly! Now its no longer blocking or waiting in any way: "L/MIN: 1334340"
[22:57:30] c-c: (thats actually 1/6th of the loops per minute)
[22:59:15] Paraxial: has joined #ruby
[22:59:50] Technodrome: has joined #ruby
[23:01:22] orbyt_: has joined #ruby
[23:01:31] c-c: Here is my example solution for non-blocking read of a named pipe (its not the full class but you can get the idea)
[23:01:35] c-c: https://gist.github.com/anonymous/2ab856e1a206b1fbf8594217563b6a39
[23:02:09] Papierkorb: erm, you use the IO.select instead of the exception stuff
[23:02:33] jphase: has joined #ruby
[23:02:55] c-c: Papierkorb: um, I've no idea how to do this otherwise
[23:03:06] Papierkorb: have you tried?
[23:03:26] c-c: I wonder what you might mean by "the exeption stuff"?
[23:03:34] c-c: *exception
[23:03:34] Papierkorb: begin .. rescue .. end
[23:03:57] ledestin: has joined #ruby
[23:04:08] Papierkorb: Exceptions are for exceptional circumstances. reading something while knowing full well there might be nothing to read isn't exceptional.
[23:04:48] c-c: Papierkorb: sorry if this offends you, I can't seem to find another way to do a non-blocking read of a named pipe in ruby
[23:05:27] c-c: Papierkorb: have you seen another type of working solution elsewhere?
[23:05:31] thinkpad: has joined #ruby
[23:05:57] Papierkorb: https://ruby-doc.org/core-2.4.0/IO.html#method-c-select-label-Example
[23:07:56] c-c: Papierkorb: I've wrestled with this quite a while
[23:08:16] jphase: has joined #ruby
[23:08:17] Papierkorb: Have you actually checked, what select does? What it returns?
[23:08:19] c-c: ah, what the hell, I'll commit and try that one more time
[23:08:27] alfiemax: has joined #ruby
[23:13:00] c-c: Well, interestingly, replacing that begin-rescue -loop with a select([iopipe], [],[],0) is 3 times faster
[23:13:36] Papierkorb: exceptions are expensive
[23:15:40] c-c: - the downside is the select never returns any string
[23:16:10] Papierkorb: it's not supposed to. its job is to tell you about your file handle states
[23:22:10] bwilson: has joined #ruby
[23:25:46] c-c: Naw, I can't get that to work.
[23:26:07] c-c: select just returns the same array of IO objects I pass it.
[23:26:54] Papierkorb: Have you read the docs?
[23:27:12] c-c: Let me turn this around for a second, if you don't mind.
[23:27:36] c-c: Papierkorb: have you actually written a select using logic for named pipes?
[23:27:59] c-c: +non-blocking
[23:28:09] Papierkorb: yes. doesn't matter if it's a named pipe, select only cares about handles.
[23:28:33] c-c: well, I've read the docs around quite a few times.
[23:29:01] Defenestrate: has joined #ruby
[23:29:05] c-c: I guess I must be stupid, but that begin-rescue-next is the best thing I've gotten to actually work without blocking.
[23:29:19] Papierkorb: ... the first paragraph is all you need to know
[23:30:36] goyox86: has joined #ruby
[23:33:02] c-c: I was trying to $ man 2 select but that returns nothing
[23:33:27] s3nd1v0g1us: has joined #ruby
[23:33:43] Papierkorb: While IO.select uses select(2) internally, what does it matter?
[23:33:49] Papierkorb: I even posted the docs link above
[23:34:44] c-c: I was hoping it would explain why does that IO.select seem to return the io handle when its value is nil
[23:35:20] charliesome: has joined #ruby
[23:40:43] hahuang65: has joined #ruby
[23:41:14] tvw: has joined #ruby
[23:44:19] mim1k: has joined #ruby
[23:45:44] jxv: has joined #ruby
[23:49:56] jenrzzz: has joined #ruby
[23:49:57] jenrzzz: has joined #ruby
[23:59:44] jenrzzz: has joined #ruby
[23:59:44] jenrzzz: has joined #ruby