<smurfendrek123>
Hello, is this a valid way of overloading the initialize method? https://bpaste.net/show/ecc673697f33 I get the error: Error in src/Db.cr:221: wrong number of arguments for 'Db::StringColumn.new' (given 1, expected 0) Overloads are: - Reference.new()
<smurfendrek123>
Can abstract classes have constructors defined if all values are defined in the abstract class? Or do i need to define those in the deriving classes?
Creatornator has joined #crystal-lang
<FromGitter>
<Blacksmoke16> do you have the full example?
<smurfendrek123>
Example of where I actually try to make a StringColumn is at the bottom
<FromGitter>
<Blacksmoke16> well you're not inheriting your `Column`
<smurfendrek123>
That's a very good point
<FromGitter>
<Blacksmoke16> plus rest are classes while that one is a struct
<smurfendrek123>
Nice that works!
<FromGitter>
<Blacksmoke16> np
<smurfendrek123>
Yea i changed StringColumn to a struct
<smurfendrek123>
Thanks!
<FromGitter>
<Blacksmoke16> np
smurfendrek123 has quit [Remote host closed the connection]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
<FromGitter>
<ravage> Hello! I'm trying to figure out why the read_byte never gets to nil in the simple TCPServer example https://bpaste.net/show/18d0c952ef77
<FromGitter>
<ravage> Am i missing something obvious?
johndescs has quit [Ping timeout: 240 seconds]
johndescs has joined #crystal-lang
<FromGitter>
<wontruefree> can you check if the client has closed the connection?
<FromGitter>
<ravage> Yes, the connection stays open
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #crystal-lang
<FromGitter>
<straight-shoota> @ravage `read_byte` only returns nil when there is no more data to read, i.e. the connection is closed. Unless you close the connection, it will block until it can read.
<FromGitter>
<ravage> @straight-shoota I see your point, but shouldn't it return nil when the IO is depleted?
<FromGitter>
<straight-shoota> A socket is only depleted when it's closed.
<FromGitter>
<ravage> So, without any end marker there is no way to know we have hit the end=
<FromGitter>
<ravage> "normal" behavior is to get null or 0 (read(Bytes)) when there is nothing more to read
<FromGitter>
<ravage> even with the socket open
<FromGitter>
<ravage> At least that's the behavior i get in other languages
_whitelogger has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter>
<ravage> Thank you for taking the time to reply.
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<straight-shoota> There are different approaches to modelling IO streams. Crystal uses blocking IO. If you want to read from a socket and the buffer is empty, execution of the current fiber stops and it is only resumed when there is data to read. If that wasn't the case (like in the BSD-style socket API Crystal's `Socket` class is based upon), in order to read from a socket, the user would need to make sure that the
<FromGitter>
... socket has received the data it wants to read and otherwise make the program wait for it.
<FromGitter>
<straight-shoota> > there is no way to know we have hit the end? ⏎ ⏎ Socket's don't have any concept of an end of stream, except for closing the socket.
<FromGitter>
<straight-shoota> Application protocols often include some kind of end markers or length delimiter, but they're built on top of basic IO streams.
<FromGitter>
<ravage> Yes, thank you, i was looking at it the wrong way and expecting behavior like a file read. Wasn't contemplating the fact of a persistent connection. Thank you again for the help, now i see my error
<FromGitter>
<Blacksmoke16> RFC to help me figure out how to best develop CORS for athena
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ruimiguel has joined #crystal-lang
<jokke>
hey, i'm trying to write a fairly simple webapp that allows people to share files. It basically just copies from the request body of one request to the response of another
<jokke>
however during the transfer the process is running with 100% cpu usage
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<straight-shoota> > ok adding a Fiber.yield in the read method on every 5th slice allows concurrent requests ⏎ ⏎ That sounds weird. `IO.copy` calls `#read_bytes` which should block and yield the fiber if it can't read directly...
<FromGitter>
<straight-shoota> Oh, wait. That's the issue.
<FromGitter>
<straight-shoota> You're not delegating `#read_bytes` so it reads every single byte using `#read`.
<FromGitter>
<straight-shoota> jokke ^^
<FromGitter>
<straight-shoota> Wait, no I confused these methods
<FromGitter>
<straight-shoota> That's not it.
<FromGitter>
<straight-shoota> But maybe there is some other reason that `Share < IO` causes issues because you don't delegate some efficiently (buffered) methods. Why are you using inheritance anyway?
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
crystal-lang564 has quit [Quit: Konversation terminated!]
<FromGitter>
<vladfaust> Do Crystal forked processes support inproc:// transport?
olbat[m] has joined #crystal-lang
devil_tux has joined #crystal-lang
<devil_tux>
guys .. need help :< doc = XML.parse(base_data); doc.children.select(&.element?).each do |child| -> how do I edit on <child> as a working copy of `doc`
laaron has quit [Remote host closed the connection]