<FromGitter>
<Nbotz> oh i see, thank you so much i get it now
<FromGitter>
<theretromaniac> 👍 ⏎ ⏎ you can search in github there are lot of examples for kemal but i suggest you to use Amber for beginning.
<FromGitter>
<Blacksmoke16> coughtryaathenacough
<FromGitter>
<Blacksmoke16> :spy:
<FromGitter>
<theretromaniac> ahhahahh
<FromGitter>
<theretromaniac> After see how some basic things work change Amber to Athena
<FromGitter>
<Blacksmoke16> ayy ;)
<FromGitter>
<spTorin> @theretromaniac I thought that Kemal is more simple then Amber, and I starting with Kemal. Amber coming with DB and many shards included. With amber we can build full web app. With kemal we can fast build simple web services. This true? Can you briefly explain the difference between them?
<FromGitter>
<Blacksmoke16> Kemal ist more based on senatria or however you spell it. Amber is based more on rails @spTorin
<FromGitter>
<Blacksmoke16> Where I'd say Amber is more full featured, while kemal just focused on the routing routing aspects
<FromGitter>
<Blacksmoke16> I'm bad at typing on my phone
<FromGitter>
<Nbotz> sorry again, but I honestly am at a complete loss as what im doing wrong. i got an error
<FromGitter>
<Nbotz> sorry again, but I honestly am at a complete loss as what im doing wrong. i got an error `in /usr/lib/crystal/io.cr:1133: undefined method 'read' for String ⏎ ⏎ ```while (len = src.read(buffer.to_slice).to_i32) > 0 ⏎ ^~~~``` ⏎ ⏎ ` [https://gitter.im/crystal-lang/crystal?at=5c3bfdf80721b912a577560f]
<FromGitter>
<Blacksmoke16> whats the error?
<FromGitter>
<Blacksmoke16> `String` class doesnt have a `read` method
<FromGitter>
<Blacksmoke16> got a playground link of what you're trying to do?
<FromGitter>
<Nbotz> its the kemal example, with a change to accomidate the name in the html
<FromGitter>
<Blacksmoke16> ah, hmm
<FromGitter>
<Nbotz> i cant change frameworks because the site is already done in kemal
<FromGitter>
<Nbotz> im not the smartest (if you've noticed) and i dont wanna break anything :P
<FromGitter>
<Blacksmoke16> yea sorry, im not too familiar with file uploads with kemal
<FromGitter>
<Blacksmoke16> but if you got the example off the kemal site its prob a kemal issue
<FromGitter>
<Blacksmoke16> either outdated docs or a bug
<FromGitter>
<Nbotz> yep, thats the example i used. i dont quite understand the `"files["image1"].tempfile` part of it, but i assumed it was tags, so i changed it to fit where the information would be
<FromGitter>
<Nbotz> is there a way to write to an end of a file?
<FromGitter>
<Nbotz> the API doesnt mention it
_whitelogger has joined #crystal-lang
<FromGitter>
<girng> @Nbotz :D
<FromGitter>
<girng> you know.. the crystal playground is actually really beneficial
<FromGitter>
<girng> i love going to it to fiddle around with code instead of having to re-compile, upload to server, etc. helps a lot!
<FromGitter>
<rishavs> @Nbotz Isn't that what the append mode does?
<FromGitter>
<rishavs> `def self.open(filename, mode = "a", perm = DEFAULT_CREATE_MODE, encoding = nil, invalid = nil, &block)` ⏎ I am just guessing, so I might be wrong. Haven't really used files a lot in Crystal
<FromGitter>
<girng> is it possible to sort a hash??
<FromGitter>
<girng> https://play.crystal-lang.org/#/r/5zsd for example, how can i get the rest of the elements in my hash that are not 2? then, how can i sort them by `game_started`
<FromGitter>
<girng> i can do select, but it will only return the realms that are `2`. i'm trying to return all of the games in the new sort, but just the ones that much the `player_realm` first
<FromGitter>
<girng> damn sorting is so confusing to me >_<
<FromGitter>
<vivus-ignis> hi! i'm having trouble trying to make reason of the compiler message. ⏎ i have a class `Distro`. ⏎ `Distro` has a class method that returns an object of a subclass of `Distro` (e.g. `Centos`, `Ubuntu`). for `Distro` class and for its subclasses i have separate files. `distro.cr` refers to subclasses with a `require "./distro/*"`. ⏎ ⏎ when i try to compile i have this output: ...
<FromGitter>
<theretromaniac> @vivus-ignis is the class Distro an abstract class?
Dreamer3_ has quit [Quit: Leaving...]
rohitpaulk has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @vivus-ignis requiring them using the `*` requires them in abc order, so `Distro` isn't defined at the time `Alpine` is read
<FromGitter>
<Blacksmoke16> hrm, but it looks like you're doing that, assuming `../distro` is that main file, i would also try to require distro before requring `./distro/*`
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<vivus-ignis> so Distro refers to Apline in a class method, and Alpine is a subclass of Distro. maybe there's some chicken-and-egg problem which compiler doesn't like
<FromGitter>
<j8r> @vivus-ignis maybe you require in the wrong order
laaron has joined #crystal-lang
<FromGitter>
<j8r> and then the Class isn't known yet by the compiler when you use it
<FromGitter>
<j8r> @vivus-ignis sounds interesting - what are you doing?
<FromGitter>
<vivus-ignis> this is a wrapper for a bunch of security scanners to be used for scanning docker images in a typical CI pipeline
Raimondi has joined #crystal-lang
<FromGitter>
<j8r> It would be great tot make the distro detection an external shard :)
<FromGitter>
<j8r> I would be interested to use it
<FromGitter>
<j8r> you read `/etc/issue`, or `/etc/lsb-release` for detection?
<FromGitter>
<vivus-ignis> yes, or run lsb-release
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter>
<vivus-ignis> ok let me try to reorg those classes... i think this must be some chicken-and-egg issue
<FromGitter>
<Blacksmoke16> id bet it is
<mps>
vivus-ignis: /etc/os-release
<FromGitter>
<j8r> ooh yes good mps, os-release is perfect
<FromGitter>
<j8r> but to just know the dist, checking if the `/etc/debian_version` exists or `/etc/redhat-release`
<simerax>
Hello together. Im currently trying to implement a simple binary tree in Crystal. I dont seem to understand how to handle Union Types. As you know in a Binary Tree every Node has 2 child nodes, each of them can either be another value or non existent (null / nil).
<simerax>
In my insert method which is used to insert a new child-node into a node I have following code:
<simerax>
<simerax>
if @left == nil
<simerax>
@left = Node.new(value)
<simerax>
else
<simerax>
@left.insert(value)
<simerax>
end
<simerax>
This does not compile due to "undefined method 'insert' for Nil (compile-time type is (BinaryTree::Node | Nil)) (did you mean 'inspect'?)"
<simerax>
How do I correctly check for Nil?
<simerax>
ups
<simerax>
i thought this would nicely format into one message
<FromGitter>
<girng> @bararchy oh really how did i miss that lol
<FromGitter>
<girng> @bararchy yeah that returns just 1 value, i just want to re-order the array with `player_realm` being first
vikaton has joined #crystal-lang
<FromGitter>
<drujensen> Anybody know of or hosting a Raspbian APT repo for Crystal yet? I found one by @ysbaddaden but it hasn’t been updated in a while.
spacemanspam has joined #crystal-lang
<robacarp>
oooo
spacemanspam has quit [Read error: Connection reset by peer]
<FromGitter>
<silmanduin66> hello
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<silmanduin66> can someone help me with docker and dockerfile ?
<FromGitter>
<silmanduin66> i just want to build and run a helloworld
<FromGitter>
<Blacksmoke16> could be a production setup, where you build the binary in release mode and statically. then just add the binary to an empty image and run the binary
<FromGitter>
<silmanduin66> what is this ```COPY --from=0``` ?
<FromGitter>
<Blacksmoke16> basic it is saying copy the binary from the first build stage, i.e. the alpline imagine, to this new image
<FromGitter>
<Blacksmoke16> like since in your example the binary is being ran from an alpine image, with all the deps and packages that alpine needs
<FromGitter>
<Blacksmoke16> i.e. plus crystal and shards, so the image is 222mb
<FromGitter>
<Blacksmoke16> vs if you just copy and run the built binary the image is only 1.5
<FromGitter>
<silmanduin66> i'm still not sure if i'll use the static
<FromGitter>
<Blacksmoke16> i wouldnt use it for development stuff, but it can be handy to know when you want to deploy the final application to a server or something
<FromGitter>
<Blacksmoke16> as since its statically compiled it can run on anything pretty much (afaik) since all of its dependencies are included with it
<FromGitter>
<silmanduin66> now i'm just learning how to use it :-P
<FromGitter>
<Blacksmoke16> ;)
<FromGitter>
<girng> How many bytes does a Boolean value use?
Harzilein has quit [Ping timeout: 268 seconds]
spacemanspam has joined #crystal-lang
spacemanspam has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> according to google, prob 1
<FromGitter>
<girng> ty
<FromGitter>
<Blacksmoke16> but no promises :p
<FromGitter>
<silmanduin66> @Blacksmoke16 i generated a``` ./server``` file with docker and alpine , but how can i find this file on my computer now ?
<FromGitter>
<Blacksmoke16> did you build it in the image?
<FromGitter>
<Blacksmoke16> er create the file locally or within the docker image?
<FromGitter>
<silmanduin66> within the docker image
<FromGitter>
<Blacksmoke16> then its not *on* your computer technically atm
<FromGitter>
<Blacksmoke16> its within the image
<FromGitter>
<silmanduin66> then how can i solve that :-P