ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.1 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
soveran has quit [Ping timeout: 264 seconds]
<RX14> @sdogruyol, Papierkorb, literal: https://github.com/RX14/crane - Only just got started, with the scaffolding done.
olek_poz has quit [Ping timeout: 268 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
onec has quit []
<FromGitter> <jwoertink> Anyone know of a cleaner way to write this query?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58c0d0401465c46a5607405f]
<FromGitter> <jwoertink> it's possible for this query to not return any results.
<FromGitter> <jwoertink> I saw the `query_one` method, but when it didn't find a record, it would blow up. So after adding catches and stuff, it came out to about the same mess
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 246 seconds]
VectorGraphics has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
VectorGraphics has quit [Ping timeout: 246 seconds]
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
havenwood has quit [Ping timeout: 240 seconds]
havenwood has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter> <crisward> Use query_one? It returns null if not found
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
justinmcp has quit [Remote host closed the connection]
justinmcp has joined #crystal-lang
olek_poz has joined #crystal-lang
bjz has joined #crystal-lang
soveran has joined #crystal-lang
mark_66 has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xmonader has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
olek_poz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
dannyAAM has quit [Ping timeout: 255 seconds]
mark_66 has quit [Quit: Leaving.]
dannyAAM has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 258 seconds]
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <crisward> @jwoertink I do my db open when I launch my app. Then share that connection. Not tested this, but it should work ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58c13256872fc8ce62da13a4]
alxnlssn has joined #crystal-lang
<FromGitter> <crisward> ```located = !MYSQL.query_one?("SELECT id FROM users WHERE token = ? ", token).nil?``` ⏎ ⏎ This may work too? [https://gitter.im/crystal-lang/crystal?at=58c132da7ceae5376a927a3a]
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
Qchmqs has joined #crystal-lang
<FromGitter> <schoening> Hehe, I put crystal on my cv :p
<FromGitter> <sdogruyol> @schoening congrats :)
<FromGitter> <sdogruyol> Also add it to your Linkedin e.g :P
<FromGitter> <schoening> Ty, got two job interviews I am gonna go to
<FromGitter> <schoening> oh yeh, forgot about getting linkedin
<FromGitter> <schoening> Half the people say to get Linkedin and the other half says its useless
<FromGitter> <sdogruyol> It may be useful depending on your country
<FromGitter> <schoening> I'll get one then. Can't hurt
<FromGitter> <idchlife> I have linkedin blocked at my country :D
<FromGitter> <sdogruyol> where's that?
<FromGitter> <idchlife> russia
<FromGitter> <sdogruyol> that's weird didn't know russia blocking stuff
<FromGitter> <idchlife> oh, many site were blocked
<FromGitter> <schoening> Haha! No the russian government is known for its freedom :p
<FromGitter> <idchlife> Ahaha :smile:
<FromGitter> <schoening> Do you have a russian only version?
<FromGitter> <schoening> Like, something similar
<FromGitter> <sdogruyol> i always thought that Turkey is leading the blocking race lol
<FromGitter> <schoening> What about China? and you said you got some stuff blocked too @sdogruyol right?
<FromGitter> <sdogruyol> we got lots of stuff blocked even imgur lol
<FromGitter> <schoening> The only site I think we got blocked here in Denmark is piratebay :p
Qchmqs has quit [Read error: No route to host]
<FromGitter> <schoening> So do you use any proxy stuff or is that very risky?
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> @schoening even proxies are blocked here
<FromGitter> <sdogruyol> TunnelBear, Zenmate e.g all blocked
<FromGitter> <sdogruyol> such a shame
<FromGitter> <schoening> Wow
<FromGitter> <schoening> I saw a Vice documentary about Cuba. They basically download terrabytes of internet stuff and smuggle it in on usb drives and sell that to the people there
<FromGitter> <schoening> Like tons of youtube videos and such stuff
<FromGitter> <schoening> And sell it
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> hehe
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Qchmqs has joined #crystal-lang
<FromGitter> <crisward> Pretty sure we don't have anything blocked here... (uk). We just get spied on.
<FromGitter> <schoening> I read that is going to increase even more now?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <schoening> Is there a way to take a screenshot with crystal ?
<FromGitter> <sdogruyol> Should be possible via a C library
<FromGitter> <crisward> On mac their is a cli command you can call out to for screen shots
<FromGitter> <crisward> `screencapture test.jpg`
<FromGitter> <schoening> Cool. I'm on Linux tho, I guess I go with a C library. Is this stuff gonna get native support or is it gonna be more like in Node.js where you call ffi ?
<FromGitter> <schoening> @crisward wow, thats pretty damn straight forward
pawnbox has quit [Remote host closed the connection]
<FromGitter> <crisward> used it a while back. Created a folder of timestamped images so I could work out my timesheets at the end of the day. You can create a little quicktime video of your working day sped up. Worked for a bit, then stopped using it.
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
<FromGitter> <schoening> Neato!
<FromGitter> <schoening> What I need is more of a take screenshot in memory, analyze pixels, do something. I wrote a crappy bot many many years ago, and was thinking of re-doing it, but in Crystal hehe xD
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
gloscombe has joined #crystal-lang
<FromGitter> <bcardiff> @schoening a shameless google search says there is https://www.howtoforge.com/tutorial/how-to-take-screenshots-in-linux-with-scrot/ but accessing the video directly will be more straight forward.
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Qchmqs has quit [Remote host closed the connection]
olek_poz has quit [Ping timeout: 268 seconds]
tatey has quit [Remote host closed the connection]
tatey has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<FromGitter> <jwoertink> Thanks @crisward for the sql suggestion. Does doing it that way take in to account pooling?
soveran has quit [Ping timeout: 240 seconds]
olek_poz has joined #crystal-lang
<FromGitter> <bcardiff> @jwoertink yes. Database is always pooled. `db.query_one?` and others works alike.
<FromGitter> <bcardiff> if you have a reference to an explicit connection (or transaction) then you are without the implicit pool.
<FromGitter> <jwoertink> sweet. So is there no reason to use this https://github.com/ysbaddaden/pool anymore?
<FromGitter> <bcardiff> It depends. right now no. but after https://github.com/crystal-lang/crystal-db/pull/44 DB will allow to create straight connections again so you can choose to use other connection pool.
<FromGitter> <bcardiff> You can check https://crystal-lang.org/docs/database/connection_pool.html for some details
<FromGitter> <schoening> @db
<FromGitter> <schoening> whops
<FromGitter> <jwoertink> Awesome. Thanks @bcardiff
<FromGitter> <jwoertink> When doing something like `MYSQL = DB.open(CONNECTION_STRING) ` in some shared module, or top level of your app, at what point would you call `MYSQL.close`?
<FromGitter> <fridgerator> in Crecto i dont ever call `close`, the connection seems to close though when the application exists
<FromGitter> <jwoertink> Interesting. You haven't seen any instances of hanging connections, or memory leaks?
<FromGitter> <fridgerator> not yet, not to say it couldn't happen
<FromGitter> <jwoertink> gotcha
<FromGitter> <jwoertink> I guess you could always add a `at_exit` block if anything
<FromGitter> <fridgerator> yeah I just saw that, didn't know it existed
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <bcardiff> Well, DB does nothing implicitly in that topic. When the Database (ie: pool) is GC-ed, the connection will be GC-ed, which will end up GC-ing the sockets, that have a `#finalize` method to close the socket.
<FromGitter> <bcardiff> If the blockess DB#open overload is used, I would suggest calling `db.close` at some point :-P. Or try to use the block version which wraps evrything with a begin/ensure.
pawnbox has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
<FromGitter> <crisward> @jwoertink I never use db.close and my mysql connection closes on app end, I've checked the connection list in the database and all connections are closed. I believe mysql times out the connections after a while anyway, crystal-db takes care of reconnecting I believe.. though @bcardiff wrote this, so he can probably speak with more authority on this. Though I think it's something you shouldn't need to care about u
<FromGitter> ... sharing the db with another app and running low on connections.
<FromGitter> <jwoertink> I'm definitely sharing my db with another app. I'm just going to write a macro to handle opening and closing the connections to avoid issues.
<FromGitter> <crisward> There are so url params so you can set how many connections you want the pool to use.
<FromGitter> <jwoertink> I was just looking for that
<FromGitter> <crisward> `?max_pool_size=50&initial_pool_size=5&max_idle_pool_size=5&retry_attempts=3` add something like this to your usual db url
<FromGitter> <jwoertink> oh sweet! Thanks. That helps
<FromGitter> <crisward> looks like they're detailed here - https://crystal-lang.org/docs/database/connection_pool.html
pawnbox has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <tekjar> Hi. Is parallelism going to change APIs exposed to user alot?
<Papierkorb> No one can be sure, but the fiber stuff probably won't change (much?), so probably not
<RX14> it might not change the APIs but your use of them might have to change to take concurrency into account, unfortunately
gloscombe has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vyay6
<crystal-gh> crystal/master 5b32e46 Ary Borenszweig: Fixed #4125: CodeGen: __crystal_raise fun is expanded with double body
<FromGitter> <tekjar> RX14: You mean user need to consider redesigning his project because threads might run on different cores?
<RX14> i wouldn't go as far as redesigning
<RX14> but you might need to for example put locks around shard array accesses
<RX14> shared*
<FromGitter> <tekjar> Ohhh
<RX14> anything with shared memory would need to be considered for problems
<FromGitter> <tekjar> Got it
<RX14> go seems to manage fine...
<RX14> I think using channels will have to be a lot more common maybe
<RX14> not sure how it'll turn out
<FromGitter> <tekjar> Yep. I noticed the increasing adoption of CSP style
<FromGitter> <tekjar> Did you guys ever consider releasing 1.0 with out parallelism?
<RX14> no
<RX14> adding parellelism would be a breaking change
<RX14> well, at least having it be on-by-default
<RX14> so it's much better to get it done before 1.0
<BlaXpirit> good reason to justify 2.0 :p
<RX14> neither rust or go have had a 2.0 because they've got 1.0 right first try
<RX14> whereas swift is on v4 by noq
<RX14> now*
soveran has joined #crystal-lang
<RX14> so, i'm not sure what the correct approach here is
<FromGitter> <tekjar> Did they :P
<RX14> i think we should get 1.0 right
<RX14> and really not have a 2.0 for a long time
<RX14> until we have a big big stash of things that we want to change
<BlaXpirit> sounds good
<BlaXpirit> soo how it worked out for python though
<BlaXpirit> see*
<FromGitter> <tekjar> Cool. I love what rust has done. It makes a lot of sense to use it on microcontrollers, low memory devices. Wish crystal could do the same on server side
<FromGitter> <tekjar> What it took me a month in rust took a week in crystal
<RX14> well i imagine that's part of the learning curve
<FromGitter> <tekjar> Alot of knowledge from past implementation helped though
<RX14> but crystal's learning curve is less for sure
<FromGitter> <tekjar> But also I never wrote any crystal or ruby code before
<RX14> i believe that rubyists find it *harder* to start in crystal than anyone else
<wmoxam> wow, 0.21.1 really fixed a lot of issues I was having in my Liquid port
<BlaXpirit> RX14, i wouldn't say so, just different difficulties
<BlaXpirit> and if those rubyists would just read the docs before guessing, that could be alleviated
<RX14> well rubyists tend to still retain the dynamically typed mindset
<RX14> it's easy to say "read the docs"
<RX14> there's a lot of rubyists that haven't used a statically typed language before
<RX14> and I think they find it hard
<FromGitter> <tekjar> If it makes sense, what safety features of rust would you like to adopt in crystal?
<RX14> i haven't used rust so I can't really comment but I think any safety we adopt would have to be easy on the learning curve
<FromGitter> <tekjar> I don't know crystal enough to comment about safety issues but I love union types and the way they preven Nil exceptions in runtime
<RX14> "no segfaults" would be possible in crystal without much change I think
<RX14> well
<RX14> no segfaults outside of unsafe code
<RX14> but ehh
<FromGitter> <tekjar> Hehehh
<RX14> it seems kinda pointless to introduce unsafe in crystal
<FromGitter> <tekjar> Unsafe DSLs
<FromGitter> <tekjar> Do you have any plans of making case statements exhaustive?
<FromGitter> <tekjar> Making sure that user covered all possible cases if not used an else statement during compile time
<RX14> well that happens in the return value for case statements (iirc)
<RX14> doesn't work for enums because you can technically create invalid enum values
<RX14> but for branching on union types
<RX14> it does work
<RX14> but it's just evaluationg whether nil is in the return type union
<FromGitter> <tekjar> Cool.
<FromGitter> <tekjar> RX14: If you can create some easy issues in `crane` with `easy` tag , it would be awesome (if it doesn't slow down your workflow)
<RX14> i'd prefer to get it fleshed out first
<RX14> not much point in opening issues when the core framework isn't there yet
<FromGitter> <tekjar> Cool. Makes sense
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
xmonader has quit [Ping timeout: 258 seconds]
alxnlssn has quit [Quit: Connection closed for inactivity]
<travis-ci> crystal-lang/crystal#5b32e46 (master - Fixed #4125: CodeGen: __crystal_raise fun is expanded with double body): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/209470828
<DeBot> https://github.com/crystal-lang/crystal/issues/4125 (CodeGen: __crystal_raise fun is expanded with double body.)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <tekjar> Hi. Is it possible to destruct a struct and extract its contents
<FromGitter> <tekjar> Is is possible to extract `pkid` during `when` in that example?
bjz has joined #crystal-lang
<RX14> @tekjar create a getter
<RX14> crystal is "pure OOP" in that you can only send messages to objects (i.e. call methods on them) which means you need a method which returns @pkid
<RX14> which is what the getter macro does
<FromGitter> <jwoertink> Has play.crystal-lang stopped working in FireFox for anyone else?
<FromGitter> <tekjar> @jwoertink It doesn't work for me on chrome
<RX14> it stops working for random for random people at random times
<RX14> clear your cookies
<RX14> it fixes it
<FromGitter> <tekjar> RX14: I understand that I could do getters. By saying "pure OOP" you mean that destructuring is not idiomatic in crystal?
<FromGitter> <jwoertink> ah, the cookie monster. yeah, that fixes it
<RX14> no, not destructuring
<RX14> we don't have much pattern matching in crystal
<RX14> just use struct.pkid
<RX14> isn't that short enough?
<RX14> with destructuring it would just be pkid instead of puback.pkid
<FromGitter> <tekjar> It's simple for this case maybe. If I have a struct with say 5 members, it looks better with destructuring at `when` directly
<FromGitter> <tekjar> Instead of calling 5 getters inside `when`
<RX14> it just means less instance variables floating around...
<RX14> a bit more typing isn't a bad thing
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
<FromGitter> <tekjar> Yep. But some paradigms feel much better. Not that I can't take the usual route :)
<FromGitter> <tekjar> Personal opinion
<RX14> for sure pattern matching is cool
<RX14> but it doesn't really fit with crystal's feel I think
pawnbox has quit [Ping timeout: 258 seconds]
<RX14> and it's usually pretty clean even without it
<RX14> if you can come up with a *really* good usecase for it i'm sure it'll be discussed
<FromGitter> <tekjar> I will. When I'm more comfortable with crystal :)
<FromGitter> <tekjar> It's just been a week
Raimondi has quit [Ping timeout: 268 seconds]
Raimondi has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
Svenskunganka has quit [Quit: leaving]
Svenskunganka has joined #crystal-lang
pawnbox has joined #crystal-lang
Svenskunganka has quit [Quit: leaving]
Svenskunganka has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]