RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
ternarysolo has joined #crystal-lang
ternarysolo has quit [Ping timeout: 246 seconds]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
<FromGitter> <bajro17> Hello I need help what is easiest way to upgrade my connection to websocket?
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 250 seconds]
f1refly has quit [Ping timeout: 250 seconds]
f1refly has joined #crystal-lang
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 264 seconds]
jemc has joined #crystal-lang
jemc has quit [Ping timeout: 246 seconds]
<FromGitter> <mehmetc> @j8r Thank you. I did some rereading on union types it is clearer now.
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 250 seconds]
<FromGitter> <bararchy> So, I know its a long shot but anyone is coming to RSA conference in SF US? Would love to meet community people IRL
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> @bajro17 you can upgrade to http/2, which can replace websockets
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 264 seconds]
<FromGitter> <vladfaust> @j8r I think the question was about upgrading a GET request to websocket connection
<FromGitter> <j8r> yes @vladfaust , I just want to point out @bajro17 that if he uses http/2, it probably don't need websockets anymore
<FromGitter> <vladfaust> http/2 does not replace websockets, as of SSR (server-side events) do not allows two-way communication
ashirase has quit [Ping timeout: 250 seconds]
<FromGitter> <j8r> with http/1 yes, not http/é
<FromGitter> <j8r> > Lack of bidirectional capabilities has often been perceived as a major drawback when comparing SSE to WebSocket. Thanks to HTTP/2 this is no longer the case. This opens up the opportunity to skip WebSockets and stick to an HTTP-based signaling instead.
<FromGitter> <j8r> of course this depends of the use case, if you are building a very real time app - you may have better to use websockets
<FromGitter> <j8r> the problem is: we don't have HTTP/2 in stdlib crystal, yet 😢
ashirase has joined #crystal-lang
<FromGitter> <vladfaust> Server-side events still don't allow two-way communication
<FromGitter> <vladfaust> As a replacement you're suggesting HTTP/2 pushes and HTTP requests instead of websocket frames
<FromGitter> <vladfaust> It is far less efficient in terms of latency
<FromGitter> <j8r> yes
<FromGitter> <vladfaust> https://github.com/ysbaddaden/http2 wip. Unfortunately, @ysbaddaden didn't put a license to that repo, so noone can use it yet
<FromGitter> <j8r> but there is HPAK compression
<FromGitter> <vladfaust> Agreed. Still can compres frames by yourself
<FromGitter> <j8r> right. Anyway in Crystal, better to use Websockets
marmotini_ has joined #crystal-lang
faitswulff has joined #crystal-lang
faitswulff has quit [Ping timeout: 268 seconds]
ternarysolo has joined #crystal-lang
faitswulff has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
lucasb has joined #crystal-lang
<FromGitter> <bajro17> I find way with help on Telegram
<FromGitter> <bajro17> but still cant figure out why my connection instantly close
<FromGitter> <j8r> Off topic: I've updated jrei/crystal-alpine Docker image
<FromGitter> <j8r> @straight-shoota it can allow you to continue the https://github.com/crystal-lang/crystal/pull/7420 experimentation
hightower2 has quit [Ping timeout: 240 seconds]
<jokke> j8r: i have an automated build
<FromGitter> <j8r> me too, but mine is based on Alpine:latest
<FromGitter> <j8r> so it will only build if alpine:latest has changed :/
<jokke> why?
<jokke> oh
<jokke> ofc
<jokke> but
<jokke> nah you can just disable cache
<FromGitter> <j8r> more stable, eventually production
<jokke> what do you mean?
<FromGitter> <j8r> alpine:latest is more stable than alpine:edge
<jokke> sure
<jokke> mine is also based on alpine:latest
<FromGitter> <j8r> and there is a Docker hub autobuild feature, that autobuild when the base `FROM image` is updated
<jokke> yeah
<jokke> i just build in the ci every day
<FromGitter> <j8r> not really joke, you more or less update to edge
<jokke> because i run apk update?
<jokke> *upgrade
<FromGitter> <j8r> yeah and all new dependencies come from edge
<FromGitter> <j8r> right?
<jokke> ah yeah right
<jokke> RUN sed -i -e 's/v[[:digit:]]\.[[:digit:]]/edge/g' /etc/apk/repositories
<FromGitter> <j8r> on my side I only install crystal and shards from edge, and all other dependencies comes from latest
<jokke> idk if that's a good idea
<FromGitter> <j8r> anyway, doing it manually isn't really a big deal
<FromGitter> <j8r> Before I was able to "watch" `crystallang/crystal`
<jokke> well it might work
<FromGitter> <j8r> not anymore :(
<jokke> just build it in gitlab ci?
<jokke> ezpz
<FromGitter> <j8r> Hum, why not!
<jokke> you can basically copy paste my build script
<jokke> just remember to set protected CI vars DOCKER_USERNAME and DOCKER_PASSWORD
<FromGitter> <j8r> wow sure
<FromGitter> <j8r> the worst is those pushing AWS credentials in clear - you can quickly be ruined and have thousands of dollars to pay
<FromGitter> <j8r> there is literally no limit of consumption, even millions to pay
<mps> j8r: this CI is just x86_64? or can it build aarch64?
<FromGitter> <j8r> I've searched for arm builds, "raw" CIs or docker based - I haven't one, yet
<FromGitter> <j8r> or there are hacks with qemu and chroots
<mps> ah, we just got multi arch drones for alpine
<mps> so, wanted to inform you about that nice feature
marmotini_ has quit [Remote host closed the connection]
<FromGitter> <j8r> multi arch drones?
<mps> some kind of docker builders which have multiple arch's
<FromGitter> <j8r> For the Alpine Linux project? cool! :)
<mps> not only alpine, but yes from a few days ago alpine also
<mps> for example if you make PR you can try build it on these drones and see results before PR goes to official builders
<jokke> mps: it can build on anything
<jokke> mps: or anything you can build the gitlab-runner for
<jokke> which is written in go
<jokke> so windows/mac/linux (x86 or arm) shouldn't be a problem
<jokke> gitlab itself only has x86 runners afaik
<jokke> but it's super easy to add your own
<jokke> i really really like the gitlab ci
<jokke> there's practically no limit to what it can do
<mps> jokke: it is somehow linked to github, but probably could be to gitlab also
<jokke> mps: what is?
<mps> jokke: don't understand?
<jokke> what is linked to github
<mps> ah, these drones
<mps> you have PR and before sending to project you check if it works using these drones
<mps> to be fair, I don't know how it works at lower level but looking them in action last few days
<jokke> ic
azuri5 has joined #crystal-lang
ternarysolo has quit [Ping timeout: 255 seconds]
ternarysolo has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
jemc has joined #crystal-lang
azuri5 has quit [Quit: azuri5]
moei has joined #crystal-lang
azuri5 has joined #crystal-lang
faitswulff has quit []
<z64> you can use gitlab CI on github, but currently CI will not be run specifically on PRs from forks
<z64> branches & prs from your own repo will run as expected
azuri5 has quit [Quit: azuri5]
ua has quit [Ping timeout: 268 seconds]
ua has joined #crystal-lang
rohitpaulk has joined #crystal-lang
chickendan has joined #crystal-lang
devil_tux has joined #crystal-lang
<devil_tux> anyone have an idea how to cleanly remove `<?xml version= ...` node from XML document?
<devil_tux> and I don't mean childrens
<chickendan> hey, folks! in c++ calling setvar.insert(x) returns a pair indicating presence, rust is doing the same, returning a bool. How can I avoid the two lookups in crystal when I want to take action upon encountering a duplicate value? Hashes allow procs/blocks on missing keys, but what about on existing keys?
<chickendan> Currently I'm checking via set.includes? and later set.add, but that's twice the work, or is crystal caching keys like lisp's sbcl is doing?
flaviodesousa has joined #crystal-lang
azuri5 has joined #crystal-lang
devil_tux has quit [Ping timeout: 250 seconds]
<z64> chickendan: if you wanted to check for existing keys, i suppose you could closure a boolean flag
rohitpaulk has quit [Remote host closed the connection]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<chickendan> z64: Damn, I've completely overlooked the fetch method. That's a helpful one. But, well, since I'm mostly inserting some thousand keys until I hit a duplicate value, the double lookup overhead is still there, isn't it? First the fetch, then the hash[x].
rohitpaulk has quit [Remote host closed the connection]
<chickendan> Dlang, for example, has this not so slick update method for hashtables: https://dlang.org/spec/hash-map.html#advanced_updating
<chickendan> But I can wrap it in a more convenient insert function.
<z64> yeah, i suppose that is the same. no i dont think there is any api like that off the top of my head (cant look at the dlang thing atm)
<FromGitter> <Sija> @chickendan: IIUC Ruby's `Set#add?` (https://ruby-doc.org/stdlib-2.5.3/libdoc/set/rdoc/Set.html#method-i-add-3F) would solve your problem, right?
<z64> sounds like it
<FromGitter> <Sija> I meant its functionality if ported to Crystal
<sagax> hi all!
<FromGitter> <Sija> howdy!
<sagax> how to update crystal with crystal?
<z64> but, if you look at the source Sija, it is exactly the same
<FromGitter> <Sija> @z64 I don't follow, same as what?
<z64> the ruby method 1. checks if the value exists in the set, then 2. updates it; chickendan wants to do this in one move
<z64> he is already doing what that ruby method does manually
<FromGitter> <Sija> oh, right
<chickendan> Yeah, ruby source does the same double lookup, but a different return val then self would make it easier. :)
<chickendan> than*
<FromGitter> <Sija> in terms of performance that would probably be the same but with cleaner API
<z64> yeah, it would still be a nice addition i think, and if there is an implementation detail to optimize, can be done later
<FromGitter> <Sija> might be worth adding it anyways
<FromGitter> <Sija> I'll take it :)
<z64> cool
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<sagax> `crystal` can self update?
<sagax> i have 0.27.0 version
<FromGitter> <Blacksmoke16> how did you install that version?
<FromGitter> <Blacksmoke16> as the update method depends on how it was installed
<sagax> i don't remember
<FromGitter> <r00ster91> did you install it using one of these guides? https://crystal-lang.org/reference/installation/
<sagax> but if crystal can some like as `crystal --update` it's to be cool
<rkeene> sagax, If you used AppFS, you would get that for free
<rkeene> :-D
<FromGitter> <r00ster91> yes that would be very convenient but unfortunately Crystal doesn't have that
<FromGitter> <Sija> @sagax in short: no
<FromGitter> <Sija> IIRC no other language provides such feature
<FromGitter> <Sija> also, that would a PITA to maintain so I wouldn't count on implementing it
<sagax> hm, i think i just download release from github
<sagax> ok, i will try this
<FromGitter> <Sija> @chickendan PR ready: https://github.com/crystal-lang/crystal/pull/7495
<FromGitter> <Sija> you can upvote and/or mention your specific usecase in case I've missed sth
flaviodesousa has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
azuri5 has quit [Quit: azuri5]
azuri5 has joined #crystal-lang
<FromGitter> <drum445> silly question, but in Ruby you can do something like ⏎ `if foo` ⏎ to check if a var exists, can you do the same in Crystal?
<FromGitter> <drum445> undefined local variable or method 'foo' is what i get
<FromGitter> <vladfaust> You haven't defined foo beforeahead
<FromGitter> <drum445> I can't guarantee it exists, it's in an ecr file
<FromGitter> <vladfaust> That's the issue
<FromGitter> <drum445> Not an issue
<FromGitter> <drum445> I want to be able to check if a var exists and then do something depending on the result
<FromGitter> <drum445> Do you know of a way sir?
<FromGitter> <Blacksmoke16> is it within a class, i.e. not top level?
<FromGitter> <drum445> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c79a3e4e1446a6ebe68dd3e]
<FromGitter> <Blacksmoke16> could you default them to nil?
<FromGitter> <drum445> I'd rather not if possible
<FromGitter> <drum445> If there's no other way that is
<FromGitter> <Blacksmoke16> can you use macros in ECR templates?
<FromGitter> <vladfaust> I don't understand how it can be undefined. `post.title` woud not compile too in this case
<FromGitter> <Blacksmoke16> i think thats the point
<FromGitter> <vladfaust> Ah, get it
<FromGitter> <vladfaust> Yeah, `nil` makes sense
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6e71
<FromGitter> <Blacksmoke16> that might work?
<FromGitter> <Blacksmoke16> i dont know if it would in ECR land tho :shrug:
<FromGitter> <drum445> Cheers @Blacksmoke16 I'll try and implement it
ternarysolo has quit [Ping timeout: 244 seconds]
<FromGitter> <Blacksmoke16> would only work for methods tho, i.e. `@foo = "bar"` wouldnt, but `getter/property` would
<chickendan> Sorry, @Sija, saw the notification just now. Thanks for spearheading this, and thanks to all the others for the feedback. :)
<FromGitter> <Sija> @chickendan yw, clean APIs FTW :)
moei has quit [Quit: Leaving...]
_whitelogger has quit [*.net *.split]
t1|Mike has quit [*.net *.split]
_whitelogger has joined #crystal-lang
<FromGitter> <arnavb> Just curious, are error messages being actively worked on for the crystal compiler? Some of them are very vague and not pointing in the right direction, while others jump straight to bug in the compiler for simple mistakes.
sagax has quit [Ping timeout: 245 seconds]
<Yxhuvud> Do you have any examples of error messages not helping?