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
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
sz0 has joined #crystal-lang
alibby2 has quit [Read error: No route to host]
alibby has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
<crystal-gh> [crystal] need47 opened pull request #4157: #4148 add values_at method for CSV::Row (master...master) https://git.io/vyH9F
<FromGitter> <tekjar> Hi. How do I create mutexs in crystal ?
<FromGitter> <tekjar> Some examples?
<FromGitter> <bcardiff> create a Mutex object `m = Mutex.new` (or in an ivar probably) and call `m.lock`/ `m.unlock` or use `m.synchronize do ... end`
<FromGitter> <tekjar> @bcardiff Thanks a lot :)
sz0 has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
Marius is now known as marius
jaitaiwan has quit [Ping timeout: 252 seconds]
jaitaiwan has joined #crystal-lang
mgarciaisaia has quit [Quit: Leaving.]
pawnbox has joined #crystal-lang
splitty_ has quit [Ping timeout: 264 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#a580fd5 (fix-travis-osx - Trying to get old brew formula in travis 1 / NaN.): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/211999778
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
splitty_ has joined #crystal-lang
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
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
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
sija has quit [Quit: Connection closed for inactivity]
akwiatkowski has joined #crystal-lang
mark_66 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
<txdv> hey guys
<txdv> how do you do logging in kemal?
<FromGitter> <KCreate> CommonLogHandler?
<FromGitter> <KCreate> You can also extend the BaseLogHandler to roll your own
<txdv> nice
<txdv> nice doc link, didnt know it existed, ill investigate that
<txdv> im trying out the file upload example in http://kemalcr.com/docs/file_upload/ and it doesnt seem to work
<txdv> doesn't seem to work
<FromGitter> <crisward> @txdv I use it like this (I've edited it to remove my app specific code)
<FromGitter> <crisward> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58cbacaf6701410e58491700]
<FromGitter> <crisward> You may want to output something at the end...
<FromGitter> <txdv> can you maybe show me the surrounding code?
<FromGitter> <txdv> Is it in a class?
<FromGitter> <txdv> Also what version of kemal are you using?
<FromGitter> <crisward> Latest I think.
<FromGitter> <crisward> Remove file_service BTW
<FromGitter> <txdv> currently im doing: post "/upload" do |env|
<FromGitter> <crisward> 1) 18.3
<FromGitter> <KCreate> @crisward Is that something app-specific?
<FromGitter> <txdv> and I just don't know yet how to just define a method like you did
<FromGitter> <crisward> ```code paste, see link``` ⏎ ⏎ should work [https://gitter.im/crystal-lang/crystal?at=58cbaddd05a31d5a4a68f95e]
<FromGitter> <txdv> that is the thing, it doesn't!
<FromGitter> <KCreate> Are you getting an error-message?
<FromGitter> <txdv> ctx.params.files is just empty
<FromGitter> <KCreate> Maybe you're transmitting them incorrectly?
<FromGitter> <txdv> tried a form and a webbrowser, tried to post with curl -F "image=@file.jpg"
<FromGitter> <KCreate> I don't know about curl but I always use the FormData class in Javascript to upload files
<FromGitter> <KCreate> especially when it's supposed to be multipart
<FromGitter> <crisward> Just a html form should be ok.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <txdv> i get an empty files array
<FromGitter> <txdv> its a hash, but still empty
<FromGitter> <crisward> Are you behind nginx or another proxy?
bjz has joined #crystal-lang
<FromGitter> <txdv> no
<FromGitter> <txdv> im running with crystal src/web.cr
<FromGitter> <KCreate> Do you have access to the raw HTTP::Request in kemal?
<FromGitter> <txdv> ctx?
<FromGitter> <KCreate> What's the type of ctx?
<FromGitter> <crisward> the ctx / env object is context which has request on it
<FromGitter> <KCreate> ah okay
<FromGitter> <KCreate> you could try dumping the request.body and check if the file is in there
<FromGitter> <crisward> Also, perhaps try doing it with a form just to make sure. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58cbb2b4ac314c8a1a5b8f55]
<FromGitter> <KCreate> is the content-disposition header automatically set?
<FromGitter> <txdv> its just empty
<FromGitter> <txdv> @crisward are you on a mac?
<FromGitter> <crisward> @txdv yes
gloscombe has joined #crystal-lang
<FromGitter> <crisward> Just tried basic example and I'm getting the same as you. In my full app it works, so I'm guessing something may need to be configured in kemal to work
<FromGitter> <txdv> the target directory for temporary files?
<FromGitter> <KCreate> that should be /tmp by default i guess
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
<FromGitter> <txdv> @KCreate what is your guess on why it is not working?
<FromGitter> <KCreate> Either the browser not transmitting the file correctly or Kemal not being configured correctly
<FromGitter> <crisward> It was working in kemal. Are you using master, or the last version?
<FromGitter> <KCreate> You should find out if the file is transmitted at all
<FromGitter> <txdv> this doesnt mention an configuration
<FromGitter> <txdv> im using master
<FromGitter> <crisward> Just tried on 0.18.3 - same, what crystal version, I seem to be on 0.21.0 locally
<FromGitter> <crisward> It's working on 0.18.2 - something must have broken somewhere...
splitty_ has quit [Quit: Leaving]
<FromGitter> <crisward> @sdogruyol Know about any issues with file upload since 0.18.2 ?
splitty_ has joined #crystal-lang
<FromGitter> <crisward> https://github.com/kemalcr/kemal/blob/master/src/kemal/param_parser.cr#L70 seems to be the only change I can see
<FromGitter> <crisward> Yep, that's it. Adding the `upload.size` breaks it
<FromGitter> <txdv> @crisward
<FromGitter> <txdv> so you are using an older crystal version?
pawnbox has quit [Read error: No route to host]
pawnbox has joined #crystal-lang
<FromGitter> <crisward> https://github.com/kemalcr/kemal/issues/309 (only on my mac, I'll update and recheck)
<FromGitter> <txdv> yeap, i took the commit before that line change and it worked
<FromGitter> <txdv> how did you find that so fast
<FromGitter> <crisward> I did some work on the uploader a few versions back so am pretty familiar with it.
<FromGitter> <sdogruyol> @crisward nice catch :smile:
<FromGitter> <sdogruyol> I'm not sure why it breaks though, need to do some testing
<FromGitter> <sdogruyol> thanks for the report
<FromGitter> <crisward> Not wanting dead files in the upload good, I'm guessing the test for it needs to be more concrete, perhaps something in the FileUpload class?
<FromGitter> <KCreate> I don't understand why upload.size would cause his files to be removed from the array
<FromGitter> <crisward> @KCreate it doesn't get added to the array if the size is nil
<FromGitter> <KCreate> Okay I see, wasn't familiar with HTTP::FormData::Part
<FromGitter> <sdogruyol> not sure why but size if always nil for upload any ideas @RX14 ?
<FromGitter> <crisward> Is it because it's a stream? Does it get bigger after you start piping it?
<FromGitter> <sdogruyol> hmm
alibby has quit [Read error: No route to host]
alibby1 has joined #crystal-lang
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: 260 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter> <KCreate> Aren't these values taken from the headers?
blassin has joined #crystal-lang
<blassin> hey all!
bjz_ has joined #crystal-lang
<FromGitter> <KCreate> hey
bjz has quit [Ping timeout: 240 seconds]
<blassin> this whole Slice/Array thing is still very confusing to me :|
<blassin> how can I split a Slice into smaller Slice? all I get is Array(UInt8)
<FromGitter> <KCreate> A slice is basically just a pointer with out-of-bounds checks
<Papierkorb> blassin: Are you sure you actually need a Slice? What are you trying to do?
<blassin> read a binary file's content and write it to a socket
<blassin> but I want to stagger the socket write, in order to have some delay between the lines of the file
<Papierkorb> Slice#[] takes a range or a (start, length) tuple, which returns the sub-slice of that part
<blassin> ah I see thanks
<blassin> and why does #each_slice on a Slice(UInt8) return an Array(UInt8) ?
<Papierkorb> because that comes from Enumerable(T), which works with arrays.
<blassin> is there an easy way to convert that Array back to a Slice? #each_slice seems to be the best way to do it in lines
<Papierkorb> Sadly, that'll waste tons of memory too.
<blassin> yeah... sounds like it would
<blassin> oh well
<FromGitter> <KCreate> Does anyone know if there's a SOAP library for crystal? Can't find anything in google
<FromGitter> <sdogruyol> https://github.com/Hamdiakoguz/isot
toto_ has joined #crystal-lang
toto_ has quit [Client Quit]
<FromGitter> <guillaume-g> Hi
<FromGitter> <guillaume-g> Can someone help me with a code issue ?
mgarciaisaia has joined #crystal-lang
<FromGitter> <fridgerator> whats the issue?
<Papierkorb> blassin: SIZE = 64; chunks = the_slice.size / SIZE + (the_slice.size % SIZE > 0 ? 1 : 0); chunks.times{|i| the_chunk = the_slice[i * SIZE, SIZE]; ... }
<FromGitter> <KCreate> @sdogruyol thanks
<blassin> Papierkorb: thanks
<FromGitter> <guillaume-g> I have a CONSTANT called CACHE_TYPES where I assign an Hash object. When I try to use this constant by doing "CACHE_TYPES["toto"]", I got the following error : CACHE_TYPES is not a type, it's a constant
<blassin> Papierkorb: I went a different way https://gist.github.com/sardaukar/fa962a6981018563aadbbd3907aeea7b
<FromGitter> <sdogruyol> @guillaume-g wow
<FromGitter> <fridgerator> how are you declaring `CACHE_TYPES` ?
<FromGitter> <fridgerator> just like `CACHE_TYPES = {"toto" => "otot"}` ?
<FromGitter> <guillaume-g> CACHE_TYPES = { ⏎ Ana::CacheTypes::LOCAL => LocalStorage, ⏎ }
<FromGitter> <guillaume-g> It's inside a class called Cache
<FromGitter> <guillaume-g> Yes it's like your example
<travis-ci> crystal-lang/crystal#d9abe28 (master - Fixed invalid File.link behaviour (#4116)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/211867858
<DeBot> https://github.com/crystal-lang/crystal/pull/4116 (Fixed invalid File.link behaviour)
<FromGitter> <fridgerator> hrm
gloscombe has quit [Remote host closed the connection]
<FromGitter> <guillaume-g> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58cbecc7ac314c8a1a5caa11]
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 260 seconds]
<FromGitter> <guillaume-g> I am using Crystal v0.21.0 by the way
<FromGitter> <fridgerator> yeah i'm not sure, i'm not able to replicate on my end
<FromGitter> <guillaume-g> Arg ⏎ I will continue to investigate, thanks
<FromGitter> <fridgerator> from searching through the crystal source for that error, it looks like it happens when you try and do something like : ⏎ ⏎ ```A = 1 ⏎ ⏎ class Foo ⏎ @x : A ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58cbeea22215a08f049826ef]
<FromGitter> <guillaume-g> I see
<FromGitter> <guillaume-g> You can't just have the value of CACHE_TYPES[config.type] directly stored in an class variable
<FromGitter> <guillaume-g> You have to use an another non-class variable to store the value of CACHE_TYPES[config.type] inside then put it into the class variable
<FromGitter> <fridgerator> doing that works for you?
<FromGitter> <guillaume-g> yes
<FromGitter> <fridgerator> ok cool
<FromGitter> <guillaume-g> Thanks for your time
<FromGitter> <fridgerator> sure np
<FromGitter> <bcardiff> There was somo ivar / class var initialization issues fixed in 0.21.1
<FromGitter> <bcardiff> @guillaume-g if you can, check with the latest version. If things are not solved / clear please submit an issue :-)
malthe has left #crystal-lang [#crystal-lang]
<FromGitter> <guillaume-g> It works !
<FromGitter> <guillaume-g> Thanks
<travis-ci> crystal-lang/crystal#c73dedf (fix-travis-osx - Avoid installing pcre): The build was canceled. https://travis-ci.org/crystal-lang/crystal/builds/212131717
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<travis-ci> crystal-lang/crystal#0f6943e (fix-travis-osx - Back to default llvm 4.0 (?)): The build was canceled. https://travis-ci.org/crystal-lang/crystal/builds/212137183
<FromGitter> <KCreate> Hey @fridgerator, I just searched for your crystal aws image but can't seem to find it. I used this help page (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/usingsharedamis-finding.html) to search for it.
<FromGitter> <KCreate> Searched for both Public and Private Images
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vyQyw
<crystal-gh> crystal/master d585459 Brian J. Cardiff: CI: fix osx build...
akwiatkowski has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest64566
<FromGitter> <schoening> Oh the horror is finally over... Finished school. No more php... my eyess... my eeeeyes
<FromGitter> <schoening> $$$$$$$ everywhere
<FromGitter> <schoening> I think I will stick to just writing pretty, pretty crystal code for a while now :p
<FromGitter> <crisward> Just out of interest, how does everyone check instance variable types before use?
<FromGitter> <KCreate> @schoening Same here 😂 Except I'm getting paid for writing php
<FromGitter> <KCreate> i use .is_a?
<FromGitter> <crisward> I see this kind of thing occasionally ⏎ ⏎ ```if (name = person.name) && name.is_a?(String) ⏎ greet(name) ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58cc01921c040b8e04091da8]
<FromGitter> <KCreate> yes i mostly do just that
<FromGitter> <crisward> not sure I like single `=` thing.. I always expect comparisons in if's.
<FromGitter> <crisward> Wasn't sure if there is a less confusing way
<FromGitter> <crisward> ```name = person.name ⏎ if name.is_a?(String) ⏎ greet(name) ⏎ end``` ⏎ ⏎ seems a bit much [https://gitter.im/crystal-lang/crystal?at=58cc020f6701410e584ac604]
pawnbox has quit [Ping timeout: 240 seconds]
<FromGitter> <schoening> @KCreate I'm.. sorry? :p haha!
<FromGitter> <fridgerator> @KCreate are you using the aws-cli to search?
<FromGitter> <KCreate> no
<FromGitter> <KCreate> the web console
<FromGitter> <schoening> @crisward isn't 1 equal sign a assignment operator? I'm confused...
<FromGitter> <fridgerator> hrmmm
<FromGitter> <KCreate> @schoening yes it is
<FromGitter> <fridgerator> omg, please tell me AMI's aren't region specific
<FromGitter> <fridgerator> I can find it in us-east-2, but not us-east-1
<FromGitter> <fridgerator> ugh
<FromGitter> <schoening> Then I don't understand what his "if (name = person.name)" example does..
<FromGitter> <KCreate> @schoening it just assigns person.name to a variable called name
<FromGitter> <schoening> inside an if statement?
<FromGitter> <KCreate> yes
<FromGitter> <schoening> So does that return some sort of truthey falsey ?
<FromGitter> <KCreate> it's the exact same as writing ⏎ ⏎ ```name = person.name ⏎ if name ⏎ # do stuff ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58cc0400f7f7d48104296daa]
<FromGitter> <schoening> Oh, okay
<FromGitter> <schoening> Well that's just devil talk right there
<FromGitter> <schoening> Thanks for teaching me that tho
<FromGitter> <KCreate> ```if name ⏎ ⏎ end``` ⏎ ⏎ this checks that name is not `false`, `nil` or a pointer with the address set to `0` [https://gitter.im/crystal-lang/crystal?at=58cc044ff7f7d4810429706b]
<FromGitter> <schoening> Ty
<FromGitter> <fridgerator> @KCreate I wasn't aware AMI's are region specific, what region were you trying to use? I can copy it there
<FromGitter> <schoening> That's actually good to re-read. So empty strings are truthy in crystal then?
<FromGitter> <KCreate> @fridgerator eu-west-1
<FromGitter> <KCreate> @schoening exactly. `0` is also truthy
<FromGitter> <schoening> Oh wow ok. I thought: "null pointers (pointers whose memory address is zero)" meant 0 would be falsey
mgarciaisaia has quit [Quit: Leaving.]
<FromGitter> <fridgerator> @KCreate ok copied, the ami id is : `ami-199dab7f`, it might take a few mintues to show up
<FromGitter> <KCreate> No, `0` is of type `Int32`. With pointers they mean this: `Pointer.new 0`
<FromGitter> <KCreate> that would be a null pointer
<FromGitter> <KCreate> @fridgerator thanks!
<FromGitter> <crisward> @schoening that's why I asked, the `=` is confusing
<FromGitter> <crisward> I've seen it in a lot of libraries written in crystal and I've always thought assignment in if statements is confusing. It's generally avoid in JS, except for those JS ninjas, the sort who think it's cool to change base prototypes.
<FromGitter> <fridgerator> @KCreate still have to manually install openssl and gcc, I'm thinking about including those as a part of the AMI, since they will almost always be required: `sudo yum install openssl-devel gcc`
gloscombe has joined #crystal-lang
<RX14> @sdogruyol as with content-length, size is a set value
<RX14> unlike content-length it's not mandatory
<RX14> and eith both you have to trust the cline tto be correct regardless
<RX14> with* client*
<RX14> I can't spot an error in the parsing code so it's likely just not been set
<RX14> what generated the multipart which you're parsing?
<FromGitter> <crisward> @RX14 it was a html form
<RX14> could you verify if the size is actually sent?
<FromGitter> <crisward> The content length header is set
mark_66 has quit [Remote host closed the connection]
<RX14> but is the size header in the multipart headers set?
<FromGitter> <crisward> ```code paste, see link``` ⏎ ⏎ doesn't look like it [https://gitter.im/crystal-lang/crystal?at=58cc0aed1c040b8e040951ee]
pawnbox has joined #crystal-lang
<FromGitter> <crisward> Those are chome's headers
<RX14> it's not a HTTP header
<RX14> it's a multipart header
<RX14> it's in the body
<FromGitter> <crisward> sorry, like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58cc0b29a84f611959b698f7]
<RX14> each "part" has it's own headers section
<RX14> with a Content-Disposition header
<RX14> and inside that content disposition header is where size is set for each part
<RX14> but it's optional and only happens on files of course
<RX14> so yeah, there's no size on that
<RX14> which is why you don't get the size
<FromGitter> <crisward> I suggested checking for filename instead, I think that is compulsory isn't it for files?
<RX14> don't rely on it
pawnbox has quit [Ping timeout: 260 seconds]
<FromGitter> <crisward> At the moment kemal is creating a temp file when the file is left empty. As none of the value are mandatory, is would seem to make sense to leave it to create an empty file. It gets cleaned up after the request. Not sure what the alternatives are?
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> ugh that's nasty then
<FromGitter> <sdogruyol> :(
blassin has quit [Quit: Page closed]
<RX14> you can't even rely on content-length
<RX14> it won't be there if the content is chunked
<FromGitter> <sdogruyol> so there's actually no way to control
<FromGitter> <sdogruyol> lol
<RX14> no
<RX14> thats why we have streams
<FromGitter> <sdogruyol> i mean to check beforehand
<RX14> they're user supplied numbers
<RX14> you can't trust them anyway
<FromGitter> <sdogruyol> :/
<RX14> never trust anything
tzekid has joined #crystal-lang
tzekid has quit [Client Quit]
tzekid has joined #crystal-lang
Guest64566 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leonardschuetz has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest36584
Guest36584 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gloscombe has quit [Remote host closed the connection]
<crystal-gh> [crystal] bcardiff closed pull request #4143: Standardise NOTE flags, again (master...fix-note-flags) https://git.io/vyPN0
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vy7YK
<crystal-gh> crystal/master c2ceee7 TSUYUSATO Kitsune: Mark constants as private (#4110)
akwiatkowski has joined #crystal-lang
tlwr[m] has left #crystal-lang ["User left"]
<travis-ci> crystal-lang/crystal#3333828 (master - Fix (hopefully) last remaining instances (#4143)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/212212631
<DeBot> https://github.com/crystal-lang/crystal/pull/4143 (Standardise NOTE flags, again)
leonardschuetz has quit [Ping timeout: 240 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Client Quit]
tzekid has quit [Remote host closed the connection]
<FromGitter> <drosehn> Getting back to the example of ⏎ ⏎ ```if (name = person.name) && name.is_a?(String) ⏎ greet(name) ⏎ end``` ⏎ ⏎ I didn't see anyone explain why people write code like that. [https://gitter.im/crystal-lang/crystal?at=58cc36c8590d72c864dbc9b6]
<FromGitter> <drosehn> Maybe everyone here already knows, but I'll mention it anyway: If you want to use `person.name` inside the `if` clause, crystal cannot assume it will get the same value from a second call to `person.name` as it got the first time. So if you used `person.name.is_a?(String)` as the `if` condition, the crystal compiler would still have no idea what the second call to `person.name` might return.
<FromGitter> <drosehn> So you need to make a local copy of the value from `person.name`, and then use that.
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vy7BA
<crystal-gh> crystal/master 9e67166 Sijawusz Pur Rahnama: GIT_REMOTE_PATTERNS regexes are being overly greedy (#4132)...
leonardschuetz has joined #crystal-lang
leonardschuetz has left #crystal-lang [#crystal-lang]
leonardschuetz has joined #crystal-lang
<FromGitter> <drosehn> I generally cringe at using `blah = value` in an `if` condition because you really *do* want to assign values, because I've seen so many bugs in C where someone wrote `blah = value` when they really meant `blah == value`. But that comes up often in crystal.
<FromGitter> <sdogruyol> Yeah
<FromGitter> <ezrast> I'll add that for those who dislike `=` in `if`, one can check for `nil` (but not other types) with `#try`: ⏎ ⏎ ```person.name.try{ |name| greet(name) }``` [https://gitter.im/crystal-lang/crystal?at=58cc389a590d72c864dbd51d]
<leonardschuetz> cool! I didn't know about that
leonardschuetz is now known as KCreate
<KCreate> sry, wrong nickname
<travis-ci> crystal-lang/crystal#c2ceee7 (master - Mark constants as private (#4110)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/212214453
<DeBot> https://github.com/crystal-lang/crystal/pull/4110 (Mark Colorize constants as private)
KCreate has quit [Ping timeout: 240 seconds]
<FromGitter> <crisward> @drosehn If you're only calling one thing, you could do it all on one line, but I'm not sure I like long expressions any more...
<FromGitter> <crisward> ```(name = person.name) && name.is_a?(String) && greet(name)```
KCreate has joined #crystal-lang
KCreate has left #crystal-lang [#crystal-lang]
<FromGitter> <crisward> @ezrast try is definitely less confusing
synstack has left #crystal-lang ["Quit message"]
<FromGitter> <drosehn> So make it a compound statement, over multiple lines... :smile: ⏎ ⏎ ```(name = person.name) && ⏎ name.is_a?(String) && ⏎ greet(name)``` ⏎ ⏎ (no, I wouldn't really want to do this...) [https://gitter.im/crystal-lang/crystal?at=58cc43531c040b8e040a8303]
<FromGitter> <elorest> Is there a somewhat simple way to interact with/wrap a cli interface like irb or mysql so that you can send messages to the process and see the response?
jokke has quit [Read error: Connection reset by peer]
jokke has joined #crystal-lang
<travis-ci> crystal-lang/crystal#9e67166 (master - GIT_REMOTE_PATTERNS regexes are being overly greedy (#4132)): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/212243400
<DeBot> https://github.com/crystal-lang/crystal/pull/4132 (GIT_REMOTE_PATTERNS regexes are being overly greedy)
<FromGitter> <elorest> Someway to interact with a processes standard in and out? Process.run seems possible but I can't seem to find much documentation on it.
<FromGitter> <fridgerator> I can't speak to `Process` much specifically, but sometimes looking at the specs is better than the documentation
<FromGitter> <elorest> Good idea. Thanks.
<FromGitter> <elorest> I'm trying to interact with bluez from kemal. I was hoping to just bind to libbluetooth.so and compile everything together but all of it's params are pointers and structs that are defined, god knows where. So i'm thinking maybe I should just wrap the bluetoothctl process. Any ideas or pointers would be welcome.
<RX14> i'd definitely go with binding libbluetooth
<RX14> everything you need should be in /usr/include/bluetooth
bjz has joined #crystal-lang
<RX14> wow libbluetooth looks like a mess
<Papierkorb> just scrolled through its headers, what's so bad about it?
<RX14> lots of inline defs in the headers
<Papierkorb> most of them don't look too useful, or are easily implementable
<RX14> sure but there's little to no documentation
onionhammer has quit [Quit: WeeChat 1.0.1]
<travis-ci> crystal-lang/crystal#9e67166 (master - GIT_REMOTE_PATTERNS regexes are being overly greedy (#4132)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/212243400
<DeBot> https://github.com/crystal-lang/crystal/pull/4132 (GIT_REMOTE_PATTERNS regexes are being overly greedy)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
onionhammer has joined #crystal-lang
<FromGitter> <exts> how do you capture a block inside a macro?
<FromGitter> <exts> @sdogruyol I mean using the macro keyword eg.: https://gist.github.com/exts/f550bd2fa4e0766727070dbc972c108f
<FromGitter> <sdogruyol> hmm
<FromGitter> <sdogruyol> it should be possible but havent tried
<FromGitter> <exts> tried a few times, always got a "syntax error in expanded macro: expecting token 'EOF', not 'end'"
<FromGitter> <KCreate> i don't think that's possible
<FromGitter> <KCreate> you may be able to get the result you need via {{yield}}
daemonwrangler has joined #crystal-lang
bjz has joined #crystal-lang
<crystal-gh> [crystal] bcardiff closed pull request #4069: Add File.touch and FileUtils.touch methods (master...file-touch) https://git.io/vyvRA
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]