Activity Graph

« Prev | Page 2 of 14 | Next »


[15:38:23] phaul: yebyen: np. I was thinking about this too, it was an interesting problem to crack
[15:38:53] phaul: also RSpec is really to blame for not handling the error correctly.
[18:00:59] phaul: where is gem::method coming from? who defined it? don't override :method
[18:01:05] phaul: &ri method
[18:02:03] phaul: and don't use :: for sending messages
[18:04:50] phaul: I am confused by your code tbh. What is gem, what is its class, is method a method of gem? Is it redefinition of Object#method ?
[18:28:34] phaul: that explains what happens with the parameters name, but does not explain what the heck gem::method is


[01:28:32] phaul: it's already night over there?! /me confused.... 'night , anyways
[01:29:27] phaul: 3am - ~ 8 hrs = 24:00 - 5 hrs = ~ 19 hrs
[01:31:04] phaul: sounds like morning to me :)
[15:31:42] phaul: hi yebyen
[15:34:22] phaul: Kernel is a module though so it has no instances
[15:37:55] phaul: that's what I would do. I dont understand what this test proves...
[15:40:08] phaul: I don't know of this global method distinction. its justa regular method on Kernel.
[15:43:00] phaul: you don't have to find def for it, if it's defined in the C core. and that global_function stuff is just MRI internal helper
[15:43:08] phaul: it is just a regular method
[15:44:18] phaul: didn't really help you with that, though, I dont know what happens in RSpec that pushes it into recursion...
[15:46:58] phaul: it just does module_function automatically in Kernel
[15:47:55] phaul: I think this should be reproducible with any module. give me a sec, let's see if I can replicate this with a custom module...
[15:59:17] phaul: yeah it just hangs
[15:59:27] phaul: rspec is in some weird loop
[16:17:28] phaul: It's up to you, I am not going to.
[16:19:51] phaul: the module_function line is not needed. simple instance_method reproduce the issue. The issue goes away if you remove the .and_call_original (as you said)
[16:33:29] phaul: what it fundamentally doesn't seem to like is the any_instance_of(module) .. yebyen I updated the gist, the commented line works, the uncommented line hangs
[16:35:41] phaul: there is. Object includes kernel, and wherever you are that self inherits Object. That self is the instance
[16:36:30] phaul: so where the BigDecimal() call is in your code that self is the receiver
[16:39:32] phaul: in fact this gives an idea. what happens if you say any_instance_of(Object) ?
[16:53:04] phaul: I would argue that testing builtin in classes like Object is not what you want. You have an object/code under test, that has some class right? Why not make that a double, and expect the BigDecimal directly on that?
[16:53:46] phaul: a =; expect(a).to receive(:BigDecimal) ; a.calculate!
[16:55:50] phaul: ah, I see, you said it, you want to test that is does not override BigDecimal() and the method lookup bubbles up all the way to Kernel.
[16:57:33] phaul: I would say that that is testing internal implementation detail, objects have the right to respond to methods whichever way they want, as sonlg as that response is good
[18:04:27] phaul: archlinux finally upgraded to 2.6 !
[18:04:35] phaul: ?hammertime
[18:05:00] phaul: ah, ruby[bot] is on vacation
[18:22:24] phaul: another thing is that maybe you need rational, floats are work of evil
[18:24:48] phaul: there is a lot of things unsafe on floats that catches ppl offguard
[18:26:14] phaul: ruboto fact ?float: Your numbers don't add up? You get "weird" results? read
[21:06:09] phaul: block_given? might be the thing. it only makes sense to me inside a def
[21:06:58] phaul: &>>block_given?
[21:10:48] phaul: well, yeild and block_given? are keywords to work in def..
[21:12:46] phaul: it would be better if it was syntax error imho
[21:13:53] phaul: &>> super
[21:18:48] phaul: this reminds me of this, innteresting that that works
[22:08:52] phaul: ?botsnack
[22:10:02] phaul: ACTION kicks rubybot hard in the back for not playing along
[23:52:59] phaul: never tried such things, but its so hard for me to beleive that you are going to be CPU limited


