ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <dscottboggs_gitlab> > And the best part is they're using some of my personal projects, such as Cadmium. So I'm getting paid to work on my FOSS projects ⏎ Fucking dream come true ⏎ ⏎ Fuck that really is a dream come true [https://gitter.im/crystal-lang/crystal?at=5d27cef6570ac36f8d0aab10]
<FromGitter> <watzon> Even this puppeteer port is a personal project. I started it like 2 years ago and dropped it because I didn't know enough back then.
<FromGitter> <watzon> But I'm back baby!
<FromGitter> <dscottboggs_gitlab> hell yeah... a lot you can learn in 2 years
<FromGitter> <Blacksmoke16> 2 years was a long time ago :P
<FromGitter> <watzon> And I've come a long way in that time
<FromGitter> <Blacksmoke16> i guess so :P
<FromGitter> <Blacksmoke16> 2 years ago i was still a sophmore
<FromGitter> <girng> AWWW
<FromGitter> <girng> hellooo
<FromGitter> <Blacksmoke16> o/
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/77nj am i missing something here?
<FromGitter> <watzon> Weird
<FromGitter> <Blacksmoke16> setting the restriction on the method to `Base` seems to fix it
<FromGitter> <watzon> Ahh yeah I didn't catch that
<FromGitter> <watzon> I wonder if that could be called a bug though?
<FromGitter> <Blacksmoke16> dunno
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <girng> WTF
<FromGitter> <girng> grrrrrrrrrrrr
<FromGitter> <girng> Array reference is back
<FromGitter> <girng> wait, gonna reduce this
<FromGitter> <watzon> Please do, I'm confused as to what the problem is
<FromGitter> <watzon> But if you need a good Matrix class you can check out my Apatite (https://github.com/watzon/apatite) library
<FromGitter> <girng> Sorry reduced
<FromGitter> <girng> Should be clearer now
<FromGitter> <girng> This damn matrix updated all of its array when I only modified 1
<FromGitter> <girng> LOOOOOOOOOOOOOOOOOOL
<FromGitter> <watzon> This is kinda weird... ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ that doesn't work as expected either [https://gitter.im/crystal-lang/crystal?at=5d27fe5654d3383937f01b12]
<FromGitter> <watzon> I feel like I'm missing something here
<FromGitter> <girng> interesting
<FromGitter> <girng> Constructor of Array.new might be generating arrays in the matrix as references maybe? Then, when an array in the matrix is changed, all of those are updated as well. Not sure if I'm making sense at this point. I just found this very weird
<FromGitter> <watzon> Wait
<FromGitter> <watzon> I've got it
<FromGitter> <watzon> there you go
<FromGitter> <watzon> Also, don't use a capital `I` for inventory unless it's going to be a constant
<FromGitter> <girng> wtf
Raimondi has quit [Ping timeout: 258 seconds]
DTZUZO has joined #crystal-lang
ht_ has joined #crystal-lang
Raimondi has joined #crystal-lang
ht_ has quit [Quit: ht_]
absolutejam has joined #crystal-lang
Raimondi has quit [Ping timeout: 258 seconds]
<FromGitter> <watzon> Has anyone tried to do a N-Body simulation with Crystal?
DTZUZO has quit [Ping timeout: 258 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <bew> Defi
<FromGitter> <bew> Definitely not me, i'm curious, what would you need this for?
<FromGitter> <watzon> It's just a benchmarking program really. I'd just love to see what a Crystal implementation would look like.
<FromGitter> <bew> It's mesmerizing to watch
<FromGitter> <watzon> Right?!
<FromGitter> <watzon> It's pretty awesome. I want to understand more of the math behind the simulation
absolutejam has quit [Ping timeout: 245 seconds]
<FromGitter> <watzon> But I'm dumb
<FromGitter> <watzon> Lol
<FromGitter> <bew> I've no idea how to make that happen either
<FromGitter> <bew> Maybe a little, but definitely not how to make it right and working^^
<FromGitter> <watzon> Me neither man, me neither
alex`` has joined #crystal-lang
absolutejam has joined #crystal-lang
Raimondi has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
<livcd> girng: what graal is doing so yes
<livcd> girng: oops sorry i was just looking at an old question of yours
Raimondi has quit [Ping timeout: 258 seconds]
<FromGitter> <girng> ;D
<FromGitter> <girng> "The search could not be completed because the search keywords were too short, too long, or too common."
<FromGitter> <girng> a search query is "too common" lmaoo okay
Raimondi has joined #crystal-lang
<FromGitter> <j8r> Oof, finally finished markdown report for fast-crystal: https://github.com/language-benchmarks/fast-crystal
<FromGitter> <j8r> Help welcome to add more benchmarks here https://github.com/language-benchmarks/fast-crystal/tree/master/src/benchmarks 😄
<FromGitter> <watzon> @wontruefree could you explain to me the purpose of `white` and `reset` here (https://github.com/wontruefree/qrencode/blob/master/src/qr/code.cr#L75)? The don't seem to be doing anything, so I can only assume they are either placeholder values for ansi escape codes that you plan to introduce, or just dead code
<FromGitter> <asterite> nbody benchmark already exists for Crystal, search for benchmarks from kostya
<FromGitter> <watzon> That's awesome! Thanks @asterite
<FromGitter> <asterite> (minus the graphical simulation :-))
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has quit [Ping timeout: 268 seconds]
alex`` has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
<FromGitter> <girng> nice
<FromGitter> <DRVTiny> Hello, people ^) ⏎ Is there any conference about Crystal?
<FromGitter> <girng> like a presentation?
<FromGitter> <girng> This was the most recent one, as far as I know https://www.youtube.com/watch?v=JkKqkzCoR-8
<FromGitter> <DRVTiny> I mean offline conferencion, like JuliaCon or PerlCon
<FromGitter> <girng> Aww, don't think so
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 268 seconds]
lucasb has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.5]
Raimondi has quit [Ping timeout: 258 seconds]
greengriminal has joined #crystal-lang
return0e has quit [Ping timeout: 258 seconds]
return0e has joined #crystal-lang
ht_ has joined #crystal-lang
Raimondi has joined #crystal-lang
return0e has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
moei has joined #crystal-lang
return0e has joined #crystal-lang
sorcus has quit [Ping timeout: 252 seconds]
greengriminal has quit [Quit: Leaving]
rohitpaulk has joined #crystal-lang
alex`` has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
absolutejam has joined #crystal-lang
<FromGitter> <Blacksmoke16> released our first piece of code using crystal at work today
<FromGitter> <watzon> @Blacksmoke16 what's that?
<FromGitter> <Blacksmoke16> brought runtime from ~40min to ~13min
<FromGitter> <Blacksmoke16> generating json/xml feeds for partners to consume
<FromGitter> <watzon> Damn that's a nice performance boost
<FromGitter> <Blacksmoke16> indeed, other python lib we were using just didnt cut it
<FromGitter> <Blacksmoke16> was ~6.5min doing only 1 feed in json, now there is 1 json and 2 xml, so ill take it :P
<FromGitter> <watzon> Well yeah, it's python
<FromGitter> <watzon> Lol
ht_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> 😉
absolutejam2 has joined #crystal-lang
absolutejam has quit [Ping timeout: 244 seconds]
absolutejam3 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 245 seconds]
<FromGitter> <watzon> I don't get how `Process#output` and `Process#error` work
<FromGitter> <Blacksmoke16> when doing like `Process.run`?
<FromGitter> <watzon> They are always nil, even if I explicitly provide `output` and `error` arguments to Process.new
<FromGitter> <Blacksmoke16> well they're going to be nil unless the process you run has output/errors after you run it
<FromGitter> <Blacksmoke16> its like the results from the execution of the proces
<FromGitter> <watzon> Right, the process that I'm running does though
<FromGitter> <watzon> If I leave those arguments out, or just set them to a filedescriptor it prints the output to stdout
<FromGitter> <Blacksmoke16> `Process.new` doesnt actually *run* the process just to be clear
<FromGitter> <watzon> It executes it
<FromGitter> <watzon> It just doesn't wait for it to finish
<FromGitter> <Blacksmoke16> ah right
<FromGitter> <Blacksmoke16> code some code to share?
<FromGitter> <watzon> Which is what I need
<FromGitter> <watzon> I'll try and minimize a sample
<FromGitter> <Blacksmoke16> then just do `Process.run` which executes and waits
<FromGitter> <Blacksmoke16> and returns a `Process::Status`
<FromGitter> <watzon> I don't want to wait for the process to complete though, because then that blocks me from doing other things
<FromGitter> <watzon> And I need to keep a record of the process so I can kill it
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <watzon> Basically this is what I'm trying to do
<FromGitter> <watzon> https://carc.in/#/r/77yi
<FromGitter> <watzon> But output and error are always nil
<FromGitter> <watzon> And even waiting for it to complete, nothing seems to get written to the io
<FromGitter> <watzon> https://carc.in/#/r/77yk
<FromGitter> <watzon> Which might be because `Process.new` converts the IO to a FileDescriptor
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> try just `puts output`
<FromGitter> <Blacksmoke16> dont have to access it via the process
<FromGitter> <Blacksmoke16> when waiting for it to finish at least
<FromGitter> <watzon> It doesn't write anything to the output though https://carc.in/#/r/77yk
<FromGitter> <Blacksmoke16> prob just isnt anything there
<FromGitter> <Blacksmoke16> https://carc.in/#/r/77ys
<FromGitter> <watzon> Ahh ok
<FromGitter> <watzon> So I'm going to need to find a way to wait for the io to have something in it
<FromGitter> <watzon> Because I can't do `Process#wait`
<FromGitter> <watzon> But I need to get a value from the processes stderr
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d28faf74d75053241351cf8]
<FromGitter> <Blacksmoke16> something like that?
<FromGitter> <watzon> Not quite. Basically this is the scenario: I am launching a headless Chrome instance using `Process.new`, once that process has launched it will write to stderr `DevTools listening on ws://websocketaddress` which I need to parse so that I can retrieve the websocket address. In javascript this would be easy because I can just add an event listener, but it seems to be a little more difficult here
<FromGitter> <watzon> I'm wondering if `IO.pipe` will work though
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <asterite> why can't you `Process#wait`?
<FromGitter> <watzon> Because I don't want to wait for the process to finish
<FromGitter> <watzon> I think I figured it out though
<FromGitter> <watzon> Feels kinda hacky, but just using a loop and reading the io as a string seems to work
<FromGitter> <asterite> What about this: https://play.crystal-lang.org/#/r/77zh
<FromGitter> <asterite> @Blacksmoke16 It's great that you are using Crystal at work! And nice performance boost
<FromGitter> <watzon> @asterite but that closes the process
<FromGitter> <asterite> ah... it also works if you don't close the process
<FromGitter> <watzon> Ahh ok
<FromGitter> <asterite> I was just closing it to be polite :-)
<FromGitter> <asterite> Actually, it doesn't work
<FromGitter> <asterite> sorry
dwdv has joined #crystal-lang
<FromGitter> <asterite> Actually, it works! My example was bad because it did `gets_to_end` so it waited until the writer didn't have more data, and for that the writer must be closed, and for that the process must close
<FromGitter> <asterite> But this works: https://play.crystal-lang.org/#/r/77zj
<FromGitter> <asterite> So I guess in your case you can `gets` some times until you get the ws line you need to parse
<FromGitter> <asterite> (I also tried it with a process that outputs numbers with `sleep 1` between each number, and it works fine)
<FromGitter> <watzon> I'll try that :)
<FromGitter> <watzon> Thanks
<FromGitter> <watzon> Hmm keeps timing out
<FromGitter> <watzon> And locally I'm getting a bad file descriptor for some reason
<FromGitter> <watzon> But the `sleep` feels hacky
<rkeene> I might go work for Amazon AWS
<rkeene> Got an offer
<FromGitter> <watzon> Oooh congrats
DTZUZO has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 272 seconds]
alex`` has quit [Ping timeout: 245 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
<FromGitter> <jwoertink> Is there a way to do this?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d291cc7d14e297762bf6ab4]
<FromGitter> <jwoertink> Where I have a top level generic, but I need to call a constant within that namespace
<FromGitter> <jwoertink> That's pretty awesome @rkeene!
<FromGitter> <watzon> @jwoertink what is `name` in this case? A method?
<FromGitter> <watzon> Or are you trying to get the class name?
<FromGitter> <jwoertink> yeah, just the class name
<FromGitter> <watzon> `T.class`
<FromGitter> <jwoertink> oh, sorry, I have a typo
<FromGitter> <watzon> You might have to do `to_s`
<FromGitter> <watzon> Ahhh ok
<FromGitter> <jwoertink> I was hoping that was it lol
<FromGitter> <jwoertink> but this is a syntax error
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d291def570ac36f8d13fccd]
<FromGitter> <jwoertink> oh, wait.. that's not how that would work
<FromGitter> <jwoertink> it was right the first time.... wasn't it?
<FromGitter> <watzon> Maybe something like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d291e3a3e2c7e397075355a]
<FromGitter> <jwoertink> ah, yeah that works
<FromGitter> <jwoertink> awesome
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <watzon> Idk why you can't do`Foo(String)::Bar.run` though
<FromGitter> <jwoertink> no clue. I assumed that's how it would work, but nope 😄
<FromGitter> <jwoertink> thanks for the help!
<FromGitter> <watzon> No problem