jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
oddp has quit [Ping timeout: 264 seconds]
<FromGitter> <confact> I am trying to parse as JSON, where all ints, floats, and so on are strings. from_json is complaining that they are string. Could I somehow overwrite and based which column it is cast it to int/float?
<jhass> confact: you can specify custom converters
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
<FromGitter> <icyleaf> Hey all guys, i have a problem to fix, here is the code which it does something like reflect a class and i don't know how to return a type of value to accept Any class or struct: https://play.crystal-lang.org/#/r/9cyk
raz has joined #crystal-lang
f1refly has joined #crystal-lang
<FromGitter> <j8r> Oops, the stdlib WebSocket does not close the connection properly
<FromGitter> <j8r> I got ⏎ ⏎ > close { target: WebSocket, isTrusted: true, wasClean: false, code: 1006, reason: "", srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, … }
<FromGitter> <j8r> `wasClean: false` is in both Chromium and Firefox
<jhass> icyleaf: https://play.crystal-lang.org/#/r/9cz8 but this feels like being too deep in the darkness of macro land honestly :P
oddp has joined #crystal-lang
<FromGitter> <icyleaf> @jhass Hah, i image this solve in my mind though :D
<FromGitter> <bburrows_gitlab> Hi All, Hoping someone here knows how to handle a http POST request where Content-Type: application/x-www-form-urlencoded. I want access to the form fields. The following works great for Content-Type: multipart/form-data but for Content-Type: application/x-www-form-urlencoded it just throws an error.``` HTTP::FormData.parse(context.request) do |field| ⏎ ⏎ ``` puts name ⏎ puts
<FromGitter> ... value ⏎ end`````` ⏎ ⏎ As an asside I tried just dumping the whole context object (expecting some string representation) to see if I could figure what was the problem but I just get thing like "#<HTTP::Request:0x106edf900>". This is for a tiny tiny application (it just receives two http forms and writes the received data to d ... [https://gitter.im/crystal-lang/crystal?at=5efc5b51b8152d348474d4e6]
<jhass> did you try HTTP::Params.parse(context.request.body) ?
<FromGitter> <bburrows_gitlab> Yes, but context.request.body is of type IO so I added to_s but it still did not work
<jhass> huh
<jhass> .body should be a string, body_io would be the IO
<jhass> oh, nvm, apparently that's only for response, not request
<jhass> so the way to get a single string from an IO is to call gets_to_end
<jhass> HTTP::Params.parse(context.request.body.gets_to_end)
<jhass> I guess a HTTP::Params.parse overload that parses from an IO wouldn't hurt if somebody is bored :P
<FromGitter> <bburrows_gitlab> I tried that also but I get this
<jhass> heh, if body = context.request.body then
<jhass> else; you_need_to_send_me_a_body; end
<FromGitter> <bburrows_gitlab> I can see that a body is sent because I used wireshark to check. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5efc603fe0e5673398e6800f]
<jhass> yeah, but how would the compiler know at compile time
<jhass> it's nilable, so you need to check
<jhass> if body = context.request.body; HTTP::Params.parse(body.gets_to_end); else; return_400; end
<FromGitter> <bburrows_gitlab> Ahhhhhhh! Sorry, I am very new to crystal. Only installed it last week :-)
<FromGitter> <bburrows_gitlab> Will give that a try, I see now the error does say its a compiler error.
_whitelogger has joined #crystal-lang
<FromGitter> <bburrows_gitlab> Thanks SO much. It's working fine now. :-)
<jhass> yw :)
livcd has joined #crystal-lang
MasterdonX has joined #crystal-lang
masterdonx2 has quit [Quit: ZNC 1.7.5 - https://znc.in]
Human_G33k has joined #crystal-lang
<FromGitter> <s0kil> We have recently upgraded Mint to Crystal 0.35.1 which started to produce linking errors (OpenSSL) during OSX build. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Here is a link to the CI build (https://travis-ci.org/github/mint-lang/mint/jobs/703775612) ... [https://gitter.im/crystal-lang/crystal?at=5efc823f6c06cd1bf46682f4]
<jhass> the major difference is that /usr/local/lib is no longer by default passed as -L argument to the linker
<jhass> you may want to try PKG_CONFIG_PATH includes the pc file directory for openssl or readding /usr/local/lib through LIBRARY_PATH
<FromGitter> <lodenos> @s0kil I have same problem too https://github.com/crystal-lang/crystal/issues/9477
<FromGitter> <lodenos> I have recompiling everithing openssl, reinstall crystal 0.35.1 clean cache check if every file exist
<FromGitter> <s0kil> @lodenos You managed to compile openssl with homebrew?
<FromGitter> <s0kil> I'm going to try. ⏎ ⏎ 1) `brew install openssl` ⏎ 2) `ln -s /usr/local/opt/openssl/include/openssl /usr/local/include` [https://gitter.im/crystal-lang/crystal?at=5efc8e313bcb6a5aa2918b78]
<FromGitter> <asterite> What's the output of `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` ?
<jhass> and do you guys have a libssl/libcrypto in /usr/local/lib? If yes, is it symlink? If yes, where to?
<FromGitter> <lodenos> @jhass
<FromGitter> <lodenos> it's not s symlink libssl.a and libcrypto.a
<jhass> I don't follow
<jhass> please elaborate
<FromGitter> <lodenos> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5efc90fe54d7862dc4bd7d6a]
<FromGitter> <lodenos> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5efc914aa813c72dcf1f5b35]
<FromGitter> <lodenos> form `usr/local/lib`
<jhass> where the hell is that libcrypto.a and libcrypto.dylib in there coming from :/
<jhass> I don't have it
<FromGitter> <lodenos> Have MacOS ?
<jhass> yeah
<FromGitter> <lodenos> hum
<FromGitter> <lodenos> Never have u a problem with that, what's your `usr/local/lib`
<jhass> a lot of stuff but all managed by homebrew
<jhass> given you got a libcrypto in there but no libssl, I suspect a version mismatch between the two
Welog has quit [Remote host closed the connection]
<FromGitter> <evvo> Hello!
<FromGitter> <evvo> I'm not sure if this is related, but I'm having a problem with the password comparison with Crypto::Bcrypt::Password: ⏎ https://play.crystal-lang.org/#/r/9d0i
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9d0m
<FromGitter> <Blacksmoke16> wrong method
<FromGitter> <evvo> Ah, I've been looking at the wrong version of the documentation
<FromGitter> <evvo> Thanks, @Blacksmoke16 :)
<FromGitter> <Blacksmoke16> np
alexherbo27 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo27 is now known as alexherbo2
<FromGitter> <wontruefree> I am sure most people here have seen my promote the Chicago Crystal podcast. But if you have not I released a really good episode with Lorenzo Barasti this week and wanted to share it here. I am hoping people who do not read the backlog might see it here. http://podcast.chicagocrystal.org/1030945/4364261-lorenzo-barasti-building-crystal-community
<FromGitter> <evvo> Very nice!
<FromGitter> <s0kil> Glad it's available on Spotify.
<FromGitter> <wontruefree> thanks !!
<FromGitter> <wontruefree> yeah we did setup support for Spotify
<FromGitter> <wontruefree> they made it surprisingly easy
<FromGitter> <wontruefree> I would love to setup a youtube integration but I have not found the time yet
<FromGitter> <s0kil> The interview with Ary really did not sound good, but it's probably acceptable for first one.
<FromGitter> <wontruefree> We have come a long way since then
<FromGitter> <wontruefree> It has been a journey on how to do this well
<FromGitter> <wontruefree> but maybe sometime in the future I can have him on again
<FromGitter> <RespiteSage> Hey, why does this not raise a `KeyError`? https://carc.in/#/r/9d1h
<FromGitter> <RespiteSage> I expected that `hash[key] ||= value` would expand to `hash[key] = hash[key] || value`, which should raise a `KeyError` if `hash[key]` hasn't been set yet (and the hash has no default).
<FromGitter> <s0kil> That would be cool
<FromGitter> <ImAHopelessDev_gitlab> hi
<FromGitter> <naqvis> @RespiteSage `||` evaluates left operand for `truthy`, so compiler turn that into sth ⏎ ⏎ ``` if tmp = seen[20_i64]? ⏎ ..... ⏎ else ⏎ .... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5efcc4a9b8152d3484760e77]
DTZUZU has quit [*.net *.split]
andremedeiros has quit [*.net *.split]
DTZUZU has joined #crystal-lang
andremedeiros has joined #crystal-lang
<FromGitter> <naqvis> hi Girng
MasterdonX has quit [*.net *.split]
sagax has quit [*.net *.split]
ua has quit [*.net *.split]
mjblack has quit [*.net *.split]
Xeago has quit [*.net *.split]
Flipez has quit [*.net *.split]
sagax has joined #crystal-lang
MasterdonX has joined #crystal-lang
mjblack has joined #crystal-lang
ua has joined #crystal-lang
Xeago has joined #crystal-lang
Flipez has joined #crystal-lang
<FromGitter> <asterite> @RespiteSage `hash[key] ||= value` expands to `hash[key] = hash[key]? || value` . Check the docs here: https://crystal-lang.org/reference/syntax_and_semantics/operators.html (combined assignment)
<FromGitter> <asterite> Wow, the docs look so much better than what I first wrote in there
<FromGitter> <RespiteSage> Ah, okay. The special `#[]` case makes sense. It's a nice semantic; I just didn't expect it.
<FromGitter> <RespiteSage> @ImAHopelessDev_gitlab Hey, there.
<FromGitter> <j8r> "won true free interview" :D
<raz> speaking of docs... will we ever stop sending people to 0.24.1 via google :p
Human_G33k has quit [Ping timeout: 240 seconds]
HumanG33k has quit [Ping timeout: 246 seconds]
HumanG33k has joined #crystal-lang
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
HumanG33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
HumanG33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
HumanG33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
HumanG33k has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
* raz shrugs
<raz> well, at least that one user who's still on 0.24.1 will never have trouble getting back to his docs :p
sgt_chuckles has joined #crystal-lang
<sgt_chuckles> hi
<FromGitter> <Blacksmoke16> o/
<sgt_chuckles> how long will it take crystal to be the new standard for game development
<oprypin> sgt_chuckles, infinity
<sgt_chuckles> congrajoolashins
<oprypin> 🎉
<sgt_chuckles> seriously though
<sgt_chuckles> would love to see more support in game dev for this language
<sgt_chuckles> cause i've done games in c++
<sgt_chuckles> and in python
<sgt_chuckles> and often wish i had the ease of python with power of c++
<sgt_chuckles> crystal looks like that
<FromGitter> <wontruefree> haha
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 256 seconds]
<FromGitter> <UnsolvedCypher_gitlab> Has anyone ever tried to implement a Crystal interpreter rather than compiler? I could see that being useful for type checking code or for really fast live reloading during development
<FromGitter> <s0kil> @UnsolvedCypher_gitlab There is this thing called Ruby, lol
<FromGitter> <UnsolvedCypher_gitlab> I realize that
<FromGitter> <wyhaines> To type/error check code without building it.... `crystal build --no-codegen --error-trace foo.cr` It returns very quickly.
<FromGitter> <UnsolvedCypher_gitlab> Ooh that's really good to know, thank you @wyhaines
<FromGitter> <watzon> Really what Crystal needs is incremental compilation. Once you add that it becomes trivial to have code hot swapping.
<FromGitter> <watzon> And then compile times during development are much less of an issue
<FromGitter> <UnsolvedCypher_gitlab> Does Crystal have an easy way to check the type of something? I think something like that would really assist in having decent autocomplete