RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
johndescs has quit [Ping timeout: 244 seconds]
johndescs has joined #crystal-lang
<FromGitter> <girng> @j8r yep. i will be forever
sagax has joined #crystal-lang
sagax has quit [Ping timeout: 272 seconds]
<FromGitter> <proyb6> Looking at Golang and someone shared a link in Reddit https://www.ageofascent.com/2019/02/04/asp-net-core-saturating-10gbe-at-7-million-requests-per-second/
<FromGitter> <proyb6> How nice if Crystal could do zero allocation on Plaintext
<FromGitter> <girng> how can i convert a long byte list to its original image data? a list of bytes like this (https://i.gyazo.com/dfb77c7c726a2b94cc14f060df9decd9.png). i'm getting the data from the tcp stream with godot's put_data (https://github.com/godotengine/godot/blob/b16c309f82c77d606472c3c721a1857e323a09e7/core/io/stream_peer.cpp#L435). i'm trying to send the image data from a client's computer across the tcp stream and for
<FromGitter> ... crystal to get the bytes and save it as a image (png, jpg, jpeg). basically uploading an image and for crystal to save the file when it has all the bytes. i'm at the point where crystal has all the bytes (socket.peek) displays them. but i need to convert these bytes to an image. that i don't know how to do. ⏎ ⏎ for exam ... [https://gitter.im/crystal-lang/crystal?at=5c59235cc2dba5382ee20ae3]
<FromGitter> <girng> this is what it should be: https://i.gyazo.com/43e2289fa6450dd515dd9ea067b6f8f7.png
jemc has quit [Ping timeout: 240 seconds]
<FromGitter> <kingsleyh> I can’t read all the code in gitter as it gets cut off - but did you try socket.read_fully
<FromGitter> <kingsleyh> Then String.new(the_bytes)
<FromGitter> <kingsleyh> @girng
<FromGitter> <girng> kk trying now
<FromGitter> <girng> OMG LMAO
<FromGitter> <girng> @kingsleyh that was the biggest fail I think i ever did in my entire life. i was using the `get_data()` from https://docs.godotengine.org/uk/latest/classes/class_image.html which returns *Returns the image’s raw data.*. This is not the same as the CONTENTS of the image *file* itself.
<FromGitter> <girng> so i did `file.get_buffer(file.get_len())` instead of the `get_data()` on the image texture, and boom: uploaded it through crystal's stream PERFECTLY
<FromGitter> <girng> Gosh i love crystal makes it so freaking easy. was having so many problems with godot's dumb http client crap
<FromGitter> <girng> so instead of an http request, i just piped those bytes through a tcp stream LOL 😆
<FromGitter> <kingsleyh> Nice!
<FromGitter> <kingsleyh> Hmm from the docs it does look like it should contain the image data as bytes in a PoolByteArray - so if it’s not enough to materialise the image then that’s very misleading!
<FromGitter> <girng> yeah, it's weird, def different data lol
<FromGitter> <girng> lol @ my google results (https://i.gyazo.com/182ad3496915b1e13b39629acfc265cb.png)
<FromGitter> <girng> anything like this in the shards? http://php.net/manual/en/function.getimagesize.php
<FromGitter> <girng> really just need to get the width or height of a jpg or png
DTZUZO has quit [Ping timeout: 250 seconds]
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
<mps> j8r: you wanted that: community/libzip: build static libzip.a and add it to -dev apk
<FromGitter> <j8r> yes mps :)
<mps> it is pushed right now
<FromGitter> <j8r> Awesome, thanks a lot mps. Yesterday I've succeeded to run Nextcloud with my statically-linked php :)
<mps> 11:25 ........ algitbot| aports:master |xxxxx x. xxxxxx| community/libzip: build static libzip.a and add it to -dev apk | http://dup.pw/aports/4d1093eb
<mps> j8r: you are welcome, we all trying to help each other. you help me explaining some things/intricacies about crystal
<FromGitter> <j8r> exactly mps, 👍
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
<FromGitter> <vivus-ignis> hi! ⏎ is there a way to define a type which covers a class and all of its subclasses? ⏎ that is, to fix a compilation error like this one: ⏎ ⏎ `instance variable '@installed' of PackageManager must be Array(Package), not Array(Package::Deb)` ... [https://gitter.im/crystal-lang/crystal?at=5c59789cc2dba5382ee42b6a]
<FromGitter> <j8r> have you an example @vivus-ignis ?
<FromGitter> <j8r> if you do `Array(Package | Package::Deb)`?
<FromGitter> <j8r> or you can have `alias Packages = Package::Deb | Package::RPM` for example
<FromGitter> <vivus-ignis> @j8r it is something like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c5980908aa5ca5abf8a1161]
sfcgeorge has joined #crystal-lang
<FromGitter> <vivus-ignis> i would have to edit an alias for each new subclass
<FromGitter> <j8r> Have you tried with generics?
<FromGitter> <vivus-ignis> no
<FromGitter> <vivus-ignis> let me see...
<FromGitter> <j8r> you can also use generics with composition, like `include PackageManage(Deb)`
<FromGitter> <j8r> With inheritance there are feedbacks that suggests the implementation is a bit buggy
sfcgeorge is now known as sfcg[away]
sfcg[away] is now known as sfcgeorge
sfcgeorge has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <kingsleyh> What is the type you use when you want to specify a Float but want it to work with both Float32 and Float64
<FromGitter> <kingsleyh> Is it something like float_t
jemc has joined #crystal-lang
jemc has quit [Quit: WeeChat 2.2]
sfcgeorge has joined #crystal-lang
sfcgeorge has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <bew> you can try `Float` for a type restriction, but it won't work for an ivar.. otherwise you can always do `Float32 | Float64`
sagax has joined #crystal-lang
jemc has joined #crystal-lang
<FromGitter> <j8r> @PlayLights_twitter you give me the idea to implement an `Object#send` library, based on macros
<FromGitter> <Blacksmoke16> neat
<FromGitter> <bew> Meh
<FromGitter> <j8r> perhaps this can be considered as a bad practise to use this
<FromGitter> <j8r> but the challenge is here :)
<FromGitter> <j8r> it could be used in interpreters too
<FromGitter> <Blacksmoke16> was looking at adding a `to_xml` to CrSerializer
<FromGitter> <Blacksmoke16> be a bit tricky on how to handle like arrays of ints
<FromGitter> <Blacksmoke16> have to see if there is some spec around it
<FromGitter> <chussenot> Hi guys, is there any mature initiative to build a lib to interact with docker API?
<FromGitter> <Sija> @chussenot I’m not sure how mature you’d call it, but there’s https://github.com/jeromegn/docker.cr
jetpack_joe has joined #crystal-lang
rohitpaulk has joined #crystal-lang
moei has joined #crystal-lang
<FromGitter> <chussenot> This project is too old and can't be compiled with last versions of crystal... and he manage few things
<FromGitter> <chussenot> ;)
<FromGitter> <bew> @chussenot I guess you'll have to make your own.. (btw tu connais https://www.meetup.com/fr-FR/pariscrystal/ ?)
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <fridgerator> 1) 27.2 already 0.o
<FromGitter> <kevinelliott> woot!
<FromGitter> <fridgerator> looks like 0.27.1 had some regressions?
FromGitter has quit [Remote host closed the connection]
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
marmotini_ has joined #crystal-lang
<mps> 0.27.2 on Alpine builds with llvm6 but fails on test. here is the error message: http://tpaste.us/7vDO
marmotini_ has quit [Ping timeout: 250 seconds]
_virkony_ has joined #crystal-lang
_virkony_ is now known as virkony
moei has quit [Quit: Leaving...]
FromGitter has joined #crystal-lang