<FromGitter>
<joshuapinter> Hey all, I ran into an issue on Ubuntu while testing my PR. I posted on Github Issues but they told me to post here instead: ⏎ ⏎ Trying to build crystal on Ubuntu 18.04 so I can do some additional testing for PR https://github.com/crystal-lang/crystal/pull/7507 and getting the following error: ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/cryst
<FromGitter>
<dscottboggs_gitlab> Yeah, it's pretty far from what I'd like but the example compiles too, and that should be at least the sketch of the whole library
<FromGitter>
<Blacksmoke16> looks like it would deff be useful, i dont know anything about audio/video codec shit
<FromGitter>
<dscottboggs_gitlab> Yeah, I just wanted to get it started because I want to add transcoding to flix.cr down the line. It wasn't as hard as I thought it would be, libav is pretty self-contained.
<FromGitter>
<Blacksmoke16> yea man, looks like a good start
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
chemist69 has quit [Ping timeout: 258 seconds]
chemist69 has joined #crystal-lang
<FromGitter>
<drum445> Cheers @straight-shoota but I get `wrong number of arguments for macro 'render' (given 1, expected 2, 1)`
<FromGitter>
<drum445> Maybe I should just use your crinja lib :)
<FromGitter>
<drum445> any examples of using it with kemal?
Vexatoast has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 250 seconds]
<FromGitter>
<straight-shoota> @drum445 Which render?
lvmbdv has joined #crystal-lang
<FromGitter>
<straight-shoota> Yeah, Crinja is nice. It adds a lot more complexity compared to ECR and it's evaluated at runtime. But supports autoescape for HTML ;)
ashirase has quit [Ping timeout: 250 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
DTZUZO has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
lucasb has joined #crystal-lang
early` has quit [Quit: Leaving]
early` has joined #crystal-lang
<FromGitter>
<drum445> @straight-shoota Seems I can't pass classes through to templates?
<FromGitter>
<drum445> {"p" = >User.new} ⏎ `Exception: type error: can't wrap User in Crinja::Value (Exception`
lvmbdv has quit [Quit: WeeChat 2.2]
<FromGitter>
<drum445> Crinja is great, but only being able to pass certain types through kind of kills it :(
<FromGitter>
<straight-shoota> Yes, that's unfortunately a limitation of Crystal's type system. `Object` can't be used as generic argument (yet).
<FromGitter>
<straight-shoota> So it can't work out of the box with arbitrary types. But it's rather simple to make it work:
<FromGitter>
<straight-shoota> This makes `User` inherit from `Crinja::Object` (so it can be used as a value) and exposes all public methods to the template.
<FromGitter>
<drum445> Are generics going to be a thing?
<FromGitter>
<straight-shoota> Yes, eventually it should work
<FromGitter>
<straight-shoota> However, it's actually not so bad right now. Because Crinja is evaluated at runtime and templates can come from third parties, it shouldn't simply expose the entire Crystal API anyway and you'll need to explicitly declare which methods should be available from the template engine.
<FromGitter>
<straight-shoota> In this case `@[Crinja::Attributes]` exposes by default all public methods which can be called without arguments. You could also specify to only expose specific methods, in order to avoid any potentially harmful methods being called from an unsafe template context.
ternarysolo has joined #crystal-lang
<FromGitter>
<kinxer> @girng Have you considered using a struct for items? A 16-length tuple seems hard to work with. (I didn't reply to your forum post because this isn't an answer to your question.)
<FromGitter>
<PlayLights_twitter> Hello guys do you know any way to know the `type` of `T` on a `Array(T)` I have `["a", "b"]` and I want to know the `typeof` of `"a"`
<FromGitter>
<kinxer> Are you guaranteed in your use case to have elements in the array?
<FromGitter>
<kinxer> That is, are you always going to have a non-empty array?
<FromGitter>
<alex-lairan> @PlayLights_twitter why do you want to know the type ?
<FromGitter>
<Blacksmoke16> you dont need the `Array(T)` since `Array(String)` is getting passed in from the `typeof`
<FromGitter>
<Blacksmoke16> was making it like `Array(Array(String))`
<FromGitter>
<Blacksmoke16> but thats also going to mess up your `validate` method since it'll be expecting an array of strings now
<FromGitter>
<PlayLights_twitter> I wanted to make it safe, using Array(T) so I know I will be an array and have the `includes`method
<FromGitter>
<Blacksmoke16> yea but `T` in this case is already `Array(String)`
<FromGitter>
<Blacksmoke16> was a 2D array since it was `Array(T)`
<FromGitter>
<Blacksmoke16> but there isnt anything stopping you from giving it an `Int32` or something as it just uses whatever the type of `value` is
<FromGitter>
<Blacksmoke16> https://play.crystal-lang.org/#/r/6f78 could split the generic into `E`, i.e. type of `@elements` and `A` the type that will be passed to `validate`
<FromGitter>
<Blacksmoke16> that works too :p
<FromGitter>
<PlayLights_twitter> haha let me see
<FromGitter>
<PlayLights_twitter> Interesting how is that possible to have `On(T)` and not define`T ` when calling the struct
<FromGitter>
<Blacksmoke16> if i had to guess it gets assumed from the type passed in on `.new`?
<FromGitter>
<bew> @j8r those are not really keywords, but they're implemented in the compiler not in stdlib and you can't override them iirc, maybe that's why they're under the name 'keyword'
<FromGitter>
<PlayLights_twitter> @Blacksmoke16 yea, so when you only need the struct or class, T would be required I think?
<FromGitter>
<j8r> @bew thanks! That's right, they can't be redefined:`'as' is a pseudo-method and can't be redefined`
DTZUZO has joined #crystal-lang
<FromGitter>
<j8r> do you know why in distribution-scripts, the Dockerfile to build the crystal linux archive is a multi-staged build which build on Debian and linking in Alpine? Doing everything on Alpine is not possible due to glibc/musl incompatibilities?
<FromGitter>
<j8r> I guess for libcrystal.a and libgc.a
mamantoha has joined #crystal-lang
mamantoha has quit [Client Quit]
mamantoha has joined #crystal-lang
mamantoha has quit [Client Quit]
mamantoha has joined #crystal-lang
mamantoha has quit [Ping timeout: 240 seconds]
sagax has quit [Remote host closed the connection]
<FromGitter>
<wontruefree> how do people here build and test for 32 bit?
<FromGitter>
<straight-shoota> @j8r I think the tow stages are mostly because of non-portability of linux binaries. I suppose when #7196 is fixed, we should be able to simplify the build process and run it completely on alpine to avoid switching.
<FromGitter>
<straight-shoota> Compiling the static libraries for libcrystal and libgc should be the same on both alpine and debian
<FromGitter>
<straight-shoota> @wontruefree I generally don't. But if I'd want to, I'd simply add a job to CI.
<FromGitter>
<wontruefree> I am developing a feature that needs 32 bit support I would not want to fire a CI job for each change I make
<FromGitter>
<wontruefree> but I normally dont worry about 32 bit either
<FromGitter>
<straight-shoota> Yeah, I've just seen your post
<FromGitter>
<wontruefree> I am finding that it is hard to build master on 32 bit. It seems like it runs out of memory and then crashes the build
<FromGitter>
<wontruefree> are you following the 128 bit PR
<FromGitter>
<wontruefree> funny I took that over from someone else because it was sitting for a while
<FromGitter>
<straight-shoota> Building the compiler might just hit the 32 bit max memory
<FromGitter>
<straight-shoota> Have you tried cross compiling from a 64 bit system?
<FromGitter>
<straight-shoota> you'd just need to link it on the 32 bit target system
<FromGitter>
<wontruefree> I have tried but I am not sure I am getting the a proper 32 bit executable out the other side
<FromGitter>
<wontruefree> I gave up on that a while ago
<FromGitter>
<wontruefree> I think I was using the --cross-compile flag with a compilation tuple
<FromGitter>
<wontruefree> I was doing it all on digital ocean VMs I am not sure if that would cause any problems
sagax has joined #crystal-lang
<FromGitter>
<wontruefree> but the 32 bit executable was not able to run the specs I think
hightower2 has quit [Ping timeout: 245 seconds]
<FromGitter>
<samholst> If I wanted to decode the URI parameter `"this%20is%20great%20!"` and display it in the view, is there a certain class that is already built in crystal for it? Just calling `params[:x]` in the view keeps the encoding. I haven't been able to find any docs on this yet
<FromGitter>
<straight-shoota> @samholst you're looking for `URI.unescape`
<FromGitter>
<samholst> Thanks @straight-shoota, that did it!
<FromGitter>
<straight-shoota> @wontruefree Yeah, you should be running something like this on the source system: `make crystal FLAGS="--cross-compile --target=i386-linux-gnu"`
<FromGitter>
<straight-shoota> That compiles an object file and prints a linker command. Then copy the source folder including the object file to the target system, run `make libcrystal` and then the linker command.
<FromGitter>
<j8r> @straight-shoota thanks for the answer, i didn't see it before asking in GitHub too
<FromGitter>
<straight-shoota> @j8r Do you have any indication that the multi stage build is responsible for #7480?
<FromGitter>
<straight-shoota> I don't see any reason for such a claim.
<FromGitter>
<j8r> I've built on alpine and it works
<FromGitter>
<j8r> And with distribution scripts, it fails
<FromGitter>
<j8r> This let me wondering what's different – one point is the Debian build and Alpine linking
<FromGitter>
<straight-shoota> I'm pretty sure there are a few more differences than that
<FromGitter>
<j8r> Yes, but which one will be responsible of this issue then?
<FromGitter>
<straight-shoota> I don't know.
<FromGitter>
<j8r> I'll do other experiments in the next day
<FromGitter>
<straight-shoota> Awesome 👍
<FromGitter>
<straight-shoota> The best way to solve this is probably to find out, what *exactly* is failing. That means bisecting the first bad commit using the distribution-scripts Dockerfile and adding debug output to the compiler build.
<FromGitter>
<straight-shoota> In fact, this should be fairly easy.
<FromGitter>
<straight-shoota> You just need to feed the sha1 hashes to the Dockerfile
<FromGitter>
<j8r> At least finding which commit, right
<FromGitter>
<wontruefree> @straight-shoota what if the specs are too big to compile on a 32 bit machine?
<FromGitter>
<straight-shoota> Either you apply the same technique or you separate the specs in a few batches.
<FromGitter>
<straight-shoota> The latter is probably easier
<FromGitter>
<wontruefree> yeah that might be an easier way to do it
<FromGitter>
<wontruefree> seems weird that CI is not failing
<FromGitter>
<wontruefree> I figured it was how I set my system up