Activity Graph

Page 1 of 4 | Next »


[17:00:14] rapha: mikecmpbll: that'd be fun moving to the UK when all other continent-dwellers are fleeing in the brexit woes :P


[21:22:02] rapha: has joined #ruby
[21:22:38] rapha: havenwood: wait, aren't you also often around during my mornings?
[21:24:33] rapha: trying to understand the Psych mid level API
[21:24:52] rapha: this is my test input, test code, test output atm: https://gist.github.com/sixtyfive/37c58aff39ceccd591ed2cc0bea0cfe0
[21:25:23] rapha: i understand why the values would show up as Scalars ... but why are the keys Scalars, too?
[21:25:44] rapha: havenwood: oh, where did i read that before? Elon Musk's Twitter account perhaps? :P
[21:26:11] rapha: i guess my question is: walking through that tree of nodes, how do i know what value belongs to what key?
[21:35:52] rapha: havenwood: It's not urgent. Just playing around with it atm. It's possible I fall asleep though, then I'll read in the morning :)


[10:44:29] rapha: has left #ruby: ("WeeChat 2.3")


[14:12:22] rapha: has joined #ruby
[14:13:30] rapha: with minitest, when i run a file containing a class deriving from Minitest::Test and using 'minitest/autorun', is there any way to hand in a piece of information from the command line?
[14:13:52] rapha: (just one string ... two characters only, in fact)
[14:17:08] rapha: adam12: "ruby -Ilib:test tests/unit/myfile.rb"
[14:17:28] rapha: well, since i found out about "--pride", i'm adding that, too, because who doesn't like pretty colours in a terminal
[14:18:23] rapha: it just ignores any further arguments
[14:18:37] rapha: thank you adam12 :-D
[14:27:18] rapha: ACTION just learned about [3].[](0) and then about [3]&.[](0) and then about nil&.[](0) and now has a hole in his brain the size of a sniper rifle bullet
[14:30:07] rapha: more like as examples of how many sadistic ways of prodding his coworkers my coworker knows
[14:32:30] rapha: also [1]&[2], okay. BUT nil&[0] - WTF!
[14:33:08] rapha: AND: [5]&.[0] doesn't work at all. might have, but doesn't. only [5]&.[](0) does.
[14:34:58] rapha: okay try this:
[14:35:07] rapha: type: def Array;end
[14:35:15] rapha: roflmaololcopter
[14:39:03] rapha: phaul: you're too knowledgable to be surprised by these, I understand. To me it's just funny/funky/interesting because it's mind-blowing in a way.
[15:33:55] rapha: phaul: wait, so *every*thing you *ever* type into a ruby file or command line "secretly" starts with "self."?


[09:51:28] rapha: has left #ruby: ("WeeChat 2.3")


[00:56:12] rapha: *.net *.split
[01:14:41] rapha: has joined #ruby


[18:05:01] rapha: has joined #ruby
[18:05:22] rapha: and i thought i was living in this lovely, small-enough niche of programming languages
[18:05:26] rapha: https://github.com/rest-client/rest-client/issues/713
[18:08:24] rapha: it's not about "use something else"
[18:08:34] rapha: it's about trust being gone
[18:09:59] rapha: good to know about the 2FA thing though ... i never wrote a Gem, so i can only hope it becomes widespread among Gem authors now
[18:10:23] rapha: oh that'd be cool!
[18:10:41] rapha: at least it would be something proactive and would help to limit that loss of trust
[18:11:50] rapha: it happened to other languages' package manages before, so yes,
[18:12:43] rapha: ruby world domination in security ftw!


[06:35:03] rapha: has left #ruby: ("WeeChat 2.3")


