RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.1 | 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> <fridgerator> it has `before_each`
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <PlayLights_twitter> Yes, looks like that is the only one
<FromGitter> <PlayLights_twitter> Maybe i can make a PR
Creatornator has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akaiiro has joined #crystal-lang
akaiiro has quit [Quit: Ping timeout (120 seconds)]
akaiiro has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
flaviodesousa has joined #crystal-lang
akaiiro has quit [Quit: The Lounge - https://thelounge.chat]
ua__ has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter> <girng> @jwoertink haha. yea.
<FromGitter> <girng> btw, is there something like list($var, $var2) in crystal? i'm looking at https://crystal-lang.org/api/0.26.0/String.html#split%28separator%3AString%2Climit%3Dnil%2C%2A%2Cremove_empty%3Dfalse%2C%26block%3AString-%3E_%29-instance-method
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7d2288cff55e561743c3f4]
<FromGitter> <girng> oh wow NVM I just removed the brackets it works!!
<FromGitter> <j8r> lol
<FromGitter> <girng> man, parsing this nginx log is a PITA
<FromGitter> <girng> they got `:`'s and spaces all over
<FromGitter> <j8r> you can `line.squeeze(' ').split ' ', remove_empty: true`
<FromGitter> <girng> wow that squeeze method is something else :D
<FromGitter> <girng> i like it
ashirase has quit [Ping timeout: 255 seconds]
ashirase has joined #crystal-lang
druonysus has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
<FromGitter> <vladfaust> Saw Reddit post as well. I think it's time to stop. To stop creating drama an admit that Crystal is the best language on the table. I use it in production and it works flawlessly. It has a fast growing community, as seen on amount of projects at crystalshards and awesome-crystal. I tried to get back to Ruby recently after catching errors in Postgres driver (which is maintained by a person which doesn't use
<FromGitter> ... this driver in production, I guess), and found it impossible.
<FromGitter> <girng> ^^ :D :D
<FromGitter> <lukeajtodd> That’s some nice positivity :D
<FromGitter> <vladfaust> Ruby is either a magic - ActiveRecord, Rails; or unnecessarily explicit (dry-rb, rom-rb), which doesn't give it a percent of performance compared to Crystal whatever
<FromGitter> <vladfaust> I cant develop knowing that the code can fail at production in Ruby, so I need to write tests for every char I imprint into .rb files
<FromGitter> <vladfaust> I'm damn serious
<FromGitter> <vladfaust> Objectively, we have a old guy person which stands aside and grumbles what everything is wrong. You either invest into the project or it's ecosystem or keep your thoughts away, being positive. IMO it scares newcomers - the language author says he wouldn't use it real-life products. Seriously? 11k commits, 300 contributors, thousands bucks of donations, many companies already using it! Crystal won't just
<FromGitter> ... survive, it's already changing the game
<FromGitter> <vladfaust> I wish I could phrase better, but I'm only good at writing the code (😏)
<FromGitter> <vladfaust> Honestly, I'm trapped into Crystal. Just no other language brings me so much joy after 1.5 years of development. I wish there was a competitor with more web-development-ish views, because it looks like some of Crystal contributors don't use Crystal themselves in the web
thews has quit [Ping timeout: 268 seconds]
<FromGitter> <vladfaust> Yep, I love speaking with walls.
<FromGitter> <vladfaust> Maybe I'm protecting what I love so much ignoring objective issues
thews has joined #crystal-lang
<FromGitter> <sdogruyol> @vladfaust that's well said
<FromGitter> <sdogruyol> I agree with you that Crystal is changing the game already
<FromGitter> <sdogruyol> Let's stop being pessimistic and get things done
<FromGitter> <girng> LOL wow
<FromGitter> <girng> just spent 10 minutes wondering wtf why nothing was happening, i had `def initalize` πŸ˜‚
<FromGitter> <girng> one thing that I think is very underrated is the crystal formatter. it helps me so much! makes my code so much more cleaner and readable. it would be insane to think what my code would look like without it xD
<FromGitter> <vladfaust> Where can I read about new JSON field attributes?
<FromGitter> <j8r> @girng there is also `initialize` vs `initialise`
<FromGitter> <girng> @j8r lol
<FromGitter> <girng> how can i detect if a command was run successfully? for example i'm doing `\`iptables -A INPUT -s xx.xx.125.84 -j DROP`\` in crystal and it works perfectly! howerver, what if the command somehow fails?
<FromGitter> <valamorgon> I want to merge two wav files using crystal only. I can already do it in python like this code below and call it from crystal later
<FromGitter> <valamorgon> import wave ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7d4ec24be56c59187d145c]
<FromGitter> <valamorgon> but I want to do it using crystal only
<FromGitter> <valamorgon> is it possible? do we have some audio library?
<RX14> i'm not aware of one
<FromGitter> <j8r> @girng yes you can, but you have to use `Process`
<FromGitter> <girng> oohhh yeah
<FromGitter> <girng> deja vu i remember asking this LOL
<RX14> @valamorgon I recall the wave file format being pretty easy to parse though
<RX14> so it'd probably pretty easy to write a library for it in pure crystal
<FromGitter> <valamorgon> @RX14 I'm a little biased, I thought it will be hard to get it done without an audio library. But I will give it a try, thanks.
<FromGitter> <girng> @valamorgon are you developing an audio mixer program or something in crystal? sounds cool
<FromGitter> <valamorgon> @girng yes part of the software is something like LMMS. Project is in crystal but audio part is mostly nodejs and python
<FromGitter> <schoening> Man.. the amount of data I have to send to the browser crashes the page, and it takes 10 seconds for crystall --release build to create that json from my classes. I dread to think how the performance of the MySQL + PHP of my client is going to be :D
<FromGitter> <rishavs> Hi guys. what is the current state of Mongodb support in crystal? I noticed that we have a driver but it doesn't seems to be used much and is still in beta. Any anecdotes/reviews of what can I expect?
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ I am getting Unhandled exception: execvp: No such file or directory (Errno)? [https://gitter.im/crystal-lang/crystal?at=5b7d5d06a491f45917853b7b]
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ i think it's working now. but https://crystal-lang.org/api/0.24.1/Process.html says `args = nil`. how am i supposed to know it accepts an array? [https://gitter.im/crystal-lang/crystal?at=5b7d68f4f86b741b05a8ff67]
<FromGitter> <j8r> good point, the argument ins't annotated - should be `args = Array(String)? = nil`
<FromGitter> <girng> not sure why my error was happening and googled, then found this (https://stackoverflow.com/questions/47050208/running-shell-commands-crystal-language-and-capturing-the-output) by RX14 :D
<FromGitter> <girng> if that example was in the docs under `run`, it would be very beneficial i think
<FromGitter> <girng> how can I capture the return value in a variable? "result = `iptables -A INPUT -s 123.123.125.84 -j DROP`" ⏎ see here: https://github.com/crystal-lang/crystal/blob/80a975cf0a98a4ce8464d0069145131667becd70/src/process.cr#L464 ⏎ ⏎ for example, even if i DO NOT do "puts result", it will still print the result. i want the result to be in `result` so i can check if something was returned or not
<FromGitter> <straight-shoota> @girng take a look at `Process.run` and it's arguments
<FromGitter> <girng> yeah was checking that .run, but i would need to put all my iptables arguments and separate them in an array. i really like just doing the entire command like a shell
nathanj has quit [Ping timeout: 255 seconds]
nathanj has joined #crystal-lang
<FromGitter> <j8r> but it's more performant to directly call the binary instead of calling a shell that will call the binary
<FromGitter> <j8r> `shell: false`
<FromGitter> <girng> where is iptables binary at?
<FromGitter> <girng> we can call binary directly? O_o
<FromGitter> <yxhuvud> girng: use the `which` command in a terminal to find out what iptables binary you would use
<FromGitter> <girng> `/sbin/iptables`
<FromGitter> <girng> O_o
ua has quit [Remote host closed the connection]
<FromGitter> <rishavs> Having a bit of struggle with handling nils. ⏎ I hav a data class as; ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b7d804cac25fd11b57be2f1]
<FromGitter> <rishavs> Having a bit of struggle with handling nils. ⏎ I hav a data class as; ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b7d810fcff55e561746158a]
<FromGitter> <paulcsmith> This is one of the most common issues people run into in Crystal. It is because instance variables (in this case `status`) must be assigned to a local variable first, or use `try`. So you can do something like `store.status.try do |status|` and then check `status == "error"`
<FromGitter> <paulcsmith> It would be awesome if Crystal gave you an error because it is nearly impossible to figure out without reading it in the docs or someone telling you
<FromGitter> <paulcsmith> Luckily once you know about it it is pretty easy to workaround :)
<FromGitter> <paulcsmith> More info here: https://crystal-lang.org/docs/syntax_and_semantics/if_var.html under "Limitations"
<FromGitter> <paulcsmith> Or actually you might need `store.try` since it appears to also be `nil`able
<FromGitter> <paulcsmith> Also, I'd consider not allowing status and message to be `nil` and instead make *just* the store billable. So if the store is there, it always has a status and message
<FromGitter> <rishavs> Thank you @paulcsmith You are a lifesaver!
ua has joined #crystal-lang
Groogy has quit [Ping timeout: 272 seconds]
<FromGitter> <paulcsmith> You're welcome
<FromGitter> <paulcsmith> Happy to help :)
<FromGitter> <j8r> @girng In fact calling a shell will parse the arguments for you, you can do this too. take a string like `/sbin/iptables my args --options` and `split(' ')` and then `cmd = command[0]; args = command[1..-1`
vikaton has joined #crystal-lang
ua has quit [*.net *.split]
emilsp has quit [*.net *.split]
notdaniel has quit [*.net *.split]
wmoxam has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
badeball has quit [*.net *.split]
wmoxam_ has joined #crystal-lang
ua has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.2]
<FromGitter> <fridgerator> 1) o - python running in the browser via asm.js : https://pypyjs.org/
<FromGitter> <hugoabonizio> awesome!
<FromGitter> <hugoabonizio> this is some years old though
<FromGitter> <hugoabonizio> this one is using webassembly https://iodide.io/pyodide-demo/python.html
<FromGitter> <fridgerator> wow
flaviodesousa has quit [Ping timeout: 264 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
Raimondi has quit [Ping timeout: 272 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
<FromGitter> <bew> Very nice love proof to Crystal by the way ;)
<FromGitter> <rishavs> what does this means ` property location : Location?`
<hightower3> Hey @vladfaust, see https://github.com/vladfaust/core/pull/59 when you get a chance
<FromGitter> <rishavs> this is rom the link you shared @bew
<FromGitter> <bew> This is what??
<hightower3> rishavs: it means, make instances of this class respond to #location() and #location=(), giving or setting the value of @location, and make the data type be class Location, or nil
<FromGitter> <rishavs> Thanks hightower
<FromGitter> <bew> @rishavs https://crystal-lang.org/api/0.26.0/Object.html#property%28%2Anames%29-macro
<FromGitter> <rishavs> not the property part, but the `Location?` bit
<FromGitter> <bew> `Location` is same thing as `Location | Nil`
<FromGitter> <bew> Oups I mean `Location?` is the same...
<FromGitter> <rishavs> so location is either an instance of Location or nil
<FromGitter> <rishavs> got it
<FromGitter> <bew> Yes
notdaniel has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondii is now known as Raimondi
alex`` has joined #crystal-lang
<hightower3> Hey folks, we are working on a Wiki app in Crystal, comments/issue reports welcome - https://github.com/crystallabs/fluence
<FromGitter> <Timbus> Neat
dom96 has quit [Ping timeout: 276 seconds]
dom96 has joined #crystal-lang
hightower3 has quit [Remote host closed the connection]
hightower3 has joined #crystal-lang
binBASH has joined #crystal-lang
Groogy has joined #crystal-lang
<Groogy> Hmm it says Array#reject! that true will delete objects but I am having the opposite behaviour, is the documentation wrong or am I screwing up things somewhere else?
alex`` has quit [Ping timeout: 240 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
<FromGitter> <Timbus> The doc is correct, you might have your test logic inverted
<FromGitter> <Timbus> `puts (1..10).reject &.even?` => [1, 3, 5, 7, 9]
<Groogy> that's not Array#reject!
<Groogy> two different methods and classes. reject! is not defined in enumerable
<Groogy> though it seems to work just fine in play
<Groogy> all I am doing is @members.reject! &.destroyed?
<Groogy> or wait
<Groogy> yeah that doesn't work for some reason
<Groogy> (also #destroyed? is not returning true, it's hardcoded to return false right now
<Groogy> and it still deletes it
<FromGitter> <Timbus> huh.. lemme see
<FromGitter> <Timbus> still seems to work for me.. That seems funky
<FromGitter> <Timbus> for reference I tried:: 'asdf = (1..10).to_a; asdf.reject! &.even?; pp! asdf'
<Groogy> yeah it worked for me on play
<Groogy> so donno
dostoyevsky has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang