ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
<FromGitter> <girng> I was thinking about getting a raspPI, new ones cna have up 4gb ram
<rkeene> rvprasad, So link it on the same system you compiled it on ?
<rkeene> Also, this bug report doesn't really rely on being cross-compiled as far as I can tell
alex`` has quit [Ping timeout: 244 seconds]
alex`` has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <girng> is it dangerous to allow messages to be sent through telnet without escape them on the server?
<FromGitter> <girng> if you a private messaging another user
<FromGitter> <tenebrousedge> why are you using telnet?
<FromGitter> <girng> i'm building a crystal chat server 5000, it works best on telnet
<FromGitter> <tenebrousedge> telnet is better than xmpp?
<FromGitter> <girng> no idea, lol
<FromGitter> <girng> for example, my server can use crystal's `.colorize(:green)` and it'll show up in green text on the client
<FromGitter> <girng> and i allow users to send messages toe ach other, or in a chat room.. so i'm sure they could send ansci escape sequence codes
<FromGitter> <girng> i wonder if there is a method or way to filter out that in my private_message method. filter all possible naughty input that could cause harm on another user's telnet client
<FromGitter> <girng> or, if they are using a console to connect, or whatever. doesn't technically have to be through telnet
<FromGitter> <girng> that's weird, looks like it gets escaped already. but using `.colorize(:red)` works
<FromGitter> <girng> colorize must be adding something else to the string
<FromGitter> <girng> if i do `puts "\u001b[31mHelloWorld\u001b[0m"` it works though
<FromGitter> <girng> socket.read_line escapes them
<FromGitter> <girng> AWESOME :D
<FromGitter> <tenebrousedge> k
<FromGitter> <tenebrousedge> what is this for?
<FromGitter> <girng> my project for fun, gonna release it on github soon
<FromGitter> <girng> chat server 5000
alex`` has quit [Ping timeout: 244 seconds]
alex`` has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <watzon> Can't wait to see it @girng, looks a lot like irc
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
absolutejam2 has joined #crystal-lang
absolutejam3 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 246 seconds]
absolutejam3 has quit [Ping timeout: 244 seconds]
DTZUZO has quit [Ping timeout: 248 seconds]
waheedi has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
sorcus has joined #crystal-lang
<alex``> hello
<alex``> can crystal be used as an interpreter (speed)?
<alex``> or it will be too slow
<alex``> ``` sh
<alex``> cat <<'EOF' | crystal eval
<alex``> ...
<alex``> EOF
<alex``> ```
absolutejam3 has joined #crystal-lang
<FromGitter> <watzon> It has to be compiled before it can be run, so it will be slow
ht_ has joined #crystal-lang
alex`` has quit [Ping timeout: 244 seconds]
alex`` has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> ugh, wifi died on my other machine, so you might get duplicate messages in a sec
<FromGitter> <absolutejam_gitlab> Depends how much code you're running alex``. If you just do small blocks, it won't be too bad - I do it for testing
<FromGitter> <absolutejam_gitlab> but there's no incremental compilation atm IIRC
<FromGitter> <absolutejam_gitlab> there's also https://github.com/crystal-community/icr
absolutejam4 has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> Anyone know how I can get the status of a Process (https://crystal-lang.org/api/0.29.0/Process.html)?
alex`` has quit [Ping timeout: 248 seconds]
<FromGitter> <absolutejam_gitlab> I'm using `fork = Process.fork` then a `while` loop in the foreground to iterate over the stdout/stderr
<FromGitter> <absolutejam_gitlab> I can see when it terminates with `fork.terminated?` but I dunno how to get the status code. I can get it within the block though
absolutejam3 has quit [Ping timeout: 272 seconds]
<FromGitter> <absolutejam_gitlab> https://play.crystal-lang.org/#/r/79q4
<FromGitter> <absolutejam_gitlab> Oh, I can use `Process.new` I think
<FromGitter> <absolutejam_gitlab> No I can't; it doesn't return. Haha
<FromGitter> <absolutejam_gitlab> Got em
<FromGitter> <absolutejam_gitlab> https://play.crystal-lang.org/#/r/79q5
<FromGitter> <absolutejam_gitlab> For anyone interested in my monologue. Apologies for the spam
absolutejam4 has quit [Ping timeout: 244 seconds]
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> I lied.
<FromGitter> <absolutejam_gitlab> this is super frustrating, haha. I want to run a command asynchronously but also be able to poll for the exit code
<FromGitter> <absolutejam_gitlab> If I do `Process.new`, it creates a new process but doesn't return the process. If I then do `wait`, my foreground is blocked.
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <asterite> I think you need to use spawn. Then when the process finishes you send something over a channel. On the other side you receive from that channel.
<FromGitter> <absolutejam_gitlab> I was going to look at that, but I thought it might not release the event loop
<FromGitter> <absolutejam_gitlab> I think I have it now htough
<FromGitter> <absolutejam_gitlab> `process = Process.new(...)` then `while Process.exists? process.pid`
<FromGitter> <absolutejam_gitlab> Not sure about exit code though
<FromGitter> <absolutejam_gitlab> Once I get it figured I might add a forums post or issue about it, to see if it perhaps needs cleaning up as a higher level API
<FromGitter> <absolutejam_gitlab> or maybe just a shard
<FromGitter> <absolutejam_gitlab> any clever ways of tailing this `IO::Memory` besides `to_a` and diffing?
<FromGitter> <absolutejam_gitlab> at the minute (for testing), I'm just `put`ting it over and over
<absolutejam1> looks like I can play with `pos`
<FromGitter> <absolutejam_gitlab> Sweet, tracking the `pos`, I can tail the stderr and stdout, and it even works when the process I'm calling updates its progress
alex`` has joined #crystal-lang
sagax has quit [Ping timeout: 258 seconds]
alex``` has joined #crystal-lang
alex`` has quit [Ping timeout: 248 seconds]
<FromGitter> <absolutejam_gitlab> how can I stop an include, erm, including?
<FromGitter> <absolutejam_gitlab> But seriously, there's no `except` like Elixir.
<FromGitter> <absolutejam_gitlab> If I `include Foo` it also includes `Foo::Bar`
<FromGitter> <absolutejam_gitlab> Which makes sense
<FromGitter> <absolutejam_gitlab> but I would like to control it a ittle
<FromGitter> <j8r> @absolutejam_gitlab there is a tail library: https://github.com/j8r/tail
<FromGitter> <j8r> Following the end of an IO is fairly simple, you can copy-paste the code too
<FromGitter> <absolutejam_gitlab> thanks
<FromGitter> <absolutejam_gitlab> yeah, wasn't too hard
<FromGitter> <absolutejam_gitlab> `Process` was harder as it looks there are some higher level APIs ready to use, but they all seemed like 80% of what I wanted
<ht_> Probably a questions that has been asked before, but how can I include a license message on top of each file without it showing up in the generated documentation?
<ht_> The documentation about the documentation generation does not seem to tell
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 245 seconds]
<absolutejam1> there's a `:nodoc:`
<absolutejam1> but I think that's only for functions
<absolutejam1> is the license getting merged with the module docs?
<ht_> It is, yes
<ht_> :w
alex``` has quit [Ping timeout: 246 seconds]
<ht_> But I do see that it is not copied in the definition of the classes
<ht_> So that is good
<ht_> Maybe I can mark the section as "license", then it does not look so out-of-place
<ht_> But I also seem unable to create markdown sections. Using `## title` or `== title` does not work?
<FromGitter> <meltheadorable> Can you not just put a blank line between the license declaration and the start of the module documentation block?
<ht_> I'll try
<ht_> That works!
<ht_> Thanks meltheadorable
<FromGitter> <j8r> @absolutejam_gitlab yes the `Process` API isn't very user-friendly :/
ua has quit [Read error: Connection reset by peer]
ua has joined #crystal-lang
<FromGitter> <asterite> strange, we designed it to be user-friendly
<absolutejam1> it's pretty much there. I mean, I managed to make it work
<absolutejam1> I don't want to sound like I'm complaining; there are just some rough edges and inconsistencies
<FromGitter> <asterite> it's fine. It's just that I'd like to see a condensed summary of problems people have. There's https://forum.crystal-lang.org/t/improve-process-api/579 but it seems the main complaint is not knowing whether it's blocking or async. The answer is `Process.new` creates a process. `Process.run` runs a process (which means it must finish). Then you can do `Process.new ... wait` to create a process and wait for it.
<FromGitter> ... Plus it's documented. Then to capture output you pass an `IO::Memory` to the `output` argument. Always a like of code: `Process.run(..., output: my_output)`.
<FromGitter> <asterite> What I mean is, I'd like to see a concrete proposal (working code) that it objectively better
<FromGitter> <absolutejam_gitlab> My gripes were the fact that some return a process, some return a process.status and there didn't seem to be an obvious way to create an async process then get a callback or check if it's alive/finished
<FromGitter> <absolutejam_gitlab> I'll see if I can throw something together
<FromGitter> <absolutejam_gitlab> This is what I ended up with: https://play.crystal-lang.org/#/r/79ry
DTZUZO has joined #crystal-lang
<FromGitter> <asterite> what are you using `stdout_progress` for?
<FromGitter> <asterite> also, it seems you want to redirect the process' output and error to stdout and stderr?
<FromGitter> <asterite> If that's the case then you can just do `Process.run("docker-compose #{args}", shell: true, output: :inherit, error: :inerit)`
<absolutejam1> to keep track of how much of the stdout/stderr log I have printed
<absolutejam1> I also wanted to save it though
<absolutejam1> In case I need to regex over the output
<absolutejam1> as docker-compose uses stderr for informational messages, so I can't just rely on it for showing errors
<absolutejam1> but that's a different gripe for a different project...
<FromGitter> <asterite> I think that's something hard to do and there's no generic process API that can give you progress over output... or well, if we do that then it won't be a generic process API (it seems like a pretty specific use case)
<absolutejam1> That's fair enough
<absolutejam1> It wasn't the tailing stderr/stdout specifically
<absolutejam1> I understand that you give the means as you can pass those in as args
absolutejam4 has joined #crystal-lang
<absolutejam1> My issues were just the fact that all `new`, `fork`, `run` all differ just enough to make them feel insconsistent. Maybe just some docs to clear some things up, such as redirecting stdout form a forked process won't work
<absolutejam1> which makes total sense when you think of it
<absolutejam1> Maybe they should all return a Process and that has a `status` (Process::Status) property, instead of some returning a status, others a process
absolutejam4 has quit [Ping timeout: 258 seconds]
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <girng> @watzon coolest thing is
<FromGitter> <asterite> I don't think you need fork because Process.new already forks
<FromGitter> <asterite> but you would need to use spawn
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ You can literally do socket.read_line, inside of another socket.read_line, so you can capture that input, then decide if you want to continue execution of that method, or return. I'm going to use this for my captcha system when users do /register nick password. [https://gitter.im/crystal-lang/crystal?at=5d35b9ff808425671ccabbfd]
<FromGitter> <girng> Once they run the register command, they can only continue execution of that command if their answer is correct. Very neat.
<FromGitter> <girng> This basically gives off the feeling that the developer/user is inside another method "interacting with it", while in telnet. Adds a bit of UX
<absolutejam1> make sure that it's nothing sensitive
<absolutejam1> over telnet
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 258 seconds]
sagax has joined #crystal-lang
duane has joined #crystal-lang
<FromGitter> <asterite> maybe Process needs a few more convenience methods for common use cases
<FromGitter> <girng> @absolutejam_gitlab just passwords πŸ˜†
<rkeene> Passwords have been illegal since 2004
<FromGitter> <girng> LOL
<rkeene> Hmm ?
<FromGitter> <girng> were you serious or just joking lol
<FromGitter> <tenebrousedge> so angular momentum is quantized, but linear momentum isn't, but is there actually any such thing as linear momentum?
<rkeene> President George W. Bush issued Homeland Security Presidential Directive 12 in August of 2004, which made passwords illegal
<FromGitter> <girng> wait what really
<FromGitter> <girng> @tenebrousedge sounds like quantum physics shenanigans i h ave no idea sorry
<rkeene> girng, Yes
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ gonna need to add a ton to this, lol [https://gitter.im/crystal-lang/crystal?at=5d35ccb3ec5abe7bbc2ba3b5]
<FromGitter> <meltheadorable> HSPD-12 did not make passwords illegal, don’t just make stuff up
absolutejam4 has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> How you declare an empty hash of type `Symbol => (Symbol => String)`
<FromGitter> <absolutejam_gitlab> so `{ :bar => { :foo => "a" } }`
<FromGitter> <girng> i think so
<FromGitter> <absolutejam_gitlab> the `of` syntax won't let me define it
<FromGitter> <absolutejam_gitlab> I've tried adding `{` and `(`
<FromGitter> <absolutejam_gitlab> eg. `{} of Symbol => (Symbol => String)`
<FromGitter> <girng> Hash(Symbol, String).new i think?
<FromGitter> <girng> @Blacksmoke16 can help
<FromGitter> <absolutejam_gitlab> `Hash(Symbol, Hash(Symbol, String)).new`
<FromGitter> <absolutejam_gitlab> ty
<FromGitter> <girng> ohh nice ;D
absolutejam4 has quit [Ping timeout: 245 seconds]
<FromGitter> <mwlang> ```{} of Symbol => String``` https://play.crystal-lang.org/#/r/79sz
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <meltheadorable> @absolutejam_gitlab this is the other thing I would have thought to try, using `of` syntax: `{} of Symbol => ({} of Symbol => String)` but it also does not work
<FromGitter> <tenebrousedge> this works: https://play.crystal-lang.org/#/r/79t5
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> for nested stuff easiest to do what @absolutejam_gitlab did
<FromGitter> <Blacksmoke16> can also make it an alias then do `MyAlias.new`
<FromGitter> <girng> i like aliases
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 244 seconds]
<FromGitter> <rishavs> Any chance that there is someone from Microsoft here in the chat? :D
alex``` has joined #crystal-lang
<FromGitter> <mwlang> Why? Are about to bash 'em harshly? πŸ˜†
<jokke> hey yall. I've been working on this little shard for the last few days. If it looks useful to you, try it out and give me feedback! It relies heavily on macros so it's good to test out all corner cases. I tried writing quite extensive specs but you never know. https://gitlab.com/repomaa/mass_assignable
sorcus has quit [Ping timeout: 250 seconds]
<FromGitter> <rishavs> @mwlang lol no. I work at MS and I am trying to set up a group of MS folks who like Crystal.
<FromGitter> <rishavs> So far my group channels have been empty and I have no idea how should I reach out to folks
<FromGitter> <Blacksmoke16> *company wide email*
<FromGitter> <rishavs> too scared to send that!
<FromGitter> <rishavs> > .>
<FromGitter> <Blacksmoke16> make sure Mr Gates gets it too πŸ˜‰
absolutejam4 has joined #crystal-lang
<FromGitter> <tenebrousedge> @rishavs maybe a work group isn't the best way to go. maybe start a group on meetup.com, or do a presentation at a tech meetup/conference
<FromGitter> <rishavs> I want it to be MS specific. If we get some members, I want to evangelize Crystal from within
<FromGitter> <tenebrousedge> why MS specific?
<FromGitter> <rishavs> I work at MS. :)
<FromGitter> <tenebrousedge> so?
<FromGitter> <rishavs> well, the plan is to evangelize Crystal in MS. In the hope of attracting some great engineering folks
<FromGitter> <rishavs> We have groups evangelizing other languages like Rust
<FromGitter> <tenebrousedge> evangelizing Crystal is one problem that you can solve, that other people might be able to help you with. Navigating MS office politics is another problem that we don't have insight into
<FromGitter> <rishavs> Oh I know that ! Don;t need help navigating MS politics. :D ⏎ I was just asking if there's anyone from MS here
<FromGitter> <rishavs> I havent been able to find any crystal users using internal office channels
<FromGitter> <tenebrousedge> well good luck
<FromGitter> <rishavs> My actual nefarious plan is to rope in someone super good for the Windows Thanks :)
absolutejam4 has quit [Ping timeout: 245 seconds]
<FromGitter> <peterschols> Hi, I'm currently using Atom for Crystal development and looking into switching to VS Code. VS Code looks good, but I can't seem to find a way to let VS Code highlight opening tags when I'm on the closing line, or vice versa. For example, when I select `end` it would be great to have the corresponding `def method_name` or `if condition`highlighted, as is the case in Atom. ⏎ Anyone got this to work in VS
<FromGitter> ... Code? Thanks!
sagax has quit [Ping timeout: 272 seconds]
Yxhuvud has joined #crystal-lang
waheedi has quit [Quit: waheedi]
absolutejam4 has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <girng> @peterschols prob best to make an issue here https://github.com/crystal-lang-tools/vscode-crystal-lang, not sure if @faustinoaq is still active or not though, haven't seen him in a while
<FromGitter> <girng> although, if it's possible to do it without messing with the plugin, maybe vscode community can help as well.
<FromGitter> <watzon> It would be a nice thing to have in the plugin
<FromGitter> <watzon> Another nice thing to have would be what they do with the Flutter plugin, adding a faux comment after each end block that says what class, module, or method the end block is ending
<FromGitter> <girng> https://paste.ee/p/PQ1VD got my captcha almost done
<FromGitter> <tenebrousedge> why are you trying to secure a telnet-based service?
<FromGitter> <peterschols> @girng @watzon thanks for the suggestions. @watzon that would be very neat indeed!
<FromGitter> <girng> @tenebrousedge good question
<FromGitter> <meltheadorable> computers can already answer some of these questions regardless
<FromGitter> <peterschols> @girng @watzon now added an issue at https://github.com/crystal-lang-tools/vscode-crystal-lang
<FromGitter> <tenebrousedge> @girng this is just a for-fun project, right? you're not planning on doing anything serious with this code?
<FromGitter> <girng> @peterschols nice
<FromGitter> <girng> @meltheadorable yes, i woudl prefer to use google's re-captcha system, but not sure how to integrate it in a console to show up
<FromGitter> <girng> does `socket.read_line` have a limit on the amount of bytes it reads?
<FromGitter> <tenebrousedge> probably, but test and see
<FromGitter> <girng> for example, if you are using socket.read_bytes, like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d361fe9be916e76e21b932d]
<FromGitter> <girng> I use socket.read_bytes for my gameserver, but for this little telnet chat server project, i'm using socket.read_line cause it works the best with it
sorcus has joined #crystal-lang
sorcus has quit [Ping timeout: 252 seconds]
duane has quit [Ping timeout: 244 seconds]
<FromGitter> <girng> f it, if anyone wants to dos a $5/yr vps go for it
lucasb has joined #crystal-lang
ht_ has quit [Quit: ht_]
<FromGitter> <meltheadorable> sending all the data cleartext over the wire seems like a bigger problem than whatever you’re trying to prevent with the captcha in terms of security, seems like weird priorities
<FromGitter> <girng> how else do you send data over the wire to work with telnet without it being "cleartext"?
<FromGitter> <tenebrousedge> telnet is not a secure protocol, so the secure way of using it would be to not use it
<FromGitter> <meltheadorable> p. much that
<FromGitter> <watzon> @girng end to end encryption
<FromGitter> <girng> SSH?
<FromGitter> <tenebrousedge> I mean, I would just write an XMPP server
<FromGitter> <j8r> @asterite I was proposing to only keep the async version, then using `&.wait` to block it. ⏎ Another thing is `output, error = Process.new` for easy output/error, inspired by Go and Python
<FromGitter> <j8r> `Process.sync` and `Process.async` is also a good idea
<FromGitter> <watzon> I like the idea of `output, error = Process.new`
<FromGitter> <tenebrousedge> it makes a lot of sense, but golang was mentioned so I am 😦
<FromGitter> <watzon> I found myself wishing recently that IO had an event listener of sorts
<FromGitter> <watzon> So that you could perform an action when new data was written to the IO
<FromGitter> <watzon> Rather than having to loop
<FromGitter> <tenebrousedge> πŸ‘
<FromGitter> <meltheadorable> i would not implement XMPP because it feels ancient & I think contemporary apps need a higher functionality baseline, rather than hoping clients and servers will actually support the right collection of extensions, but that also rules out telnet
<FromGitter> <watzon> I agree. Anything with XML would be off the table for me
<FromGitter> <tenebrousedge> what's the alternative?
alex``` has quit [Ping timeout: 244 seconds]
absolutejam4 has quit [Ping timeout: 246 seconds]
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 245 seconds]
<FromGitter> <tenebrousedge> anyone?
<FromGitter> <watzon> Matrix?
<FromGitter> <tenebrousedge> kk
<FromGitter> <bajro17> if I type crystal lang on yt and click to sort be upload date last video is before 3 months :(