[07:08:13] rapha: Oh! The year...
[07:08:30] rapha: Wishing so much for an updated Pickaxe though...
[07:10:31] rapha: Well ... rubyisdead.science.
[15:36:13] rapha: baweaver: sure, but no new pickaxe, right?
[15:37:54] rapha: (very relevant thread imho: https://www.reddit.com/r/ruby/comments/82ubtj/is_it_still_worth_reading_the_pickaxe_manual/)
[15:40:38] rapha: even just https://rubyreferences.github.io/ as a paper book available on amazon would be cool
[16:03:23] rapha: Ryctolagus: with pleasure :D
[16:04:19] rapha: havenwood: reference is one thing, and tutorials are another ... the Pickaxe was pretty awesome with respect to guiding one through the language features, do's and better-not-do's, etc.
[16:10:09] rapha: i mean, in japan, there's probably lots of stuff the non-japanese-speaking part of the community isn't even aware of


[21:08:07] rapha: Iambchop: finally saw your examples from yesterday now! Okay, so it is not unlike C, just a bit different. Thank you :)


[23:16:44] rapha: has joined #ruby
[23:17:08] rapha: why doesn't https://gist.github.com/sixtyfive/e3b0f81ddcb02976fa36ac57e831f8b3 do what I thought it'd do?
[23:19:20] rapha: also, though: https://gist.github.com/sixtyfive/b686ee783265ac28c9a2809fc05ad579 :-D


[13:04:47] rapha: has joined #ruby
[13:06:12] rapha: what's the nicest way to get the "195" in "Pages: 195" as an Integer? I'm using .match(/[0-9]+/).to_s.to_i, but that seems overly complicated...
[13:09:53] rapha: sonne: the input is sufficiently regular that both of these will work, and i like the second of them best. Dankeschön! :-D
[19:12:18] rapha: baweaver: wow, okay, that looks really elegant!


[23:45:38] rapha: Quit: WeeChat 2.0-dev


[00:32:19] rapha: has joined #ruby
[00:32:41] rapha: is there any way to make something like '"x#{3.times {"a"}}y"' output "xaaay" instead of "x3y"?
[00:34:02] rapha: i had a hunch map() would be involved
[00:34:12] rapha: ACTION hates map(), it's like magic
[00:34:38] rapha: easier said than done
[00:35:33] rapha: is it possible that it's name is misleading? or that my understanding of the english word "map" ("to map" in the sense of "to map something onto something"?) is erroneous?
[00:36:04] rapha: well, the 'a'*3 thing at least is easy to understand and intuitive :)
[00:37:35] rapha: interesting, i didn't realize programming languages were that much like real languages
[00:38:58] rapha: i wonder what'll happen if i /join #smalltalk and declare "ruby is t he smalltalk that won"
[00:39:30] rapha: (will they send me to /join #go-lang to learn that "go is the ruby that won"?)
[00:41:29] rapha: seriously? "[wolf pack programming] depends on a shared (web-based) editor that several developers use at once to develop code for the same tasks"? i'd go crazy!


[16:06:06] rapha: has left #ruby: ("WeeChat 2.0-dev")


[16:33:14] rapha: has left #ruby: ("WeeChat 2.0-dev")
[16:33:16] rapha: has left #RubyOnRails: ("WeeChat 2.0-dev")


[16:56:46] rapha: Does ruby care if i have SomeClass and AnotherClass::SomeClass alongside it? Or will they not get in each other's way because of the subclassing?
[17:01:13] rapha: dminuoso: you mean if I write "class Someclass < AnotherClass; ..." then it's not nested?
[17:13:34] rapha: dminuoso: nope, no more Rails for me, I jumped ship and feel free as a bird again :)
[17:14:01] rapha: The article is still good!
[17:16:06] rapha: dminuoso: I didn't want to have prefixes or suffixes to the subclass names, so now they're all in their own submodule, which seems to work nicely.


[11:05:46] rapha: Ping timeout: 240 seconds
[11:33:12] rapha: has joined #ruby
[11:33:14] rapha: has joined #RubyOnRails


[08:47:19] rapha: *.net *.split
[09:31:44] rapha: has joined #ruby
[09:31:56] rapha: has joined #RubyOnRails


