<FromGitter>
<uSide> Hey guys! Is there any way to make something like ⏎ mytuple = Tuple.new ⏎ somearray.each { |othertuple| mytuple = mytuple + othertuple }
<FromGitter>
<faustinoaq> What is the equivalent of `send` in Python. When I was learning Crystal I also discover `blocks` and now `send`. I found that Python has first class functions and decorators, but I never seen something like `send` before 😅
wes[phi] has quit [Ping timeout: 240 seconds]
<Papierkorb>
uSide, no. Tuples are not lists, they're structures. If you need a list, use Array.
<FromGitter>
<faustinoaq> Python tuples are quite similar to Crystal ones. Does Ruby have tuples?
<FromGitter>
<uSide> @faustinoaq nope
<FromGitter>
<Qwerp-Derp> I wish the offline version of Crystal had the Crystal documentation of that version...
<FromGitter>
<faustinoaq> Oh, now I see why people are using Crystal tuples as arrays, is a new concept for they. I didn't know Ruby, I came from Python and Crystal tuples was very familiar to me
<FromGitter>
<Qwerp-Derp> Wouldn't it be easy to achieve, since there's already a Crystal documentation generator and there already exists documentation in the Crystal source code for the doc generator to create documentation?
<FromGitter>
<uSide> @faustinoaq I just thought that tuple is like a light version of array
<FromGitter>
<faustinoaq> Well, is a bit different. Arrays and tuples are sequences but tuples are inmutable by default.
<FromGitter>
<bew> @Qwerp-Derp you can do it by yourself, using `crystal doc src/compiler/crystal/command.cr` or sth like that (can't test right now)
<FromGitter>
<bew> as this file is the compiler entry point, it'll generate the compiler docs
<FromGitter>
<bew> it's not the very first entrypoint, but if we use `src/compiler/crystal.cr` it complains that I didn't use that compilation flag "I know what I'm doing thing"
<FromGitter>
<jwaldrip> @asterite given our conversation earlier today, can I get approval on the YAML PR and maybe a merge.
<FromGitter>
<elorest> `amber new cruddemo -d [mysql, pg, mysql]`
<FromGitter>
<elorest> `cd cruddemo`
<FromGitter>
<elorest> `amber g scaffold Post title:string content:text`
wes[phi] has quit [Ping timeout: 264 seconds]
Philpax_ has joined #crystal-lang
Philpax__ has joined #crystal-lang
Philpax_ has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter>
<elorest> @wwselleck There are ways to do that in kemal and used to be an example on kemalcr.com. Amber also makes it very easy. There is a demo on the home page. ⏎ https://amberframework.org/
<FromGitter>
<bararchy> Arch just got LLVM5, also a new Crystal version ?
<Papierkorb>
If their debians version of fann sucks, you can also compile it on your own. In case you're wondering, yes that's normal to do. You can somehow also cache such data.
<FromGitter>
<bararchy> Papierkorb Thanks :) I need to build from source I think
<crystal-gh>
[crystal] asterite closed pull request #4990: Correctly work formatting double splat argument with trailing comma (master...fix/crystal-format/double-splat-trailing-comma) https://git.io/v5dDt
<FromGitter>
<2called-chaos> Hey guys, I try to write a very simple tool which copies files. Coming from ruby I wonder how read_at is supposed to work. I get offset but what is the second parameter "bytesize"? It's being passed to PReader.new which does not show up in the API docs (at least in the search). If I pass File.size there it breaks because File.size returns a uint64 and PReader wants a int32
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
<FromGitter>
<codenoid> hi, is `HTTP::Client` have a default timeout value ?
<FromGitter>
<ino76> @mverzilli today I finally found something about it in documentation :) >>
rohitpaulk has quit [Ping timeout: 248 seconds]
<crystal-gh>
[crystal] asterite opened pull request #4995: Macros: automatically resolve alias in types (master...feature/macro-resolve-alias) https://git.io/v5FLT
<FromGitter>
<2called-chaos> @asterite I figured I don't need it :) I just copied the method from fileutils. I just need stream copy while printing offset to stderr (like pv)
<FromGitter>
<2called-chaos> It's a little bit slower than pv (tested with --release build) but I can live with that I guess
alex`` has quit [Quit: WeeChat 1.9]
rohitpaulk has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #4996: Semantic: don't find type parameter in alias (master...bug/3502-type-parameter-in-alias) https://git.io/v5Fqv
claudiuinberlin has joined #crystal-lang
<RX14>
somehow when I tried to make do/end and {/} block notation have the same prescedence i broke macro blocks, it's weird
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
<Yxhuvud>
which of the priorities of those two would you unify to?
Philpax__ has quit [Ping timeout: 246 seconds]
snsei has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
snsei_ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
wes[phi] has joined #crystal-lang
p0p0pr37 has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
<oprypin>
could be neither -- disallowing priority ambiguity
<oprypin>
btw i had a crazy idea recently - doesn't the priority in `a *= b + c` look really confusing?
<oprypin>
make it an error or make the formatter do `a *= (b + c)`
<Yxhuvud>
No, not really.
<FromGitter>
<bew> not confusing to me
<RX14>
yeah oprypin i did do neither
<RX14>
i enforced requiring () around args when using a block
<RX14>
I think its for the best
<RX14>
it means you can always just attach the block you're parsing to the last function call
<RX14>
and since you error on brackets it all works out in the end
<oprypin>
seems good
<RX14>
i've done 95% of the work
<RX14>
now i just need to do the other 95%
<oprypin>
`(a * b) + c` BUT `a *= (b + c)`, `a *= (b += c)` - but i could easily see someone thinking that `a *= b += c` or `a *= b + c` means something else in the heat of the moment
<RX14>
a *= b += c means "refactor this code" to me
<oprypin>
`a *= b + c` also means that to me
<RX14>
i'd work it out from the docs and hope i never saw it again
<oprypin>
for anyone still listening, the definition of this would be for assignment operators that have a non-`=` counterpart, require parentheses if the non-`=` would've required parentheses
snsei has joined #crystal-lang
<FromGitter>
<bew> I see `a *= <expression>`, that expression shouldn't need parenthesis based on 'what operator is used'..
<oprypin>
let me put it another way. would `a = a * b + c` still work the same?
<FromGitter>
<bew> no, its `a = <expression>`
<oprypin>
im talking about the previous example. `a *= b + c` is entirely different from `a = a * b + c`
<FromGitter>
<bew> so it works as `(a * b) + c`
<oprypin>
which is why it can confuse people in the heat of the moment
<FromGitter>
<bew> (your exaple above
<FromGitter>
<bew> )
<FromGitter>
<bew> yes it's different
<RX14>
thats because `a *= b` isn't `a = a * b`, it's `(a = a * b)` which makes perfect sense
rohitpaulk has quit [Ping timeout: 255 seconds]
<oprypin>
that's not right
<oprypin>
it's `a = a * (b)` perhaps but the parentheses are not there
<FromGitter>
<kustom666> Hi everyone! I'm trying to add SSL support to crystal-mysql so that I can connect to an aws RDS instance. However, when I turn the TCPSocket into an SSL Socket, I get the SSL23_GET_SERVER_HELLO:unknown protocol error. The server doesn't have SSL v2 or v3 enabled (as they are fairly old). How can I disable them in my crystal app? I've tried passing the NO_SSL_V3 and NO_SSL_V2 options to my context but I get
<FromGitter>
... the same issue
<cerulean>
if anyone cares, i just wanted to show off my chatroom I made in Crystal: https://livepost.mixflame.com/chatroom (theres a whole site there besides the chat)
snsei has quit [Remote host closed the connection]
<FromGitter>
<crisward> not sure if images work on IRC
<FromGitter>
<crisward> The web double sockets are probably getting created in your JS.
<FromGitter>
<crisward> The both had frames in them, so both connected.
<FromGitter>
<jsilverMDX> sorry for the delay, i thought you meant amber room
<FromGitter>
<jsilverMDX> ah thanks
<FromGitter>
<jsilverMDX> let me see if i can reproduce
<FromGitter>
<jsilverMDX> well in FF it only made 1 socket
<FromGitter>
<jsilverMDX> let me try chrome
<FromGitter>
<jsilverMDX> chrome seems to have a bug here
<FromGitter>
<jsilverMDX> i develop with FF
<FromGitter>
<jsilverMDX> wait no
<FromGitter>
<jsilverMDX> im wrong
<FromGitter>
<jsilverMDX> I know why
<FromGitter>
<jsilverMDX> i can fix it right now
<FromGitter>
<jsilverMDX> brb
<FromGitter>
<jsilverMDX> the chat does open two sockets, that's by design and only on the chat page
<FromGitter>
<jsilverMDX> because the chat channels are considered seperate from the main site
<FromGitter>
<jsilverMDX> it won't hurt you
<FromGitter>
<jsilverMDX> or your browser
<FromGitter>
<jsilverMDX> the /chat endpoint is able to accept multiple sockets
<FromGitter>
<jsilverMDX> obviously
<FromGitter>
<jsilverMDX> 💎
rohitpaulk has quit [Ping timeout: 248 seconds]
<Papierkorb>
You won't notice now, but with that, you halved the effective count of concurrent users.
<FromGitter>
<jsilverMDX> Oh, I see
<FromGitter>
<jsilverMDX> good point
<FromGitter>
<jsilverMDX> ill make a ticket about it
<FromGitter>
<jsilverMDX> i do work on my tickets btw
<FromGitter>
<crisward> Thanks, just thought I'd point it out incase it wasn't intensional. Just recently worked with web sockets. Had issue with keep alives, and auto reconnects. Seem to have solved it now. At one point I had over 400 connections...
<FromGitter>
<crisward> Real users...
<FromGitter>
<jsilverMDX> nice !
<FromGitter>
<jsilverMDX> :D
<FromGitter>
<jsilverMDX> yeah this is my first websockets app
<FromGitter>
<jsilverMDX> and my first crystal app
<FromGitter>
<jsilverMDX> there's still problems with our WebSocket implementation serverside it seems but other than that it seems pretty good... I'm not worried, I just need to combine the files or require one or something
<FromGitter>
<jsilverMDX> ok I added it to my issues
<Papierkorb>
Actually, only using one connection has an effect on your users too. Or rather, their devices. Yes, my desktop computer won't budge. My mobile connection may not either, but it may introduce additional start lag. But more connections to handle means more work for the CPU and Modem, hence, battery life may suffer .. Just a tiny bit. But if every app dev would try their best, those "tiny bits" would really add up
<FromGitter>
<crisward> Cool. The big takeway from my experience is be careful with writing js to auto-reconnect. It's possible to ddos yourself if lots of people go to your site and leave their browser open (eg mobile phones). This happens if you don't do the keep alive correctly as all the effort is in the reconnect. If you get the keep alive right everything works well.
<Papierkorb>
jsilverMDX, Remember that TCP is slow at first (Not much of an issue for chat). But the TCP and (hopefully) TLS handshakes require some roundtrips before being usable, at which point your application also does some handshake. That are probably like 8-10 TCP packets just for that. Mobile networks have terrible latencies, so say 500ms. You just added up to 5s of boot time to your web page.