ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.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
<FromGitter> <uuwa> So even if I don't use the formatter, the fact that it removes them means it is bad style. Okay, question clear.
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Blacksmoke16> added a `to_s` method to the list/violation โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e76ab4c1d73bb22eb97c421]
<FromGitter> <Blacksmoke16> ๐Ÿ’ฏ
<FromGitter> <smalls12> thats kool !
<FromGitter> <smalls12> what other forms could it validate?
<FromGitter> <smalls12> besides empty
ur5us has joined #crystal-lang
<FromGitter> <Blacksmoke16> atm thats the only one i implemented
<FromGitter> <Blacksmoke16> but planning on quite a few additional ones, plus custom ones can be defined
<FromGitter> <smalls12> fair enough, any ideas though ?
<FromGitter> <smalls12> oh ok
<FromGitter> <smalls12> maybe validate some type of formatting like email address, phone number
<FromGitter> <Blacksmoke16> prob most of those, minus the ones that depend on Intl, like Language/locale
<FromGitter> <Blacksmoke16> and some that are redundant, like `Type`
<FromGitter> <smalls12> ๐Ÿ‘
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e76b1de4f537701a0b7f6f8]
<FromGitter> <Blacksmoke16> error messaging works with arrays now
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter> <randiaz95> Very cool!
<FromGitter> <randiaz95> D. Scott Boggs is still using .cr i see...
<FromGitter> <randiaz95> @dscottboggs_gitlab
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#b2b8498 (master - IO::Hexdump: forward missing methods to underlaying IO (#8908)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/665355440
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8908 (IO::Hexdump: forward missing methods to underlaying IO)
<FromGitter> <smalls12> trying to work with time class
<FromGitter> <smalls12> this is in the docs but doesnt work
<FromGitter> <Blacksmoke16> you're looking at old docs
<FromGitter> <smalls12> bah
<FromGitter> <smalls12> google -_- why
<FromGitter> <smalls12> it was second option lol
<FromGitter> <smalls12> what is `Crystal::ThreadLocalValue`
<FromGitter> <smalls12> cant find docs
<FromGitter> <Blacksmoke16> prob related to that
<FromGitter> <randiaz95> Does anyone know why my headers key value not persisting after the first request? โŽ โŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e76c8095831300e1e1ea04d]
<FromGitter> <Blacksmoke16> does `anonymous` get printed twice?
<FromGitter> <randiaz95> yes
<FromGitter> <Blacksmoke16> and the response doesnt have a `key` header ?
<FromGitter> <Blacksmoke16> because you're adding the header to the response, how would the request know about that header?
<FromGitter> <randiaz95> I thought the request was read only
<FromGitter> <randiaz95> and the response was write only
<FromGitter> <randiaz95> I do get the key into the response headers though: โŽ โŽ `context.response.print "Hello world, got #{context.response.headers}!"` returns a key in the hash
<FromGitter> <randiaz95> I think I confused headers with cookies... sory
<FromGitter> <Blacksmoke16> np
<FromGitter> <randiaz95> Wow... I just found a simple way to go around csrf...
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <randiaz95> So dumb.. Instead of executing a post request from the outside site; just store the credit card data onChange of the input tag.
<FromGitter> <randiaz95> and send a direct request.
<FromGitter> <randiaz95> What is stopping anyone from doing that?
<FromGitter> <randiaz95> not saying that I am going to do that...
<FromGitter> <randiaz95> But I am fearful...
<FromGitter> <Blacksmoke16> not sure i follow
<FromGitter> <randiaz95> So, csrf is making sure that the client is sending a post request from the correct site.
<FromGitter> <randiaz95> because there can be hidden cc input tags that autocomplete without the user knowing in hacker sites.
<FromGitter> <Blacksmoke16> You can turn off autocomplete and there are options you can add to the cookie to reduce that vulnerability
<FromGitter> <smalls12> > https://crystal-lang.org/reference/syntax_and_semantics/annotations/built_in_annotations.html#threadlocal โŽ โŽ I thought that initially, but that attribute isn't used anywhere in the code
<FromGitter> <smalls12> im trying to use https://github.com/crystal-community/zeromq-crystal which seems to be based off some early versions of crystal
<FromGitter> <Blacksmoke16> Yea Looks like it needs updated
<FromGitter> <randiaz95> I am trying to move away from non-vanilla. http servers and trying to use the base one
<FromGitter> <Blacksmoke16> The one in the stdlib?
<FromGitter> <randiaz95> yeah
<FromGitter> <Blacksmoke16> Why?
<FromGitter> <Blacksmoke16> Also gl as you're going to need to implement a router
<FromGitter> <randiaz95> I am a hobbyist and am looking at it more as an educational tool
<FromGitter> <randiaz95> right
<FromGitter> <Blacksmoke16> Fair enough
<FromGitter> <randiaz95> at work I make Flask Python api's
<FromGitter> <randiaz95> and essentially all you need to do it pip install everything lol
<FromGitter> <Blacksmoke16> Should try out some Athena ๐Ÿ˜‰
<FromGitter> <randiaz95> hm
<FromGitter> <randiaz95> Is that the one that you were building during x-mas break?
<FromGitter> <Blacksmoke16> Is my framework yea
<FromGitter> <randiaz95> Brilliant!
<FromGitter> <randiaz95> I have a feeling it will be complex; but atleast I remember it had design patterns
<FromGitter> <randiaz95> sorta like mvc or somethin
<FromGitter> <Blacksmoke16> not too complex if you dont need it to be
<FromGitter> <randiaz95> I shards installed ya
<FromGitter> <randiaz95> with all the possible malware
<FromGitter> <randiaz95> ;)
<FromGitter> <Blacksmoke16> ha
<FromGitter> <randiaz95> George, I forgot the goal of Athena.
<FromGitter> <randiaz95> Mainly reusability?
<FromGitter> <randiaz95> It seems to use threads; so are there performance benefits?
<FromGitter> <Blacksmoke16> its built on top of the stdlib's `HTTP::Server`, which also uses fibers, so nothing really fancy there
<FromGitter> <randiaz95> ART seems to be an event based routing system. Can I create non-http request events?
<FromGitter> <Blacksmoke16> mainly just takes a diff approach. I.e being annotation based, having a DI service container, using normal methods as route actions, and flexible as the majority of it can be extended/customized
<FromGitter> <randiaz95> Right. I see the customization aspect
<FromGitter> <Blacksmoke16> internally it uses that lib
<FromGitter> <Blacksmoke16> to emit/handle the events required to handle the request
<FromGitter> <randiaz95> Wow.
<FromGitter> <randiaz95> So like events in long running processes can be called? like after finishing a long running etl you can trigger ml training then finally send an event that sends email or websocket push?
<FromGitter> <Blacksmoke16> probably, would be able to define your own events then emit them when you want
<FromGitter> <randiaz95> I think I got an error while trying to run your example. Essentially the athena-config dependency can't find athena.yml
<FromGitter> <randiaz95> I think it is in a directory above ./
<FromGitter> <Blacksmoke16> mmm, probably need to generate one when installing
<FromGitter> <Blacksmoke16> should just be able to add one to your root and it'll be ๐Ÿ‘
<FromGitter> <Blacksmoke16> can be empty
<FromGitter> <randiaz95> ah ok
<FromGitter> <Blacksmoke16> thanks for that, first i heard about it. I'll get it fixed for next release
<FromGitter> <randiaz95> That's not common in most people lol.. Most people don't put much heart and soul to what they do.
<FromGitter> <Blacksmoke16> i try :p
<FromGitter> <randiaz95> I also don't know how to hang the ART.run
<FromGitter> <Blacksmoke16> hang?
<FromGitter> <randiaz95> yep in the example we do spawn ART.run
<FromGitter> <randiaz95> so it doesnt wait and listen; but just finishes the script
<FromGitter> <Blacksmoke16> oh yea, thats just for the example so that the client can execute its requests
<FromGitter> <randiaz95> Ah. True my bad lol
<FromGitter> <Blacksmoke16> would just need to do `ART.run` and it'll block to handle requests
<FromGitter> <randiaz95> I should puts those .body outputs then
<FromGitter> <randiaz95> This is flask for Crystal :D
<FromGitter> <randiaz95> I think I will try to make a tool for work in it. ( I make some local wifi tools for my team sometimes)
<FromGitter> <Blacksmoke16> haha yea, is mainly based on symfony which does a similar things
<FromGitter> <Blacksmoke16> i come from a more PHP background so is more like symfony/spring like versus rails
<watzon> Damn the Crystal alpine package is out of date
<FromGitter> <Blacksmoke16> Can't use the docker image?
<watzon> The docker image is using debian, and debian unfortunately isn't good at updating packages
<watzon> I need libmagickwand 7 and would rather not build it in the image
<watzon> May have to though
<watzon> Thought maybe extracting the tar.gz for Crystal into the alpine container would work, but trying to run shards install is giving me a non zero exit code
<watzon> Well installing from source it is
return0xe has quit [Remote host closed the connection]
<FromGitter> <laynef> Do you guys need help with making Ubuntu for Crystal with Docker?
<FromGitter> <laynef> *Ubuntu support
<watzon> Nah Ubuntu support is there, Crystal should run fine on it. It's ImageMagick that's the issue
<FromGitter> <laynef> What or who currently needs help or support?
gangstacat has quit [Quit: ฤœis!]
gangstacat has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e_ has quit [Client Quit]
return0e has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 250 seconds]
Human_G33k has joined #crystal-lang
HumanGeek has quit [Ping timeout: 264 seconds]
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
Groogy has joined #crystal-lang
_ht has joined #crystal-lang
ua has quit [Read error: Connection reset by peer]
ua has joined #crystal-lang
<FromGitter> <Blacksmoke16> @watzon no i mean the Alpine docker image
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#aed65fc (master - Add Int#bit_length (#8924)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/665490209
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#2fdde2f (master - Make OptionParser example to exit on --help (#8927)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/665498588
<DeBot> https://github.com/crystal-lang/crystal/pull/8927 (Make OptionParser example to exit on --help)
<FromGitter> <j8r> @watzon the Alpine image has the version 7 of imagemagick
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7792fcdca65f4b20e3c183]
<FromGitter> <Blacksmoke16> is the syntax i went with
<FromGitter> <Blacksmoke16> `declare_annotation` accepts a FQN and creates the annotation there, and defines the constant used to resolve it
<FromGitter> <Blacksmoke16> `initializer` accepts the default error message and a splat of additional options that constraint allows
<FromGitter> <Blacksmoke16> just to make it easier, versus duplicating the default ones and calling super all the time
<FromGitter> <Blacksmoke16> would be nice if `annotation` keyword made a struct that handles that annotation but one can dream :p
<FromGitter> <jwoertink> With `HTTP::Headers`, does crystal automatically handle translating between `-` and `_`?
<FromGitter> <jwoertink> like `headers["CONTENT_TYPE"]` would be the same as `headers["Content-Type"]`?
<FromGitter> <jwoertink> or should those be treated differently?
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8r5d
return0e has joined #crystal-lang
<FromGitter> <Blacksmoke16> fwiw if you want to be future compatible, use lowercase header names
return0e has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> `HTTP/2` requires it
<FromGitter> <Blacksmoke16> and is BC
return0e_ has quit [Read error: Connection reset by peer]
<FromGitter> <jwoertink> so like `headers["content_type"]`?
return0e has joined #crystal-lang
<FromGitter> <Blacksmoke16> "content-type" is what i would do
<FromGitter> <Blacksmoke16> underscores are allowed but dash is more common
<FromGitter> <jwoertink> that makes sense. Cool thanks
alexherbo2 has joined #crystal-lang
<FromGitter> <andrewc910> @Blacksmoke16 Hey, may i ask what you mean by " Can you ensure you have a periodic build setup?"?
<FromGitter> <andrewc910> Thanks!
<FromGitter> <andrewc910> What frequency would you recommend? Monthly?
<FromGitter> <Blacksmoke16> weekly prob
<FromGitter> <Blacksmoke16> ideally it would be testing against both latest and nightly
<FromGitter> <Blacksmoke16> in other news, i remembered crystal has method overloading
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e779c217d676c4d6170136c]
<FromGitter> <Blacksmoke16> so i can do stuff like this ๐Ÿ˜ฎ
<FromGitter> <andrewc910> Okay, ill get this done today and ping the PR.
<FromGitter> <Blacksmoke16> โค๏ธ thanks
<FromGitter> <andrewc910> Thanks for the help as always :)
<FromGitter> <Blacksmoke16> np
<FromGitter> <Blacksmoke16> i guess what should happen if you do like
<FromGitter> <Blacksmoke16> ```@[Assert::NotBlank] โŽ property age : Int32``` [https://gitter.im/crystal-lang/crystal?at=5e779fe36241ff2ebca2c46d]
<FromGitter> <Blacksmoke16> currently it just noops
<FromGitter> <Blacksmoke16> should that result in an exception, or some `TypeMismatch` violation?
<FromGitter> <Blacksmoke16> heh `Error: undefined macro method 'Underscore#resolve'`
<FromGitter> <Blacksmoke16> i made it a compile error `Error: Constraint Athena::Validator::Constraints::NotBlank cannot be applied to Job#age. This constraint does not support the Int32 type.`
<FromGitter> <noaheverett_twitter> Newbie question, I'm trying to send binary data over a websocket client created via `ws = HTTP::WebSocket.new`
<FromGitter> <noaheverett_twitter> I undestand ws.send sends text data, but the stream option sends binary data? Does anyone have an example of using the stream method or a way to send binary data over a websocket?
<FromGitter> <Blacksmoke16> prob something like
<FromGitter> <Blacksmoke16> ```ws.stream do |io| โŽ io.write bytes โŽ end``` [https://gitter.im/crystal-lang/crystal?at=5e77a8379f01f43069ab97a2]
<FromGitter> <noaheverett_twitter> ah ok! trying now thank you!
<FromGitter> <Blacksmoke16> ๐Ÿ‘
Groogy has quit [Quit: WeeChat 2.7.1]
<FromGitter> <noaheverett_twitter> I already forgot how to do this again: how do I convert a string into a slice that can be sent via io.write?
<FromGitter> <noaheverett_twitter> you rock, thank you for helping me
alexherbo2 has quit [Ping timeout: 264 seconds]
<FromGitter> <Blacksmoke16> np
Human_G33k has quit [Remote host closed the connection]
<FromGitter> <wout> While implementing an API, I found this timestamp return value: `12424312`. Is this a standard in some language? Because it is way too short.
<FromGitter> <wout> I can convert it to an acceptable value by multiplying by `100`: `Time.unix(@timestamp * 100)`.
alexherbo2 has joined #crystal-lang
<oprypin> wout, no, that makes no sense. one wouldn't have a multiplier of 100 there either
<FromGitter> <wout> @oprypin Yeah, it's probably a mistake. I'll have to contact them about this. Thanks!
ur5us has joined #crystal-lang
<oprypin> oprypin, could be time since they started their server :o 143 days
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo20 is now known as alexherbo2
<FromGitter> <dscottboggs_gitlab> @randiaz95 โ˜๏ธ March 21, 2020 8:50 PM (https://gitter.im/crystal-lang/crystal?at=5e76b660e1bdad01ab4dba70) what?
_ht has quit [Remote host closed the connection]
<FromGitter> <uuwa> Is it normal that static arrays take long to compile? I needed to compile an uninitialized 10,000-items static array (which I later filled) and my OS froze.
* watzon uploaded a video: 2020-03-22_16-13-14.mp4 (158KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/nGDuCSAfcqJeGLzuoSrYGTVB >
<watzon> I did a thing
<oprypin> uuwa, yea it's been brought up as an issue, try a search
<watzon> It's a LLVM problem afaik. Or at least a way with the generated LLVM IR
<oprypin> watzon, werent you the one who brought it up? do u have a link?
<FromGitter> <dscottboggs_gitlab> watzon โŽ โŽ ```code paste, see link``` โŽ โŽ would be a better way to do that. I think your current method of choosing a random color would be weighted towards darker colors. [https://gitter.im/crystal-lang/crystal?at=5e77f509ada7ae4f2e370fac]
<FromGitter> <dscottboggs_gitlab> or maybe green/blue colors?
<FromGitter> <dscottboggs_gitlab> regardless, super cool
<FromGitter> <Blacksmoke16> prob could do `byte.to_s(str, base: 16)`
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang