ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.0 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<FromGitter> <schoening> @Papierkorb that was the one! And according to wiki the alternative (like node.js, crystal/kemal, etc) is called FastCGI
<FromGitter> <schoening> thanks!
<Papierkorb> that's the protocol, yeah
Aytan72 has quit [Remote host closed the connection]
Aytan72 has joined #crystal-lang
<Papierkorb> Though usually you implement HTTP anyway nowadays
<FromGitter> <schoening> Well now I have more stuff to look into :D
<FromGitter> <schoening> I just finished my first week at my first programming job. It uses some ancient .net 1.0 (in some places) and that seems to be working in the cgi fashion so I was interested on the topic ^^
Aytan72 has quit [Ping timeout: 246 seconds]
<FromGitter> <schoening> Ohh Ruby can't do method overloading.. Crystal is way cooler
<Papierkorb> Ruby is completely dynamic, doesn't make too much sense to do that in ruby
<Papierkorb> only thing that you could do overloading with would be count of arguments
<Papierkorb> Though I also really appreciate method overloading in Crystal
<Papierkorb> schoening, how much coding experience you got in total?
<FromGitter> <schoening> How do you quantify that
<Papierkorb> years of actively doing something
<FromGitter> <schoening> Hm.. Good question. I think I first started playing around with code 5 years ago.
<FromGitter> <schoening> Why
<Papierkorb> If you haven't done network programming yet, you can try implementing FastCGI
<Papierkorb> it's not too complex, but interesting enough if you haven't done network programming yet
<FromGitter> <schoening> I have no idea how to get started :D
<Papierkorb> Am I right to assume you didn't do network programming yet, though have an interest in doing so?
<FromGitter> <schoening> I have written web applications and rest api. But I think you are talking about on a deeper level?
<Papierkorb> Implementing a TCP/network protocol, not using a library implementing one, yesy
<Papierkorb> *yes
<FromGitter> <schoening> I would like to know how computers actually comunicate not just the fluff on top
<Papierkorb> Great
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<Papierkorb> Well, some protocols that are beginner friendly are: HTTP (text based), FastCGI (binary iirc), IRC (text based)
<Papierkorb> All of them are TCP, and have proper RFCs, are stable and are well documented in general ("Google-able")
<Papierkorb> Basically, networking libs have two different kinds of complexity: Architecture ("what does what"), and the logic itself ("how does it what")
<Papierkorb> What the logic implements is defined by the RFC, reference documents, or whatever you use
<Papierkorb> Architecture is guided by it to some extend, but not that much either. More often than not, this is the harder problem
<FromGitter> <schoening> Is HTTP and FastCGI roughly equally hard to implement?
<Papierkorb> But focus on the logic first. First, decide one a protocol, and implement its logic. in a single file or something. Start with the first packet needed: If it needs a handshake (The packet sequence exchanged first between client and server), that. If not (Like in HTTP), then the simplest packet. and then improve upon that until you're implementing a satisfiable amount
<Papierkorb> HTTP is darn simple, you can literally implement it as bash script
<Papierkorb> FastCGI is more annoying at first as you have to configure an NGINX or something to talk to
<Papierkorb> The complexity of HTTP is not getting to work, but to get it "right"
<FromGitter> <schoening> I think I should do that first since I have no idea how to implement any of this yet
<Papierkorb> If you don't have it already, install Wireshark too to sniff communication between you and the server
<Papierkorb> Great
<Papierkorb> Now, decide if you want to implement a server or client
<Papierkorb> Client is easier I'd guess, easier to check too
<FromGitter> <schoening> I mean. I get it on the level I need for my work. But I don't really understand how two machines can send data to each other..
Aytan72 has joined #crystal-lang
<Papierkorb> Does the "OSI model" tell you anything?
<Papierkorb> do you know what it is?
<FromGitter> <schoening> No
<FromGitter> <schoening> So far I have only been using all the existing tech to build stuff with. Not how they are implemented.
<FromGitter> <schoening> What do you work with btw Papierkorb
<FromGitter> <schoening> osi model looks similar to some models i have seen of operating systems
<Papierkorb> Overview is roughly: A network (on that level) consists of multiple protocols stacked upon each other. First comes the physical wire itself (or air for wifi), then some one or two protocols, then the IP (Internet Protocol), and then TCP.
<Papierkorb> That's really rough ^ :)
<Papierkorb> Either way, if you want to understand what's actually going on, I'd start with the TCP (Transmission Control Protocol) article on Wikipedia. Not even kidding. Don't read it in full, just skim it for now, it's probably long.
<Papierkorb> Then read about TCPSocket (That's a Crystal class, require "socket" for it), and which methods you need
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Papierkorb> `TCPSocket.new("123.123.123.123", 1234)` will get you a connection to that address, and then just write into and read from it. Nothing more to worry about yet on that level
<FromGitter> <schoening> Nice. Thank you. I open the tabs and start reading until I fall asleep. Its almost 3 am :D
<Papierkorb> Try to implement a simple http command now, this will be `GET`. Tip: Build a small HTTP server using whatever you like which sends you a `Hello World` message upon requesting something
<Papierkorb> Yup almost 3am here as well ^^
<Papierkorb> What did you mean by what I'm working with?
<FromGitter> <schoening> Whats your job, or rather, why do you know this stuff I suppose
<Papierkorb> I've been coding since I was ten years old, you get to know stuff after doing things for many years I guess :)
<FromGitter> <schoening> cool :)
<Papierkorb> my job, intern as software engineer. Can't wait to get out of uni though. Boring.
<Papierkorb> Not too important though. Sharing knowledge is the most fun any way.
<FromGitter> <schoening> Haha. Im glad Im done with school two. It almost killed my passion for programming
<FromGitter> <schoening> amen
<Papierkorb> I'd usually at this point tell you that it'd be fine to /query me w.r.t. networking specific questions if you wanted, though I'm on IRC so no idea if the bridge bot allows this
<FromGitter> <schoening> I can just jump on the irc in those cases np :) thanks
<FromGitter> <schoening> time for bed. gn
<Papierkorb> gn
Aytan72 has quit [Remote host closed the connection]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter> <eliasjpr> Is it me or there is a miss leading comment in `HTTP::Server::Response` library ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=590d2fbe0a783b6c0a6c8c1f]
<FromGitter> <eliasjpr> That method is just getting cookies
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Aytan72 has joined #crystal-lang
bjz has joined #crystal-lang
Aytan72 has quit []
maxpowa has quit [Ping timeout: 260 seconds]
maxpowa has joined #crystal-lang
gchase has joined #crystal-lang
<gchase> anyone here?
gchase has quit [Client Quit]
<FromGitter> <fridgerator> sort of
maxpowa has quit [Ping timeout: 260 seconds]
maxpowa has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
bjz_ has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
sz0 has joined #crystal-lang
<wuehlmaus> hi, all! can someone point me to an example where a unix pipe is used. i was searching for it and first thought IO had popen which it does not. i think it's in "process" but i don't understand it.
<FromGitter> <bew> wuehlmaus: `IO.pipe` : https://crystal-lang.org/api/0.22.0/IO.html#pipe(read_blocking=false,write_blocking=false)-class-method
<wuehlmaus> bew: thanks! :) so near and still so far :)
<FromGitter> <bew> yep! what are you trying to do?
<wuehlmaus> i want to pipe to the less command
<oprypin> wuehlmaus, pfft that's easy
<oprypin> but yeah, no example last time i checked
<wuehlmaus> damned, it IS very easy :)
<oprypin> wuehlmaus, https://carc.in/#/r/1wxb
<FromGitter> <bew> you don't need to use pipe directly, `Process` abstract this
<FromGitter> <bew> Oo @oprypin do you store all your tests somewhere? or how did you fund that one?
<FromGitter> <bew> found*
<oprypin> bew, i posted this earlier in irc and i have irc logs
<FromGitter> <bew> yeah I remember, you searched the logs and found it, didn't you?
<oprypin> yes
<FromGitter> <bew> nice
<FromGitter> <bew> Do you know why IOs given to process can't be a filedescriptor ? `needs_pipe?` is `io.nil? || (io.is_a?(IO) && !io.is_a?(IO::FileDescriptor))`
<oprypin> bew, uhh i think this is a check whether the abstraction needs to introduce a level of indirection
<oprypin> io nil means "the caller requests some io" so we'll make a pipe. io being a file descriptor means it can be piped directly so we don't need to wrap it, other ios need to be wrapped
<FromGitter> <bew> ok I see!
<FromGitter> <bew> about the `io.nil?` meaning that a pipe needs to be created, I'd expect `io == true` to do that (not when it's nil)
<oprypin> bew, it's just a silly convention for the arg. there have been some suggestions to rework this
<FromGitter> <bew> oh I'll look into this then
<oprypin> yeah swapping `nil` and `true` would be clearer https://crystal-lang.org/api/0.22.0/Process/Stdio.html but the most likely outcome is an enum
<FromGitter> <bew> `true` inherit from parent. What does this do actually?
<oprypin> bew, "nothing" - like what bash does when you just run a command
<FromGitter> <bew> ty!
<wuehlmaus> hmm, IO.pipe looked super easy but i did not manage to pipe to less so i will look now at oprypin's example
<wuehlmaus> that's what i had. i must have forgotten the essenial.
<FromGitter> <bew> https://carc.in/#/r/1zka
<wuehlmaus> d'oh! thanks, bew!
<FromGitter> <bew> the arguments of `IO.pipe` are booleans, for reading/writing in a blocking way (see the api doc)
<wuehlmaus> hmm, doesn't work, it puts out the "hello" but less is not used
<oprypin> wuehlmaus, of course it's not used, this is entirely irrelevant
<oprypin> just forget everything and look at my example
<FromGitter> <bew> a pipe only creates a tunnel between 2 file descrptors... You might want to use `Process.new "less"` and feed the input of the process
<FromGitter> <bew> wuehlmaus: this works for me: https://carc.in/#/r/1zkc (carc.in just crashes because less is not installed)
<wuehlmaus> bew: oprypin thanks for the help
<wuehlmaus> oprypin: ^^^
<FromGitter> <bew> yw! does it works for you?
<wuehlmaus> yes, it's what i wanted
Ven has joined #crystal-lang
Ven is now known as Guest35758
Guest35758 has quit [Client Quit]
Ven_ has joined #crystal-lang
Ven_ has quit [Client Quit]
splitty___ has joined #crystal-lang
splitty_ has joined #crystal-lang
splitty__ has quit [Ping timeout: 260 seconds]
splitty___ has quit [Ping timeout: 260 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 255 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest37184
<wuehlmaus> what's the easiest to use crystal ide right now?
<txdv> what crystal ide?
<wuehlmaus> i am using vim right now, but a more powerful completion system would be handy
<wuehlmaus> yeah
<wuehlmaus> actually vim would be best as i am most confortable with it for 2 decades
<wuehlmaus> but i take what helps the most
<RX14> there isn't really a crystal IDE yet
<RX14> but we'll get there one day i'm sure
<wuehlmaus> right now i am using icr with the help of {{@type.methods.map &.name.stringify}}.sort.uniq
<wuehlmaus> but even that misses some methods now and then :)
<wuehlmaus> e.g. IO.pipe obviously :)
Guest37184 has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
<RX14> why not use the documentation?
Ven_ has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 268 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest45772
Guest45772 has quit [Ping timeout: 260 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 258 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
Ven is now known as Guest38218
Guest38218 has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 245 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
codealchemy has joined #crystal-lang
codealchemy has quit [Quit: WeeChat 1.5]
Ven has joined #crystal-lang
Ven is now known as Guest29528
Guest29528 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> I think I found something weird in openssl
<RX14> before the commit, if I add a print on the read() function it reads 1 byte at a time perfectly time
<RX14> but it seems if you simply read the same socket with 8KiB it breaks
<RX14> maybe it's something weird bit the bio
greengriminal has joined #crystal-lang
Ven_ has joined #crystal-lang
<FromGitter> <fridgerator> interesting
<FromGitter> <fridgerator> i've seen several people complain about websockets + tls
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> so this works: https://aww.moe/hg6zhp.txt
<RX14> oops
<RX14> that code doesn't work
<RX14> the most basic SSL code
<RX14> yet HTTP::Client works just fine
<RX14> it's so weird
<RX14> yup i'm 100% confused, it seems that HTTP::Client works by magic
<FromGitter> <fridgerator> lol
<RX14> as far as I can see, I do the same in my test code as HTTP::Client
<RX14> yet it works and my test code fauls
bungoman has quit [Ping timeout: 258 seconds]
bungoman has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
<oprypin> RX14, gotta sprinkle it with some flushes tho
<oprypin> ssl.puts...; ssl.flush - works
<RX14> ...
<oprypin> i ran into this with my gitter bot, had to add the flush the other day, but i thought it was my oversight not a new change
<RX14> i feel so stupid
<RX14> I was busy debugging the reading side
<RX14> when the request hadn't been sent
<oprypin> but it is a new change indeed
<RX14> i mean the commit is a hack anyway
<RX14> lets be honest
sp4rrow has joined #crystal-lang
<oprypin> RX14, now that i think about it, are sockets ever buffered in any programming language?
<oprypin> OS does buffering and things are just fine
<RX14> yes?
<RX14> OS buffering isn't "fine" for performance
<oprypin> i dont recall ever needing to call flush in sockets in python
<oprypin> not that i'm an avid user of sockets
greengriminal has quit [Quit: This computer has gone to sleep]
sp4rrow has quit [Quit: Textual]
sz0 has quit [Quit: Connection closed for inactivity]
<oprypin> RX14, thaaat's not sockets
<RX14> it's a stream...
<RX14> why would they be different?
<oprypin> says someone who just ran into exactly that kind of difference
<RX14> well
<RX14> there is an advantage to buffered sockets
kochev has joined #crystal-lang
kochev has quit [Remote host closed the connection]
zipR4ND has joined #crystal-lang
greengriminal has joined #crystal-lang
zipR4ND has quit [Ping timeout: 240 seconds]
ben__ is now known as ben
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
zipR4ND has joined #crystal-lang
<crystal-gh> [crystal] deepj opened pull request #4385: Add Hash#transform_keys and Hash#transform_values (master...transform-keys-values) https://git.io/v9w3p
Raimondii has joined #crystal-lang
Raimondi has quit [Read error: No route to host]
Raimondii is now known as Raimondi
greengriminal has quit [Quit: Leaving]
LastWhisper____ has joined #crystal-lang
<FromGitter> <bew> @deepj How did you do the `Hash#transform_values!` method (with bang) without re-creating the hash?
<FromGitter> <bew> (you said you did it in #4385 )