RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | 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 joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <bew> @straight-shoota "thanks" for what?
<FromGitter> <straight-shoota> Oh, I meant to ping @barachy for āŽ āŽ > @straight-shoota for joining the core team šŸŽ‰
<FromGitter> <bew> Wut? I missed that OĆ² congrat'!
Renich has joined #crystal-lang
<FromGitter> <bew> @straight-shoota you deserve it :)
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> I was wondering when it will be! Finally, congrats @straight-shoota :P
<FromGitter> <straight-shoota> It has just been made official.
<FromGitter> <straight-shoota> Thank you =)
<FromGitter> <j8r> YAML::Any => JSON::Any to be easy doesn't surprise me, but not expecting it to be in one line.
<FromGitter> <j8r> Serializable and mapping will be more complex
<FromGitter> <j8r> Talking about that, there is a PR to standardize both implems https://github.com/crystal-lang/crystal/pull/6556
DTZUZO has quit [Ping timeout: 272 seconds]
<FromGitter> <Sija> @straight-shoota That had to happen sooner or later :) Congrats! šŸŽ‰
non-aristotelian has quit [Quit: non-aristotelian]
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <icyleaf> Congrats! @straight-shoota
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
<FromGitter> <sam0x17> is anyone familiar with the zlib integration in crystal? I'm looking for the easiest way to apply the DEFLATE algorithm to a Slice(UInt8), but I'm finding the zlib API to be crazy complicated
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has quit [Ping timeout: 250 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <sam0x17> is this the fastest way to concatenate two slices? from what I can tell copy to/from isn't very useful here because there is no way to specify an offset: āŽ āŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c272721ab910e7d3aec5ae4]
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <vladfaust> @anamba give it a try github.com/onyxframework/background
<FromGitter> <vladfaust> Its in beta, should work for now šŸ™‚
<FromGitter> <vladfaust> @straight-shoota my sincere congratulations! I always envied your deep understanding of how Crystal works šŸ¤¤
<FromGitter> <vladfaust> If you have questions thereafter, it's better to ask theme here: https://gitter.im/onyxframework/background
laaron has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
<oprypin> sam0x17, haha no. you can "offset" the slice itself with `+` and copy to that
Renich has quit [Quit: Renich]
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> how to read real-time dynamic stdout of process in crystal
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
<FromGitter> <codenoid> process like -> https://i.makeagif.com/media/8-22-2015/EgkrBx.gif
<FromGitter> <j8r> @codenoid you have to use terminal's escape sequences
<FromGitter> <j8r> I've made a CLI text editor, looking at its code could help you
<FromGitter> <j8r> https://github.com/j8r/cride
<FromGitter> <j8r> You need to know the length of the terminal. The CLI is stored as an `Array(String)`
DTZUZO has joined #crystal-lang
<FromGitter> <j8r> Of you want read, you'll got also escape sequences
<FromGitter> <j8r> You can call Process, having and IO::Memory initialized before to use as output, and to a `while io_outpuy.gets`
<mps> j8r: I made crude hack to APKBUILD to build libzip Alpine package for you
<mps> j8r: it can build libzip-static to be installed from local repo
<mps> if you are interested or need it I could post it to some paste server
<FromGitter> <j8r> mps: thank you :o
<FromGitter> <j8r> you don't have to take from your time on this things you know
<FromGitter> <j8r> I'll send a PR on aports
<FromGitter> <j8r> or it's better it will be you, that's your work :)
<mps> well, I presume you have a reason for that, probably needed for some programs in crystal, and then it will be useful to me in future
<FromGitter> <j8r> it can be used in Crystal, my use case was compiling PHP7.3 statically with zip support
<FromGitter> <j8r> in the past there was sqlite-static missing too, i sent a PR
<mps> well, static package is not hard to make in Alpine, but that flip switch in libzip is somewhat problematic
laaron has quit [Remote host closed the connection]
<mps> yes, more and more software tries to escape from static
<mps> I will look at CMakeFiles.txt if I could hack it to build shared and static in one pass
<FromGitter> <j8r> no mps
<mps> although i don't have much experience with cmake
<FromGitter> <j8r> doesn't need to
<FromGitter> <j8r> we can just add a `static` function
<FromGitter> <j8r> like https://git.alpinelinux.org/cgit/aports/tree/community/php7/APKBUILD, it will call an internal `_build`
<mps> this is crude but it build libzip-static
<FromGitter> <j8r> that will be also called by `build`
<mps> yes, of course
<mps> no, sorry, misunderstood you. build just do 'make'
<FromGitter> <j8r> but it will build only the `.a` :/
<mps> 'abuild rootpkg' will build apk file
<mps> right. 'abuild build' will build libzip.a
<mps> it will be in 'src/libzip-1.5.1/lib/libzip.a'
<FromGitter> <j8r> thanks for your work, I'm creating a branch on aports to work on this, then come back to you when done :)
<mps> this one I posted can build everything, but libzip-x.x.x.apk is empty because shared lib is not built
<mps> so it is naturally empty
<FromGitter> <j8r> that's a good start
<FromGitter> <j8r> However I don't think it'll be merged as-is - working on improving it
<mps> right, it should be refined
<mps> anyway, I will talk about it on the alpine channel when I find some time, I had a hard working day yesterday
<mps> btw, reading your code of the 'cride' to learn something :) nice work and inspiring
<FromGitter> <talbergs> Could someone please explain this magic to me? https://play.crystal-lang.org/#/r/5vfw Why this not compiles?
<FromGitter> <Blacksmoke16> if you make `a` also a class variable it works. Is to due with it not having access to var `a` in the context of the class
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> its a similar thing to as why you couldnt access an ivar/local var in a class method
<FromGitter> <talbergs> Quite a bit magic if you compare module B and X2
<FromGitter> <Blacksmoke16> not really because in `B` they are both local variables so there is no conflict there
<FromGitter> <Blacksmoke16> `A` works because they are both class variables, so is in eachother's scope
<FromGitter> <j8r> mps: thx, i posted it a bit by mistake (I thought @codenoid want to write, not read)
<mps> j8r: something comes to mind, you need just libzip.a file and separate is not needed?
<mps> s/separate/separate package/
<FromGitter> <j8r> yes, maybe with the header file
<FromGitter> <j8r> > devfhg
<FromGitter> <j8r> 5u 5
<FromGitter> <j8r> 6i
<FromGitter> <j8r> i
<FromGitter> <j8r> f
<FromGitter> <j8r> i
<FromGitter> <j8r> wow the bug
<FromGitter> <j8r> sorry :(
<mps> it could be put in libzip-dev together with shared version then
<FromGitter> <j8r> how to do this? Having the .so, .h and .a in -dev?
<mps> yes, and .a
<mps> but build must be done twice
<mps> i mean build function must have two blocks, one to build static and copy it somewhere, then build shared and copy preserved static file back
<mps> or make to separate builddirs
<mps> s/to/two/
<FromGitter> <greenbigfrog> Is there like an opposite of `Hash#compact`? Basically I want all keys where the value is nil
<FromGitter> <j8r> i doubt
<FromGitter> <j8r> that's simple to verify: def self.success?(status_code : Int) āŽ āŽ ```(200..299).includes?(status_code)``` āŽ āŽ end [https://gitter.im/crystal-lang/crystal?at=5c276f0d8d31aa78b11658cf]
<FromGitter> <greenbigfrog> I didn't find anything. Which is why I'm asking šŸ˜„
<FromGitter> <Blacksmoke16> `hash.values.none?`
<FromGitter> <Blacksmoke16> er nvm, that would just return bool if keys are not nil/false
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.0/Hash.html#select%28%26block%3AK%2CV-%3E_%29-instance-method
<FromGitter> <Blacksmoke16> would prob do the trick
<FromGitter> <Blacksmoke16> h.select { |k, v| k.nil? }
<FromGitter> <greenbigfrog> cool. thanks
<FromGitter> <j8r> @greenbigfrog https://carc.in/#/r/5vgs
<FromGitter> <j8r> `transform_values` is what you are looking for
<mps> j8r: I made new APKBUILD which builds libzip-dev with .so and .a file, in single 'abuild build' invocation. here it is http://tpaste.us/kZ6Z
<mps> j8r: I made new APKBUILD which builds libzip-dev with .so and .a file, in single 'abuild build' invocation. here it is http://tpaste.us/kZ6Z
<mps> uh, something was wrong with tmux, sorry for duplicate msg
<FromGitter> <greenbigfrog> @j8r I don't want to change it to nil šŸ˜„ I want to select where the value is nil. thanks though šŸ˜
<FromGitter> <j8r> @greenbigfrog ha sorry
<FromGitter> <j8r> a bit tired today :|
<FromGitter> <j8r> mps wow man, thank you very much!
<FromGitter> <j8r> do you want to send the patch, or me?
<mps> not sure if that patch will be accepted
<mps> I tried once something similar and to convince core dev but looks like my rationale were 'soft'
<mps> anyway, I could try again but first would like to talk with maintainers about change
<mps> btw, are you on any Alpine irc channel
<mps> we can work together on the that there
<mps> j8r: I posted tpaste url to #alpine-linux, will see if anyone have comments or objections. your rationale would be useful :)
<FromGitter> <j8r> mps not yet, good idea
<FromGitter> <proyb6> Does Crystal utilize International Components for Unicode (ICU)?
<FromGitter> <proyb6> We know https://github.com/olbat/icu.cr
<FromGitter> <sam0x17> @oprypin thanks. I still dont get how the + offset thing works. When I try the following I get index out of bounds: āŽ āŽ ```def slice_concat(a : Bytes, b : Bytes) āŽ b.copy_to(a + b.size) āŽ end``` [https://gitter.im/crystal-lang/crystal?at=5c279129babbc178b2f74d34]
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <sam0x17> nvm I got it: āŽ āŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2793de2863d8612ba94e1a]
<FromGitter> <talbergs> `p!` debug prints everything in one line. Its hard to read for me. Is there a way to debug multiline or with indention?
<FromGitter> <j8r> `pp!`?
<FromGitter> <sam0x17> yeah, definitely adding this to all my projects where I work with Bytes: āŽ āŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27957409b806684982bcf6]
<FromGitter> <sam0x17> edit (should have been + size not + b.size)
<FromGitter> <sam0x17> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c279700d945b96882138687]
Raimondi has joined #crystal-lang
<RX14> @straight-shoota great to have you on the core team :)
<FromGitter> <talbergs> Ow, nice `pp!` it is, thanx!
<FromGitter> <j8r> mps just join IRC (like, now)
<FromGitter> <j8r> šŸŽ‰
<FromGitter> <j8r> good job!
<FromGitter> <j8r> in case you're interested, here a the static binaries https://bitbucket.org/dfabric/packages/downloads/ and the source code https://github.com/DFabric/apps-static
Jenz has joined #crystal-lang
<FromGitter> <j8r> what is your github mps?
<FromGitter> <j8r> btw, thanks for all :)
<mps> j8r: I dislike github so don't have account there
<mps> we had talk at Alpine to move to gitlab, although don't know will that be done
<mps> btw, when played with go-lang I always had split mind about static building, sometimes static are good but sometimes it is not
<mps> and, as you know, go-lang prefer or even force static building
<FromGitter> <j8r> that's bad for system tools.
<FromGitter> <j8r> My opinion is better to statically link applications which are independent of the OS
<FromGitter> <j8r> and dynamic link those that are dependent, like UI/Desktop stuff in GTK/Qt
<FromGitter> <j8r> gitlab isn't much that different than github
<Jenz> I recommend taking a look at sr.ht
<Jenz> Though it's only beta atm
<Jenz> It looks very promising ATM
<FromGitter> <j8r> The best would be not migrate X to Y, but have X mirrored from Y
<mps> Jenz: sr.ht was also discussed with the author of it, he is often on the Alpine irc
<Jenz> What did he say?
<FromGitter> <j8r> git is decentralized, it shouldn't be a problem to have multiple mirrors
<mps> Jenz: to me also it is very interesting but it is not yet ready for big projects like distro
<Jenz> Yeah, gotta agree...
<Jenz> I can't rename my issue-tracker D:
<Jenz> Ye
<Jenz> *Yet
<mps> ddvault (author) is very responsive
<mps> s/ddvault/ddevault/
<mps> j8r: my dislike to github is from 'political' point of view, not technical
<FromGitter> <j8r> didn't know, really promising. Sounds like a gitolite++
<mps> excuse me, have a guests. cul
<FromGitter> <j8r> gitlab is also meh (still better) with freemium ;/
<Jenz> How can I find out at compile time whether the release flag is present?
<Jenz> {% flag?(:release) %} ?
<Jenz> Eh just with an `if`
<Jenz> Ok, nvm. flag?(:release) works
<trashhalo[m]> Is anyone using crystal in prod? and if so whats the percentage of your codebase thats cr?
Jenz has quit [Ping timeout: 250 seconds]
<FromGitter> <j8r> IIRC @sam0x17 and @bararchy have Crystal code in prod
<FromGitter> <greenbigfrog> depends on how you want to define prod ;) If you want to count hobby projects that actually get used, I've got one that's 100% crystal (shitty code though because I'm completely self taught and sometimes a bit lazy to go back and rewrite stuff if it works)
Renich has joined #crystal-lang
<FromGitter> <j8r> prod usually means money implications
<FromGitter> <j8r> that allow to earn money from
Raimondi has quit [Ping timeout: 240 seconds]
<trashhalo[m]> yea prod for me has money implications.
laaron has joined #crystal-lang
<FromGitter> <bararchy> yeha, NeuraLegion uses crystal in prod
Renich_ has joined #crystal-lang
<FromGitter> <wontruefree> would this make a 32bit crystal compiler on a 64 bit machine? `make crystal FLAGS='--cross-compile --target "i686-linux-gnu"'`
Renich has quit [Ping timeout: 246 seconds]
Renich_ is now known as Renich
laaron- has joined #crystal-lang
Renich_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5vjn seems there is an issue with no return type on method
<FromGitter> <Blacksmoke16> should return a `Nop` but it does
laaron has quit [Ping timeout: 256 seconds]
Renich has quit [Ping timeout: 272 seconds]
Renich_ is now known as Renich
<FromGitter> <fridgerator> I have a couple of production services written in 100% crystal
<FromGitter> <fridgerator> and a couple internal tools using crystal as well
<FromGitter> <Blacksmoke16> how would you test a web framework?
<FromGitter> <Blacksmoke16> like prob run the server instance then the spec
<FromGitter> <sam0x17> usually you would have unit testing built into the web framework. there is also a selenium shard so you can simulate the browser
<FromGitter> <Blacksmoke16> šŸ‘
<FromGitter> <kingsleyh> Taiko is not bad for testing too
<FromGitter> <Blacksmoke16> check this out, WIP prototype but is pretty neat
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27dc2c93cce97d3bb8a7d4]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27dc468dafa715c7110d26]
<FromGitter> <Blacksmoke16> *yet another web framework* but with param conversion
<FromGitter> <Blacksmoke16> vs having to deal with converting strings all the time, also have an `Exists` converter that can fetch the record from db from like `/users/123` # => `SELECT from USERS where id = 123`
<FromGitter> <Blacksmoke16> assuming whatever orm you are using has a `find` method
<FromGitter> <vladfaust> > assuming whatever orm you are using has a `find` method āŽ āŽ That's bad IMO
<FromGitter> <Blacksmoke16> meh, its not a big deal imo, can just define your own find method if you want it to do something diff or it doesnt have one by default
<FromGitter> <vladfaust> Overall annotation approach looks fresh, good job
<FromGitter> <Blacksmoke16> šŸ’Æ
<FromGitter> <vladfaust> What about Integer params?
<FromGitter> <vladfaust> Or non-model params, like "foo" and "bar"?
<FromGitter> <vladfaust> For an action
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27e0e337975e7ca9437db0]
<FromGitter> <Blacksmoke16> ```curl --request GET \ āŽ --url http://localhost:8888/test/5/7``` [https://gitter.im/crystal-lang/crystal?at=5c27e0ec8d31aa78b119285d]
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> like that
<FromGitter> <vladfaust> Nice, inline routing
<FromGitter> <vladfaust> A method is a REST action
<FromGitter> <vladfaust> Nice, nice
<FromGitter> <vladfaust> Interesting how it would play for big apps with many files
<FromGitter> <greenbigfrog> looks interesting
<FromGitter> <Blacksmoke16> can also do this
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27e212f6166a30278c7683]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c27e222db5b5c688327c2c5]
<FromGitter> <Blacksmoke16> ```curl --request GET \ āŽ --url http://localhost:8888/foo/bar āŽ āŽ "bar"``` [https://gitter.im/crystal-lang/crystal?at=5c27e23cd945b96882157640]
<FromGitter> <Blacksmoke16> to require the params to match a regex to match that the route
<FromGitter> <Blacksmoke16> all param conversion happens at compile time, so with many files i dont think it would be a big deal, not much diff than rails or something
<FromGitter> <j8r> Looks neat. Only hope I can still use my structs :)
<FromGitter> <Blacksmoke16> thats one issue i dont know an answer to
<FromGitter> <Blacksmoke16> since this works by just finding all classes that inherit from an abstract `Controller` class
<FromGitter> <Blacksmoke16> cant define a struct and a class with the same name
<FromGitter> <j8r> Isn't possible to do like `Serializable`?
<FromGitter> <Blacksmoke16> like what?
<FromGitter> <Blacksmoke16> have to include it?
<FromGitter> <j8r> `include Athena::Controller`
<FromGitter> <j8r> :)
<FromGitter> <j8r> It could even be used in a module
<FromGitter> <Blacksmoke16> i dont think i could
<FromGitter> <Blacksmoke16> since this works by just finding all classes that inherit from an abstract Controller class
<FromGitter> <Blacksmoke16> to build out the routes for the radix tree
<FromGitter> <vladfaust> Now I see why you asked for an ability to iterate through all type annotated with specific annotation, @Blacksmoke16
<FromGitter> <vladfaust> You could get rid of Controller and just annotate methods if it worked
<FromGitter> <Blacksmoke16> `{% methods = c.class.methods.select { |m| m.annotation(Get) || m.annotation(Post) || m.annotation(Put) } %}` is how im doing it atm, works for me
<FromGitter> <Blacksmoke16> yea pretty much
<FromGitter> <Blacksmoke16> `{% for c in Athena::Controller.all_subclasses %}`
<FromGitter> <Blacksmoke16> could also override the controller class to add custom methods used on all routes
<FromGitter> <j8r> @Blacksmoke16 what happens if I want 2 servers in 2 fibers for instance?
<FromGitter> <Blacksmoke16> idk
<FromGitter> <Blacksmoke16> lol
<FromGitter> <Blacksmoke16> how would i test that?
<FromGitter> <Blacksmoke16> the server if ofc just build on `HTTP::Server` so i dont *think* it would be a big deal?
<FromGitter> <Blacksmoke16> but i dont know for sure
<FromGitter> <j8r> you run a server that listen on X in the main fiber, then you `spawn` a new one and start a new server listening on Y
<FromGitter> <j8r> logically, they won't share the same routes
<FromGitter> <j8r> so in your case, 2 different objects that inherit from your controller
<FromGitter> <j8r> I am afraid they may share the same routes :/
<FromGitter> <Blacksmoke16> mm sorry, still not sure i follow
<FromGitter> <Blacksmoke16> share the same routes as in two apps define same route?
<FromGitter> <j8r> they shouldn't share routes
<FromGitter> <j8r> like 2 different apps in 2 different processes
<FromGitter> <Blacksmoke16> hmm sec let me try it
<FromGitter> <Blacksmoke16> is that a common thing?
<FromGitter> <j8r> not actually
<FromGitter> <j8r> a use case is reverse proxies
<FromGitter> <Blacksmoke16> isnt that what nginx is for? :p
<FromGitter> <j8r> usually it listens at least on both 80 and 443
<FromGitter> <j8r> yes.
<FromGitter> <j8r> A Nginx in Crystal for example
<FromGitter> <Blacksmoke16> hmm
Raimondi has joined #crystal-lang
<FromGitter> <Blacksmoke16> yea im not sure i have a way to limit which routes get used for each app
<FromGitter> <Blacksmoke16> so even if i went module route would still pickup all classes with the controller parent class
<FromGitter> <Blacksmoke16> im not going to worry about it
<FromGitter> <j8r> as long as RX14 sage advice is followed https://github.com/kemalcr/kemal/pull/378#issuecomment-440825575 :)
<FromGitter> <Blacksmoke16> ill think on it, would be neat for sure
laaron- has quit [Ping timeout: 256 seconds]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Ping timeout: 256 seconds]
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> also tied it in with my validation shard šŸ’Æ
DTZUZO has quit [Ping timeout: 250 seconds]