bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Guest4565 has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
Guest4565 has quit [Quit: ...]
bjz has joined #crystal-lang
<FromGitter>
<jwoertink> I have this cURL line that works that I'm trying to translate in to a `HTTP::Client` request, but I keep getting `HTTP Error 400. The request hostname is invalid`. Can someone take a look and see what I'm missing here?
<FromGitter>
<jwoertink> ```code paste, see link```
<FromGitter>
<fridgerator> I was getting errors like that too, then I just used `HTTP::Client.post` instead and it worked better for me
<FromGitter>
<jwoertink> hmm.. is the signature the same?
<FromGitter>
<fridgerator> you can still pass headers and body to `#post`
<FromGitter>
<fridgerator> so I think so
<FromGitter>
<jwoertink> cool. I'll try that
<FromGitter>
<fridgerator> anyone successfully using json type with crystal-pg?
pawnbox has joined #crystal-lang
<FromGitter>
<jwoertink> lol, yeah, that worked @fridgerator
<FromGitter>
<jwoertink> I wonder if that's a bug?
<FromGitter>
<fridgerator> i'm not sure
<FromGitter>
<fridgerator> I just assumed I was doing something wrong, lol
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<jwoertink> well, then I'm doing the exact same thing wrong
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
sija has joined #crystal-lang
onionhammer has quit [*.net *.split]
jokke has quit [*.net *.split]
jamie_ca has quit [*.net *.split]
lhz has quit [*.net *.split]
jamie_ca has joined #crystal-lang
lhz has joined #crystal-lang
jokke has joined #crystal-lang
onionhammer has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
olek_poz has joined #crystal-lang
greengriminal has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
tlwr[m] has joined #crystal-lang
<crystal-gh>
[crystal] Sija opened pull request #4132: GIT_REMOTE_PATTERNS regexes are being overly greedy (master...fix-doc-generator-git-remote-patterns-repo-regex) https://git.io/vyKYu
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<raydf> @fridgerator, i'm using json with crystal-pg. Are you having any trouble?
<FromGitter>
<fridgerator> are you using `DB.mapping` ?
<FromGitter>
<fridgerator> i'm not sure what type to set that field to
<FromGitter>
<raydf> JSON::ANy
<FromGitter>
<raydf> Any*
<FromGitter>
<raydf> I'm not using DB.mapping
<FromGitter>
<raydf> but i'm almost sure it should work
<FromGitter>
<fridgerator> ok that might work
<FromGitter>
<fridgerator> i'm using `DB.mapping`, if I set the type to `JSON::Any` can I assign the value using a hash?
<FromGitter>
<raydf> You can use DB.mapping with the property mapped to Hash(String, JSON::Any)
<FromGitter>
<raydf> i suppose that the key should be a string for your case?
<FromGitter>
<raydf> you can use this function for converting some objects to JSON::Type and then get the JSON::Any from that
<FromGitter>
<fridgerator> great, thanks!
<FromGitter>
<raydf> or you could modify the function to always return JSON::Any
<FromGitter>
<fridgerator> ok I think I can make this work, much appreciated @raydf
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
jamie_ca has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
splitty_ has quit [Quit: Leaving]
splitty_ has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
Qchmqs has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
olek_poz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
pawnbox has joined #crystal-lang
qchmqs_ has joined #crystal-lang
qchmqs_ has quit [Client Quit]
Qchmqs has quit [Ping timeout: 256 seconds]
pawnbox has quit [Ping timeout: 246 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<crystal-gh>
[crystal] MakeNowJust opened pull request #4134: Formatter: fix to separate defs with visibility modifiers (master...fix/crystal-format/modifier-def) https://git.io/vyKWw
crystaltest has joined #crystal-lang
pawnbox has joined #crystal-lang
crystaltest has quit [Remote host closed the connection]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
sija has quit [Quit: Connection closed for inactivity]
Philpax_ has quit [Ping timeout: 260 seconds]
alibby has quit [Ping timeout: 256 seconds]
alibby has joined #crystal-lang
Qchmqs has joined #crystal-lang
alibby1 has joined #crystal-lang
alibby has quit [Ping timeout: 240 seconds]
Philpax_ has joined #crystal-lang
_whitelogger has joined #crystal-lang
bew78 has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]
Philpax__ has joined #crystal-lang
Philpax_ has quit [Ping timeout: 260 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Qchmqs has quit [Quit: Konversation terminated!]
shelvacu has quit [Quit: Goodbye for now]
shelvacu has joined #crystal-lang
<FromGitter>
<raydf> np @fridgerator
sz0 has joined #crystal-lang
greengriminal has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<zatherz> ` alias Char is already defined`
<Papierkorb>
fridgerator, lines 6,7: Instead of the double nil-check (not_nil!, nil?), consider doing `if l = @@log_handler; l << ...` or `@@log_handler.try{|l| l << ...}` instead
<FromGitter>
<fridgerator> ok thanks, i've been curious about this pattern to
<FromGitter>
<fridgerator> I know if you check `.nil?` inside of an `if` block, then its already inferred that its not nil so you don't have to check
<Papierkorb>
Instead of manually writing escape sequences, you can use the Colorize module. Though I wouldn't use those at all for log files
<Papierkorb>
Yes, but you can also write say `if something_nilable` without .nil?, which does the same if something_nilable is not a Bool
<Papierkorb>
if course, if something_nilable is `false`, it would still not execute the branch :)
<FromGitter>
<fridgerator> ok
<FromGitter>
<fridgerator> wonder if I can check the type of IO, and apply colors if it is not a `File`
<FromGitter>
<fridgerator> thanks for your help @Papierkorb
<Papierkorb>
You could use `.is_a?(File)`, but that's not good code. Much better: Use `IO#tty?`
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
greengriminal has joined #crystal-lang
Googz has quit [Ping timeout: 260 seconds]
<txdv>
how do i resolve a hostname to an ip?
<Papierkorb>
txdv: If you really need to, you can use Socket::Addrinfo.resolve: https://crystal-lang.org/api/0.21.1/Socket/Addrinfo.html#resolve%28domain%2Cservice%2Cfamily%3AFamily%3F%3Dnil%2Ctype%3AType%3Dnil%2Cprotocol%3AProtocol%3DProtocol%3A%3AIP%2Ctimeout%3Dnil%29%3AArray%28Addrinfo%29-class-method
<Papierkorb>
txdv: You don't need that to connect to an address though
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<txdv>
in /opt/crystal/src/socket/addrinfo.cr:28: can't restrict Nil to Type
<txdv>
Oo
<txdv>
feels like the return clause is never called
<Papierkorb>
Yep, looks like a bug -.-
bew78 has joined #crystal-lang
<bew78>
Is there a way to show the source code (might be generated) after all macro expansions ?
<bew78>
I know there is `{% debug() %}` but this will print only my current macro...
<txdv>
hm
<txdv>
is there a way to convert a string to a binary ascii representation?
<bew78>
I'm looking for something like `crystal build --no-codegen --dump-after-macros` or something like that, do you think I should open an issue for that ?
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<txdv>
io.write_byte(0) Error in main.cr:12: no overload matches 'IO::Memory#write_byte' with type Int32
<Papierkorb>
write_bytes
<txdv>
yeah but that needs a slice
<txdv>
write-bytes writes 4 bytes
<txdv>
and i cant cast an int32 to an uint8
<txdv>
:D
<txdv>
nevermind, to_u8
<bew78>
luislavena: I keep getting the usage message, without any explaination on error, what did I missed ? `crystal tool expand test.cr`
<FromGitter>
<drosehn> I don't understand what `expand` wants, but `crystal tool expand -c macro-expand.cr macro-expand.cr` did seem to do something more useful than printing just the usage message.
<bew78>
true, and by specifying a location with `crystal tool expand -c test.cr:9:5 test.cr` gives me `no expansion found` even though `9:5` is on a macro name...
<FromGitter>
<drosehn> ... although maybe I was just lucky there. I tried it on a different file which has some macros in it, and it complains "Error: cursor location must be file:line:column". And if I add a "line:column", I always seem to get `no expansion found`.
<bew78>
I'm not alone!..
<bew78>
maybe there is a bug in the matrice... somewhere in the universe...
<FromGitter>
<drosehn> Looks like the "line:column" needs to be somewhere inside a `{{...}}`
<FromGitter>
<drosehn> so it doesn't show you the result of expanding all the macros in a source file, but just what's happening inside a single macro-expansion.
<FromGitter>
<drosehn> ... I think.
<bew78>
Yes, I got it to work (I was not testing the right file, it's late here ^^), but yes, it does not show me more than a `{% debug() %}`..
<txdv>
how do i read an u16 from an io?
<bew78>
I'm trying to show get the list of instance vars from a macro (with `@type.instance_vars`), but I always get [] (see: https://carc.in/#/r/1pmf)
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<drosehn> Wouldn't you need to be operating on an instance of `class A` for that to work?
<bew78>
it's not what I want.. maybe it's not possible :(
<FromGitter>
<drosehn> I was playing around with something like this once. Here's an excerpt:
<FromGitter>
<drosehn> so then you'd call `A.class_method_names` on a class, or `some_a.method_names` on an instance of that class.
<FromGitter>
<drosehn> I'm not sure that code-excerpt will work correctly outside of the file where I was playing with it, but maybe it'll give you some ideas of what you could try.
olek_poz has quit [Ping timeout: 240 seconds]
<bew78>
Nice! but I can't use that for my case, as I need to generate code for the class, based on the current instance vars defined
<bew78>
so cannot be called from a method
<bew78>
like you do
<FromGitter>
<drosehn> Hmm. but what would happen if you added `self.class_method_names` inside of the definition of `class Object ... end`
<bew78>
I don't think it'll do much differences
<FromGitter>
<drosehn> Oh, except that you want instance_variables, so I suspect that's going to be difficult.
bjz has joined #crystal-lang
<bew78>
hmmm, I testing the limits of the current macro system implementation ^^
<bew78>
I'm
<bew78>
*
<FromGitter>
<fridgerator> there's a video about macros floating around somewhere of a presentation by one of the core members thats pretty good
<bew78>
ah? do you have the link?
<FromGitter>
<fridgerator> I don't, i'm looking for it
bjz has quit [Client Quit]
greengriminal has quit [Quit: This computer has gone to sleep]