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
zorp has quit [Ping timeout: 272 seconds]
marmotini_ has joined #crystal-lang
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
marmotini_ has quit [Ping timeout: 264 seconds]
marmotini_ has joined #crystal-lang
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 264 seconds]
marmotini_ has joined #crystal-lang
zorp has joined #crystal-lang
marmotini has quit [Ping timeout: 252 seconds]
akaiiro has quit [Ping timeout: 252 seconds]
akaiiro has joined #crystal-lang
rohitpaulk has joined #crystal-lang
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 244 seconds]
marmotini has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
marmotini has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
marmotini has quit [Ping timeout: 252 seconds]
<FromGitter> <proyb6> How do you convert the slice byte of A to unicode? ⏎ Syntax error in :2: expected hexadecimal character in unicode escape ⏎ ⏎ ```o = "A".to_slice ⏎ p "\u{o}"``` [https://gitter.im/crystal-lang/crystal?at=5bcc1d0b1c100a4f29bc70fc]
_whitelogger has joined #crystal-lang
<FromGitter> <yxhuvud> @straight-shoota Seen http://250bpm.com/blog:137 ? (follow up regarding #6468)
<FromGitter> <proyb6> So my custom slice code to string is faster than lchop by 5 (Short string) to 14ns (Long string)
marmotini has joined #crystal-lang
marmotini has quit [Ping timeout: 240 seconds]
Raimondii has joined #crystal-lang
ashirase has quit [Ping timeout: 240 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
ashirase has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <proyb6> So I realise HTTP context.response.write accept slice type as opposite to context.response.print? I could shave down to <3ns on any length string with slice, while lchop grew 100ns+. Amazing!
ua has quit [Ping timeout: 244 seconds]
ua has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <talbergs> Hola, how is the progress on this one? https://github.com/crystal-lang/crystal/issues/2061#issuecomment-174366834
<oprypin> talbergs, nobody's doing that. i think that particular thing is actually not viable whatsoever
<FromGitter> <talbergs> So I have to write my first c-binding now :(
<FromGitter> <Heaven31415> It's really simple, don't worry :P
<FromGitter> <Heaven31415> If you know C of course :P
<FromGitter> <talbergs> :b
<oprypin> :ь
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
return0e has joined #crystal-lang
return0xe has quit [Ping timeout: 268 seconds]
<FromGitter> <ljuti> Found a bug in compiler, trying to figure out if there’s already a similar upcast issue open.
<FromGitter> <j8r> @talbergs there are tools to generate bindings from a .h
<FromGitter> <Heaven31415> @j8r how good is your generator?
<FromGitter> <ljuti> OK, narrowed the code down and it seems to be reproducible. Will open an issue.
rohitpaulk has joined #crystal-lang
<FromGitter> <Heaven31415> If methods in standard library or in compiler source are missing type restrictions, will PR adding them be accepted?
<oprypin> Heaven31415, standard library - probably yes
<FromGitter> <Heaven31415> Well, the best way to know is to create a PR :P
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <drum445> Hello all, if I have a kemal app which inits a db connection pool. How is best to share this to my repos directory, currently I am passing the db module connection into the repo classes but not sure whether this is best?
<FromGitter> <drum445> I guess to make it simpler, should I just add all the repo classes to the same module as the routes?
<FromGitter> <drum445> What is the best way to share a db connection pool around my directories ?
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter> <drum445> so far I've gone with this ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5bcc6c48435c2a518edfe8eb]
<FromGitter> <drum445> require "mysql" ⏎ ⏎ class Conn ⏎ @@db = uninitialized DB::Database ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5bcc6c4ac7bf7c3662478eb1]
<FromGitter> <drum445> So far I've gone with this
<FromGitter> <drum445> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcc6c62600c5f6423e3f5c9]
<FromGitter> <drum445> then my main file calls Conn.connect and the repos can just use Conn.db
<FromGitter> <drum445> Anything wrong with that?
<oprypin> uninitialized is almost always wrong
<FromGitter> <drum445> oh right, so how is best to go about this then?
<FromGitter> <drum445> It's basically a static class so I can't have an initializer
<FromGitter> <drum445> Been trying to come up with a nice way of doing this for a while now lol
_whitelogger has joined #crystal-lang
<FromGitter> <vladfaust> I'm sorry to disturb, @everyone, but I spent much time on it and sure it would be helpful to many. Meet new version of https://crystaljobs.org, which is actually capable of jobs! Cheers ❤️
<FromGitter> <vladfaust> Guess it didn't work :thinking:
<FromGitter> <r00ster91> The `@everyone` worked
<FromGitter> <vladfaust> Ah, okay. It's not highlighted for me
<FromGitter> <r00ster91> the background looks very nice. But what does the β mean?
<FromGitter> <vladfaust> It's Beta
<FromGitter> <r00ster91> aah
<FromGitter> <bajro17> @vladfaust can I get this example job? :) So nice work congratulation
<FromGitter> <vladfaust> @bajro17 come at Nowhere St, 42, Utopia 4242 right now
<FromGitter> <drum445> nice work @vladfaust
<FromGitter> <drum445> Anyone know what I can do about my db class above?
<FromGitter> <vladfaust> Why not ⏎ ⏎ ```class Conn ⏎ @@db = DB.open("mysql://root:password@localhost:3306/test") ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bcc74b9ef4afc4f28ab32f1]
<FromGitter> <drum445> won't that mean everytime it's Conn.db is called it will open a new connection?
<FromGitter> <drum445> I want to use pooling
<FromGitter> <vladfaust> Nope, it won't mean that. It's class variable, called once on class declaration
<FromGitter> <bajro17> @vladfaust are you use any web framework for site or make it from 0?
<FromGitter> <vladfaust> It's VueJS, @bajro17
<FromGitter> <drum445> awesome, so then my repos can call Conn.db. That seems to work well you reckon?
<FromGitter> <drum445> Thanks mate
<FromGitter> <vladfaust> @drum445 99% sure, using it like that in my projects. May be missing something very deep
<FromGitter> <j8r> @Heaven31415 depends of the lib
<FromGitter> <drum445> @vladfaust top stuff, God bless
<FromGitter> <vladfaust> @drum445 👼
<FromGitter> <drum445> look what just got uploaded
<FromGitter> <bajro17> @drum445 :like:
<FromGitter> <vladfaust> Nice voice, thanks for tutors
<FromGitter> <Heaven31415> I don't think it's him :P
<FromGitter> <drum445> Just popped up in my sub feed lol
<FromGitter> <drum445> Great to see big creators getting interested in Crystal though
DTZUZO has joined #crystal-lang
<FromGitter> <Heaven31415> Yeah, it's good for morale.
<FromGitter> <drum445> You fine gentlemen on Linux or Mac?
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <proyb6> macOS
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Remote host closed the connection]
<FromGitter> <bajro17> is it good idea to params must be on end of link?
<FromGitter> <paulcsmith> I'm running into a strange issue ```require "http" ⏎ ⏎ HTTP::Client.get(url: "https://lucky-integration-c9732017.herokuapp.com")```
<FromGitter> <Blacksmoke16> `require "http/client"` try that
<FromGitter> <paulcsmith> Is getting an end of file error, but when I visit it in the browser or with CURL it loads fine
<FromGitter> <paulcsmith> It's a runtime error :S If you pop that in crystal play you'll probably see the same thing. It's strange that it works in the browser and with Curl, but fails when making the request with Crystal 🤔
<FromGitter> <Blacksmoke16> ah
<FromGitter> <Blacksmoke16> yea i see same error
<FromGitter> <paulcsmith> Hmm, I think this is a bug in Crystal. If I do this style it works :S ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcc945264cfc273f900db64]
<FromGitter> <paulcsmith> very strange!
<FromGitter> <Blacksmoke16> that just returns first line
<FromGitter> <Blacksmoke16> prob still persists if you do like `.gets_to_end` where it throws that exception once the end of file is reached, vs just stopping and returning everything
<oprypin> paulcsmith, try adding the request header "Connection: Close"
<oprypin> hm, works for me as-is anyway
<FromGitter> <paulcsmith> I just deleted the app, maybe it is getting a 404 (which does work)
<FromGitter> <paulcsmith> I did't mean to delete the app, but the integration spec clean up on every run. Sorry about that
<FromGitter> <paulcsmith> Trying with the headers now
marmotini has joined #crystal-lang
<FromGitter> <paulcsmith> Ok I did this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcc9bfb82893a2f3b18aafd]
<FromGitter> <paulcsmith> And I still get `End of file reached`
<FromGitter> <paulcsmith> The odd thing is it does return a body, but it is an empty string. But if you visit that URL or curl it `curl https://lucky-integration-0b82c095.herokuapp.com` you can see it is definitely not supposed to be empty
<FromGitter> <paulcsmith> Another oddity. Using this style does not raise any errors, but also returns an empty body: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcc9de46e5a401c2da956dc]
<FromGitter> <cpunion> Can anyone makes this code(https://play.crystal-lang.org/#/r/5adw ) work? I want to build a dynamic property's reader. It works fine for simple method, but can’t work with methods with block argument. Seems `Crystal::Macros::Def#block_arg` can’t use to check whether a method requires a block argument. (I filtered `String#count` and `String#delete` because another problem).
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <cpunion> Code updated: https://play.crystal-lang.org/#/r/5ady
<oprypin> cpunion, it tells you "'String#each_char_with_index' is expected to be invoked with a block, but no block was given" , what is not clear?
<oprypin> > 98. value.each_char_with_index
<oprypin> if you wrote this code alone, it would break just as well, no need to involve macros
<FromGitter> <bajro17> Can someone help me convert from ruby to crystal this regex ⏎ ⏎ ```Regexp.new('\A' + path.gsub(/:[\w-]+/, '[\w-]+') + '\Z')``` [https://gitter.im/crystal-lang/crystal?at=5bcca737c7bf7c3662490085]
<FromGitter> <cpunion> I want to build dynamic property’s reader, it can wrap an object of any type, a server receive string command then read property and reply.
<FromGitter> <cpunion> So I want it support all methods without arguments.
<FromGitter> <cpunion> In the code, I want it ignore methods that requires block argument like `each_char_with_index`.
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 264 seconds]
<FromGitter> <zbaylin> Is there any way to convert an object into a hash representation of itself?
<FromGitter> <Blacksmoke16> should have to implement a method to do it
<FromGitter> <zbaylin> that's what Im trying to do
<FromGitter> <zbaylin> but unlike Ruby, there is no `#instance_variables` method, or anything like it
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5aeq
<FromGitter> <Blacksmoke16> ofc just an example
<FromGitter> <Blacksmoke16> if JSON would work you could check out https://crystal-lang.org/api/0.26.1/JSON/Serializable.html
akaiiro has joined #crystal-lang
marmotini has quit [Ping timeout: 264 seconds]
DTZUZO has quit [Ping timeout: 244 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <valamorgon> I've got a class like with nested hash attribute like this
<FromGitter> <valamorgon> class Parser ⏎ @@translations = { ⏎ ⏎ ```"set" => { ⏎ "language" => "Language" ⏎ },``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5bccbca0ab17df2631ca910d]
<FromGitter> <valamorgon> I want to see if my variable inside the hash like this
<FromGitter> <valamorgon> if @@functions["set"].has_key?(children[0].text)
<FromGitter> <valamorgon> and I got this error:
<FromGitter> <valamorgon> undefined method 'has_key?' for String
<FromGitter> <valamorgon> but my type "set" key is also has a hash value, it is not string
<FromGitter> <valamorgon> why I got this error?
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <bew> Are you sure there's only a hash inside that hash?
<FromGitter> <bew> What it the type of `@@translations`?
marmotini has joined #crystal-lang
<FromGitter> <valamorgon> well I didnt define any type, I directly created it like this
<FromGitter> <j8r> and `typeof(@@translations)`?
<FromGitter> <valamorgon> actually I check it like this now
<FromGitter> <valamorgon> typeof(@@translations["set"]) == Hash && @@translations["set"].has_key?(children[0].text)
<FromGitter> <valamorgon> let me check the type again
<FromGitter> <valamorgon> @j8r it is Hash(String, Hash(String, String))
<FromGitter> <valamorgon> oops
<FromGitter> <valamorgon> sorry for wasting everybodies time, it turns out I had two hash one is translations other is translation
<FromGitter> <valamorgon> thnkas for helping me out anyway
<FromGitter> <j8r> @valamorgon to debug `pp!({x, x.class, typeof(x)})` is useful 😄
rohitpaulk has joined #crystal-lang
marmotini has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <valamorgon> @j8r fair enough, maybe I will talk to the duck next time though like this guy: https://www.youtube.com/watch?v=huOPVqztPdc lol
marmotini_ has joined #crystal-lang
marmotini has joined #crystal-lang
rohitpaulk has joined #crystal-lang
marmotini_ has quit [Ping timeout: 272 seconds]
<FromGitter> <j8r> how can I generate a `crypt` compatible hash with `OpenSSL::Digest.new`?
rohitpaulk has quit [Ping timeout: 264 seconds]
akaiiro has quit [Remote host closed the connection]
<FromGitter> <j8r> To be short: I would like to create an `/etc/shadow` entry
<FromGitter> <ljuti> Here’s the code and the spec that produced the possible compiler bug I mentioned earlier today https://gist.github.com/ljuti/d719507523f6c9fc8725672b893b0951
<FromGitter> <ljuti> Crystal repo already has a few similar looking issues open https://github.com/crystal-lang/crystal/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+upcast
<FromGitter> <ljuti> Just wondering should I open a new issue or add the Gist to most relevant one, if you can help me identify the one
<FromGitter> <j8r> hum... they use a special base64 encoding on `/etc/shadow` :/
<FromGitter> <wontruefree> I am implementing a scraper in crystal and it has more errors writting to socket because of a broken pipe. I thought this would only happen if the network connection reset. Am I using the HTTP client wrong?
<oprypin> ljuti, if you put the repro in one file then you can report it without worries
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter> <j8r> wow https://akkadia.org/drepper/SHA-crypt.txt :( ⏎ I think I'll use `crypt` directly then
marmotini has quit [Remote host closed the connection]
marmotini has joined #crystal-lang
<FromGitter> <ljuti> @straight-shoota Re: #6974 - funnily enough, if I run the whole spec suite for my project from which the repro code was extracted, the suite passes without compiler error.
<FromGitter> <ljuti> If I run just the one spec file that’s testing a specific struct with that behavior, I get the compiler error
<FromGitter> <ljuti> OK, now I get compiler error consistently again. Maybe I’m too tired to remember what I had changed. :)
<FromGitter> <ljuti> Workaround for me is to use classes instead of structs, which is fine for me now.
<FromGitter> <j8r> Yeah i succeed to use `crypt` ⏎ I've something like that ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bcce822c08b8b30674ef5af]
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
daemonwrangler has joined #crystal-lang
DTZUZU has joined #crystal-lang
marmotini_ has joined #crystal-lang
marmotini has quit [Ping timeout: 240 seconds]
zorp has quit [Ping timeout: 252 seconds]
moei has quit [Quit: Leaving...]
marmotini_ has quit [Ping timeout: 252 seconds]
marmotini_ has joined #crystal-lang