<FromGitter>
<reiswindy> Hi, I have a question about the `.to_json`implementation in Tuples. Why is it implemented with macros instead of using `each_with_index`? Is it for performance reasons or something else?
alex`` has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<kolyaio> Hey, I want to format timestamp from Postgres. How can I do it ?
<FromGitter>
<kolyaio> I getting string from the database created by amber’s migration of the database timestamp.
<FromGitter>
<Timbus> Postgres returns an iso-formatted time. You can just use `Time.parse_iso8601` on the returned value? But that being said, Amber uses the Granite ORM? I haven't used that, but can you not just make the field a `Time` type?
<FromGitter>
<Timbus> Amazing.. I just looked and the granite documentation doesn't really cover anything regarding fields. But yes you can just use `field a_time : Time`in your model, and you won't need to do the parsing. Does that help @kolyaio ?
wontruefree has joined #crystal-lang
<FromGitter>
<kolyaio> Yeah but that’s looks like a bad solution
<FromGitter>
<kolyaio> Because I already have timestamp field called created_at and updated_at
<FromGitter>
<kolyaio> Btw what orm should I use instead ?
<FromGitter>
<kolyaio> Now it says `ERROR: Invalid timezone at 19: "2018-07-06 16:00:57>> UTC" (Time::Format::Error)`
<FromGitter>
<bew> I think I've found the problem
<FromGitter>
<kolyaio> @bew what’s the problem :O
<FromGitter>
<bew> 2sec I'm checking
<FromGitter>
<bew> what did you do to fix the "invalid number" error (your first one)
<FromGitter>
<bew> ?
<FromGitter>
<bew> hm no, it's not what I thought
<FromGitter>
<bew> the `>>` is not the problem, it's added in the error message to help locate the issue in the string it's trying to parse
<FromGitter>
<bew> do you know where the string is coming from? is it your code?
Philpax has joined #crystal-lang
Raimondii has joined #crystal-lang
ashirase has quit [Ping timeout: 268 seconds]
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
ashirase has joined #crystal-lang
<FromGitter>
<Timbus> It's coming from postgres, and that's not an ISO formatted time I guess? PG docs say it does iso time..
<FromGitter>
<Timbus> > Yeah but that’s looks like a bad solution ⏎ > Because I already have timestamp field called created_at and updated_at ⏎ ⏎ I don't understand.. what does that have to do with anything? Are you trying to access those fields? I think you need to show your Post model. [https://gitter.im/crystal-lang/crystal?at=5b41d7923d8f71623d65d9d6]
<RX14>
you have specified to listen only on "localhost"
<FromGitter>
<foi> Error: connect ECONNREFUSED 127.0.0.1:8888 ⏎ from nodejs cleint, but via telnet localhost 8888 is ok
<RX14>
if the nodejs server is on a different server
<RX14>
then it can't connect
<FromGitter>
<foi> @FromIRC both on my pc
<RX14>
no docker?
<FromGitter>
<foi> aaaah. I have docker... i stopping him
<RX14>
no I meant was the nodejs running in docker
<RX14>
if telnet works but nodejs doesn't - on the same terminal then I haaven't a clue
<FromGitter>
<foi> No, not in container
<FromGitter>
<foi> i can record video
<RX14>
then not a clue
<FromGitter>
<Timbus> Yeah if anything it's a node issue at this point, if crystal is listening and you can confirm with telnet.
<FromGitter>
<foi> Sorry, i'am not sure where is error. I will record very short video with demonstation
Philpax has quit [Read error: Connection reset by peer]
<FromGitter>
<Timbus> Usually it's just a mismatch with what you bound to... You might want to try binding to no name instead of "localhost". Binding to "0" might also work. ⏎ You might also want to specify the host explicitly from the client.
<FromGitter>
<foi> Binding crystal tcp server on 0.0.0.0 helps! Thanks!
<FromGitter>
<Timbus> np
mech422_ has joined #crystal-lang
mech422 has quit [Ping timeout: 248 seconds]
mech422_ has quit [Ping timeout: 268 seconds]
mech422 has joined #crystal-lang
mech422 has quit [Ping timeout: 276 seconds]
<crystal-gh>
[crystal] RX14 closed pull request #6348: Fix access of class vars from generic metaclass (master...bug/3719-class_var_from_generic_metaclass) https://git.io/fNejU
<crystal-gh>
[crystal] straight-shoota opened pull request #6356: Fix: Add type restriction to Crypto::Bcrypt::Password#== (master...jm/fix/bcrypt-password-eq) https://git.io/fNv76
Philpax has joined #crystal-lang
<FromGitter>
<foi> HI! Why when i connecting from nodejs tcp client (to crystal tcp server) i need always to to add \n to end of tcp-message (otherwise connection is not closed)? In crystal tcp client OK ⏎ ⏎ crystal tcp server ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b4205a481816669a43a3281]
lvmbdv has quit [Ping timeout: 260 seconds]
<oprypin>
foi, `gets` is literally "read until you find `\n`"
<oprypin>
there also isn't really such a thing as "end" in sockets
Philpax has quit [Quit: Leaving]
<FromGitter>
<foi> @oprypin Oleh, but why crystal client << "client" works without "\n" ?
<oprypin>
probably because in nodejs you are not doing "read until you find `\n`" but rather "read some number of bytes"
<crystal-gh>
crystal/master afeaee4 Ary Borenszweig: Encoding: compare with case insensitive UTF-8 or UTF8 to avoid using iconv when not necessary (#6355)
<FromGitter>
<foi> @oprypin Many thanks for your advice! Brilliant