<Heaven31415>
thanks dude, but I already did it with sprintf xD
<FromGitter>
<Blacksmoke16> :p
<Heaven31415>
but you are really helpful which is good
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<girng> hello all
Heaven31415 has quit [Quit: Leaving]
<FromGitter>
<girng> gona be working on my gameserver here soon. not the master server, but the tick rate one. this is gonna be fun :D
<FromGitter>
<girng> will most likely do a 15hz or 20hz tickrate server per crystal instance. not sure how many players it will handle, but should be a good amount. am excited!!!
rohitpaulk has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> over 9000 players
<FromGitter>
<girng> LOL
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<codenoid> hi
<FromGitter>
<codenoid> how to get yesterday date in crystal
rohitpaulk has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> hm
<FromGitter>
<Blacksmoke16> `Time.now - 1.day`
<FromGitter>
<Blacksmoke16> `or
<FromGitter>
<Blacksmoke16> `1.day.ago`?
<FromGitter>
<codenoid> oh, it's working
<FromGitter>
<codenoid> Day
<FromGitter>
<Blacksmoke16> 👍
_whitelogger has joined #crystal-lang
<FromGitter>
<codenoid> thankyou crystal doesn't have `Date` (like ruby)
<FromGitter>
<Blacksmoke16> its called `Time`
rohitpaulk has joined #crystal-lang
<FromGitter>
<codenoid> Time.yesterday
<FromGitter>
<codenoid> error
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<Blacksmoke16> yea its not a method
<FromGitter>
<Blacksmoke16> would have to do either `Time.now - 1.day` or `1.day.ago`
<FromGitter>
<Blacksmoke16> how would you humanize a number, like add commas
<FromGitter>
<girng> when you call functions inside a fiber what happens to that function. is it duplicated to be used inside that fiber? or does the fibers just reference the method and use the code inside of it?
<FromGitter>
<girng> for example in my example above in the handle_login method, let's say i use a `db` to query some info etc. and other modules. and let's just pretend the handle_login is a very large method. now. go look at the spawn handle_connection part. let's say 100 users log in, all their connections are fiber'd. ⏎ ⏎ now, is the handle_login duplicated so each of those fibers can use it? or, do all of the fiber'd
<FromGitter>
... connections just reference the handle_login and use it instead?
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<girng> what i guess i'm trying to ask (and apologize if i'm not explaining it clearly). but do the amount of the methods i have in fiber'd `handle_connection` ultimately determine how many users that can connect? because i assume the larger my `message_handler` becomes, each new fiber will have to make room for all of it's methods. am not sure lol
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 244 seconds]
moei has quit [Ping timeout: 260 seconds]
return0xe has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<jrfondren> no, that memory is shared.
lvmbdv has joined #crystal-lang
<FromGitter>
<jrfondren> it would be shared even if you fork()ed a bunch of processes instead of using fibers
<FromGitter>
<jrfondren> in general, don't worry about code. worry about data
rohitpaulk has joined #crystal-lang
<FromGitter>
<girng> ty
lvmbdv has quit [Quit: WeeChat 2.2]
rohitpaulk has quit [Ping timeout: 240 seconds]
hightower2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<codenoid> i have 2 employe, and i told them to learn Crystal !, xD
<FromGitter>
<codenoid> @Blacksmoke16 , change 30.1 to your local dns
<FromGitter>
<codenoid> i use echo, while there is no text editor (nano, vim, ed, etc)
<FromGitter>
<Blacksmoke16> yea i fixed it
<FromGitter>
<Blacksmoke16> thanks
<FromGitter>
<codenoid> 👍
<FromGitter>
<Blacksmoke16> or maybe not
<FromGitter>
<Blacksmoke16> yea http client cant connect for whatever reason
<FromGitter>
<codenoid> :/
<FromGitter>
<Blacksmoke16> trying github api just to make sure its not the host im trying to connect to
<FromGitter>
<Blacksmoke16> `Unhandled exception: No address found for api.github.com:443 over TCP (Socket::Error)`
<FromGitter>
<Blacksmoke16> nope
<FromGitter>
<j8r> Sounds like a dns problem
<FromGitter>
<Blacksmoke16> hmm plan b
<FromGitter>
<Blacksmoke16> can curl those apis within container just fine
return0xe has joined #crystal-lang
thews has quit [Ping timeout: 252 seconds]
<FromGitter>
<Blacksmoke16> well got it working, using the crystal imagine as a base
return0e has quit [Ping timeout: 245 seconds]
<FromGitter>
<Blacksmoke16> so guess there is some dependency http client needs there that doesnt get statically compiled, as it doesnt work on alpine/scratch image bases
<FromGitter>
<Blacksmoke16> is there a way to figure out what that dependency would be?
<FromGitter>
<j8r> There is an issue about dns and docker
<FromGitter>
<j8r> It might be related, dunno
<FromGitter>
<Blacksmoke16> hmm
<FromGitter>
<Blacksmoke16> could it be related to alpine using musl-libc vs glibc?
<FromGitter>
<Blacksmoke16> i dont know much about this stuff but that seems to be a possibility
<FromGitter>
<Blacksmoke16> since that seems to be the only major diff dependency wise between the crystal image and alpine image
<FromGitter>
<Blacksmoke16> yea its deff the issue, ill file a bug
<FromGitter>
<j8r> No it's not related to the libc
<FromGitter>
<Blacksmoke16> sure seems like it
<FromGitter>
<Blacksmoke16> but you prob know more about it than i do, just reporting what i find
<FromGitter>
<Timbus> I see dns problems all the time with alpine so it's a fair assumption. That said, you compiled with --static so I can't understand how it's the libc
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<drum445> all languages should compile to single binaries like Crystal and Go
<FromGitter>
<j8r> It's more related to Docker containers than Alpine itself
<FromGitter>
<j8r> Alpine is neat. On ubuntu, that's dnsmasq that can cause problems. IIRC it's installed by default
<FromGitter>
<Timbus> The only problem Ive ever had with dnsmasq is docker trying to circumvent it :-/
_whitelogger has joined #crystal-lang
DTZUZO has joined #crystal-lang
hightower2 has quit [Ping timeout: 252 seconds]
<FromGitter>
<girng> i'm having trouble with this json. if i only have like 2 keys it works. but if i start adding more than that, i get index out of bounds error
<FromGitter>
<girng> ok so i was thinking the `as_h` was going to do `{"1" => {"item_id" => 1_i64}}`, not `{"1", {"item_id" => 1_i64}}` that's what confused me
<FromGitter>
<girng> my bad. sorry ty for help
<FromGitter>
<xababafr> Hi everyone :) I'm looking for a way to go through a crystal code's ast and look for variables and methods, to get their types.. Is there any way to do it with the Transformer class? I have no idea how type is handled in Ast Nodes