[01:58:25] rapha: YAY! , my Swiss keyboard and I mean
[01:59:35] rapha: eam: apeiros: this is the result of the stuff I asked questions about earlier. https://github.com/sixtyfive/watchsys/blob/master/watchsys ... I'd be happy about criticism :)
[02:26:14] rapha: string.split /\ -\ /
[07:20:46] rapha: growp: So change the regex accordingly.
[07:20:52] rapha: Oh. Gone.


[22:32:01] rapha: is it possible (and how?) to run a shell command in ruby inside a thread and to also kill it again?
[22:33:13] rapha: ultimatr sounds good
[22:33:29] rapha: i know about the backticks - but how to _end_ the process?
[22:34:18] rapha: apeiros: or would it end upon Thread#kill if the backticks are inside the Thread#new block?
[22:36:36] rapha: i just thought of threads because i want to do stuff after i start the process and then end the process once i'm done doing stuff.
[22:36:59] rapha: ACTION wanders off to the docs
[22:38:35] rapha: oh cool, thanks!
[22:39:34] rapha: without having read that yet ... spawn does return the pid. so all should be fine. except if i want to see the spawned process's stdout i guess
[22:41:17] rapha: i'll stop asking stupid questions now and just try to get it working and maybe come back with better questions
[22:42:21] rapha: why go banned fork?
[22:42:24] rapha: that does not parse...
[22:42:47] rapha: oh! not go, Go+
[22:43:04] rapha: s/+/! ... still learning the Swiss keyboard layout
[22:43:19] rapha: ACTION got himself an X200 with a Swiss keyboard
[23:00:33] rapha: http://rubyforadmins.com/reading-growing-files <- really cool
[23:29:18] rapha: so i spawned a new process and have its pid now. i can wait for it to end or i can end it. but how do i tell it to pause? (i.e. as if i was pressing Ctrl-Z in the terminal and then did "fg" to resume it)
[23:35:09] rapha: No, it pauses it and backgrounds it, both


[01:19:04] rapha: if i have lots of [{foo: 1.2, bar: 2.3}, {foo: 3.2, bar: 3.0}] but need lots of [{foo: [1.2, 3.2]}, {bar: [2.3, 3.0]}] is that something I would use .map for? my brain is a bunch of knots right now :(
[01:24:28] rapha: I'm playing around with something that's probably quite ugly, no rush :)
[01:26:36] rapha: Radar: no, that's exactly what I was after!
[01:26:38] rapha: ACTION reads
[01:26:55] rapha: what sort of construct is "p begin"?
[01:27:23] rapha: oic that's just the bot's code
[01:28:43] rapha: Radar: what do you mean by "acc"?
[01:30:29] rapha: ah, that's an apt name then
[01:30:38] rapha: i think i need to read up on each_with_object
[01:37:43] rapha: the _with_object part is what i give it in the argument array, not in the block
[01:37:55] rapha: so it's not that complicated even :)
[01:57:56] rapha: Radar: it's quite practical btw: https://gist.github.com/sixtyfive/aa8dc49c5fe0fdccaaf81818a8ca300b
[01:58:08] rapha: ACTION marvels at how many packets his router routes
[02:03:17] rapha: It's a nice little Gem!
[02:04:01] rapha: Radar: say, is something like each_with_object crossing over into the functional programming realm?
[02:05:23] rapha: Hmm. I will have to tell my Haskell-wielding friends to stop laughing at Ruby and me.
[02:13:59] rapha: I guess, but then I'll just call them Haskellipsters or something.
[09:32:00] rapha: baweaver: cool, thanks for the alternative solution! :)