[00:27:53] phaul: that code has a lot of things that don't make sense ruby wise. Im not talking algorithm wise, but just pure language wise
[00:29:46] phaul: well, 9 year old code according to the license, stay strong mikecmpbll :)
[00:30:57] phaul: no, I did not even meant that. just skimming the rest
[00:31:12] phaul: ah english...
[00:43:45] phaul: mikecmpbll: out of curiousity, how did you inherit this code, or what project is this?
[00:54:18] phaul: well, things I spotted first look : method 78 is an interesting reinvention of spaceship. They random use return. They have classes for methods. method on 239 is waay too long and its repeating itself probably copy paste, but probably most methods are too long anyways. they use `and' when they meant &&.
[00:55:06] phaul: but the task want to criticise the code but to figure out why the error message, so probably im no help :)
[01:11:28] phaul: look, I feel sorry for you to have to work with such old code, and I am speculating the author is long gone and the code is unmaintained for almost a decade, based on sciruby activity plus the licence in the file. The author made code that's used 9 years later, most of us can't say the same so he must have done some thing right... It's just that reading the code now wouldn't fill me with much confidence,
[01:11:31] phaul: especially that probably you can't raise tickets, or contact the author. Maybe time to fork and take over?
[09:50:36] phaul: because Rise::MirrorManager::Manager does not have send_error_notification method. I bet it has an instance method with that name, that comes from the included Rise::MirrorManager::Notification.
[09:51:25] phaul: but the existance of the instance method is just speculation. What the error says is that there is no class method
[09:58:45] phaul: it doesn't matter if it's private.
[09:59:03] phaul: you are calling it in class context
[10:00:37] phaul: ah the instance method is defined just a few lines up on line 47, not included from the module.
[10:02:24] phaul: class X; def x; end; end # is x class or instance method in this example?
[10:07:16] phaul: send_error_notification is defined in the class as an instance method on line 47, and is not a module_function. unless you also define it in modules that you don't show us
[10:12:11] phaul: &>> class X; at_exit { p self }; end
[10:22:06] phaul: to reproduce this with a minimal example:
[10:22:39] phaul: &>> class Manager; def send_error_notification; end; at_exit { send_error_notification }; end
[13:00:25] phaul: am0123_: hi
[13:21:00] phaul: as a side not there is a boolean case syntax in ruby with ommitting the expression after the case, and just listing whens.
[13:21:49] phaul: &>> case; when 3.odd? then 'odd'; when 3.even?; then 'even'; end
[16:06:58] phaul: or ask them to measure performance. that usually keeps them busy ;)
[19:11:11] phaul: dviola: take that with a pinch of salt
[19:13:44] phaul: SM also said first we should just "throw code at the wall and see what sticks".
[19:18:07] phaul: they meant isn't sandimetz-y _enough_ - right?
[19:41:28] phaul: this also reminds me the break up phrase "it's not you - it's me". Thanks very much. we all know what that means. If they beleive in what they are saying they should at least stand by it, rather than this "fit/compatibility" nonsese. Also introducing classes for the sake of it is just stupid and nothing more but cargo cult programming.
[22:01:40] phaul: Wafficus: are you aware of ?
[22:01:46] phaul: you might like it
[22:02:28] phaul: hit me :)


[11:31:05] phaul: &>> a = [1,2]; b = a; a += [3]; [a, b]
[11:35:45] phaul: so as canton7 said. Plus apart from += doesn't modify as it's just a shorthand for .. = .. + .., integers cannot be modified anyway. there is no way to monkey patch a method into Integer that modifies the value of self
[11:58:30] phaul: there must be a further magic that makes that work. namely it calls []=. because [] returns the same object as dig, so there is no difference there.
[12:10:01] phaul: yeah, it's quite invlolved. (result.[](:work)).[]=(:workers, (result.[](:work)).[](:workers).+(1))) if im parsing it correctly
[12:10:36] phaul: &ast>> result[:workers][:work] += 1
[12:11:00] phaul: ast doesn't expand it
[17:19:35] phaul: dviola: you might not even like this rewrite, but my attempt:
[17:34:02] phaul: dviola: I made my changes mainly following the ideas from here:
[18:37:03] phaul: mspo: Sandi calls these or wrapper objects of these factories, and she talks about pushing the conditional out as far as possible (out or up the stack). But she can't avoid having them
[18:42:47] phaul: mspo, undeniably we introduce more classes and more complexity at the surface level, in exchange eliminating all conditional code paths from everywhere, apart from 1 top level factory dispatch
[18:43:21] phaul: same as null pattern just applied for every if not just nil?
[18:47:23] phaul: alhtough I don't agree with sandi that this should be applied all the time, but in her example and here as well I think it fits


[09:46:07] phaul: scatterp: please paste that file.
[10:19:20] phaul: scatterp: nothing obvious I can see.
[10:21:45] phaul: I would start by verifying that the call in question is inject({}). Pass a different argument like [] instead of {} and check that the error msg changes.
[10:22:57] phaul: this time it should complain wrong argument type Array (expected String)
[10:38:50] phaul: hm. so it's probably not even that call. this is going to be very difficult to debug over IRC unfortunately
[10:43:52] phaul: are you familiar with pry and or byebug?
[10:47:19] phaul: stick a require 'byebug' at the top of the file and a single line that just says byebug on line 207
[10:48:07] phaul: re-running the app should stop at a byebug prompt, where you can inspect the variables inside that method.
[10:53:58] phaul: at the prompt try the followings:
[10:54:12] phaul: puts current_user.accounts.class
[10:54:34] phaul: puts current_user.accounts.first.class
[11:00:04] phaul: scatterp: ignore ruby[bot] for now
[11:01:18] phaul: ah. we are getting closer, current_user.accounts.first.class reproduces this issue
[11:06:05] phaul: now enter this line at the byebug prompt:
[11:06:17] phaul: catch TypeError
[11:07:07] phaul: when stops enter this:
[11:13:36] phaul: yeah, as you said activerecord 4.2.10 might be now incompatible
[11:16:15] phaul: I think it comes from frame 4 in your backtrace, where the mysql2 adapter calls the old interface on BigDecimal
[11:17:27] phaul: at byebug prompt you can zoom on any part of the backtrace with the fr command.
[11:20:13] phaul: check frame 4 from the backtrace. when byebug is stopped at the exception ( the point when you did bt command) do frame 4.
[11:23:26] phaul: hm. that's not it. I meant this location home/deploy/peatio/current/vendor/bundle/ruby/2.6.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/mysql2_adapter.rb:222
[11:25:19] phaul: but it feels first you should upgrade active_record, and see where that takes you.. you can also ask #RubyOnRails if they know about such incompatibility.
[12:25:36] phaul: al2o3-cr: hi there
[12:26:52] phaul: pff. your fiddling capabilities are way beyond me :) I wonder if there is a limit to what you can do
[14:06:06] phaul: yield_with_args checks if it yields the args in one go. 3 args one time, not 1 arg 3 times
[14:09:01] phaul: the only thing that's suspect to me with the implementation on the paste is the double *args, one shadowing the other
[14:09:39] phaul: well, scratch that, there are other issues
[14:12:21] phaul: on the paste it's a mixture of definition of the method and a call to a method. when you define a method use the def keyword. Also in the definition you don't pass a block. you will pass the block when the method is called
[14:13:51] phaul: def eval_block(*args, &block) ; ... implementation body comes here .. ; end
[14:14:16] phaul: there is no def eval_block(...) do
[14:19:25] phaul: the def keyword is still missing
[14:23:29] phaul: Swyper: don't worry we all started somewhere
[14:32:21] phaul: for these kind of conditions ppl tend to flatten out the if and move the error checks at the top.
[14:32:25] phaul: reads nicer
[15:29:12] phaul: you have the full array interface at your displosal. #length, #[]
[15:29:46] phaul: in an instance method length will just give you the length. self[3] will give you the elem under index 3
[15:30:19] phaul: but you can be explicit and also say self.length
[15:31:49] phaul: methods without explicit receiver are always sent to self. you can ommit self, but writing self.method also works
[15:32:41] phaul: there are cases when you have to spell out self.. for instance #class would be taken as the class keyword, not the class method.


[03:06:28] phaul: Quit: bye
[13:58:06] phaul: has joined #ruby-offtopic
[13:58:06] phaul: has joined #ruby
[17:12:31] phaul: galaxie: paste all error logs you have (full logs please), including the commands you executed.
[18:17:47] phaul: catbusters: you are mixing instance methods and class methods.
[18:19:48] phaul: add is an instance method. call is a class method. calling add from call doesn't work as without explicit receiver it is sent to the class, but the class doesn't have such method
[18:26:59] phaul: make it private, and make it class method. open the singleton class with class << self .. end syntax, declare a private scope, and define the method (without self)
[18:31:26] phaul: yes, that should do what you want
[18:40:29] phaul: I'm not sure, I am not a big fan of thsese design patterns in Ruby, I fail to see why just PORM (plain old ruby modules) are not enough to factor code out if the code is separable enough from the rest of the class. But someone else might see things differently
[19:19:19] phaul: havenwood: when you said they are different things, I think you misunderstood the question. even though catbusters missed the full code I think it was about private_class_method vs class << self; private def blah .. Those are semantically equivalent right? Just using different syntax to achieve the same
[19:21:21] phaul: in other words a making the instance method of the class' singleton class private is the same as making a class method of the class private.
[19:23:20] phaul: &>> module M; class << self; private def blah; 1; end; end; end; M.blah
[19:23:32] phaul: uplime: ^
[23:17:03] phaul: &>> a = false or true; a


[10:01:03] phaul: hays: define_method takes a symbol no need to convert. instance_variable_get also takes a symbol. As you were saying passing strings feels iffy but all these reflective methods work without strings, symbol is always an option
[12:05:59] phaul: Quit: bye
[13:10:42] phaul: has joined #ruby
[13:10:43] phaul: has joined #ruby-offtopic
[13:37:40] phaul: there is :"@#{a}" but yes, that is still string interpolation.
[13:38:10] phaul: but I would remove the if a.is_a symbol. and consider that a code smell.
[13:39:13] phaul: for your method a can be anything that define_method accepts. why narrow it down. If define_method doesn't accept something it will raise exception, why do it's job half way?
[13:40:17] phaul: also if define_method accepts something new in the future or stops accepting something, it can handle it, your code wouldn't need to be modified.
[13:47:49] phaul: thinking about it, if one really wants to avoid instance_variable_get one could with instance_eval with a block and getting the value out into an outer local variable. But it's really just overcomplicating things.
[13:49:47] phaul: although the instance_var name still would be assembled as string, never mind


[01:55:53] phaul: Ping timeout: 258 seconds
[02:17:58] phaul: has joined #ruby-offtopic
[02:17:58] phaul: has joined #ruby
[08:25:52] phaul: Ping timeout: 268 seconds
[09:57:58] phaul: has joined #ruby-offtopic
[09:57:58] phaul: has joined #ruby
[10:09:07] phaul: Ping timeout: 240 seconds
[10:11:20] phaul: has joined #ruby-offtopic
[10:11:20] phaul: has joined #ruby
[10:15:39] phaul: Ping timeout: 246 seconds
[10:18:41] phaul: has joined #ruby-offtopic
[10:18:41] phaul: has joined #ruby
[12:24:45] phaul: is it in your $HOME/.local/bin? if so is that in your PATH?
[13:46:56] phaul: Quit: bye
[14:43:09] phaul: has joined #ruby
[14:43:10] phaul: has joined #ruby-offtopic


[00:04:37] phaul: has joined #ruby-offtopic
[00:04:37] phaul: has joined #ruby
[08:58:56] phaul: comet23 fwiw that method works fine here
[09:44:23] phaul: mutantkeyboard: also inside the field of Ruby web development some ppl migrate to newer frameworks which either better fit how web development is changing, like sinatra, with single page apps or microservies, or have a cleaner design but still MVC like hanami.
[12:32:02] phaul: i think adac wants to interpret regexp as a string. regexp is not matched but rather is the data
[12:33:18] phaul: well, #to_s and #scan
[12:35:23] phaul: to_s seems to insert some junk.. so be careful. that aside why would you want to do this
[12:35:38] phaul: &>> /(a|b|c)/.to_s
[12:39:02] phaul: I think parsing regexes with regexes falls into the same category as parsing anything complex like html with regexes. simply dont
[12:40:32] phaul: well, this might be an xy thing, you havent told us why you are doing such a thing
[13:44:02] phaul: hi sandelius
[13:45:21] phaul: I heard it was windy over there, how are you holding up
[13:53:31] phaul: equivalent but parser precedences might differ, you might need () around expressions to force the parser
[13:53:51] phaul: sometimes direct search and replace fails
[14:11:23] phaul: hi, jhass, sorry for jumping on you as soon as you appear :) can you please update to 2.6 for our bot, when you have time? (in your own time, no rush)
[14:12:35] phaul: ah, cool, thanks
[15:18:39] phaul: ruby[bot] , welcome back among the living!
[15:19:02] phaul: >> RUBY_VERSION
[15:42:39] phaul: Ping timeout: 246 seconds
[15:48:51] phaul: has joined #ruby
[15:48:52] phaul: has joined #ruby-offtopic
[17:46:12] phaul: Ping timeout: 250 seconds
[17:48:06] phaul: has joined #ruby-offtopic
[17:48:06] phaul: has joined #ruby
[19:49:07] phaul: Ping timeout: 240 seconds
[20:11:39] phaul: has joined #ruby-offtopic
[20:11:39] phaul: has joined #ruby
[20:37:19] phaul: Ping timeout: 268 seconds
[20:45:04] phaul: has joined #ruby-offtopic
[20:45:04] phaul: has joined #ruby
[22:38:28] phaul: Ping timeout: 258 seconds
[23:00:42] phaul: has joined #ruby-offtopic
[23:00:42] phaul: has joined #ruby
[23:20:15] phaul: Ping timeout: 258 seconds
[23:23:19] phaul: has joined #ruby-offtopic
[23:23:19] phaul: has joined #ruby


[00:18:48] phaul: Quit: bye
[10:40:27] phaul: has joined #ruby-offtopic
[10:40:27] phaul: has joined #ruby
[14:16:17] phaul: Swyper: what's the purpose of the string argument? You are not touching it anywhere...
[14:16:37] phaul: which should thell you that something is still amiss
[14:21:36] phaul: there are issues with your code, I don't know how or why it passes or what the task actually was, but that code certainly doesn't look right, I can detail issues with it, or we can take an other approach, you show me the task and I try to give you pointers towards a good solution
[14:34:56] phaul: Swyper: please first paste the original exercise
[14:48:23] phaul: well, you missed the reversed.join(' ') bit from the channel :)
[14:53:00] phaul: as a rule of thumb don't use self modifing or destructive methods inside a #map altough it's fine here.
[14:55:42] phaul: #map should be about the return value, in a functional style. we call it for what it returns. #each should be about the side effect it causes, we usually don't care about what it returns but care about what it does. dont mix them
[15:12:06] phaul: rubydoc will now go offline for a bit due to electrical wiring fixes. Should be back soon #homehostingsucks
[15:14:32] phaul: Quit: bye
[17:15:13] phaul: has joined #ruby-offtopic
[17:15:13] phaul: has joined #ruby
[18:16:06] phaul: channel logger is down...
[20:37:27] phaul: comet23: imagine the chaos if everybody is randomly adding functionality to classes that everybody uses. If two gems are adding the same methods to array differently, and you depend on both, then you are in screwed
[20:39:15] phaul: yeah. and I define it so that my array shifts all of its contents (numbers) by given number of bits. Because in my domain that feels intuitive
[20:39:47] phaul: point is unless there is an authority to it , it just end up in chaos
[23:41:37] phaul: Ping timeout: 250 seconds


[21:40:18] phaul: has joined #ruby-offtopic
[21:40:39] phaul: Client Quit
[21:40:53] phaul: has joined #ruby
[21:40:54] phaul: has joined #ruby-offtopic
[21:41:25] phaul: Client Quit
[21:41:38] phaul: has joined #ruby
[21:41:39] phaul: has joined #ruby-offtopic
[21:44:46] phaul: ?pizza, Eiam
[21:45:12] phaul: ruby[bot] ruined it :(
[22:37:38] phaul: havenwood: have you heard about the C obfuscation contest? even though it's C you might appreciate some of the code there :)
[22:39:00] phaul: it still seems to be a thing
[22:42:20] phaul: there are some genious entries it's so simple, almost elegant
[22:55:42] phaul: this is way off, what am I missing
[23:13:57] phaul: leftylink: those are great, thanks for the link.
[23:15:17] phaul: yeah, I was a bit disappointed printing random chars on my screen first. then... whoa! that's cool!
[23:22:12] phaul: pretty awesome too