ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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> <georgeu2000> How do I update the value in a Named Tuple?
<FromGitter> <georgeu2000> ```z = { foo:1}```
<FromGitter> <georgeu2000> Should I be using another data type?
<FromGitter> <georgeu2000> Use case: params for HTTP query: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=59dc0fa33cb340a261059426]
<FromGitter> <ezrast> You should be using a Hash; Tuples (named or otherwise) are immutable.
<FromGitter> <georgeu2000> ```{ "query": "foo" } of String => String``` ⏎ ⏎ ? [https://gitter.im/crystal-lang/crystal?at=59dc1099bbbf9f1a3840222b]
<FromGitter> <georgeu2000> I guess this works: ` z = { "query"=> "foo" } of String => String`
<FromGitter> <georgeu2000> Thanks, that worked.
p0p0pr37 has quit [Remote host closed the connection]
p0p0pr37 has joined #crystal-lang
<FromGitter> <ezrast> You can actually leave out the `of String => String` in this case; it's only needed for an empty literal or when you want the types to be something more general than what the compiler can figure out.
Creatornator has joined #crystal-lang
p0p0pr37 has quit [Remote host closed the connection]
p0p0pr37 has joined #crystal-lang
<FromGitter> <georgeu2000> I see. Thanks.
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
A124 has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <ethagnawl> Hi, all. has anyone had success running `crystal deps` on a Raspberry Pi? I'm met with: "/opt/crystal/embedded/bin/shards: symbol lookup error: /opt/crystal/embedded/bin/shards: undefined symbol: GC_get_push_other_roots" when I try. FWIW, I'm using the build of Crystal available via http://public.portalier.com/raspbian/ and I've tried installing every dependency I've seen suggested, including Boehm GC.
<FromGitter> <ethagnawl> Also, is anyone aware of a Crystal Shard which wraps up WiringPi? I've looked around but haven't found anything. I've got a proof-of-concept working and I've learned a bit while building it out, but I don't want to sink too much time into it if anyone else has already solved that problem.
<FromGitter> <HCLarsen> @ethagnawl I tried using the stuff on public.portalier.com/raspbian, and it simply didn't work.
<FromGitter> <ethagnawl> @HCLarsen Interesting. I didn't have any issues until I tried to install dependencies.
<FromGitter> <HCLarsen> Step 3 always gives me an error saying that there's an issue with the key.
<FromGitter> <ethagnawl> What about any of the other options? e.g. cross-compiling for the Pi
<FromGitter> <ethagnawl> It's just such a compelling use case for Crystal... The Crystal version of my silly motion detector program uses an order of magnitude less memory than the Python version.
<FromGitter> <HCLarsen> There are no other options on that page.
<FromGitter> <HCLarsen> Of course it's a compelling use case, which is why I've been after this for months.
<FromGitter> <ethagnawl> Right, I meant any of the other options floating around the web. e.g. https://stackoverflow.com/a/42796648/382982
<FromGitter> <georgeu2000> How can I overwrite HTTP::Client method and call original? The following does not seem to work: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dc4a3ee44c43700a13de09]
rohitpaulk has joined #crystal-lang
<FromGitter> <Brusalk> How should kwargs work with macros?
<FromGitter> <Brusalk> I'm seeing something that I think is odd, but I'm not familiar with macros enough to know if it really is strange: ⏎ ⏎ ``` Args: {1, 2, 3, "hi"} ⏎ Kwargs: {}``` ⏎ ⏎ It seems like the kwarg is packed into args, rather than kwargs? [https://gitter.im/crystal-lang/crystal?at=59dc5225bac826f0545612a8]
<FromGitter> <Brusalk> ... which seems wrong to me
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 255 seconds]
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
<FromGitter> <monouser7dig> @RX14 sure I know that is why I like type, please not remove it, would be even better if you could restrict its range and its operator (e.g. create an Int that can not be multiplied) see https://github.com/foonathan/type_safe
rohitpaulk has joined #crystal-lang
<FromGitter> <monouser7dig> you can actually as well pass instances of a struct with just one property around and have functions that only accept that struct/ class instead of its instance ⏎ ⏎ ```struct myint ⏎ @Int ⏎ end ⏎ ⏎ foo(I : myint)``` ⏎ ⏎ but that is just insanity [https://gitter.im/crystal-lang/crystal?at=59dc67ba614889d4759686ac]
alex`` has joined #crystal-lang
<Yxhuvud> @monouser7dig: I probably won't start to do heavy rewrites on the grammar any time soon. There are other optimizations I am looking at that will give better optimizations yet.
<Yxhuvud> (and actually it is the right recursion that is troublesome. left recursion is *very* well behaved in earley parsers).
rohitpaulk has quit [Ping timeout: 255 seconds]
<Groogy> Morning!
mark_66 has joined #crystal-lang
flaviodesousa has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<Papierkorb_> Moin
alex`` has quit [Quit: WeeChat 1.9.1]
<FromGitter> <Rinkana> Morning
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has joined #crystal-lang
alex`` has quit [Client Quit]
rohitpaulk has quit [Client Quit]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
flaviodesousa has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
waveprop has joined #crystal-lang
<FromGitter> <krypton97> Terminal based ide, has crystal supports too ;)
DTZUZO has quit [Ping timeout: 255 seconds]
<FromGitter> <imonmyown> Morning :)
<FromGitter> <bew> 'ning ;)
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
<watzon> Can anyone tell me why this would be giving me the error `undefined method 'from' for Nil (compile-time type is (TelegramBot::Message | Nil))`. https://gist.github.com/watzon/ba5b44b10186e2a06db77d5d1eece2ce
<Papierkorb_> .. line?
<watzon> Line 25 is checking that `msg.reply_to_message` and `msg.reply_to_message.from` are not nil
<Papierkorb_> line of the error.
<watzon> I included the error in a comment above the line
<watzon> line 25
<Papierkorb_> you have to store the value of msg.reply_to_message in a variable first
<watzon> Why is that? It's already being stored isn't it?
<Papierkorb_> No it's not. You're calling a method there, and its result may change to the next call
<watzon> You're saying `msg.reply_to_message` is a method?
<Papierkorb_> What else could it be?
<watzon> An instance variable
<Papierkorb_> No?
<Papierkorb_> That'd be @foo
<Papierkorb_> but same reasoning goes for that.
<watzon> I guess that's just weird to me haha
<Papierkorb_> So?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_> Please check the macros output if you don't believe me.
<Papierkorb_> Also read up on the definition of `getter`.
<watzon> I believe you, I just don't quite understand why I'd have to assign it to a variable. But oh well.
<Papierkorb_> `def foo : String?; rand > 0.5 ? "Ok" : nil; end`
<Papierkorb_> What does foo return?
<Papierkorb_> On the first call?
<Papierkorb_> On the second call?
<Papierkorb_> On any subsequent call?
<Papierkorb_> if you can't be sure it's String in 100% of the calls, the compiler can't either
<Papierkorb_> Your code may work in Ruby. But even there it's wrong
<Papierkorb_> You can of course use other shorthands, like Object #try
<Papierkorb_> as in `if name = user.name.try(&.last_name)`
claudiuinberlin has joined #crystal-lang
<watzon> Try seems to be the less messy solution, I had it working using `as` as well
<Papierkorb_> .as would simply throw a cast error. if you don't care, use #not_nil! for such cases.
waveprop has left #crystal-lang [#crystal-lang]
<watzon> I'm interested though, how would you refactor that section?
<Papierkorb_> Having those #cmd blocks in the super looks whacko
<watzon> Lol yeah it's just some starting code to get things working
<Papierkorb_> If the shard isn't advanced enough to declare a command on a method, at least move each cmd into its own method
<Papierkorb_> def install_start_command; cmd "start" do .. end; end
<Papierkorb_> Use %{} or HEREDOCS for multiline strings to make them more obvious
<watzon> Good point
<watzon> I haven't used Crystal in a couple months and I've been stuck in the land of Javascript, so I'm a bit rusty
<Papierkorb_> `params[x][y]` is ruby style. Prefer structure and type safety over dynamic structures whenever possible. If not possible, break the dynamic structure down to somethin less dynamic as fast as you can in your code
<Papierkorb_> E.g., do the `user = params[0]` before the if, and then check if `user.starts_with?('@')`
<Papierkorb_> In my code, I may do `if (user = params[0]).starts_with?('@')`, but this syntax is 'controversial' in the community. I don't see much wrong with it as first step
<Papierkorb_> Oh now I see, you want the user later on
<watzon> Yeah, the main point of the block so far is determining the user
<Papierkorb_> So that's another thing then: Refactor that big if-elsif-else block there into its own method. Could be a generally useful functionality. In any case, much more readable
<Papierkorb_> Prefer using idiomatic functionality like String#starts_with? (etc) over manually doing `str[0] == '?'`
<FromGitter> <crisward> @sdogruyol x2 compile times would be nice.
rohitpaulk has quit [Ping timeout: 255 seconds]
<Papierkorb_> watzon: With all of that in place, I think it'd be easy on the eyes, including that time in 4 months you need to fix some unexpected behaviour
<watzon> Papierkorb_: Thanks for the tips
<watzon> Let's see if I can't get myself back into Crystal mode
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] jackturnbull opened pull request #5095: Use query string from URI-based instantiation (master...master) https://git.io/vdVIc
alex`` has joined #crystal-lang
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] straight-shoota opened pull request #5096: Remove `expect_raises` matcher without type argument (master...jm-remove-expect-raises) https://git.io/vdV3c
rohitpaulk has joined #crystal-lang
flaviodesousa has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<Papierkorb_> ... anyone else started to tag types in Ruby code in Crystal style?
<Papierkorb_> Could never remember how YARDs notation worked..
<FromGitter> <OldhamMade> hey everyone. I'm getting intermittent errors running kemal when I build with `--release --no-debug`. seems to bail on first-run, with the following error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dcb5c2bac826f054581035]
<FromGitter> <OldhamMade> if I restart, it runs without issue, restart, and it'll fail... wondering how I can debug this
<Papierkorb_> sdogruyol, ^ - Is Kemal closing listen sockets on application exit?
<FromGitter> <OldhamMade> also, this is running within a docker container
<FromGitter> <OldhamMade> can't seem to replicate on my local machine
<FromGitter> <sdogruyol> @OldhamMade first time see
<FromGitter> <sdogruyol> Seeing that
<FromGitter> <OldhamMade> yeah, it's been solid since I started using it
<FromGitter> <OldhamMade> I've not done too many changes to my app
<FromGitter> <sdogruyol> You also use sentry?
<FromGitter> <OldhamMade> I'm mostly wondering how I go about isolating the issue
<FromGitter> <OldhamMade> yeah, that's a recent addition to try and help debug; I first noticed the problem deploying to the cloud
<FromGitter> <sdogruyol> I'm not that knowledgeable about docker however I'm pretty sure @crisward can help you with that
<FromGitter> <OldhamMade> since it's intermittent, it's hard to know what change I made may have introduced this bug into my code
<crystal-gh> [crystal] akzhan opened pull request #5097: Use Random::Secure with Crystal::Hasher. (master...use-random-secure-in-crystal-hasher) https://git.io/vdVWd
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <crisward> @OldhamMade Not had that exact issue, but if it's happening during a restart I'd check how much memory your VM has. Memory usage spikes during rebuild.
<FromGitter> <crisward> Actually it looks like it may have already started 😕
<FromGitter> <crisward> Have you tried disabling sentry client to see if that fixes it? I seem to remember having issues with the sentry client when connecting to https.
rohitpaulk has joined #crystal-lang
<FromGitter> <straight-shoota> Hey =)
<Papierkorb_> Yo
<FromGitter> <bew> plop!
<FromGitter> <straight-shoota> I'm using VS Code with the Crystal Language extension, but only recently. ⏎ For some reason the commands to toggle comments don't work in Crystal files... But I think they should (I'm not certain). Anyone got some clues?
<FromGitter> <straight-shoota> I've tried key combinations as well as command pallette
<Papierkorb_> Had the same issue actually when I tried VSCode
<Papierkorb_> @faustinoaq may know more
<FromGitter> <bararchy> Papierkorb_ It happens to me all the time by mistake while writing Ruby, I'm like ⏎ def bla(a : String) BOOOM syntax error, and I'm like WTF ? ahhh
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <crisward> @straight-shoota working fine in my vscode - not sure what I'm doing right
<FromGitter> <straight-shoota> yes
<FromGitter> <straight-shoota> I'm not sure if it has worked for me before.
<FromGitter> <crisward> @faustinoaq what do you do with the scry file? Does it need to be copied somewhere in particular?
<FromGitter> <faustinoaq> scry is optional, in vscode-crystal -lang you need to specify scry path 👉 https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Settings#server
<Papierkorb_> A whole daemon just for commenting?
<FromGitter> <yxhuvud> Hmm. Anyone got any good tips of how to let the types of locals in a block passed to a macro not not conflict with locals in the rest of the macro?
<FromGitter> <faustinoaq> > A whole daemon just for commenting?
<FromGitter> <faustinoaq> What do you mean ?
<FromGitter> <faustinoaq> 😅
<Papierkorb_> Read like I'd need scry for commenting to work
<Papierkorb_> (Doesn't work for me either)
<FromGitter> <bew> @yxhuvud what do you mean "the types of locals" ?
<FromGitter> <yxhuvud> let me create a gist
<FromGitter> <faustinoaq> Papierkorb_ No, comments are handled by VSCode, not daemon is needed for commenting 😅
<FromGitter> <yxhuvud> Hmm. Or actually, I'll simply split it out and avoid locals in my macro.
<FromGitter> <bew> you mean local variables?
<FromGitter> <yxhuvud> Yes, what else could I mean?
<FromGitter> <yxhuvud> ah, that is even nicer.
<FromGitter> <bew> I don't know ^^ just wanted to be sure
snsei has joined #crystal-lang
<FromGitter> <faustinoaq> Scry is just an optional server for formatting, search implementations and linting. ⏎ ⏎ Scry is optional because the vscode-crystal-lang extension already has these features using Node.js spawning crystal processes. The advantage of scry is one process on backgrounf, but currently one process with a huge amount of RAM aprox 500 MB, I'm thinking on implement scry using processes instead of the whole
<FromGitter> <bew> 👍
<FromGitter> <faustinoaq> Papierkorb_, So you should be able to use comments, this feature is not related to any background process on vscode-crystal-lang extension
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <straight-shoota> @faustinoaq any idea why comments couldn't be working? It seems only for crystal files.
<FromGitter> <crisward> @faustinoaq sorry for confusing the matter. If it helps I think @straight-shoota is on linux, I'm on mac, mine works btw
<FromGitter> <straight-shoota> No I'm on windows
<wmoxam> 😲
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
Creatornator has joined #crystal-lang
xiljin has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <faustinoaq> > No I'm on windows ⏎ ⏎ @straight-shoota Oh, 😅 then try changing CRLF to LF
<FromGitter> <faustinoaq> > @faustinoaq sorry for confusing the matter. If it helps I think @straight-shoota is on linux, I'm on mac, mine works btw ⏎ ⏎ I'm on Linux and works fine
xiljin has joined #crystal-lang
<FromGitter> <straight-shoota> I'm already using LF everywhere
<FromGitter> <faustinoaq> > any idea why comments couldn't be working? It seems only for crystal files. ⏎ ⏎ If you use crystal files as ruby files, Does comments work ?
Creatornator has joined #crystal-lang
<FromGitter> <straight-shoota> Yes, with Ruby syntax it works
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
Creatornator has joined #crystal-lang
<FromGitter> <straight-shoota> Not that I'm aware of..
<FromGitter> <straight-shoota> But I'll try deactivating
<FromGitter> <straight-shoota> Oh, the devtools now shows ⏎ ⏎ > ENOENT: no such file or directory, open 'C:\Users\Johannes\.vscode\extensions\faustinoaq.crystal-lang-0.3.4\crystal-configuration.json'
<FromGitter> <straight-shoota> There is a backslash missing in the path 😲
vaclavt has joined #crystal-lang
vaclavt has left #crystal-lang [#crystal-lang]
<FromGitter> <straight-shoota> Reinstalled the plugin, and it works again... 🤔
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
unshadow has joined #crystal-lang
<FromGitter> <faustinoaq> 😅
sz0 has joined #crystal-lang
Creatornator has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
flaviodesousa has quit [Ping timeout: 240 seconds]
Creatornator has joined #crystal-lang
<Papierkorb> bararchy, Ping
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Papierkorb here , sorry :)
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mark_66 has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 260 seconds]
Creatornator has joined #crystal-lang
ShalokShalom_ has joined #crystal-lang
ShalokShalom has quit [Ping timeout: 264 seconds]
ShalokShalom_ is now known as ShalokShalom
<FromGitter> <georgeu2000> @tbrand - Thanks. It is not even printing, so I'm not sure why...
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
unshadow has quit [Quit: unshadow]
unshadow has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
snsei has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 248 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
<FromGitter> <OldhamMade> @crisward yeah, I've tried disabling sentry, with no change.
<FromGitter> <OldhamMade> so, basically I'm building my docker container image, then I'll `docker run -it my/image` and hit the url, and it's a coin-toss as to whether it'll run happily or whether it'll bomb-out. if it runs, it's "running" -- there are no problems with subsequent requests.
<crystal-gh> [crystal] straight-shoota opened pull request #5098: Add parenthesis to all occurences of expect_raises (master...jm-parenthesis-expect_raises) https://git.io/vdwtR
claudiuinberlin has joined #crystal-lang
<FromGitter> <OldhamMade> interestingly, if I connect to the container and run the binary from there, it continues to fail sporadically. however, if i build and run the binary locally, it doesn't fail at all.
claudiuinberlin has quit [Client Quit]
<FromGitter> <OldhamMade> local=mac, container=alpine
claudiuinberlin has joined #crystal-lang
snsei has joined #crystal-lang
danielpclark has quit [Quit: Leaving]
Creatornator has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
unshadow has quit [Quit: unshadow]
DTZUZO has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
dannyAAM has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest70887
rohitpaulk has quit [Ping timeout: 258 seconds]
rohitpaulk has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest70887 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
txdv has quit [Quit: WeeChat 1.6-rc1]
<FromGitter> <Sophrinix> has anyone ever written go bindings for crystal. aka using a go library in crystal lang?
txdv has joined #crystal-lang
txdv has quit [Client Quit]
Creatornator has joined #crystal-lang
txdv has joined #crystal-lang
txdv has quit [Client Quit]
<oprypin> probably
txdv has joined #crystal-lang
<crystal-gh> [crystal] iSarCasm opened pull request #5099: Detect recursive generic structs (master...detect_recursive_generic_structs) https://git.io/vdw0q
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
wontruefree has joined #crystal-lang
<FromGitter> <coderhs> Hey there. Is there any shards to generate pdf in Crystal. What to try porting code2pdf gem from Ruby to Crystal.
<FromGitter> <straight-shoota> @coderhs Unfortunately no, it's still needed. See crystal-community/crystal-libraries-needed/issues/40
<FromGitter> <straight-shoota> There is however a shard with bindings to libwkhtmltox so you could co through HTML as a workaround: blocknotes/wkhtmltopdf-crystal
<FromGitter> <straight-shoota> That's what I'm using with md2pdf (https://github.com/straight-shoota/md2pdf)
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <coderhs> Yes. Wkhtmltopdf-crystal would be good for me. As I am planning to do some syntax highlighting and most of those generate css
rohitpaulk has quit [Remote host closed the connection]
<oprypin> coderhs, qt5.cr, when it gets support for QPrinter
<FromGitter> <OldhamMade> Ah, progress... ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dd304a3cb340a2610b5241]
<crystal-gh> [crystal] RX14 closed pull request #5097: Use Random::Secure with Crystal::Hasher. (master...use-random-secure-in-crystal-hasher) https://git.io/vdVWd
<FromGitter> <OldhamMade> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dd3056210ac26920cdbd10]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oprypin> OldhamMade, please show the line of code where you specify 0.0.0.0 8080
<FromGitter> <OldhamMade> this time I compiled with `--release` but without the `--no-debug` flag in the container
<FromGitter> <coderhs> @oprypin at would be a huge dependency for such a small task. Don't you think?
<oprypin> coderhs, since when is PDF a small task
<FromGitter> <OldhamMade> `Kemal.config.port = ENV.fetch("APP_PORT", "3000").to_i`
<oprypin> OldhamMade, yeah what aboout the other one
<FromGitter> <OldhamMade> the rest is default from kemal
<FromGitter> <OldhamMade> APP_PORT is also set in my Dockerfile to 8080
<FromGitter> <OldhamMade> `ENV APP_PORT 8080`
<FromGitter> <coderhs> Since I am used to using prawn from Ruby world @oprypin :-D
<oprypin> coderhs, so you had an easy solution, doesnt mean that lib is simple
jhass has quit [Ping timeout: 240 seconds]
<oprypin> OldhamMade, my suspicion was either the port number is a string (apparently not) or the host name was specified as "http://0.0.0.0" not "0.0.0.0" (but apparently you're not specifying it at all)
asterite has quit [Ping timeout: 264 seconds]
<FromGitter> <coderhs> Ya. But installing whole of qt in a server just for generating PDF? I mean won't loading that library to memory be an overkill on its own. I mean I agree that it can be done with qt. But for a simple non gui or web application I don't see the value in having such a dependency. Of course just my opinion.
<FromGitter> <OldhamMade> yeah; the fact that it's intermittent is really making it hard to track down. however, it's definitely something in `Kemal.run` as that's where it's pointing with `53:5`
DeBot has joined #crystal-lang
Creatornator has joined #crystal-lang
asterite has joined #crystal-lang
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
jhass has joined #crystal-lang
<FromGitter> <imonmyown> Guys, can someone please help ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dd3355614889d4759b2922]
<oprypin> coderhs, not whole, just qt5-base
<oprypin> Installed Size:56.0 MB mkay
<oprypin> imonmyown, ensure that `other` is not nil
<FromGitter> <imonmyown> @oprypin, I thought it being a mandatory argument implies it's not nil... seems like I was wrong... ⏎ What's the idiomatic way to do that?
<FromGitter> <straight-shoota> you could use `.not_nil!` but that's smelly and there's probably a better way, but depends on the context
<oprypin> imonmyown, the idiomatic thing to point out is somewhere in the code you didnt show
<FromGitter> <straight-shoota> question is: why can `other` be nil?
<FromGitter> <imonmyown> well, not sure this will be helpful: https://gist.github.com/imonmyown/c30c64bc3ba2c55ea758eb9dcebc12f5
<FromGitter> <imonmyown> Would appreciate general feedback on the code (suggestions, improvements, style comments)
<FromGitter> <OldhamMade> @imonmyown is there a chance the `if` in `average` on line 23 isn't true?
<FromGitter> <OldhamMade> as in, could `average` return nil?
<FromGitter> <imonmyown> @OldhamMade no chance that I see, I added the line to make the code compile
<FromGitter> <OldhamMade> how about specifying the return type as
<FromGitter> <OldhamMade> just a thought
<FromGitter> <OldhamMade> (I'm new to crystal 😄 )
<FromGitter> <imonmyown> Is there a better way (to remove the `if`)? :)
asterite has quit [Ping timeout: 258 seconds]
DeBot has quit [Ping timeout: 255 seconds]
DeBot_ has joined #crystal-lang
jhass has quit [Ping timeout: 258 seconds]
asterite has joined #crystal-lang
jhass has joined #crystal-lang
<FromGitter> <imonmyown> Like make sure `average` is called only on instances where `T=Tuple(Float64, Int32)`
<oprypin> imonmyown, first of all don't extend array pls
<FromGitter> <imonmyown> I think the best way is just to remove the method altogether
<travis-ci> crystal-lang/crystal#2637f83 (master - Use Random::Secure with Crystal::Hasher. (#5097)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/286224429
<DeBot_> https://github.com/crystal-lang/crystal/pull/5097 (Use Random::Secure with Crystal::Hasher.)
<FromGitter> <imonmyown> @oprypin, yeah inheritance would probably be better
<oprypin> imonmyown, why do you want to add the runtime check if the compiler already has a better compile time check for you -- just error out if this doesnt make sense
<FromGitter> <imonmyown> @oprypin I moved averaging to `finalize`: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59dd3969e44c43700a192136]
<oprypin> i'm sorry what?
<FromGitter> <imonmyown> moved the `average` method into where it was invoked from
<oprypin> probably don't do that
<oprypin> imonmyown, please note that there is no guarantee when or even if `finalize` will be called
<FromGitter> <imonmyown> I call it manually
<oprypin> so rename it from `finalize` because it's special
<FromGitter> <imonmyown> ok, will do
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter> <imonmyown> Guys how do you now get packages from AUR, do you set up some docker image for this purpose or there's some other way?
<RX14> @imonmyown this isn't an arch linux help channel but you should use a helper like pacaur
<RX14> you should read the AUR wiki page though
<FromGitter> <imonmyown> @RX14 I know, sorry about that
<FromGitter> <imonmyown> I just knew guys here were using Arch
<FromGitter> <faustinoaq> `yaourt -S package_name`
<RX14> you should know how to build AUR packages manually before using a helper
<FromGitter> <faustinoaq> I use Manjaro Linux
<FromGitter> <imonmyown> @faustinoaq that seems outdated
<RX14> and btw, pacaur is newer and better than yaourt
<FromGitter> <faustinoaq> @imonmyown Crystal is available on community repos
<FromGitter> <faustinoaq> so `pacman -S crystal`
<FromGitter> <faustinoaq> should works
<FromGitter> <faustinoaq> I'm using that
<RX14> @imonmyown if you want to use the AUR read this https://wiki.archlinux.org/index.php/Arch_User_Repository
<FromGitter> <imonmyown> @faustinoaq I was actually interested in VScode
<FromGitter> <faustinoaq> I'm a fan of VSCode and TypeScript now 😄
<FromGitter> <imonmyown> Yeah, M$ guys can still do great IDE's
<FromGitter> <faustinoaq> Yeah, Visual Studi 2017 is very impressive
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wontruefree has joined #crystal-lang
<FromGitter> <Hellfire01> where can I find the documentation for the Crystal Unit Tests ?
<FromGitter> <Hellfire01> found this : https://crystal-lang.org/api/0.23.1/Spec.html
<FromGitter> <Hellfire01> but I have no information on how to implment it
<FromGitter> <Hellfire01> is it possible to get the tests to run at compilation ?
<oprypin> Hellfire01, it is not advisable to run tests at compilation
<oprypin> just add that to your one-liner
<oprypin> crystal spec && crystal run myproject.cr
<FromGitter> <Hellfire01> so how should I use them ?
<oprypin> just look for examples
<FromGitter> <Hellfire01> id not find much, mostly shards bt it is not what I am looking for
<FromGitter> <Hellfire01> quite possibly not using the right keywords
<FromGitter> <Hellfire01> so i just place everything in a spec folder ?
<FromGitter> <Hellfire01> how does Crystal know where the main file is ?
<oprypin> Hellfire01, it just runs everything in spec folder when u run crystal spec
<oprypin> Hellfire01, and dont forget to `require "spec"` because that's what contains all those weird thingies `describe` `should` etc
<FromGitter> <Hellfire01> so, if i got it right, I just place all of my spec files in the spec folder and Crystal will test them one by one with the `Crystal spec` instruction ?
<FromGitter> <Hellfire01> will it recurcively go in the sub-directories or must I show Crystal were to find them ?
<oprypin> recursively
<FromGitter> <Hellfire01> thanks
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
wontruefree has joined #crystal-lang
<FromGitter> <georgeu2000> Can I use this to compile my app for linux? ⏎ `crystal build your_program.cr --cross-compile --target "x86_64-unknown-linux-gnu"`
<FromGitter> <georgeu2000> It is Alpine 3.4.
<FromGitter> <jwaldrip> Hey guys, checking in again on the Crystal release... any word.
<FromGitter> <jwaldrip> I am literally dying to get the YAML updates.
<FromGitter> <georgeu2000> And how do I install `cc`?
<FromGitter> <faustinoaq> I think you command should work ⏎ ⏎ In alpine you can install cc using `apk install clang` or `apk instal gcc`
<FromGitter> <georgeu2000> I did install gcc, but get `cc: error: /usr/local/Cellar/crystal-lang/0.23.1/src/ext/libcrystal.a: No such file or directory`. Do I have to update the PATH or something?
<FromGitter> <georgeu2000> Oh, I see. It's working: `-lpthread /usr/local/Cellar/crystal-lang/0.23.1/src/ext/libcrystal.a`
<FromGitter> <georgeu2000> The command is for OSX, not unix.
<FromGitter> <georgeu2000> Maybe it is easier to compile in Linux.
<FromGitter> <georgeu2000> Without cross compiling.
<FromGitter> <faustinoaq> Yeah, try compiling using an Alpine enviroment for development and then you can copy the binary to an Alpine dedicated to production
Creatornator has joined #crystal-lang
wontruefree has quit [Ping timeout: 258 seconds]
<FromGitter> <georgeu2000> Which one works for Alipine? https://crystal-lang.org/docs/installation/
<FromGitter> <georgeu2000> `apt-get` works but then `/bin/sh: bash: not found`
<FromGitter> <faustinoaq> @georgeu2000 see http://public.portalier.com/alpine/
<FromGitter> <faustinoaq> I think we should put this on official docs