Activity Graph

« Prev | Page 2 of 17 | Next »


[00:01:36] phaul: ACTION is thinking maybe when there is an error we should just let it die and spill the error on stderr instead of the extra work to move it over to stdout. And we should report back stderr.
[00:05:39] phaul: nah Im pondering about the bot
[00:06:20] phaul: it could report back syntax error correctly with I think
[00:42:16] phaul: there we go :)
[00:46:15] phaul: hm. not perfect but it will do
[09:48:01] phaul: al2o3-cr: same here. Also if I do double tab (on nick complete) it started inserting some emoji junk that I don't have fonts for


[15:12:30] phaul: @points += [1, 3, 0][results[0] <=> results[1]]
[15:13:01] phaul: but don't write code like this
[15:19:05] phaul: it's unecesarrily trying to be clever sacrificing clarity for shortness
[16:30:24] phaul: Quit: bye
[17:37:58] phaul: has joined #RubyOnRails
[17:37:58] phaul: has joined #ruby-offtopic
[17:37:58] phaul: has joined #ruby
[23:01:50] phaul: if you use yhe & syntax on the argument list it automatically binds it to an argument
[23:02:13] phaul: then you can assign it to any instance variable like everyting else.
[23:03:19] phaul: &>> class X; def initialize(&block); @x = block; end; def foo;; end; end; x = { hello } ;
[23:03:30] phaul: &>> class X; def initialize(&block); @x = block; end; def foo;; end; end; x = { 'hello' } ;
[23:15:36] phaul: It's probably slower than yield because then you don't have to proc-ify the block. But here the proc object is created either way. I don't beleive 10x but I don't have numbers. One would have to measure. But even then I would say don't optimize up front. Do your algorithm in a sane way and when it's slow profile it.
[23:28:42] phaul: & on method declare "procifies" wheras on call "blockifies" back. so yes, that's how map(&method(:blah)) works
[23:30:37] phaul: but I'm don't fully understand your example or what it's trying.
[23:31:08] phaul: I'm not sure I fully understand --- edited lines after I wrote it
[23:32:32] phaul: write a small paste or something, and if it doesn't work we can help
[23:33:38] phaul: syntax errors are not reported back correctly by the bot
[23:33:46] phaul: click on the links


[12:35:51] phaul: klasses are just objects. You can pass them around
[12:36:44] phaul: no, but probably I wouldn't do it either
[12:38:27] phaul: what makes the decision on A or B? somewhere there is going to be a case that decides otherwise there is no point in the two possibilities. There I would just chose A or B and there is no need for parent class altogether
[12:39:01] phaul: that said I would probably transfer the decision into BaseHandler
[12:39:46] phaul: class BaseHandler; def self.for_thing(x) case x when X then AHandler; when Y then BHandler ...
[12:40:12] phaul: but it's subjective opinion and peoples preferences differ
[12:41:59] phaul: sure. Imo the only way to really go wrong with this if you replicate the decision logic in multiple places. There should be 1 place which dispatches on A/B types.
[12:59:13] phaul: the other thing I started doing, again it is very subjective, is to get rid of raise NotImplementedError methods. And if a common parent only has NotImplementedError methods then get rid of the parent class. And child classes just have the same methods without a common parent. Im sure this view is somewhat controversial. But for instance look at how TrueClass and FalseClass doesn't have a common parent.
[13:07:24] phaul: something like
[13:13:00] phaul: there are 2 options. doing the same as for BHandler, or introducing a plugin like architecture where Handler.for picks up child classes automatically. Either form a common folder like /handlers or using hooks like inherited
[13:15:33] phaul: then each match check can be put in a class method and Handler.for just calls different handlers in a loop to check which can handle
[13:16:05] phaul: class AHandler; def can_handle?(thing) :a == thing; end ...
[13:17:03] phaul: def _self_.can_handle? ^
[16:37:00] phaul: TIL what a f*up gemspec add_development_dependency is. they are just under the assumption that you would use bundler anyways. But if that's the case really it should be removed as it doesn't work
[16:37:10] phaul:
[16:37:30] phaul: I'm closing this issue, because I believe it will sooner become irrelevant (by how technology advances) than coming to a resolution.
[16:37:40] phaul: that was said in 2014 :D
[16:48:39] phaul: sure, thaikolja
[17:30:53] phaul: al2o3-cr: looks fine to me. last part is just var = expr.some_instance_method or which part did you expect to fail?
[17:34:25] phaul: I dont see concatenation, I see 3 local vars foo (symbol), foo﹖ (lambda), foofoo﹖ (integer)
[17:36:38] phaul: nah extra pair of eyes. rubber duck. etc. we all been there
[18:47:41] phaul: hi rockyh


