RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
DTZUZO_ has quit [Read error: Connection reset by peer]
lvmbdv has quit [Quit: Connection closed for inactivity]
francisl has joined #crystal-lang
<FromGitter> <girng> I was just thinking in my benchmarks with json.parse and from_json it's important i should have called the `as_xxx` for their respective type
<FromGitter> <girng> that would have been more fair, because with json.parse, you usually do that for comparison. when u do from_json, you already specified the types so don't need to do another as_xx or to_xx ;)
rohitpaulk has joined #crystal-lang
ua_ has quit [Ping timeout: 252 seconds]
<FromGitter> <edwardloveall> whoever made the index.json that's creating as part of generating documentation: THANK YOU!
<FromGitter> <edwardloveall> it's so detailed and parseable and easy to hack around with
DTZUZU has quit [Ping timeout: 252 seconds]
DTZUZU has joined #crystal-lang
francisl has quit [Quit: francisl]
rohitpaulk has quit [Ping timeout: 252 seconds]
francisl has joined #crystal-lang
DTZUZO_ has joined #crystal-lang
<FromGitter> <girng> i just saw a topic on gamedev.net of crystal lang being used
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <proyb6> @girng Love to have the link to read the article?
francisl_ has joined #crystal-lang
francisl has quit [Ping timeout: 252 seconds]
francisl_ is now known as francisl
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
francisl has quit [Client Quit]
francisl has joined #crystal-lang
francisl has quit [Client Quit]
francisl has joined #crystal-lang
francisl has quit [Client Quit]
francisl has joined #crystal-lang
francisl has quit [Ping timeout: 252 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <girng> check pm
<FromGitter> <HarrisonB> If I have an Array of varying types and I want to `select` all of the elements of type `T`, what would be the best way to tell the compiler, "hey! these are all of type `T`"
<FromGitter> <bararchy> @girng I would also love a link, why not share here?
<FromGitter> <HarrisonB> This is the best I came up with; let me know if this can be improved upon: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I had tried using `Array#select`, but that didn't tell the compiler that the elements selected were of type `T` apparently [https://gitter.im/crystal-lang/crystal?at=5bb5a909435c2a518e4bd673]
<FromGitter> <ezrast> @HarrisonB You can also do `collection.compact_map{ |item| item if item.is_a? T }`; your way is a little more explicit though.
<FromGitter> <HarrisonB> @ezrast thanks! that fits much better with what i'm trying to do
<FromGitter> <ezrast> `map` methods are allowed to set the type of the Array they return because they can look at the return type of the block they are passed before instantiating the Array. The Array can't be recast after the fact because that could change how the elements are expected to be laid out in memory.
<FromGitter> <HarrisonB> makes sense
<FromGitter> <straight-shoota> @edwardloveall ⏎ ⏎ > whoever made the index.json that's creating as part of generating documentation: THANK YOU! ⏎ ⏎ That would be me (#4746). But the data was actually already available internally, it just needed to be serialized to JSON. [https://gitter.im/crystal-lang/crystal?at=5bb5b4c86e5a401c2d141d05]
<FromGitter> <girng> dat code those O_o
<FromGitter> <girng> i think api should be more simplified imo
<FromGitter> <girng> actually, i take that back. it looks like that is just the clustering example
<FromGitter> <girng> the first code block looks simple
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
DTZUZO_ has quit [Ping timeout: 245 seconds]
Tortice has quit [Read error: Connection reset by peer]
ua has joined #crystal-lang
<FromGitter> <j8r> @proyb6 the only thing more vulnerable in PHP apps vs other languages is if the attacker is on the machine, (s)he can change the application source code at runtime, without even restarting anything
<FromGitter> <bararchy> @j8r what's "DFabric" ?
sevensidedmarble has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
Tortice has joined #crystal-lang
<FromGitter> <j8r> @bararchy "The self-hosted fabric for your apps" (https://github.com/DFabric) :P
<FromGitter> <j8r> That's an organization I've created for self-hosted related projects
<FromGitter> <bararchy> That's really cool!
<FromGitter> <bararchy> good luck with it
ashirase has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <j8r> @bararchy thank you 😃
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> i starred =]
<FromGitter> <j8r> thanks @girng :)
<FromGitter> <girng> thank you for all the past help you have given me, YOU DESERVE the stars!
<FromGitter> <j8r> haha np :)
<FromGitter> <bararchy> yeha @j8r is damn awsome :)
<FromGitter> <j8r> I don't know what I've done to have all of compliments today, thanks guys 😄
<FromGitter> <j8r> Hum i can't compile Crystal master locally, have you succeed?
<FromGitter> <j8r> even inside `crystallang/crystal:nightly`
<FromGitter> <bararchy> @j8r spec issues? or compile error?
<FromGitter> <j8r> compile time error @bararchy
<FromGitter> <bararchy> what error?
<FromGitter> <j8r> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb5e6063844923661e1937a]
<FromGitter> <j8r> i'll retry
<FromGitter> <j8r> nvm
<FromGitter> <j8r> This was cache
<FromGitter> <j8r> :-|
<FromGitter> <j8r> actually, no exactly. I need to add a `as` cast in `unix = seconds - UNIX_EPOCH.total_seconds.as(Int64)` at `src/time.cr line 1298`
<FromGitter> <j8r> (I'm preparing a PR) This doesn't change the Time API, but IMHO adds clarity by replacing `UNIX_SECONDS = SECONDS_PER_DAY.to_i64 * (1969*365 + 1969/4 - 1969/100 + 1969/400)` to `UNIX_EPOCH = Time.utc 1970, 1, 1` ⏎ Another side effect is performance increased, in some places by 1.5x
<FromGitter> <mehmetc> I’m trying to use gdb or lldb on a Kemal app but it looks as if some debug info is missing. Do dependencies inherit the debug flag? using Crystal 0.26.1 with LLVM 4.0.0 on linux
<FromGitter> <j8r> hum I'll use `nanosecond`
<FromGitter> <girng> are u sure it's not possible to limit float decimals to 2 decimal points w/o doing %.2f a string conversion?
<FromGitter> <girng> it just feels so hacky to do a float conversion to string in my game loop lol
<FromGitter> <girng> *%f.2* typo, my bad
<FromGitter> <bararchy> @mehmetc Try to compile with `--debug` flag
<FromGitter> <girng> i mean *%0.2f*, my bad
Tortice has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
<hightower2> Hey folks, I have a strange problem... on 0.26.1, running 'crystal -v' works just fine as some users, while under some users it produces error 'Failed to raise an exception: END_OF_STACK'
<hightower2> I tested this with both Debian package and a binary tgz
<hightower2> Any ideas?
<hightower2> The error happens even when I call crystal binary directly (avoiding that wrapper in bin/)
<hightower2> seems to be related to crystal's inability to open tty which the terminal is using
<hightower2> well ok, won't bother with it right now
<FromGitter> <edwardloveall> fair enough @straight-shoota , still thank you ❤️
<FromGitter> <mehmetc> @bararchy Will the —debug flag also compile the dependencies with debug information. A lot of stuff is “optimized out” today.
francisl has joined #crystal-lang
<FromGitter> <fusillicode_twitter> Hi guys, can I post here a question I've just asked inside the crecto channel ? 🤔
<hightower2> fusillicode: just ask :)
Tortice has joined #crystal-lang
francisl has quit [Quit: francisl]
lvmbdv has joined #crystal-lang
sagax has quit [Read error: No route to host]
francisl has joined #crystal-lang
<FromGitter> <drum445> Anybody have any tutorials on how to setup multiple crystal apps on one server using nginx?
<FromGitter> <j8r> a crystal app won't be different from a Go, Rust or C one
<FromGitter> <drum445> well I guess a tutorial for any of them then please, as I have a few Go and Crystal apps running but I am running the binaries for them
<FromGitter> <drum445> Would be nice to use nginx
<FromGitter> <j8r> If you're lazy you could also use Caddy :)
<FromGitter> <j8r> simple configuration, on Let's Encrypt built-in
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <drum445> cool
<FromGitter> <drum445> So how do you host multiple crystal apps on a single machine?:
<FromGitter> <drum445> Currently I have them all on diff ports and just do ⏎ nohup ./app &
<FromGitter> <codenoid> i use kemal, different port and supervisord
<FromGitter> <codenoid> for session i use both kemal-session-redis and crystal-redis
<FromGitter> <j8r> the proprer way is to create a system service. On recent linux, it's systemd (a template is here https://github.com/DFabric/DPlatform-Shell/blob/master/sysutils/service.sh#L83)
<FromGitter> <j8r> then `systemctl enable $name.service`. You'll have a service au started on boot, on auto restarted if it fails for a reason
<FromGitter> <j8r> sorry to tell you @codenoid , but supervisord is a Python sh** compared to `systemd`/`openrc` :) ⏎ In fact, when you install it, supervisor has its own systemd/init.d service under the ground, which spawns you apps as subprocesses... nice (ironic)
<FromGitter> <j8r> but if you're on macOS or windows... I may understand
<FromGitter> <codenoid> :o
hightower2 has quit [Remote host closed the connection]
<FromGitter> <codenoid> yeah
<FromGitter> <codenoid> sometime my big kemal app
<FromGitter> <codenoid> need access trigger to keep active
<FromGitter> <codenoid> idk, if user access 1 page, the loading time is sooo looooongggg ⏎ but when user open new page (in newtab etc), the first page and this second page is loaded
<FromGitter> <j8r> browser cache?
<FromGitter> <codenoid> that's make me thing to move to elixir
<FromGitter> <codenoid> i don't think so :
<FromGitter> <codenoid> i think it's in kemal it self @j8r
<FromGitter> <j8r> Do you `spawn` for each requests? Is it async?
<FromGitter> <codenoid> what
<FromGitter> <j8r> I don't know if requests done by clients are sync or async
<FromGitter> <codenoid> a web framework
<FromGitter> <codenoid> different page
<FromGitter> <j8r> Yes I know, but does kemal handle concurrent requests?
<FromGitter> <codenoid> just 2 request at the same time
<FromGitter> <codenoid> i need crystal code review (?)
<FromGitter> <codenoid> *and in my local
<FromGitter> <bararchy> @codenoid Seems strange, I'm using Kemal with 20k concurrent users at tests, no issues
<FromGitter> <j8r> maybe you have a DB, a slow connection?
hightower2 has joined #crystal-lang
hightower2 has left #crystal-lang [#crystal-lang]
ua has quit [Excess Flood]
ua has joined #crystal-lang
[spoiler] has quit [Ping timeout: 252 seconds]
ua has quit [Client Quit]
<FromGitter> <codenoid> i use mongo
<FromGitter> <codenoid> at small code base
<FromGitter> <codenoid> no, it's woring fine
<FromGitter> <codenoid> sorry for late reply
<FromGitter> <codenoid> working fine
ua has joined #crystal-lang
[spoiler] has joined #crystal-lang
<FromGitter> <j8r> You'll have to identify what's render the page load slow. ⏎ Switching to other technologies can also produce slow apps
<FromGitter> <codenoid> i render html page
<FromGitter> <codenoid> with 4 ajax access
<FromGitter> <codenoid> and sometimes the ajax load successfully, sometimes like case 1
akaiiro has quit [Ping timeout: 252 seconds]
<FromGitter> <codenoid> wdyt
<FromGitter> <codenoid> 1) i'm too lazy to get sht done
akaiiro has joined #crystal-lang
<FromGitter> <drum445> @codenoid what lib with mongo, I couldn't find a good one
<FromGitter> <Thellior> Is there a way to install a subdirectory of a monorepo? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I have a mono repo with apps and libs folder. Now i want to install a lib logger into one of my apps. So i need to add the dependency to the shards file to install it. With ruby i can normaly specify a glob in the gemfile. Does something exist in the shards implementation or is this a missing feature. Than i
<FromGitter> ... can work on the feature if needed :) [https://gitter.im/crystal-lang/crystal?at=5bb63249435c2a518e4f6cea]
<FromGitter> <fridgerator> @Thellior I believe someone asked this question a few days ago, and the answer was that no shards doesn't have this feature
<FromGitter> <Thellior> @fridgerator Ok thanks for the fast response. I will check if can create the feature :)
<FromGitter> <fridgerator> there was as short discussion about it, if you search "monorepo" in gitter Its towards the top in chis channel
<FromGitter> <fridgerator> I'm trying to bind a c library which has relative includes: `#include "include/internal/blah/blah.h`
<FromGitter> <Thellior> @fridgerator I see
<FromGitter> <fridgerator> I'm adding that include path as a flag: `@[Include("/full/path/to/include/stuff/file.h", flags: "-I/full/path/to/include")]` but its still not finding the relative include
<FromGitter> <fridgerator> fatal error file not found
<FromGitter> <fridgerator> what am I doing wrong?
<FromGitter> <fridgerator> using crystal_lib
<FromGitter> <fridgerator> nvmd
<FromGitter> <fridgerator> figured it out
<FromGitter> <jwoertink> oo?
<FromGitter> <jwoertink> what was it?
<FromGitter> <fridgerator> `flags: "-I/full/path/to"`
<FromGitter> <fridgerator> just removed "include" in the include path
<FromGitter> <jwoertink> I was just about to suggest try chugging a beer. Ideas usually come to me when I do that
<FromGitter> <fridgerator> haha
<FromGitter> <fridgerator> I would, but i'm at work
<FromGitter> <jwoertink> bad ideas... but ideas
<FromGitter> <jwoertink> 😂
<FromGitter> <jwoertink> interesting... so your path can't be to the include file, just to the directory it's in?
<FromGitter> <codenoid> kalinon/mongo.cr (fork from datanoise/mongo.cr)
<FromGitter> <codenoid> @drum445 based on lib-mongoc
<FromGitter> <fridgerator> since the relative includes in the c code already had the "/include" in the path, I needed to include the parent directory
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> that makes sense
<FromGitter> <jwoertink> good call
<FromGitter> <fridgerator> 👍
<FromGitter> <fridgerator> I'll probably catch a lot of flak for this, but i'm trying to bind to CEF (Chromium Embedded Framework)
<FromGitter> <codenoid> :(
<FromGitter> <fridgerator> YOU CANT STOP ME
<FromGitter> <j8r> flak?
<FromGitter> <fridgerator> people will complain, or think its a bad idea
<FromGitter> <j8r> nvm this is same a critics, for me flak has always been https://en.wikipedia.org/wiki/8.8_cm_Flak_18/36/37/41
<FromGitter> <j8r> "catching a lot of flak" was like: "i'm flying, and I'm catching a lot of AA bullets" 😄
<FromGitter> <fridgerator> haha, I'm guessing thats where the term came from
Tortice has quit [Read error: Connection reset by peer]
Tortice has joined #crystal-lang
rohitpaulk has joined #crystal-lang
sevensidedmarble has joined #crystal-lang
<FromGitter> <jwoertink> haha
<FromGitter> <jwoertink> I have a flak jacket that is still in tact if you need it :D
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
Tortice has quit [Remote host closed the connection]
junland has quit [Quit: Disconnected.]
junland has joined #crystal-lang
akaiiro has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
return0xe has quit [Remote host closed the connection]
return0e has joined #crystal-lang
non-aristotelian has joined #crystal-lang
Tortice has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.26.1/Array.html how does the `Array` class inherit the `Reference` class methods when the class isnt setup like `Array(T) < Reference`?
<FromGitter> <bew> I'm listening to a song named Crystal, perfect 👍
<FromGitter> <bew> https://youtu.be/pf87V5K5P5I
<oprypin> Blacksmoke16, Reference is a fake class that's inherited by any `class`
<oprypin> Blacksmoke16, Value is a fake class that's inherited by any `struct`
<FromGitter> <Blacksmoke16> but where/how is it inherited? some macro magic somewhere?
<oprypin> Blacksmoke16, it's an inherent part of the language, why would macros even have to be involved
<FromGitter> <Blacksmoke16> idk thats why im asking :p
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <bajro17> @bew bro it is awesome thanks for share :)
<FromGitter> <bajro17> When we can expect 0.27
<FromGitter> <bew> Soon (tm)
<Tortice> when it's ready
<FromGitter> <bew> @bajro17 (i have no idea ^^)
francisl has quit [Quit: francisl]
<FromGitter> <drum445> Why do I still like PHP lol
<FromGitter> <girng> damn 100+ new messages overnight, crystal's gitter is 👍 lit
<FromGitter> <girng> @drum445 lol same here
francisl has joined #crystal-lang
bmcginty has quit [Ping timeout: 272 seconds]
<FromGitter> <girng> the only reason i use php is because of all the online tutorials out there, and when I was a kid, those helped me greatly. if i were to re-write a forum or something now, i'd prob use kemal though
<FromGitter> <codenoid> $50k >
bmcginty has joined #crystal-lang
<FromGitter> <codenoid> cr project
<FromGitter> <j8r> Everyone loved to hate PHP
<FromGitter> <codenoid> can we use https://hacktoberfest.digitalocean.com/
<FromGitter> <codenoid> to help crystal development ?
<FromGitter> <fridgerator> If you make 5 PR's to open source repo on github you get a hacktoberfest tshirt. What did you have in mind to help crystal?
<FromGitter> <codenoid> add `Hacktoberfest` to crystal repo, and let people fix crystal issue
<FromGitter> <fridgerator> ah
francisl has quit [Quit: francisl]
Tortice has quit [Remote host closed the connection]
<FromGitter> <jwoertink> ^ I like that idea
llua has joined #crystal-lang
<FromGitter> <codenoid> the way to promote crystal too
<FromGitter> <jwoertink> Is there a way to convert `Bytes` in to a string?
<FromGitter> <jwoertink> like `slice.to_a.map(&.something).join` ?
<FromGitter> <jwoertink> `slice.to_a.map(&.chr).join` I think this will work
<FromGitter> <jwoertink> but maybe there's a better way. I was hoping `slice.to_s` would, but that method is more like inspect than "convert to a string"
<FromGitter> <girng> i got 1 pr merged, which was editing a .css file lol
<FromGitter> <girng> i want my shirt!
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 252 seconds]
johndescs has quit [Ping timeout: 268 seconds]
johndescs has joined #crystal-lang
<FromGitter> <bew> @jwoertink the other, way around: `String.new(some_bytes)`
<FromGitter> <bew> (oops sneaky comma^^)
<FromGitter> <jwoertink> ah
akaiiro has quit [Remote host closed the connection]
DTZUZO has joined #crystal-lang
Tortice has joined #crystal-lang