[17:56:47] rapha: hi lovely rubyists
[17:58:06] rapha: i want to use dstat to record some stats on our network router and make nice little graphs out of that. dstat just runs as a process and keeps writing into a .csv file. my question is: would you start dstat through the ruby script or would you just assume that it'll be started some other way and keep polling the .csv file?
[17:59:53] rapha: (regrettably it can't be made to output the csv data to "-")
[18:02:34] rapha: well there's one consideration, either way: it just keeps writing and writing into that file, so i'd like to empty it out in regular intervals. but then how is my ruby script going to cope with that?
[18:04:26] rapha: file update notification of any sort doesn't necessarily make sense because the intervals in which dstat writes to the file are fixed anyways
[18:07:47] rapha: Papierkorb: 02-08 19:32:26,0.202,0.226,99.563,0.004,0.000,0.005,0.0,0.0,0.0,180334592.0,199540736.0,742088704.0,2949984256.0,0.0,0.0 ... i guess the timestamp could be used as an ID.


[10:13:22] rapha: There used to be find_all_by_* methods, but they don't exist anymore. Is there any new way to ensure you get an ActiveRecord::Relation back instead of a single result if there is only one?
[10:14:02] rapha: sevenseacat: that has the same problem for me. If there's only a single result, it doesn't give me a set.
[10:14:23] rapha: weird then
[10:15:12] rapha: muzik: activerecord 5.1.2, but i'm using it on its own, without rails. might that be the problem?
[10:15:35] rapha: ... and on ruby 2.2, because 2.4 won't compile properly with gcc 7.
[10:17:06] rapha: ACTION tries #where again
[10:18:57] rapha: muzik: i think chaining order matters. if i use "some_scope.where(blah)" instead of "where(blah).some_scope" ithen it works. which is weird because some_scope also uses where(foobar), but okay...


[14:52:30] rapha: i have a piece of code (a validation) that works, but is neither DRY nor pretty ... is there anything obvious about https://gist.github.com/sixtyfive/82681b0b6a6a9ed589b45e52b2d80a00 that you would change and how?


[11:21:29] rapha: Is there any way to select all those tags with Nokogiri that do not contain any further tags? My best try so far is doc.css('*').xpath('text()') {|n| n.parent}, but when I try n.parent.content.strip! inside of that (which is the point of the exercise) nothing happens.
[11:22:58] rapha: But n.content='Meh' works. Strange.
[11:23:34] rapha: Albeit mildly entertaining to have a big and complicated HTML document that reads "Meh Meh Meh" all the way.
[11:36:43] rapha: Okay, better question: how do I find out what the things I get from "blah".bytes actually are? I.e. what their Unicode code is? (A space character is 32 which is not the same as 0020)
[11:54:41] rapha: Oh. So easy!
[11:54:48] rapha: ACTION huggles #codepoints and elomatreb
[12:00:41] rapha: Okay, so the problem is with Nokogiri. It changes a <p>1</p> into a <p> 1</p> for some reason.
[12:11:26] rapha: But s/he is right dminuoso: 2*16+0=32 - ain't it so?
[12:12:03] rapha: dminuoso: Well, okay, that part was context. Which a computer cannot understand on its own.
[12:12:32] rapha: >> 32.to_s(16) == "0020"
[12:12:43] rapha: >> 32.to_s(16)
[12:12:51] rapha: well, close enough...
[12:13:19] rapha: dminuoso: but the writing was "0020", not "020"
[12:17:10] rapha: >> "For breakfast: #{['scrambled eggs, grilled tomatoes and rye bread', 'musli with oranges, raisins and warm milk', 'rye bread with various spreads and cheeses'][rand(0..2)]}"
[12:17:27] rapha: Damn. Now I still don't know.
[12:18:34] rapha: Seems the bot is different from what we're used to.
[12:18:52] rapha: >> "For breakfast: #{['scrambled eggs, grilled tomatoes and rye bread', 'musli with oranges, raisins and warm milk', 'rye bread with various spreads and cheeses'].values_at(rand(0..2))}"
[12:19:11] rapha: Okay, that's strange.
[12:19:23] rapha: Did I break it? :(
[12:20:34] rapha: Anyways, the laptop decided for the first choice.
[12:25:50] rapha: I see. Btw, Papierkorb, your version would have to be .sample(1)[0]
[12:28:08] rapha: Oh, cool, thank you! :)


[20:23:12] rapha: say, is there any HTML manipulation library you like better than Nokogiri?
[20:23:54] rapha: (performance is pretty much irrelevant, I'm after a fun-to-use API)
[20:25:26] rapha: ACTION looks at both
[20:26:01] rapha: yup, google knew :)
[20:33:08] rapha: havenwood: Oh, ouch: "Why are you writing an XML parser? Why not use Nokogiri?" - Answer: "In short, because Nokogiri doesn't work."
[21:13:22] rapha: Well, it's still possible that someone will produce good software, no matter their motivation.
[21:14:18] rapha: Anyone have any experience with Ox?
[21:29:35] rapha: darix: thanks for the mechanize suggestion, I'll keep that at the back of my mind.
[22:29:36] rapha: So it seems for now I'll be staying with Nokogiri.


[17:49:40] rapha: Is Dir[] an exact synonym of Dir.glob() ?
[17:52:49] rapha: Papierkorb: I like Dir[] better, but can't get it to take a block for looping through the results. Is that what you mean by does not take optional flags?
[17:53:29] rapha: adam12: tried...
[17:53:53] rapha: adam12: Papierkorb: indeed, it was the .each - i just had a type in there, too.
[17:54:03] rapha: Thank you both! :)
[17:57:23] rapha: "to be preferential to sth" ... didn't know that construct, but loving it, too :)
[18:00:11] rapha: dminuoso: but how do you get data stored in files for legacy reasons into a database, etc. if you refuse to work with files?
[18:03:07] rapha: dminuoso: but you start out with XML which happens to be contained in files. How do you get it out of those files without touching them?
[18:15:19] rapha: dminuoso: oh. Interesting way of doing things. It wouldn't work for me atm, but I'll remember that for the future :)
[18:16:13] rapha: say, guys
[18:16:30] rapha: i wrote this block here and it does what it's supposed to, but it's not pretty
[18:16:45] rapha: can you think of a way to write these lines (2-5) as one line somehow? https://gist.github.com/sixtyfive/fa009ba99f27b362a5b301446cbbf4fd#file-blah-rb-L2-L5
[18:17:41] rapha: ACTION wonders why dminuoso and elomatreb have not long abandoned #ruby for #haskell
[18:20:13] rapha: dminuoso: It takes a path and extracts some parts of it into the variables in line 6.
[18:20:47] rapha: ROFLMAOLOL
[18:21:05] rapha: Why is my brain always such a tomatoe?
[18:21:46] rapha: dminuoso: '*'+'*' is a case of 'self-documenting code, rapha-style', though
[18:21:58] rapha: not using a regex is a big-o brainfart.
[18:27:31] rapha: elomatreb: Oh now I see why you thought that I was missing separators. Config.data is not a String though, but a Pathname.
[18:29:07] rapha: German Amazon thinks there's two editions of The Well-Grounded Rubyist from 1600 and from 1707, that is, before the one from 2009 and 2014.
[18:47:08] rapha: cseder: Ada and Ruby in perfect union, that would be quite the language :)


[10:38:24] rapha: jesus christ, not only debian, now also ruby. what is it with those pesky spammers.
[11:38:11] rapha: What's an "OG" name?
[11:38:21] rapha: ar1a, sorry
[11:38:30] rapha: yeah, messed my brain up :)
[11:38:37] rapha: it's my name
[11:38:47] rapha: and it's been my handle since around 1995
[11:39:05] rapha: that dude was probably not even out of his nappies by that time
[11:39:14] rapha: ar1a: what's a coinkidink?
[11:39:19] rapha: (sorry, not a native speaker)
[11:39:46] rapha: well, okay, prolly barely out of them then
[11:40:15] rapha: anyways, one of my given names is Raphael so i don't feel like there's anything wrong with my handle
[11:40:49] rapha: and to add to that, i did play Quake 1 and 2 and also 3 in a clan for quite a while


[14:01:06] rapha: But hey, perhaps if the ruby-hipster-culture dies, then perhaps that'll do the community some good.
[14:03:36] rapha: Hmm, I'll shut up then :)