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> <snadon> what’s the best way to install an old version of crystal? ´brew install crystal@0.25.1´ does not work
akaiiro has quit [Ping timeout: 256 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 240 seconds]
elfryskai has quit [Remote host closed the connection]
<FromGitter> <bcardiff> @snadon download .tar.gz from github, extract and use the binary from there.
<FromGitter> <Sija> there’s also https://github.com/pine/crenv
<lvmbdv> did you know void linux doesn't keep previous versions of packages because it cant afford to :)
akaiiro has joined #crystal-lang
<FromGitter> <Sija> @bcardiff care to review #5765
<FromGitter> <Sija> ?
akaiiro has quit [Ping timeout: 256 seconds]
akaiiro has joined #crystal-lang
_whitelogger has joined #crystal-lang
return0e has joined #crystal-lang
return0xe has quit [Ping timeout: 276 seconds]
akaiiro has quit [Ping timeout: 244 seconds]
Creatornator has joined #crystal-lang
emilsp has quit [Ping timeout: 610 seconds]
akaiiro has joined #crystal-lang
emilsp has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pabs has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 272 seconds]
Raimondii is now known as Raimondi
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
ua_ has quit [Ping timeout: 240 seconds]
ua_ has joined #crystal-lang
ua__ has joined #crystal-lang
ua_ has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 272 seconds]
<FromGitter> <Konfuscious_twitter> Hi, is this a channel where I can ask beginner questions as well?
<jokke> just ask ;)
<jokke> see #1
<FromGitter> <Konfuscious_twitter> Ha, good point
<FromGitter> <Konfuscious_twitter> I am reading in a CSV file using CSV.parse, but I'm having trouble casting the Array(Array(String)) into Array(Array(Int32))
<FromGitter> <Konfuscious_twitter> (My next step involves getting Array(Array(Int32)) as input, but I would like to avoid casting it element by element)
<jokke> right
<jokke> lemme check
<jokke> hm ok there doesn't seem to be any built-in method to convert values
<FromGitter> <lukeajtodd> I think the way that makes most sense would be to loop through the elements no? and just `to_i` the values as you go?
<FromGitter> <Konfuscious_twitter> My chance to contribute? :D
<FromGitter> <Konfuscious_twitter> Yes, Luke, that would definitely work, I was more interested in seeing if there's a simpler solution I'm perhaps not seeing
<jokke> i don't think there is
<FromGitter> <j8r> there can't because a CSV is strings, there is no type officially
<jokke> CSV.each_row(STDIN) { |row| row.to_a.map(&.to_i) }
<jokke> `CSV.each_row(STDIN) { |row| row.to_a.map(&.to_i) }`
<FromGitter> <Konfuscious_twitter> That seems like a good method, thank you :)
<jokke> but sure: your chance to contribute! :) see the ruby implementation.
<FromGitter> <Konfuscious_twitter> Alright, I'll definitely have a look when I can, cheers
<FromGitter> <lukeajtodd> I am a complete beginner with Crystal, how do we actually go about contributing? Is there a doc somewhere for this? I really like the lang and would love to be able to do that!
<FromGitter> <bararchy> @lukeajtodd Just go over to the main repo on github, look at the open issues and search for https://github.com/crystal-lang/crystal/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Acommunity%3Anewcomer
<FromGitter> <j8r> https://carc.in/#/r/4scn
<FromGitter> <lukeajtodd> ahh thank you good sir :)
<FromGitter> <Konfuscious_twitter> Cheers @j8r
rohitpaulk has joined #crystal-lang
ashirase has quit [Ping timeout: 256 seconds]
ashirase has joined #crystal-lang
_whitelogger has joined #crystal-lang
jhass has quit [Quit: Bye]
jhass has joined #crystal-lang
elfryskai has joined #crystal-lang
<FromGitter> <vladfaust> ```code paste, see link``` ⏎ ⏎ How is that possible that the first is valid, but the second's not? What should I do to make the second pass as well? [https://gitter.im/crystal-lang/crystal?at=5b7befcd60f9ee7aa46e1c10]
<FromGitter> <schoening> "can't apply visibility modifier" is that because my class includes JSON::Serializable ?
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
alex`` has joined #crystal-lang
elfryskai has quit [Remote host closed the connection]
<FromGitter> <vladfaust> Is that intended behavior: https://carc.in/#/r/4sd3?
<jokke> vladfaust: yeah
<jokke> you need to rewind first
<FromGitter> <vladfaust> @jokke strange, I did `.rewind` in the example above and `.pos` returned 0, but `gets_to_end` still returned "". Nevermind, however, I got it working. Thanks!
<jokke> 👍
alex`` has quit [Quit: WeeChat 2.2]
DTZUZO has joined #crystal-lang
elfryskai has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
Creatornator has joined #crystal-lang
<FromGitter> <j8r> How can I resolve the relative path of a symlink? `File.real_path` always returns the absolute one
<FromGitter> <j8r> e.g. with `ls -l` I've `... 10 Aug 21 15:00 symlink -> real_file`
<FromGitter> <straight-shoota> @j8r you need `readlink` for that. There are currently no bindings implemented in stdlib, though.
<FromGitter> <straight-shoota> something along that should do it: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b7c1b831d3a5711b679edb9]
<FromGitter> <j8r> thanks @straight-shoota :)
<FromGitter> <j8r> 255 is the max path size in bytes?
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <straight-shoota> yeah
<FromGitter> <straight-shoota> might not be enough in some cases
<FromGitter> <straight-shoota> a more sophisticated implementation needs to check if `size < buffer.size` and increase the buffer otherwise.
<FromGitter> <straight-shoota> also missing are error handling, unicode characters etc.
Creatornator has joined #crystal-lang
<FromGitter> <rishavs> I am struggling a bit with ECRs. I am trying to render define a route with a view as; ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I don't want to write my own macros, so the Layout + Page implementation of Kemal will not help me much. [https://gitter.im/crystal-lang/crystal?at=5b7c2673a491f459177e4a7e]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
alex`` has joined #crystal-lang
<FromGitter> <rishavs> TLDR; how do I pass a variable/object to a ECR.render function?
<FromGitter> <fridgerator> I have no experience with ECR, but the examples in the api documentation show you have use it within a Class
<FromGitter> <fridgerator> and the instance variable are what get used in the template
<FromGitter> <rishavs> hmmm.... gonna give it a try. Thanks @fridgerator
<FromGitter> <paulcsmith> You can't use a variable in the filename because it is compiled at compile time
<FromGitter> <paulcsmith> Or you can, but it needs to be a variable at compile time, defined in a macro like `{% page = "my-wonderful-page' %}`
<FromGitter> <rishavs> but the example for macros here https://crystal-lang.org/api/0.26.0/ECR.html#render%28filename%29-macro seem to sggest i can pas a simple variable "name" to my ECR.render without doing anything
<FromGitter> <girng> hello friends once again! miss u all
<FromGitter> <bararchy> @girng hi dude :) long time
<FromGitter> <girng> @bararchy i just thought i'd come here after seeing that thread on reddit. i hope nothing is going to happen to crystal ;)
<FromGitter> <bararchy> what thread?
<FromGitter> <girng> "Will Crystal survive ?" one in crystal sub
<FromGitter> <asterite> Rishav Sharan that variable is being used in the template. You can't interpolate a variable in the path to the ecr file.
<FromGitter> <rishavs> yeah, but I managed to take care of my use case without using macros.
<FromGitter> <paulcsmith> @rishav you can’t use variable names in the file name, but you have access to all methods and variables within scope
<FromGitter> <paulcsmith> Sorry. Was a bit late on that :)
<FromGitter> <rishavs> This is my route ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and this simple workaround works! :D [https://gitter.im/crystal-lang/crystal?at=5b7c35e458a3797aa397e622]
<FromGitter> <rishavs> Thanks for the help guys @paulcsmith and @asterite
<FromGitter> <rishavs> > @girng is talking about https://www.reddit.com/r/crystal_programming/comments/98s10f/will_crystal_survive/ ⏎ ⏎ o.0
<FromGitter> <j8r> I really wonder who is fridgamarator and the-asterite 😄
<FromGitter> <girng> hahahah
<FromGitter> <paulcsmith> You’re welcome. I’m glad you got it working
<FromGitter> <paulcsmith> @rishavs
<FromGitter> <asterite> I'm the-asterite. I had another asterite but got tired and deleted it, then tried to re-create it but it's impossible in reddit (another proof of my bi-polar attitude :-P)
<FromGitter> <j8r> Haha, like http://eccothedolphin.wikia.com/wiki/The_Asterite ? This is the @asterite we all know! 😄 There is still @realasterite available, just in case 😄
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> j8r: that's the one and only asterite ;-)
<FromGitter> <jwoertink> lol I remember that game. I used to get so mad at it
<FromGitter> <girng> i have a question about cores / number of crystal apps running
<FromGitter> <girng> so basically since crystal will utilize 1 core in my i7 2600 cpu, if i load up another separate terminal and run crystal again, i will be essentially utilizing 2x cores then?
<FromGitter> <girng> assuming they are using fibers in the apps
<FromGitter> <j8r> Yes there will have 2 processes in two threads
<FromGitter> <j8r> they can run on the same or different cores, this is up to the OS
<FromGitter> <girng> kk, ty!
<FromGitter> <girng> I just made some smores... my lord they are my fav snack/candy. i charred the marshmellows with a lighter lol
<FromGitter> <girng> loop do sleep is so niccee, love it
<FromGitter> <girng> in node, i always had to do setInterval(function(){ code }, 1000) or whatever. now, it's just loop do sleep and end. much easier to write lol
alex`` has quit [Quit: WeeChat 2.2]
druonysus has joined #crystal-lang
<FromGitter> <jwoertink> I hate marshmallows, but somehow, s'mores just make them so much better especially when on fire 😂
<FromGitter> <rishavs> Quick question, if I need to create thousands of dataobjects, is it leaner to create them as classes or hash objects? For example, if I need to create 1000 comments on my page, should I create a comments class and fill the data in each instance or should I create an array of hashes?
<FromGitter> <jwoertink> My guess would be a static array of tuples
<FromGitter> <jwoertink> but purely a guess without having done any sort of benchmark
<FromGitter> <paulcsmith> I'm not sure, but my guess is that unless you need the absolute fastest thing possible, it would be better to create a class or struct. Hashes/NamedTuples are not very flexible. You can't add methods to them, it's hard to write type signatures for them since every time you add a key, you need to change the type sig.
<FromGitter> <paulcsmith> You may be able to use a struct, but that depends on what you're doing
Creatornator has joined #crystal-lang
<FromGitter> <rishavs> Well performance is a criteria, but only if there is a huge difference between the two approaches. Currently, i am using both classes and hashes in my code and want to standardize it.
<FromGitter> <paulcsmith> I think the performance hit would be minimal, but I'd be curious to see what your benchmarks show
<FromGitter> <rishavs> well i was asking because i am too lazy to benchmark :D
<FromGitter> <rishavs> But you have convinced me about using classes, so classes it is now :D
sz0 has joined #crystal-lang
<FromGitter> <paulcsmith> Haha right on :)
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> Classes are much lightweight and efficient than hashes. Always
<FromGitter> <asterite> And they are type-safe
<FromGitter> <asterite> You'd only use hashes like that in a dynamic language, almost never in a statically typed language
alex`` has joined #crystal-lang
oz has quit [Quit: EOF]
oz has joined #crystal-lang
Yxhuvud has joined #crystal-lang
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 276 seconds]
<FromGitter> <rishavs> @asterite thanks! good to know that
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 272 seconds]
Raimondii is now known as Raimondi
emilsp has quit [*.net *.split]
davic has quit [*.net *.split]
binBASH has quit [*.net *.split]
davic has joined #crystal-lang
jfontan has quit [*.net *.split]
aarongodin has quit [*.net *.split]
foca has quit [*.net *.split]
emilsp has joined #crystal-lang
foca has joined #crystal-lang
pracabor has joined #crystal-lang
pracabor is now known as robacarp
Creatornator has joined #crystal-lang
kmctown has joined #crystal-lang
baweaver has quit [*.net *.split]
<FromGitter> <paulcsmith> Just curious if we have a rough timeline on when 0.26.1 might be released?
petercommand has quit [*.net *.split]
Liothen has quit [*.net *.split]
olbat has quit [*.net *.split]
olbat has joined #crystal-lang
hightower2 has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
<hightower2> Hey, with Kemal, I use the file upload feature and along with an upload I am sending a custom param. Looking into network data, it is being sent (along with other parts): Content-Disposition: form-data; name="page_name" value="home". How do I read this value on the Kemal side?
Liothen has joined #crystal-lang
<hightower2> I do not see this value anywhere in env
<hightower2> got it
kmctown has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<robacarp> macros which accept blocks which accept arguments: not a thing?
<robacarp> I swear I've done this before...
<robacarp> I swear I've done this before...
<robacarp> dammit
<robacarp> ah, it was an unrelated bug
elfryskai has quit [Remote host closed the connection]
<FromGitter> <paulcsmith> @robacarp Do you have an example? I think I tried doing that before but couldn't figure it out
<FromGitter> <robacarp> ```code paste, see link``` ⏎ ⏎ I was just tinkering with this ^ [https://gitter.im/crystal-lang/crystal?at=5b7c72ec94f8164c177e9fa1]
ua__ has quit [*.net *.split]
go|dfish has quit [*.net *.split]
livcd has quit [*.net *.split]
woodruffw has quit [*.net *.split]
woodruffw has joined #crystal-lang
ua__ has joined #crystal-lang
<FromGitter> <paulcsmith> Does that work? The `yield(name)` in a macro?
<FromGitter> <paulcsmith> I guess I could just try it lol
go|dfish has joined #crystal-lang
<FromGitter> <robacarp> it does
<FromGitter> <robacarp> I don't know if I like it yet, but it compiles
<FromGitter> <asterite> It works. But note that there's a small semantic different with the rest of how macros work: https://github.com/crystal-lang/crystal/issues/2924 . That should probably be fixed.
<FromGitter> <HCLarsen> Yo @robacarp , I'm just reading through one of your libraries, got a quick question about it.
<robacarp> okay, go ahead
<FromGitter> <HCLarsen> icmp.cr. What happens when there's no response from the server you're pinging? Does the library just hang, or does it return an error after a certain period of time?
<robacarp> there's a timeout parameter
<robacarp> default looks like it's 10...seconds? https://github.com/robacarp/icmp.cr/blob/master/src/icmp.cr#L14
<robacarp> @HCLarsen does icmp.cr work under crystal 0.26? I haven't tested it
<FromGitter> <HCLarsen> Ahh, just saw how to do that in the specs. Is that parameter in seconds?
<FromGitter> <HCLarsen> I haven't actually tested your library yet, or installed Crystal 0.26. I should probably get on that latter.
<robacarp> I don't see any evidence that it is in seconds, but I'm assuming it is.
<robacarp> If you end up running it on 26, let me know success or failure, I'd appreciate it.
<FromGitter> <HCLarsen> I probably will end up running it on 26.
<FromGitter> <HCLarsen> I'm looking to write a quick bit of code that checks for an internet connection, and pinging a DNS server is the best method that I've thought of so far.
<FromGitter> <HCLarsen> Hence, what brought me to your lib
<robacarp> cool! I hope it works for you, I use it for monitoring uptime on various services around the internet
<FromGitter> <HCLarsen> That's a cool idea too.
druonysus has quit [Read error: Connection reset by peer]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has quit [Quit: WeeChat 2.2]
Vexatos has quit [Remote host closed the connection]
hightower2 has quit [Remote host closed the connection]
moei has quit [Quit: Leaving...]
Vexatos has joined #crystal-lang
Creatornator has joined #crystal-lang
moei has joined #crystal-lang
druonysus has joined #crystal-lang
baweaver has joined #crystal-lang
thews has quit [Excess Flood]
thews has joined #crystal-lang
kmctown has joined #crystal-lang
kmctown has quit [Client Quit]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
<FromGitter> <PlayLights_twitter> Hello! Does Crystal Spec has a "before_all" ?