<FromGitter>
<johnjansen> anyone know how to force docs for private methods
<FromGitter>
<paulcsmith> Is there a way to ignore the version and make shards always get the latest commit from master?
<FromGitter>
<fridgerator> you can specify `branch: master` in the shard.yml
<FromGitter>
<fridgerator> which I *think* is default if you only specify github: link
<FromGitter>
<paulcsmith> Ok I'll give that a try. ThanksQ
<FromGitter>
<paulcsmith> *!
<FromGitter>
<fridgerator> :thumbsup:
chimkan has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
chimkan has quit [Quit: chimkan]
chimkan has joined #crystal-lang
<FromGitter>
<codenoid> hi, how to compress / minifying html output in kemal ?
chimkan has quit [Quit: chimkan]
<FromGitter>
<codenoid> @sdogruyol @fridgerator
<FromGitter>
<johnjansen> ok people, another question, anyone know how to specify the type of a `yield`
<FromGitter>
<elorest> proxy through nginx?
<FromGitter>
<johnjansen> @elorest i presume you were directing that at @codenoid
<FromGitter>
<johnjansen> hows it going BTW?
<FromGitter>
<elorest> @johnjansen You guessed right. I’m doign pretty good. How are things going for you?
<FromGitter>
<elorest> I’ve mostly just been working on amber and related projects for the last couple months outside of work.
<FromGitter>
<johnjansen> great man, very busy … back writing some crystal which is very satisfying
<FromGitter>
<elorest> Yeah I really like crystal
<FromGitter>
<johnjansen> amber is looking good
<FromGitter>
<elorest> Had to go back to go for a couple days last week. Not nearly as much fun.
<FromGitter>
<johnjansen> im in the throws of building a custom database with crystal, im pretty happy that i can even attempt that ;-)
<FromGitter>
<elorest> Interesting. Just as a challenge or are you actually trying to solve a problem?
<FromGitter>
<johnjansen> index all domain names and make them fuzzy searchable … for my day job
<FromGitter>
<codenoid> @sdogruyol add to kemal PR please
<FromGitter>
<elorest> @codenoid did that help?
<FromGitter>
<johnjansen> i was about to say “what PR” and then the comment disappeared
<FromGitter>
<johnjansen> ;-)
<FromGitter>
<elorest> @johnjansen So basically sphinx in crystal?
<FromGitter>
<johnjansen> pretty much … but alot lighter
<FromGitter>
<elorest> I wonder how hard it would be to wrap sphinx. I mean it’s written in c++ instead of c.
<FromGitter>
<elorest> In ruby I usually just send commands to it’s daemon.
<FromGitter>
<codenoid> ` OR compress your response with a handler using Gzip. ` , idk how sir :/ , or catch kemal output, andn modify it, and output is modified
<FromGitter>
<johnjansen> yeah i wonder … anyway, this is a thought experiment as much as anything … if i cant make it fast and memory efficient, then ill keep going until i can ;-)
<FromGitter>
<johnjansen> so you want to minify and compress
<FromGitter>
<codenoid> @johnjansen yassss
<FromGitter>
<johnjansen> you could look at wrapping something like this https://github.com/deanhume/html-minifier although there may be a common solution im unaware of ...
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<elorest> Do you see any issues with my last one though?
<FromGitter>
<johnjansen> i dont think so on the surface, although there *may* be some small formatting issues depending on the actual html being minified
<FromGitter>
<johnjansen> it looks pretty good and is certainly what id start with
bjz has joined #crystal-lang
thews_ has joined #crystal-lang
dom96_ has joined #crystal-lang
FromGitter has quit [Ping timeout: 260 seconds]
thews has quit [Ping timeout: 260 seconds]
dom96 has quit [Ping timeout: 260 seconds]
dom96_ is now known as dom96
tatey has quit [Ping timeout: 260 seconds]
FromGitter has joined #crystal-lang
RX14 has quit [Ping timeout: 260 seconds]
olbat has quit [Ping timeout: 260 seconds]
dannyAAM has quit [Ping timeout: 260 seconds]
tatey has joined #crystal-lang
RX14 has joined #crystal-lang
dannyAAM has joined #crystal-lang
olbat has joined #crystal-lang
<FromGitter>
<akzhan> It seems that the Changelog is far behind the changes in the Crystal code itself :-)
_whitelogger has joined #crystal-lang
saadq has quit [Ping timeout: 255 seconds]
saadq has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 255 seconds]
cyberarm has quit [Ping timeout: 276 seconds]
cyberarm has joined #crystal-lang
flaviodesousa has joined #crystal-lang
shelvacu has quit [Ping timeout: 276 seconds]
shelvacu has joined #crystal-lang
<crystal-gh>
[crystal] MakeNowJust opened pull request #4627: Format: fix 4620, fix to format /= after else in case (master...fix/crystal-format/4620-divop-after-case-else) https://git.io/vQZnD
nikkkk has joined #crystal-lang
nikkkk has quit [Client Quit]
<FromGitter>
<crisward> I'm getting a crash with `Invalid memory access (signal 11) at address 0x0` Any ideas how I track down what is causing this?
<FromGitter>
<crisward> The issues I've found on github don't seem to match what I'm seeing.
<FromGitter>
<bew> @crisward can you share more details about the error? Can you share some code? Are you dealing with lib bindings?
Raimondii has joined #crystal-lang
<FromGitter>
<straight-shoota> My crystal ball is currently in maintenance, so I'm sorry that I can't tell the cause from the distance ;)
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<crisward> @bew - just kemal. It only seems to be happening on my local vm. Think is may be linked to files be written to a NFS share, as I'm using file sessions.
<FromGitter>
<crisward> Thats the main difference between local and live, so was my first thought.
<FromGitter>
<straight-shoota> The stacktrace points to OpenSSL
<FromGitter>
<straight-shoota> What version of openssl do you have on your vm? `$ openssl version`
<FromGitter>
<crisward> The code is running inside the Crystal Buildpack. One second I'll enter the container and check. I also know the build uses an older version of llvm. But again these should be identical local and live.
<FromGitter>
<crisward> OpenSSL 1.0.1f 6 Jan 2014
<FromGitter>
<bew> And local?
<FromGitter>
<bew> Does it crashes on startup, after a specific action? Does it crashes with a kemal hello world?
<FromGitter>
... filesystem on the live server may be too quick to replicate this issue.
<FromGitter>
<crisward> I have a logout process, which is quickly followed my calling for the user data. The logout returns ok, but then crashes just after. The call for user data returns a 500. I've tried running both of these routes independently and they seem fine. I'm wondering if the session being read, while being written is possibly the cause. I'm probably going to have to script something to recreate this consistently. The
<FromGitter>
<straight-shoota> as a side note: if this "live" is a production environment, you should really update openssl. For 3-year-old 1.0.1f there are a number of known vulnerabilities, including heart bleed.
<FromGitter>
<straight-shoota> Well, it seems to happen when HTTP::Client creates a POST request over an OpenSSL socket
<FromGitter>
<crisward> Not using ssl inside container, my ssl is being proxied outside the container and is up to date. The container is the crystal buildpack which is out of date in many ways, including using llvm 3.5.
<FromGitter>
<straight-shoota> Raven is obviously calling an HTTPS request which then utilizes OpenSSL
<FromGitter>
<crisward> Ah, just realised, using Raven / Sentry. Pretty sure that's is using SSL.
<FromGitter>
<crisward> Pretty ironic if my error tracking is causing the error.
<FromGitter>
<crisward> I'll try disabling the error tracking and see what happens.
<FromGitter>
<straight-shoota> You're probably gonna see your original exception :D
<FromGitter>
<crisward> @straight-shoota thanks for the help. Will let you know what I find...
badeball has joined #crystal-lang
A124 has quit [Disconnected by services]
A124 has joined #crystal-lang
<FromGitter>
<crisward> Thinks thats it... it won't crash now. Raven was sending 401's to sentry, so it may have just been that. Not sure why openssl crashes sometimes and not others. Will look to update it in the buildpack and see if the error goes away.
<FromGitter>
<straight-shoota> Your welcome =
<FromGitter>
<straight-shoota> An HTTP error should not cause an invalid memory access^^
<FromGitter>
<straight-shoota> If it still fails with updated buildpack, you should probably open an issue
tatey_ has joined #crystal-lang
dannyAAM has quit [*.net *.split]
tatey has quit [*.net *.split]
hako has quit [*.net *.split]
badeball_ has quit [*.net *.split]
mrus has quit [*.net *.split]
binBASH has quit [*.net *.split]
tatey_ is now known as tatey
dannyAAM has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
mrus has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
binBASH has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<crisward> Looks like updating openssl in the buildpack is far from simple. Actually using dokku, which doesn't seem to have a updated base buildpack. Trying to do `apt-get install openssl` but getting the same version
<FromGitter>
<bew> try to update package database with `apt-get update` ?
<FromGitter>
<straight-shoota> or update the distro release
<FromGitter>
<faustinoaq> Sometimes crystal generated binaries could be big, but with some tricks and tools it could be *smaller* :smile:
<FromGitter>
<bew> what is strip?
<FromGitter>
<faustinoaq> strip - Discard symbols from object files.
<FromGitter>
<bew> yeah I'm just reading that, but isn't it an issue to remove symbols?
<FromGitter>
<akzhan> somebody shows me compiling with custom prelude. It allows to create even smaller binaries.
<FromGitter>
<faustinoaq> strip doesn't remove all, it keep just necessary symbols
<FromGitter>
<bew> @akzhan weird, I heard that unused code isn't compiled in the binary, so why removing some requires in prelude will make smaller binaries (as it shouldn't be in the binary as not used)
<FromGitter>
<faustinoaq> @bew no documentation yet
<FromGitter>
<faustinoaq> but small binaries + fast compile times and good syntax make crystal useful for embed devices
<FromGitter>
<faustinoaq> A good documentation for assembler and a shard for this kind of projects would allow to compile crystal with a custom prelude specifying just necessary.
<FromGitter>
<faustinoaq> Is a great idea :satisfied:
<FromGitter>
<bew> yeah sure, but crystal for embedded devices (like arduino) will need another stdlib!
<FromGitter>
<faustinoaq> maybe it would be a *smaller* stdlib
<FromGitter>
<bew> maybe!
<FromGitter>
<faustinoaq> would be like `mruby` to `ruby`,
<FromGitter>
<bew> but thoses embedded devices don't have much spaces for malloc'd data structures, so some core design may need a rework
<FromGitter>
<bew> and as some things about the necessary, and initial classes is/are hardcoded in the compiler, either we fork, either (And I much prefere this solution) we allow compiler modules, to modify things like that
<FromGitter>
<faustinoaq> > I was able to get it down to 8602 bytes. I will give you a hint: if you run crystal build a number of options will be shown. One of those options will allow you to not depend on GC, PCRE, etc.
<FromGitter>
<faustinoaq> Is like starting from scratch, but without too much work
<FromGitter>
<bew> not exactly from scratch, as `Crystal::Program` has some defined classes already, especially there relation to "I'm a reference" and "I'm a Value", but really close to scratch
chimkan has joined #crystal-lang
<FromGitter>
<faustinoaq> *defined classes already*, those classes are a reason to choice crystal, simplify all the work when using IR assembler (LLVM)
<FromGitter>
<bew> sorry, didn't understood your last message
<FromGitter>
<faustinoaq> Using the source code, regular expressions and time :satisfied:
benner has joined #crystal-lang
<FromGitter>
<faustinoaq> but still is a lot of work to do, including submodules, subclases and their methods plus documentation
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter>
<bew> I see that you get the type of the word before to get correct completion suggestion, but how do you get the file to compile bad code (`obj.`) to get the type of `obj` ?
<FromGitter>
<kazzkiq> How exactly am I suppose to iterate through a JSON::Any type? I'm fetching a JSON from an endpoint and handle each object in a loop, but got no success on what I've tried so far.
<FromGitter>
<kazzkiq> In the case structure isn't predictable, is there any "generic" way to handle it?
<FromGitter>
<bew> From what I see from the link at coinmarketcap, it seems to be quite structured
<FromGitter>
<kazzkiq> Got it. Thanks.
Philpax has quit [Ping timeout: 240 seconds]
<FromGitter>
<bew> here is a small example how to properly deal with all thoses strings: https://carc.in/#/r/29ed
<FromGitter>
<bew> @kazzkiq
<FromGitter>
<kazzkiq> Awesome, thanks!
<FromGitter>
<kazzkiq> I tried mapping a JSON key that starts with number (`24h_volume_usd`), but it seems to give error. How could I handle those starting with numbers?
<FromGitter>
<bew> use a different name for crystal, and specify `your_crystal_key: {type: SomeType, key: "24h_volume_usd"}`
<FromGitter>
<bew> also, for the `last_updated`, you'll see that there are some Time converter already available
<RX14>
because it was only merged in the latest release
<FromGitter>
<johnjansen> ohhhhh
<FromGitter>
<johnjansen> haha
<RX14>
haha i disabled my capslock
<RX14>
turned it into an extra modifier
<RX14>
much better use of such a big key
<FromGitter>
<bew> which modifier?
<RX14>
mod3 i think
<RX14>
nope
<RX14>
mod4
<RX14>
which is what winkey is bound to in X11
flaviodesousa has quit [Remote host closed the connection]
<RX14>
my old keyboard was a monterey K108 which was too old to have a winkey
<Yxhuvud>
faustinoaq: do you have any idea of how much work supporting LSP would involve?
<RX14>
Yxhuvud, there's a crystal LSP server a while ago being worked on
<RX14>
along with a crystal-vscode-ide extension which worked with it
<FromGitter>
<johnjansen> has homebrew been updated for the latest version
<RX14>
not sure, probably not
<RX14>
it hasn't even been released yet
<RX14>
just tagged
<FromGitter>
<johnjansen> oh well thats probably the problem then
<RX14>
the release process goes changelog -> tag
<RX14>
which sets the release commit
<RX14>
and then it takes a few days to generate the release binaries
<FromGitter>
<johnjansen> ok then ;-)
<RX14>
and then the mailinglist is informed and the tag turns into a github release etc
<FromGitter>
<johnjansen> so im ahead of the game again
<RX14>
might be longer this time, not sure if @asterite did the previous release or bnot but i'm willing to bet he's not doing this one
<FromGitter>
<johnjansen> fair enough
<RX14>
@johnjansen you can build the release now if you want to
<RX14>
it's probably trivial to edit the homebrew formula
<RX14>
not sure how homebrew handles edits however
<FromGitter>
<molovo> @RX14 Should just need to update download URL, version number and sha256 hash - homebrew handles the rest itself
<FromGitter>
<johnjansen> another rabbit hole i dont want to fall into right now ;-) as it is im several branches off the one i fell into to begin with
<RX14>
yes it's trivial to update the file but idk how trivial to get homebrew to use the updated formula
<RX14>
i've never used homebrew - never had a mac
<RX14>
@johnjansen side projects? I know the feel
<FromGitter>
<johnjansen> ill PM you
<FromGitter>
<dipnlik> hello. I wanted to try crystal via a docker image. ran `docker run -it -p 8080:8080 -it crystallang/crystal crystal play` and tried browsing to `http://localhost:8080` but Chrome says `ERR_EMPTY_RESPONSE`. Tried `nc -v localhost 8080`, it looks like the server is running fine. How can I fix this? (I'm new to both docker and crystal, willing to learn about both)
<FromGitter>
<fridgerator> do you get an ip address from `docker-machine ls` ?
<FromGitter>
<fridgerator> if so, try that instead of `localhost`
<RX14>
@dipnlik you'll need to tell the playground to bind on 0.0.0.0
<FromGitter>
<dipnlik> @fridgerator i'm not using docker-machine at the moment, so`docker-machine ls` doesn't show anything. tried http://172.17.0.2:8080 too, since that's the IP that I got via `docker inspect <containerId>`, that also didn't work
<RX14>
for example, `docker run -it -p 8080:8080 -it crystallang/crystal crystal play -b 0.0.0.0`
<RX14>
that works for me whereas the original command does not
<FromGitter>
<dipnlik> @RX14 worked like a charm, thank you!
<RX14>
i recommend not binding 8080:8080 on docker though because that exposes the playground to anyone on your lan
<RX14>
just tested `docker run -it -p 127.0.0.1:8080:8080 -it crystallang/crystal crystal play -b 0.0.0.0`
<RX14>
and that works
<RX14>
not accessible on LAN
<RX14>
crystal play is essentially a giant RCE on purpose
<FromGitter>
<faustinoaq> You can clone the repo in your `.vscode/extensions` folder and compile it.
<FromGitter>
<faustinoaq> But only linux binary is avaliable, because I don't have a Mac :sweat_smile:
<FromGitter>
<elorest> This is probably really easy or not possible lol. How would I gzip a string without saving it to a file? It seems that gzip writer only takes IO objects or Filenames. Is there a StringIO object like in Ruby?
<Papierkorb>
elorest, see IO::Memory
<Yxhuvud>
faustinoaq: well, I'm not a vscode user, so your code is not all that useful.
<FromGitter>
<elorest> <Papierkorb> Is there an example somewhere of using that with a string. I’ve seen it being used for encrypted data before.
<Yxhuvud>
(to me. could be pretty swell for other people)
<Papierkorb>
elorest, a String is not a good container for either ends. If you want to compress data from a String, String#to_slice may be your friends
<RX14>
Papierkorb, if you're using Gzip::Writer you might as well use << on it
<RX14>
which avoids the verbosify of write(string.to_slice)
<RX14>
the destination should absolutely be a slice though
<FromGitter>
<faustinoaq> **<Yxhuvud> ** Scry doesn't support Formatting yet, but is less resource intensive than Node.js spawning processes. This (https://github.com/faustinoaq/vscode-crystal-lang/tree/support-scry) branch has support for symbols, live linter, basic completion and snippets. Others features like *peek implementations*, *instance method completion* and *types on hover* are WIP by @kofno in his free time :smile:
<FromGitter>
<luislavena> @elorest you will open a Gzip::Writer around a IO::Memory and then write the "string".to_slice into it: https://play.crystal-lang.org/#/r/29g9
<FromGitter>
<luislavena> you will need to build a string using the slice of bytes you just read from the Gzip
<FromGitter>
<elorest> It seems like it already returns the slice as a string, rather than a slice.
<FromGitter>
<elorest> `rstr.class => String`
<FromGitter>
<elorest> In your example don’t we need to close io?
<FromGitter>
<luislavena> @elorest you only need to close the `gzip` instance if you're not using the block version. The IO can remain open and you can rewind it to re-read it again.
<FromGitter>
<sdogruyol> @faustinoaq keep up the good job :+1:
Renich has quit [Quit: Renich]
bjz has joined #crystal-lang
<FromGitter>
<elorest> @luislavena Helped a lot. Thanks.
Aytan72 has joined #crystal-lang
chimkan has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
chimkan has quit [Quit: chimkan]
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter>
<raydf> @faustinoaq i should replace the plugin created by Ryan with yours?
<FromGitter>
<raydf> should i?*
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hightower3 has joined #crystal-lang
Kug3lis has joined #crystal-lang
hightower4 has quit [Ping timeout: 268 seconds]
<FromGitter>
<faustinoaq> @kofno did a great wotk with `crystal-ide`. My extension is based on his work and you can use it if you want more features like a formatter, and ECR support (snippets), and symbols, and completion and other things to help you when you code :satisfied:
<sauer2>
the last line is part of another, larger method
<sauer2>
>(I'm wondering why would you want to have a nil in an array of statement now)
<sauer2>
Chances are I did that instead of another cast or check somewhere else.
<FromGitter>
<bew> Using `Array(Stmt | Nil)` will makes you have a check *every* time you want to read/manipulate the array, I'm not sure it's a big win
<sauer2>
It probably isn't. I'm just not sure there 100% isn't a case with Nil...