ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
taupiqueur has quit [Ping timeout: 265 seconds]
hightower3 has joined #crystal-lang
notzmv has quit [Ping timeout: 268 seconds]
notzmv has joined #crystal-lang
<FromGitter> <naqvis> postmodern: https://carc.in/#/r/ccss
<FromGitter> <mateuszwieloch> Hey I'm trying to build a terminal UI that will have ability to choose between multiple options like in the image. I'd appreciate advice where to start - what crystal library provides needed functionality, whether to go low level like NCurses bindings or is there something providing it out of the box?
<FromGitter> <naqvis> take a look at https://github.com/crystal-term/prompt
<FromGitter> <mateuszwieloch> 🙏🏻Thank you! Looks like it has what I need or at least what I can use as a starting point
<FromGitter> <naqvis> 👍
<FromGitter> <naqvis> Published wasmer-crystal (https://github.com/naqvis/wasmer-crystal) WebAssembly runtime for Crystal
<FromGitter> <vlazar> ❤️ Wow, that's so cool! So I can use any Rust libs compiled to WASM from Crystal now?
<FromGitter> <naqvis> thanks and yeah
<FromGitter> <naqvis> 🙏
<FromGitter> <vlazar> > A complete and mature WebAssembly runtime
<FromGitter> <vlazar> Is "mature" part there about it being tested in prod?
<FromGitter> <naqvis> that applies to `wasmer`
<FromGitter> <vlazar> gotcha, thank you!
<FromGitter> <naqvis> 🙏
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 265 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Quit: taupiqueur]
taupiqueur has joined #crystal-lang
ua_ has quit [Ping timeout: 260 seconds]
<FromGitter> <Dan-Do> A silly question as I don't know wasm. Does it mean that we can run Crystal code in browser?
ua_ has joined #crystal-lang
<FromGitter> <naqvis> no, you can't compile crystal code to wasm. But via this shard now you can run other wasm modules from Crystal
<FromGitter> <naqvis> this shard embeds wasm runtime inside crystal
<FromGitter> <Dan-Do> 👍
hightower3 has quit [Remote host closed the connection]
hightower3 has joined #crystal-lang
hightower3 has quit [Client Quit]
hightower3 has joined #crystal-lang
hightower3 is now known as hightower2
hightower2 has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 245 seconds]
<FromGitter> <vlazar> which means if you miss something in Crystal shards you can check https://crates.io/categories/wasm or anything else that works when compiled to WASM
<FromGitter> <Dan-Do> That's really valuable for the community ❤️
<SamantazFox> Hmm, I have a weird bug. I'm investigation atm, but the general idea is that because of the decompression issues in HTTP::Client from stdlib
<SamantazFox> I did implement a decompression routine (https://github.com/iv-org/invidious/pull/2623), but it raises the following exception "HTTP::Client::Response#body_io cannot be nil (NilAssertionError)" in some edge cases.
casionaut has joined #crystal-lang
<SamantazFox> I've deployed that fix for a few days now, on bare metal Debian, without a problem. But we keep getting issue reports about it.
<SamantazFox> So I'm trying to figure out if the problem is due to docker, or some specific container.
<FromGitter> <Dan-Do> Regarding the body_io, sometimes the client cannot parse the response. I have a monkey patch like this
<FromGitter> <Dan-Do> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=61a38d9963c1e83c9531d53f]
<FromGitter> <Dan-Do> The patch is ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=61a38dc9abdd6644e3ac5514]
<FromGitter> <Dan-Do> (un)comment the like that works your you
<SamantazFox> haaaaaaa *flails*
<SamantazFox> thanks!
casionaut has quit [Quit: o7]
casionaut has joined #crystal-lang
casionaut has quit [Quit: o7]
hightower2 has joined #crystal-lang
<SamantazFox> whyyyy
<SamantazFox> why is the body_io niled?
<yxhuvud> Why does it matter to you?
<SamantazFox> yxhuvud: because of a bug in the stdlib, a response's body is not always decompressed, and rather than checking if it was properly done, I've made a patch in my code to send the Content-Encoding header, which disables auto decompression, and do that by myself.
<SamantazFox> but, Compress::Gzip::Reader and Compress::Deflate::Reader both takes IOs, not Strings
<yxhuvud> if gets to end has been called, it will be nothing more to decompress anyhow, so it wouldn't matter
<SamantazFox> my problem is that `response.body` is a String, and I have to feed it to Compress::Gzip::Reader
<FromGitter> <Blacksmoke16> `body_io` is only set if you're using the block version of one of the request methods
<SamantazFox> So I though: let's use response.body_io instead, to directly have an IO
<straight-shoota> There is no way to access either body or body_io. They're mutually exclusive
<SamantazFox> That's something I'd expect, yeah, but why `body` is always the full body, as a `String` and `body_io` is that same body as `IO`, but `Nil` on Docker?
<straight-shoota> Sorry what has Docker to do with this?
<SamantazFox> I'm trying to figure that out, actually.
HumanG33k has quit [Quit: WeeChat 3.0]
<SamantazFox> For context, I've made this code, to prevent an issue from happenning: https://github.com/iv-org/invidious/pull/2623/files
<SamantazFox> Said issue is: "body is sometimes decompressed, sometimes not"
<SamantazFox> So, I've set "Content-Encoding" to "gzip, deflate" to disable HTTP::Client's auto-decompression, and added the required logic to decompress the body by myself
<SamantazFox> problem is that when deployed on bare-metal, it works fine, and on Docker, we're getting this: https://github.com/iv-org/invidious/issues/2632
<FromGitter> <Blacksmoke16> i mean is it not possible you're doing like `HTTP::Client.get "..."` then trying to access `body_io` on it?
<SamantazFox> `response.body_io`, yes.
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=61a3a3c9026dc63ca61e5489]
<SamantazFox> Why is it "not okay"?
<SamantazFox> oops, wrong link
<SamantazFox> better
<FromGitter> <Blacksmoke16> because `body_io` is only set in the context of using the block overload, so `body` wouldnt be set
<FromGitter> <Blacksmoke16> while if you used the non block overload `body` is set and `body_io` is not
<FromGitter> <Blacksmoke16> by "not okay" meaning it'll raise saying it shouldn't be nil
<FromGitter> <Blacksmoke16> if you try to use it in not the right context
<SamantazFox> Oh, I misunderstood the code snippet you provided
<SamantazFox> Ok, I get it now.
<SamantazFox> Why isn't that mentionned in the API doc?!
<SamantazFox> Ok, thanks y'all
<SamantazFox> Now, I'm wondering why it works sometimes, and not others.
<SamantazFox> And of course impàlement that properly
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
notzmv has quit [Ping timeout: 268 seconds]
ur5us has joined #crystal-lang
notzmv has joined #crystal-lang
taupiqueur has quit [Remote host closed the connection]
taupiqueur_ has joined #crystal-lang
taupiqueur has joined #crystal-lang
taupiqueur_ has quit [Ping timeout: 265 seconds]
taupiqueur_ has joined #crystal-lang
taupiqueur has quit [Ping timeout: 265 seconds]
taupiqueur_ has quit [Remote host closed the connection]
taupiqueur has joined #crystal-lang
<SamantazFox> What's the most recommended? `Foo::Bar.echo` or `Toto::Foo::Bar.echo`
<FromGitter> <Blacksmoke16> probably doesnt really matter, could argue the former since its shorter, or the latter because its more clear what specific type it points to
<FromGitter> <jrei:matrix.org> In rare casea you have no choice of the latter if the stdlib uses the same name
taupiqueur has quit [Ping timeout: 265 seconds]
taupiqueur has joined #crystal-lang
<SamantazFox> mmmh, okay, thanks :)
okcando has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
taupiqueur has quit [Ping timeout: 268 seconds]
taupiqueur has joined #crystal-lang
okcan_ has joined #crystal-lang
okcando has quit [Ping timeout: 265 seconds]
okcando has joined #crystal-lang
okcan_ has quit [Ping timeout: 240 seconds]