[03:51:20] phaul: Ping timeout: 255 seconds
[12:04:34] phaul: has joined #ruby
[12:04:35] phaul: has joined #RubyOnRails
[12:04:35] phaul: has joined #ruby-offtopic
[12:53:27] phaul: mjacob:


[00:06:50] phaul:
[00:07:53] phaul: it seemed down a second ago
[09:04:29] phaul: kke, "#{..}" is a string literal
[09:07:11] phaul: &ri BigDecimal, marz_d`ghostman
[09:07:35] phaul: ah, I wanted to link
[09:07:56] phaul: nm. sometimes rubydoc can be PITA
[10:43:46] phaul: drop the class from that, given that there are two objects in total, you can do [true, false].include?(object) or object == true || object == false if you really need to match on those two.
[10:45:38] phaul: what tbuehlmann said is also true. the fact you need this is a bit of a smell
[10:48:03] phaul: yeah. that's a smell :) don't validate that things match classes. If it behaves like a true or false it's good enough. Doesn'tneed to be it. You might need to convert. Instead of checking the type, do (object ? true : false) or some like !! object, but I don't
[10:48:45] phaul: and use the converted object in JSON
[11:06:18] phaul: RougeR: sure. there are always exceptions. it's not that validating bools is bad, but in general validating on classes is bad. It makes the code harder to extend by tying methods down to classes. for instance the reek tool flat out tells you off for using any type checks. Not everybody agrees with that though.
[11:07:32] phaul:
[13:08:36] phaul: &>> '= fgk}; jfdgk};'.scan(/= (.+?)};/)
[13:09:58] phaul: haxx0r: does this help? btw :)
[13:17:12] phaul: try putting a ? on your *
[13:17:24] phaul: * is greedy
[13:17:33] phaul: it will consume </script>
[13:39:11] phaul: I was wrong. It seems greediness only applies if it doesn't fail overall match.
[13:55:29] phaul: al2o3-cr: reading this it seems core guys would choose TypeError
[16:25:37] phaul: &fake Matz.quote
[16:27:52] phaul: especially that now it doesnt truncate quotes halfway as it used to ;)
[16:30:32] phaul: also fixed the ri BigDecimal thing. now the logic is that if classname.downcase == require_name || require_name == core => default to that, instead of complaining for multiple hits
[16:31:20] phaul: I'm not sure how derpy used to deal with these things..
[17:18:35] phaul: Quit: bye
[17:20:10] phaul: has joined #ruby
[17:20:11] phaul: has joined #RubyOnRails
[17:20:11] phaul: has joined #ruby-offtopic
[22:22:00] phaul: al2o3-cr: are you pen testing ? :)
[22:22:48] phaul: havenwood: I tried to read that paper but it was way over my head.. I understood about nothing in it :)


[14:16:11] phaul: write a recursive algorithm?
[23:01:19] phaul: &fake HitchhikersGuideToTheGalaxy.marvin_quote
[23:02:17] phaul: ah. shame. I should increase the allowed message size. Now we never now the punchline
[23:09:58] phaul: that looks very interesting. I'll read the paper tomorrow and we can disuss it further. atm it's past midnight here, so not today. but I don't have anything for tomorrow


[00:11:13] phaul: Enumerator is a wrapper on Fiber , it can reset it. Create a new one drop the old one
[14:47:17] phaul: I made a thing
[15:26:41] phaul: tbuehlmann: :)
[18:03:29] phaul: Quit: bye
[18:04:52] phaul: has joined #RubyOnRails
[18:04:52] phaul: has joined #ruby-offtopic
[18:04:52] phaul: has joined #ruby


[08:57:33] phaul: Quit: bye
[09:01:20] phaul: has joined #ruby
[09:01:21] phaul: has joined #RubyOnRails
[09:01:21] phaul: has joined #ruby-offtopic
[09:50:18] phaul:
[09:51:09] phaul: it's really cr*p.
[09:51:50] phaul: What is the name of the element that is used to define what an object looks like after it is created?
[10:14:02] phaul: String#[] takes regex
[10:14:22] phaul: &>> 'hightower2'[/to./]
[19:46:43] phaul: hansol: you are not connected to the database
[20:06:43] phaul: I see. Yay! You’re on Rails! :)
[23:36:10] phaul: dmwit: this looks interesting. Are you familiar with the Enumerator class?
[23:37:06] phaul: Iterator looks quite similar to Enumerator as far as the interfaces go
[23:43:14] phaul: &ri Enumerator
[23:43:40] phaul: they can represent infinite streams, lazily:
[23:44:13] phaul: &>> { |y| loop { y << 1 } }.take 10
[23:44:27] phaul: notice how the loop is an infinite loop
[23:45:48] phaul: it's just while true
[23:50:26] phaul: hm. I haven't got that far :) I was just observing and pointing out similarities between your stuff and stuff that's there :D
[23:52:17] phaul: but since you mentioned "infinite streams" I immediately thought of Enumerators and lazyness. because they use fibers internally, and without those you can't afaik replicate lazy behaviour. the infinite loop with strict evaluation will be infinite


[11:50:36] phaul: ee2019: check if you have cms_scanner installed
[11:50:53] phaul: gem list --local | grep cms_scanner
[11:53:30] phaul: install it
[11:55:15] phaul: install zlib (non gem, C library)
[11:59:04] phaul: package of your linux distro
[13:09:42] phaul: fun challange for the day: implement Enumerator.
[13:10:53] phaul: to_enum and anything that uses built in Enumerator is off limits of'c
[13:16:11] phaul: fiftysix: hi
[13:44:38] phaul: al2o3-cr: I did documentation on the bot commands, here's the up to date reference
[16:47:53] phaul: in bin/pry (not the one in PATH but the one that's invoked by it it does $0='pry'. If you comment that out it works
[16:54:31] phaul: this also reproduces :
[16:56:45] phaul: pry is definately buggy here, but I would argue that so is MRI
[17:02:07] phaul: I'm trying to find specs for what should happen when you write $0...
[17:02:28] phaul: describe "Kernel#global_variables" do
[17:02:30] phaul: it "needs to be reviewed for spec completeness"
[17:03:20] phaul: althoough that's the instance method
[17:05:18] phaul: probably they haven't specced it otherwise they would have caught it :)
[17:25:55] phaul: I get a consistent '-'


[14:43:37] phaul: &>> 'aag!!'.succ
[14:55:04] phaul: &>> x = { |y| a = 'a'; loop { y << a; a.succ! } }; x.find_index('zzz')
[21:53:52] phaul: on mri at least
[21:54:51] phaul: I don't know if the order is actually specced. as blocks there are supposed to be without side effects
[21:55:07] phaul: but MRI goes left to right
[21:56:10] phaul: hint: pry. pry-doc. > $ Array#all?
[21:56:45] phaul: shows the C source, and you can see the iteration from 0 to arr_length - 1
[21:58:54] phaul: gem install pry
[21:59:10] phaul: it's a gem a better irb
[22:00:12] phaul: you need to install pry-doc as well
[22:00:25] phaul: then at pry prompt just do $ Array#all?
[23:07:31] phaul: yeah. it's been like that for some time now
[23:07:55] phaul: we need apeiros to restart it
[23:18:56] phaul: nice, can't wait to see them. (online - youtube)
[23:22:36] phaul: It's a bit far for me :)


[01:10:08] phaul: &fake FamilyGuy.quote
[15:33:44] phaul: also "TRUE" is not how we represent true
[15:34:18] phaul: makes you wonder if this is ruby at all
[22:51:34] phaul: &>> JSON.parse('{"a":{"b":1}}')
[22:53:29] phaul: hi al2o3-cr
[22:58:34] phaul: ?code pedahzur
[22:59:12] phaul: pedahzur: please share your code with us, so we can take a look
[22:59:35] phaul: ACTION also pokes ruby[bot]
[23:15:31] phaul: what causes the extra address to appear?
[23:16:59] phaul: I assumed you could reproduce this. So now that you cleared it it's all good and the 2nd address is not coming back
[23:17:50] phaul: or it comes back after a while?


[15:25:32] phaul: what is an iterator?
[15:26:18] phaul: is it something that includes Enumerable or instance of Enumerator
[15:33:00] phaul: sounds like I'm trolling but I'm geniunely curious how that book defines iterators
[15:38:58] phaul: also makes it hard when books come up with concepts on their own, that are not part of a language. Makes ppl familiar with the language confused
[15:52:35] phaul: ah, Kernel#iterator? is an alias to block_given?. I never knew. Altough "mildly depricated".
[15:52:50] phaul: &ri Kernel#iterator?
[15:59:41] phaul: you don't match with the method name on the recursion
[16:00:34] phaul: deep_key_to_string vs deep_string_transform_key, arent those supposed to be the same?
[16:02:17] phaul: how about .tranform_values ?
[16:02:56] phaul: no but nm, I forgot that you need to modify the keys too
[16:03:31] phaul: and recurse on the values that then tranforms them (deeper)
[16:03:44] phaul: but yeah, you need both k, v
[16:06:04] phaul: I'm not sure if it's an improvement but you can tranfer the conditional into the array, [ k.to_s, v.instance_of? Hash ? v... : v ]
[16:07:36] phaul: fair enough
[16:13:58] phaul: TheBrayn: are you on >= 2.6 ?
[16:14:35] phaul: then to_h now takes a block, and map can be removed
[16:14:43] phaul: 2.5.3 doesn't have it
[16:16:05] phaul: &25>> [1,2,3].to_h { |v| [v, v.odd?] }
[16:16:25] phaul: &>> [1,2,3].to_h { |v| [v, v.odd?] }
[16:56:59] phaul: if you want you could make a local
[16:57:15] phaul: then ppl ust gem install from you
[16:57:57] phaul: that's how publis gems to the ecosystem
[16:58:26] phaul: and you can also do this
[17:01:55] phaul: I never install anything to system level, I agree with that
[17:02:29] phaul: gem wise that is
[19:41:59] phaul: classes all override the new method. That's how you get instances of classes
[19:42:27] phaul: disclaimer: as far as I understand things.
[20:10:34] phaul: ACTION keeps forgetting about #allocate
[22:11:20] phaul: edit methodname


[12:57:46] phaul: their name is hacked lowercase which means you can't use them by name.
[12:57:56] phaul: this errors:
[12:58:27] phaul: &>> IO::generic_writabe.class
[12:59:00] phaul: &>>
[12:59:20] phaul: &>> IO::included_modules
[12:59:36] phaul: &>> StringIO::included_modules
[12:59:41] phaul: &>>
[13:00:22] phaul: so you can't call it by name, but if you get to it by other means you can use it
[13:02:01] phaul: yes that would fail
[13:02:44] phaul: I don't think so
[13:03:07] phaul: &>> StringIO::generic_writable.methods
[13:04:14] phaul: what is the code that fills k with value "StringIO::generic_writable" ?
[13:04:53] phaul: all it needs is not stringifying the method and sending the method to the module object ratherthan evalling a string
[13:05:15] phaul: s/stringifying the method/stringifying the module/
[13:06:10] phaul: &>> k = StringIO.included_modules.first; k.class
[13:06:18] phaul: &>> k = StringIO.included_modules.first;
[13:08:47] phaul: paste the code that fills in the variable k
[13:18:42] phaul: insert a bit of guard code in: if k == 'StringIO::generic_writable; then k = StringIO.included_modules[0]; ns[k]['methods'] = k.methods; else ... normal path...
[13:22:10] phaul: oh I thought we just wanted to make it run.
[13:30:34] phaul: it's just the ruby parser parsing lowecase name as method name
[13:30:56] phaul: as was demonstrated by the channel bot, which does the exact same behaviour
[13:32:55] phaul: lower case module name is an internal hack. they shouldn't do it, and given they did it they shouldn't leak it out. There was an attempt by nobu to remove it from the list of constants, but seems it still leaks
[14:06:00] phaul: &fake Hacker.say_something_smart
[17:51:44] phaul: it's an object Enumerator passes into the block that was given to new.
[17:54:10] phaul: eindoofus: essentially yes, it's the values enumerator gives you on each next
[18:09:52] phaul: do you mean that the stdout does not appear on the console any more? That's because it's captured into stdout variable.
[18:11:19] phaul: ah, nm I see you actually do a puts stdout at the end
[18:11:37] phaul: try puts stdout.inspect and see if that changes anything
[18:24:53] phaul: try puts stderr.inspect
[18:25:37] phaul: I mean check if it's outputting to stderr when you think it should output to stdout
[18:25:52] phaul: in case of no error
[18:27:46] phaul: ah. it was status == 0 when I looked at it ;)
[18:27:58] phaul: nm. I donno then
[18:57:32] phaul: paul__: I have an idea!
[18:58:39] phaul: paul__: try redirecting the command output into a file from the shell and check the output. Some programs check if their output is tty and if not then they behave differently
[18:59:26] phaul: paul__: ls is an example. If outputting to tty it prints a comapct list if output is not tty it outputs an entry per line
[19:16:10] phaul: reading the man page I bet it's going to be that. I distinguishes between interative vs non interactive mode based on whether output is tty
[19:17:17] phaul: with -i it will behave like invoking it normally
[19:18:52] phaul: programs always have stdout. it's a file descriptor and there is a is_tty() function in C that tells programs if their output is a terminal. They can act differently based on that
[19:19:18] phaul:
[19:20:27] phaul: paul__: try splitting the args
[22:03:33] phaul: &>> [*?!..??]*??
[22:32:24] phaul: it's a problem of making puzzles, not an easy one
[22:34:07] phaul: I was thinking about it a bit after the fact myself too. The thing was it would have been largely unfair to give any less information, as then I would have just pointed to a code of ~300 dense lines of code.Without familiarity to the code I would say it becomes impossible
[22:45:50] phaul: I played a bit more with that code base, and managed to gain 3x speedup with two optimizations steps. I was thinking about doing a write up, kinda like a blog post. atm I don't have a ruby blog
[22:49:44] phaul: replacing this with almost halved the time
[22:50:32] phaul: sorry wrong position
[22:50:58] phaul: replaced this