RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
scott_tams has quit [Quit: Leaving]
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <drosehn> You could use something like stunnel to setup the ssl-connection. (I suspect that mysql wants ssl connections, not ssh sessions).
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <girng> i was curious what's the fastest and most performant way to replace words in a string? gsub?
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> anyone have an example of using the `path` option in `shard.yml`?
<FromGitter> <Blacksmoke16> ``` CrSerializer: ⏎ path: /home/george/dev/git/myapp``` [https://gitter.im/crystal-lang/crystal?at=5c29870cdb5b5c68833196c7]
<FromGitter> <Blacksmoke16> but is still installing from github
<FromGitter> <Blacksmoke16> mm nvm, think it was cached
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
<FromGitter> <girng> what kind of type do we need to use in a query that's selecting a bit(1) from mysql (https://i.gyazo.com/e46f17990a776400490374362677462d.png)? example: `db.query_all "select hardcore from rpg_characters where user_id = ? ", client.user_id, as: {Bool}` ⏎ ⏎ error i receive is: ⏎ `not supported read` [https://gitter.im/crystal-lang/crystal?at=5c29cf8cdb5b5c6883332910]
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter> <girng> would i need something like this? https://crystal-lang.org/api/0.24.0/BitArray.html
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <straight-shoota> @girng `UInt8` probably?
<FromGitter> <girng> hmm tried that but am getting ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c29ddf08dafa715c71cc709]
<FromGitter> <girng> Int8 compiles, but UInt8 gives that error before compiling. `Int8` and `Bool` give the `not supported read` when the query is executed
DTZUZO has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
<FromGitter> <straight-shoota> @7sedam7 There is an issue for mysql over tls: crystal-lang/crystal-mysql#68
<FromGitter> <vladfaust> @girng it's a nice idea to dive into the MySQL driver code and maybe extend it
<FromGitter> <vladfaust> I mean, it's not that hard
<FromGitter> <vladfaust> Had to do some extensions both to crystal-pg and redis to make my ideas work :)
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <girng> @vladfaust interesting. i saw that someone did a custom class and got a solution in https://github.com/crystal-lang/crystal-mysql/issues/12#issuecomment-264726491
<FromGitter> <vladfaust> That's a common thing
<FromGitter> <vladfaust> Just take care so your changes don't overlap with possible future additions to the main code
<FromGitter> <girng> ok, thanks. yeah the db mysql code is very nice and easy to read
<FromGitter> <girng> pretty sure i need to modify \lib\mysql\src\mysql\types.cr right?
<FromGitter> <girng> wow, the `decl_type` macro creates structs
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> @straight-shoota is it intentional not to be in https://github.com/orgs/crystal-lang/people ? Or you have only rights on crystal-lang/crystal?
<FromGitter> <straight-shoota> My membership was private. Made it public
<FromGitter> <straight-shoota> Thanks for asking!
<FromGitter> <7sedam7> inper34pen
<FromGitter> <j8r> Np, we see now our @straight-shoota cowboy :)
<FromGitter> <j8r> 10 public members in crystal-lang!
<FromGitter> <Willyboar> Well done! Congrats @straight-shoota. You are very active and you deserve it.
<FromGitter> <straight-shoota> Thanks =)
<FromGitter> <7sedam7> > A workaround would be to terminate the ssl connection to a local socket and connect to that. That's what I've done once or twice (not with crystal-db though). ⏎ Hei @straight-shoota can you explain how could I do it in crystal?
<FromGitter> <straight-shoota> It could probably be done by using `IO.copy` to bidirectionally pipe between an SSL and local TCP socket. ⏎ But implementing that yourself is probably not the best option. I suppose there are a lot of edge cases to account for in order to keep the connection going. Ensuring fault tolerance can be very tricky.
<FromGitter> <j8r> @7sedam7 or you can open an SSH tunnel with `ssh -L`
<FromGitter> <j8r> and connect to the database as it was in localhost
<FromGitter> <straight-shoota> I'd rather use dedicated tool like `stunnel` or `ssh -L`
<FromGitter> <straight-shoota> The latter requires login access on the target system
<FromGitter> <proyb6> Let see how actively Crystal was installed from Homebrew? ⏎ 1,005 (30 days), 4,902 (90 days), 13,219 (365 days)
<FromGitter> <Willyboar> no bad
<FromGitter> <proyb6> I think it's not by unique installation
<FromGitter> <Willyboar> It contains and upgrades?
_whitelogger has joined #crystal-lang
<FromGitter> <7sedam7> works nicely, thanks @straight-shoota and @j8r
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <straight-shoota> great 👍
<dom96> proyb6: where did you get these stats?
<FromGitter> <proyb6> ```brew info crystal```
<FromGitter> <girng> is it possible to see crystal's installation statistics on WSL?
laaron has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
laaron has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
<FromGitter> <girng> dang, didn't know we could chain the select and min_by methods like this (https://play.crystal-lang.org/#/r/5vx2) 😍 jeez crystal makes it so easy
Renich has joined #crystal-lang
DTZUZO has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
ua has quit [Quit: Leaving]
ua has joined #crystal-lang
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> so im working on request lifecycle events now, like `after_all`, etc
<FromGitter> <Blacksmoke16> and wanted to get some feedback/thoughts
<FromGitter> <Blacksmoke16> current plan is for the user to define a class method in their controller, add an annotation, and the event it should be called on, e.x ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2a5d76babbc178b2087274]
<FromGitter> <Blacksmoke16> this would trigger that callback on any request for any route defined in that controller class
<FromGitter> <Blacksmoke16> also prob have a `actions` property on the annotation to limit the routes it gets executed on
<FromGitter> <Blacksmoke16> or possibly make it execute on the class its defined in, OR children of that class
non-aristotelian has joined #crystal-lang
<FromGitter> <Willyboar> @Blacksmoke16 where are you from. I am asking because the name Athena.
<FromGitter> <Blacksmoke16> PA USA
<FromGitter> <Blacksmoke16> Named based on the Greek god :p
<FromGitter> <Willyboar> Yes i know. I am Greek :)
<FromGitter> <Blacksmoke16> ;)
<FromGitter> <Willyboar> i am waiting to test Athena ;)
<FromGitter> <Blacksmoke16> go ahead, most things should be working on the `v0.1.0` branch
<FromGitter> <Blacksmoke16> at least in regards to basic function and conversions and such
<FromGitter> <Blacksmoke16> but deff not stable :p
<FromGitter> <Blacksmoke16> syntax and stuff might change
<FromGitter> <Blacksmoke16> and i dont have any docs written yet
<FromGitter> <Willyboar> I am thinking about trying to write my own framework, or at least try.
<FromGitter> <Blacksmoke16> give it a try, can be a fun project
<FromGitter> <Willyboar> Yes, i think it would be. And i am thinking something different from the excisting frameworks.
<FromGitter> <Blacksmoke16> oh?
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Raimondi has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> what were you thinking @Willyboar ?
<FromGitter> <kevinelliott> I’ve spent some time reading crystal source code this holiday :)
<FromGitter> <Willyboar> well it’s to early to tell something @Blacksmoke16
<FromGitter> <Blacksmoke16> ah, thought you already had an idea of what you would do differently
<FromGitter> <Willyboar> yes i have but it is very general at the moment. I usual organizing a lot before i start something.
<FromGitter> <Blacksmoke16> 👍 sounds like a plan
<FromGitter> <Willyboar> 👍
<FromGitter> <codenoid> so
<FromGitter> <codenoid> will crystal become 1.0 in 2019 ?
<FromGitter> <Blacksmoke16> we'll find out
laaron- has joined #crystal-lang
laaron has quit [Ping timeout: 256 seconds]
<FromGitter> <grahamnicholls> Am I in the right place - I want to ask about using globals in Crystal (which I'm hugely excited about(Crystal, not globals))? I posted on SO - not long ago - I'm an impatient old g*t, but was reading around and it seemed that this might be better. Thanks.
<FromGitter> <Blacksmoke16> global variables?
<FromGitter> <Blacksmoke16> they arent a thing
<FromGitter> <grahamnicholls> PS Excited because Ruby is lovely, but seems to be dying in favour of the less expressive Python. Compiled Ruby seems like the perfect sweet spot.
<FromGitter> <grahamnicholls> Well, they seem to be - but I might be misunderstanding modules.
<FromGitter> <grahamnicholls> DO I post a code snippet here?
<FromGitter> <grahamnicholls> (And I know it's not compiled Ruby, really, in case that's a terrible faux pas!)
<FromGitter> <Blacksmoke16> sure, got a playground link?
<FromGitter> <grahamnicholls> playground - is that codepen?
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/ yea
<FromGitter> <grahamnicholls> Ta. Does this work https://play.crystal-lang.org/#/r/5w2r ?
<FromGitter> <Blacksmoke16> well it doesnt compile :P is that your question?
<FromGitter> <grahamnicholls> YEah, I saw that - it does on my laptop - 2 secs ...
<FromGitter> <grahamnicholls> I'm wondering about the global debug_mode
<FromGitter> <Blacksmoke16> well thats a constant
<FromGitter> <Blacksmoke16> so you wouldnt be able to change the value once you define it
<FromGitter> <grahamnicholls> Is it - I'm able to write to it - give ma a couple of minutes to get it to compile ...
<FromGitter> <Blacksmoke16> kk
<FromGitter> <grahamnicholls> OK, sorry for the delay - what's there compiles, now.
<FromGitter> <grahamnicholls> SO the idea is that if you run it with a "-d" on the command-line, it toggles the global debug_mode
<FromGitter> <grahamnicholls> then your calls to the method debug_msg() actually do something, as opposed to simply returning.
<FromGitter> <grahamnicholls> Ah but it isn't working as I expected, when I test with solver -d 1 2 3 , it works, but without the -d it still prints the debugs, which fits with what you expect. false != nil - let me fix that ...
<FromGitter> <Blacksmoke16> would have to relink it
<FromGitter> <Blacksmoke16> each run is diff url
<FromGitter> <grahamnicholls> OIC, ta - will do - (and false is false, so ignore last comment).
<FromGitter> <grahamnicholls> https://play.crystal-lang.org/#/r/5w2w
<FromGitter> <Blacksmoke16> maybe check that out if you doing CLI stuff
<FromGitter> <grahamnicholls> I'm not a fan of optionparsers, TBH. IMO, thy obfuscate, when I want a simple:
<FromGitter> <grahamnicholls> debug_mode=true if args.includes?("-d")
<FromGitter> <Blacksmoke16> as you wish
<FromGitter> <Blacksmoke16> that could just be `debug_mode = args.includes? "-d"`
<FromGitter> <grahamnicholls> that sets a global (and I know that they are (not unreasonably) frowned upon, but I think this is a useful example, and TBH whether I use an optionparser or not, I'd still like to know if I'm being too "old school"
<FromGitter> <grahamnicholls> So even with optionparser, I'd want to set the global "debug_mode", so that the code can have debug_msg calls which either (normally) do nothing, or when -d is given , print whatever theyre told to.
<FromGitter> <grahamnicholls> And yes, I prefer your syntax there, thanks - seems more Ruby/Crystal like code.
<FromGitter> <grahamnicholls> Still have the question - is that a "global" (debug_mode). If it is, should I be taken out and shot for using it, because there's a better way?
<FromGitter> <Blacksmoke16> its global in the sense its in the top level namespace
<FromGitter> <Blacksmoke16> but its not actually a global variable
<FromGitter> <Blacksmoke16> better way to handle this imo would be have a like config class, and use class vars
<FromGitter> <Blacksmoke16> then if you get that flag switch the var there to true
<FromGitter> <grahamnicholls> Hmmm. This is exactly what I was wondering.
<FromGitter> <Blacksmoke16> or a struct
<FromGitter> <grahamnicholls> My objection is that my code (and in C I'd use a struct for this) seems more readable than having a config class (but of course, things always grow).
<FromGitter> <grahamnicholls> I'm not wedded to my opinion, though, which is why I'm here, really.
<FromGitter> <Blacksmoke16> can use the record macro
<FromGitter> <Blacksmoke16> `record Config, debug_mode : Bool = false`
<FromGitter> <grahamnicholls> I do firmly believe that simple is better, though (which is an objection to optionparsers)
<FromGitter> <Blacksmoke16> which defines a struct with given properties
<FromGitter> <grahamnicholls> That sounds interesting - I need to go and read about it, then.
<FromGitter> <Blacksmoke16> er well that would be ivars, not class vars so would have to define the struct manually
<FromGitter> <grahamnicholls> back in mo' when I've had a read...
<FromGitter> <Blacksmoke16> ```struct Config ⏎ class_property debug_mode : Bool = false ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5c2a821ed945b96882254519]
<FromGitter> <grahamnicholls> I wonder - I tend to use Ruby (and hopefully Crystal) mostly for what I'd have done in awk/sed/tr/bash/pipes, etc in the past. I love Ruby for it's expressive clarity - do you think I need to try to start being more Ruby/Crystal oriented, and get more into the idiom of both?
non-aristotelian has quit [Quit: non-aristotelian]
<oprypin> grahamnicholls, i always say that if you're in Ruby mindset while writing Crystal, you're gonna have a bad time
laaron has joined #crystal-lang
non-aristotelian has joined #crystal-lang
<FromGitter> <grahamnicholls> Interesting - (I suspect that I'm not enough in the Ruby mindset- being an old C-programmer), but why do you say that, please?
laaron- has quit [Remote host closed the connection]
<FromGitter> <bararchy> Any clue what does this error means? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2a83ebc20dd65207abfb58]
<FromGitter> <Blacksmoke16> While the syntaxes are similar they are separate languages
<FromGitter> <Blacksmoke16> Does not map 1 to 1 to Ruby, best to take a step back and rethink how you plan to do something to take advantage of crystal
<oprypin> yes, that's a nice way to put it
<FromGitter> <grahamnicholls> OK, thanks.
robacarp has joined #crystal-lang
<FromGitter> <grahamnicholls> So, is there a stype guid along the lines os the Python one, which I can read? Thanks.
<FromGitter> <grahamnicholls> or even a style-guide, sorry. wrong glasses on.
<oprypin> (though i personally disagree with what the formatter does)
<FromGitter> <grahamnicholls> :-)
<FromGitter> <grahamnicholls> A bit like me with my aversion to optionparsers.
<FromGitter> <Blacksmoke16> but you say you like to keep things simple, cant get much more simple than like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2a8d2b37975e7ca9538f79]
<FromGitter> <Blacksmoke16> simple != readability
<FromGitter> <Blacksmoke16> my as well take advantage of the built in features of a language, esp if it makes something easier to see what is going on
<FromGitter> <Blacksmoke16> but of course its all relative to what the project is
<FromGitter> <Blacksmoke16> hmm, now to think of how i want to handle global before/after events
<FromGitter> <Blacksmoke16> vs controller specific
<FromGitter> <grahamnicholls> Simpler than debug_mode = args.includes? "-d"` ? I'm not convinced :-)
<FromGitter> <grahamnicholls> As you say - depends somewhat on the project, but I'm persuadable - I'll look again at option_parser, thanks.
Raimondi has joined #crystal-lang
<FromGitter> <Willyboar> Happy new year from Greece 🎆
<oprypin> grahamnicholls, that works if you have only flags with no values and no positionals
<FromGitter> <vladfaust> Happy NY from Russia 🇷🇺
<mps> vladfaust: s prazdnikom :) (happy new year or someting like in my translation to Russian)
<FromGitter> <vladfaust> Mps are you SLAV?
<mps> Serb, if you take them to Slovene
<mps> vladfaust: btw, I read Russian but I'm bad at writing :(
<FromGitter> <drujensen> @vladfaust Happy New Year!
<FromGitter> <kevinelliott> Happy new year
<FromGitter> <vladfaust> Russian is one of the toughest and most blyatiful languages 😋
<FromGitter> <Sija> Happy New Year to y'all from polish mountains 🇵🇱🌲🎉
<FromGitter> <vladfaust> hope to see us *all* here shine this year
<mps> happy new year to all of you :)
<FromGitter> <Willyboar> @vladfaust yes russian is tough. Like greece and most of the asian languages.😂
<mps> vladfaust: yes, Russian is crystal in spoken languages
<FromGitter> <Willyboar> no. I will dare to say it is like rust
<FromGitter> <Willyboar> 😃
<mps> although I like Italian to
<FromGitter> <Willyboar> Italian is like python
<FromGitter> <vladfaust> I’m sorry, have to go 😔 Have a nice celebration you all 🍾
<FromGitter> <Willyboar> have a nice time
<mps> be careful with vodka, and enjoy :)
<FromGitter> <Willyboar> 😃😃😃😃😃😃
<mps> Willyboar: with which spoken language you associate C, then?
<FromGitter> <Willyboar> hmm, i think german
<mps> could be, Perl then is Chinese at least for me
<oprypin> ayy
laaron- has joined #crystal-lang
<FromGitter> <j8r> I've read
<FromGitter> <j8r> Previously, a language with coroutines that compiled in LLVM would have had to implement coroutines by hand. LLVM 4.0 adds support for representing coroutines directly in the compiler via new instructions in its intermediate representation (IR).
laaron has quit [Remote host closed the connection]
<oprypin> poor birds flying away, probably thinking the world is ending
<FromGitter> <j8r> Does it may influence the implementation of coroutines in Crystal?
<oprypin> crystal completely ignores coroutines. are you saying if it influences the *potential* implementation? it'd have to be shoehorned in anyway
<FromGitter> <j8r> oprypin I was confusing fibers and coroutines
gangstacat has quit [Remote host closed the connection]
<FromGitter> <j8r> The main difference is coroutines haven't a scheduler