<FromGitter>
<Blacksmoke16> wouldnt it be easier to build a static binary on alpine, then just upload that binary?
<FromGitter>
<Blacksmoke16> versus trying to install/build on heroku
<straight-shoota>
both approaches should work
<straight-shoota>
suggesting something entirely different doesn't help to solve the problem at hand ;)
<FromGitter>
<Blacksmoke16> dont need to solve the problem if there is no problem in the first place :p
<FromGitter>
<snadon> It is an automatic deployment when merging a PR. Also, the Github Action builds and runs the spec just fine.
<FromGitter>
<Blacksmoke16> same OS on the action/heroku?
renich has quit [Quit: renich]
<FromGitter>
<Blacksmoke16> possible lucky scripts dont support x architecture?
<FromGitter>
<Blacksmoke16> :shrug:
<straight-shoota>
Unlikely
<FromGitter>
<snadon> It is intermittent
<FromGitter>
<snadon> Usually it builds just fine but today I got the error twice
<FromGitter>
<paulcsmith> This is an issue that has happened with numerous people in Docker containers as well. Some even ran into it when building locally
<FromGitter>
<paulcsmith> So not just Heroku and pre compiling a binary is not what everyone can or will do. Plus it may still have issues since there are intermittent issues with Docker compiles as well
<straight-shoota>
@paulcsmith is there an issue for that?
<FromGitter>
<paulcsmith> Yes I believe both of those are what people are seeing
<FromGitter>
<paulcsmith> Since it is intermittent I have no idea what is causing it and it is just about impossible to reproduce. I do know that @jwoertink said that this issue appeared (I think) on v0.34 and was fine on 0.33
<FromGitter>
<snadon> I know I got it in the past but a while ago so I think 0.33 was fine
<straight-shoota>
Why are you aware of these issues with multiple users but there are only two reports on the issue tracker? :D
<straight-shoota>
Seems like a nasty debugging task unfortunately :(((
<straight-shoota>
@snadon please add your details to the issue I mentioned
<FromGitter>
<paulcsmith> Yeah definitely. I've not had any time to dig into it. It has actually only happened to me once so hasn't caused me too much pain, but I know others see it a lot more often for some reason
<FromGitter>
<paulcsmith> Even though that is about homebrew, I'm guessing there is a similar route issue. It looks pretty similar on the surface at least
<straight-shoota>
The issue states it's running on docker
<straight-shoota>
that seems the unifying ground
<straight-shoota>
Let everyone add to the issue. Even if the error is not easy to grasp. That makes it even more important to have more reports.
<FromGitter>
<paulcsmith> I've had it locally on macOS. I will add that to the issue
<FromGitter>
<paulcsmith> And Heroku does not use Docker by default. The buildpack being used uses some Heroku specific container magic
<FromGitter>
<paulcsmith> But I dunno, maybe it is especially prevalent with containers of any kind 🤷♂️
<straight-shoota>
could be
<straight-shoota>
obvious similarity is that it starts showing up with 0.34.0
straight-shoota has quit [Ping timeout: 260 seconds]
<FromGitter>
<watzon> One more thing to add to my `crystal-term` org
<FromGitter>
<didactic-drunk> Is there any way to debug the require path? By showing every attempted require?
<FromGitter>
<watzon> Not that I know of
<FromGitter>
<watzon> What's going on?
<FromGitter>
<didactic-drunk> `require "compress/zstd"` doesn't work. My changes aren't published yet.
<FromGitter>
<damianham> @all Guys - if you are following the news I am sure you may now be aware of the controversy surrounding the simulation software used by Professor Neil Ferguson to model the spread and fatality rates of Covid-19. Basically they have been using some software (that may have been transpiled from Fortran) that has just 1 test, is non deterministic (although the game theory guys say that is OK), is written in C++
<FromGitter>
... with the no classes, has many files with thousands of lines (one 5404 lines), functions of >400 lines and produces random results on each run so the model needs to be run multiple times and take the average. It has been severely criticized as amateur hobbyist code by a seasoned ex Google developer. Professor Ferguson has ... [https://gitter.im/crystal-lang/crystal?at=5eb4eb4a97338850a2f4bae3]
return0e has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
<raz>
i'll take his word over any "ex-googler" any day of the week
zorp has joined #crystal-lang
wakatara has joined #crystal-lang
alexherbo2 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter>
<RomainFranceschini> While it certainly could have been written in a better way, its unfortunately pretty common that models are released in a similar state, written in an ad-hoc way, with few tests (if any), sometimes re-used for different purposes. The main issue is that such models are usually not written by computer scientists, they are written by domain experts (epidemiologists in this case). As such they are just
<FromGitter>
... interested in validation (i.e. whether their assumptions fits reality), not verification (i.e. does the model implements those assumptions correctly).
<FromGitter>
<RomainFranceschini> There's nothing wrong if the model is non-deterministic. Stochastic models are really common to model uncertainty. It's fine to take the average behaviour as long you have means to make a run deterministic (e.g. by setting the random seed)
<FromGitter>
<RomainFranceschini> The question is whether the assumptions that are used for this model fits the reality. I'm not an epidemiologist so I won't do that as a computer scientist. So I don't think there's a point in reproducing this model in another language.
<FromGitter>
<RomainFranceschini> But it's interesting to question the meaningfulness of this model, there's plenty of others models from other labs to compare with, both in terms of assumptions and results.
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter>
<RomainFranceschini> BTW I'm a postdoc in a modeling and simulation lab so I really like those questions. Our role is to offer formalisms and tools to domain experts so they can choose the most appropriate one to develop a model given a set of properties of interest
<raz>
wise words romain. yes, totally agree with questioning the models and helping with the code. unfortunately in this particular case there has been a flood of politically motivated spam from people who don't know zilch about code or the underlying models.
<raz>
that's harmful not only because it distracts from proper reviews of this particular simulator, but also discourages scientists from publishing their code in general
<raz>
suggesting some rando could just rewrite 5k lines of a complicated simulator on a weekend, without the scientific background that went into it, is just silly.
<FromGitter>
<Uzay-G> How can I tell the compiler that I know a certain variable is not nil?
<raz>
a little thing i've been wondering about for a while. is the second construct slower here?: `"foo #{some_computation()}"` vs `bar = some_computation(); "foo #{bar}"
<raz>
`
<raz>
i imagine the compiler must be smart enough to inline that, so they should be the same. but is that really true?
<raz>
(premise being that it really looks exactly like that. i.e. "bar" is not used again later or such)
<jhass>
raz: "foo #{bar} baz" is rewritten to String.interpolation("foo ", bar, " baz"), so the question is, is a = 1; foo(a) slower than foo(1)? Well, how do we pass an argument to a function? We push it onto the stack. Whether we push that value from an intermediate (some memory location), another place in the stack (some memory location) or the heap (some memory location) shouldn't make a
<jhass>
difference. So in this simple example they are the same. Now if the source of that local variable is a bit more complex and becoems opaque to LLVMs optimizer, that might influence certain optimizations like inlining the call or precomputing operations on constant values.
<raz>
gotcha. as usual it's a bit more complicated than my little brain imagined.
<jhass>
But all of this is minor and low level enough that you shouldn't spend ANY headspace on this unless in optimization mode for a performance criticial bottleneck of you application that you previously identified. And even then only after you're done with any algorithmic or structural optimizations you could make to that.
<jhass>
so to summarize: you don't need to care about this.
<raz>
yup, the extra variable allocation likely doesn't make a difference in any but the tightest looped real world scenarios
<jhass>
and there only if it actually survives the optimizer
<jhass>
so it's somemthing where you'd look at the optimized LLVM IR, imagine which operations you could save and trace that back to your code
<raz>
yep got it. was more of a curiosity. thx!
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
straight-shoota has joined #crystal-lang
<jhass>
is there any way to fake global variables? I cannot allocate memory yet
<jhass>
and __crystal_once does, so no constants or class vars :/
<FromGitter>
<lodenos> I have a problem with HTTP::Client inside it test ⏎ Since yesterday I tourn around my computer, ⏎ How it's possible an HTTP::Client.get can't work inside a it test. ⏎ Example: ⏎ First case I can call my API Route ... [https://gitter.im/crystal-lang/crystal?at=5eb5454f7a24ff01b00cd0bf]
<FromGitter>
<lodenos> I have look the code of 'it' and Example.cr and everything look normal
<FromGitter>
<Uzay-G> i thought it automatically sanitized things
<FromGitter>
<sagotsky> Hi there. I've been watching crystal for a while but only recently tried tinkering with it. I had a ruby script that just wasn't snappy enough and I thought this seemed like a good chance to play with crystal. Where I'm stuck and google is failing me, is reading from a long running process. I got `Process.run` to run something. I gave it an `IO::Memory` to capture stdout. But to waits for the process to
<FromGitter>
... finish. I'd like it read from the process, let me react to that new data, then block until there's more to read. In ruby, I think I used popen3 for that, but I'm having trouble finding something equivalent here. Anyone have any hints for me?
<straight-shoota>
@Usay-G ECR is just string expansion. It doesn't have any context awareness. It doesn't even care whether it expands to HTML or any other format
<jhass>
sagax: essentially you want to change .run for .new
<jhass>
ah sorry, sagotsky ^
<jhass>
either the block form or if not, make sure to call waitpid after you're done reading (or do the reading in another fiber and waitpid on the main fiber)
<FromGitter>
<Uzay-G> oh no i thought it escaped like `ERB`
<jhass>
ERB does not escape anything, it's the very same concept
<FromGitter>
<Uzay-G> but then how do web frameworks like `Amber` or `Lucky` even work?
<jhass>
Rails patches ERB to escape things
<FromGitter>
<Uzay-G> oh ok
<straight-shoota>
I'm not even sure lucky uses ECR
<straight-shoota>
by default it uses a crystal-based DSL for generating HTML
<FromGitter>
<Uzay-G> oh wow this is a problem... I need to find a way to escape all values
<FromGitter>
<Uzay-G> yeah it uses luckyHTML
<FromGitter>
<sagotsky> ty @jhass!
<jhass>
sagotsky: oh I think it's just Process::Status#wait or so for waitpid these days
<jhass>
but block form is probably fine for your needs
<jhass>
and ups again, looks like the block form moved to run
<jhass>
kinda makes sense
gangstacat has joined #crystal-lang
<FromGitter>
<sagotsky> block form with wait/waitpid is the hint i needed :)
<jhass>
either block form or #wait :D
_ht has quit [Remote host closed the connection]
<jhass>
run is essentially new.wait, run(&) is essentially p = new; yield p; p.wait
_ht has joined #crystal-lang
_ht has quit [Client Quit]
_ht has joined #crystal-lang
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 272 seconds]
<repo>
if i were to use some code from shards, how would i require it in my script?
<repo>
i tried just requiring "shards/versions" which is what i need to use, but crystal can't find it
<FromGitter>
<Blacksmoke16> did you install it?
<repo>
shards?
<repo>
of course
<FromGitter>
<Blacksmoke16> as a dependency i mean
<repo>
or do you mean as a dep
<repo>
hm
<repo>
no
<FromGitter>
<Blacksmoke16> that would do it
<repo>
i c
<repo>
ic
<repo>
so no way to access the globally installed shards?
<repo>
yeah ok it doesn't include source
<repo>
s
<repo>
makes sense
<repo>
Missing "v0.1.0:shard.yml" for "shards"
<repo>
hmm
<FromGitter>
<Blacksmoke16> pin it to a version?
<repo>
ah
<repo>
yup that did the trick
<repo>
thanks
renich has joined #crystal-lang
wakatara has joined #crystal-lang
wakatara has quit [Client Quit]
<straight-shoota>
yeah that missing "v0.1.0:shard.yml" is a bug and already fixed
lanodan has joined #crystal-lang
<FromGitter>
<matthewmcgarvey> I've been trying to use the `at_exit` hook to make sure a process is stopped when the code finishes but I can't figure out how to call a method in the current context from within the passed in block. The broken code looks like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ It fails because `stop_process` is not a method inside the `at_exit` context [https://gitter
<FromGitter>
<straight-shoota> but that's probably not ideal solution
<FromGitter>
<didactic-drunk> Is there an equivalent of ruby's module `prepend`?
<jhass>
I don't think we have
<FromGitter>
<didactic-drunk> A workaround?
<jhass>
what do you need it for?
<jhass>
(please don't just describe how prepend works :D)
<hightower2>
:)
<FromGitter>
<didactic-drunk> The module is an satisfies an interface. Also a few methods are hooks, meant to be overriden but still call super with the default implementation.
<jhass>
and you can't use a base class?
<jhass>
possibly abstract
<oprypin>
sounds like module `extend` functionality is wanted
<raz>
oprypin: friends don't tell friends to use a legacy language!
<oprypin>
now thats cruel
<FromGitter>
<didactic-drunk> @jhass I am using an `abstract Base` class. This is a simplified example. I'm using more than one module. Some provide an Interface, others provide implmentations, some do both. This `Base` class needs to include a module both providing an interface and hooking in to the exisiting methods in `Base`.
<jhass>
is it important that M#foo is called first?
<FromGitter>
<didactic-drunk> @Blacksmoke16 I didn't know it worked like that.
<jhass>
ah yeah, looks like you can just include into the base in your case
<jhass>
but neither is exactly prepend's behaviour I guess
<raz>
hmm, in other news, we really need a hero to parallelize shards (the git clones)
<FromGitter>
<didactic-drunk> It's not going to work. My example is too simple. @oprypin's example is what I'm using to work around this bug, but every subclass needs to include the module which is less than ideal.
<FromGitter>
<jwaldrip> Would it be helpful if crystalshards.org allowed for webhooks so that we could immediately index for changes upon a push of a new github tag?
<FromGitter>
<matthewmcgarvey> That was helpful above about the `at_exit` but unfortunately there's still a problem. I have specs that depend on this process starting before the specs and closing it after and I'm adding the `at_exit` because the process could be left running if you do ctrl-c during a test or something like that. Just to verify my `at_exit` was working i added: ⏎ ⏎ ```at_exit { puts "FOOO" }``` ⏎ ⏎ and ran
<FromGitter>
<matthewmcgarvey> You are meant to call .stop at the end. It's more of a guarantee. That's why I'm just going to leave it out. If the process is still running after it's not my fault :/
<FromGitter>
<matthewmcgarvey> I was focusing on copying then improving later. That seems like it could be a possible api
<FromGitter>
<matthewmcgarvey> thanks for your help!
<FromGitter>
<Blacksmoke16> its a common pattern in stdlib for example to have the block be safe, but also have unsafe constructs
<FromGitter>
<Blacksmoke16> like `File.new` versus `File.open do ..`
hightower2 has quit [Ping timeout: 260 seconds]
<FromGitter>
<jwaldrip> I am trying to figure out how to "watch" the output of `Process.new` and raise an error if there as been no output to stdout/stderr or input to stdin within a given time. How could I go about this and ensure that the outputs still stream in realtime to the system io?
<FromGitter>
<Blacksmoke16> channel with `select` and timeout?