<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!
<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 ?
<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>
<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> 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
<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>
<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).
<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>
<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
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.