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> <samueleaton> Does anyone one know when the next release of Crystal will be?
<oprypin> samueleaton, very soon
<oprypin> 2017-09-25.log:[17:23:00] <FromGitter> <mverzilli> We'll tag 0.24 as soon as we merge the YAML revamp PR
<oprypin> but then some more PRs were brought up
<oprypin> samueleaton, i encouraged devs to mark must-have PRs for the next release: https://github.com/crystal-lang/crystal/milestone/22 so waiting for those, i guess
<oprypin> they're all more or less ready
<FromGitter> <samueleaton> I had a PR thats been ready for a long time that improves the playground. would it be possible to squeeze this in before the release? https://github.com/crystal-lang/crystal/pull/3652
<oprypin> samueleaton, probably, but i dont influence the decision. raise your voice
<oprypin> really sucks how this PR was treated
rohitpaulk has joined #crystal-lang
<FromGitter> <samueleaton> haha. yeah. opened for 10 months. Hey @bcardiff resolve your requested changes! 😄
kubaxvx_ has quit [Ping timeout: 240 seconds]
kubaxvx_ has joined #crystal-lang
<FromGitter> <samueleaton> There was other stuff I was going to add to the playground after this but it never closed haha. I want to add the ability to drag the divider between the code and the output left and right to increase/decrease the width the editor and the output sections. does that useful?
kubaxvx__ has joined #crystal-lang
kubaxvx_ has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
kubaxvx__ has quit [Ping timeout: 248 seconds]
kubaxvx__ has joined #crystal-lang
sotrhraven_droid has joined #crystal-lang
<sotrhraven_droid> how hard would it be to convert a ruby ffi gem to crystal
sotrhraven_droid has quit [Quit: -a- IRC for Android 2.1.35]
DTZUZU has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 246 seconds]
DeBot has quit [Ping timeout: 252 seconds]
asterite has quit [Ping timeout: 246 seconds]
DTZUZU has joined #crystal-lang
yopp has quit [Ping timeout: 258 seconds]
tliff has quit [Ping timeout: 240 seconds]
literal has quit [Ping timeout: 255 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yopp has joined #crystal-lang
tliff has joined #crystal-lang
asterite has joined #crystal-lang
literal has joined #crystal-lang
jhass has joined #crystal-lang
fiete has quit [Ping timeout: 248 seconds]
fiete has joined #crystal-lang
<FromGitter> <faustinoaq> @asterite your name is all over the compiler [0] 😆 ⏎ ⏎ [0] - https://github.com/crystal-lang/crystal/search?utf8=%E2%9C%93&q=%22ary%22&type=Code
snsei has joined #crystal-lang
mark_66 has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Papierkorb_ has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <crisward> Anyone used kemal to serve mp4's? It's missing a mime type, which I've patched for now, but I also think there maybe an issue with "Content-Range", BTW it's working on everything but Safari, desktop and IOS
rohitpaulk has joined #crystal-lang
<Groogy> Morning!
<FromGitter> <elorest> Morning.
<FromGitter> <elorest> I'm going to bed.
<FromGitter> <faustinoaq> > Anyone used kemal to serve mp4's? It's missing a mime type ⏎ ⏎ I haven't use Kemal for serving video, but I know Amber (based on Kemalyst, based on Kemal) serve mp4 video pretty well, check the home page https://amberframework.org/ ⏎ ⏎ > t's missing a mime type, which I've patched for now ... [https://gitter.im/crystal-lang/crystal?at=59ccacc4614889d4754b9c05]
<Papierkorb_> Morning
<FromGitter> <faustinoaq> Morning 😄
<FromGitter> <crisward> Yes I'll send patch, but that isn't the whole story. I suspect there maybe something wrong with the Content-Range implementation. Ambers video also doesn't work on safari.
DTZUZU has quit [Read error: Connection reset by peer]
<FromGitter> <faustinoaq> Oh, nice, so if someone find the solution, we will solve an Amber issue too 😅
DTZUZU has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <imonmyown> Morning all
<Groogy> o/ imonmyown
rohitpaulk has joined #crystal-lang
jokke is now known as schnupp|
schnupp| is now known as portwolf
portwolf is now known as schnupp|
schnupp| is now known as jokke
<crystal-gh> [crystal] ysbaddaden closed pull request #5049: parser: Fix typo in comment (master...parser-fix-typo) https://git.io/vdm9q
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <drosehn> If you're working on macOS, you might want to check those web pages with the browser called iCab. In some cases it has much better error diagnostics than other web browsers.
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <drosehn> see http://www.icab.de/
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <crisward> @drosehn thanks... using curl at the moment to check stuff.
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
flaviodesousa has joined #crystal-lang
<travis-ci> crystal-lang/crystal#97bb611 (master - parser: Fix typo in comment): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/280783539
<FromGitter> <crisward> I have some code I'm using to patch kemal while I test a fix. What determines which version gets used? I can't seem to work out if it needs to be the last or first declared or there is some other magic I'm missing.
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <crisward> @faustinoaq found the issue and sent some pull requests to kemal.
snsei has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> @crisward thank you 🙏
<FromGitter> <icyleaf> Anyone knew how to use instance variable in module? thanks.
<FromGitter> <crisward> @sdogruyol this video issue is proving to be a bit weird
<FromGitter> <crisward> safari likes one content-range, chrome likes another
<FromGitter> <sdogruyol> I've no prior experience about fighting with videos on those browsers :/
<FromGitter> <crisward> I've not had a lot, usually use vimeo / youtube
<FromGitter> <sdogruyol> same
<FromGitter> <crisward> It looks like I may need to check the user agent, but that just seems wrong
<FromGitter> <sdogruyol> anything on StackOverflow or?
snsei has joined #crystal-lang
<FromGitter> <crisward> Not found anything... firefox works with both?
<FromGitter> <bararchy> LOL welcome to the world of HTTP content types and browser "RFC"
<FromGitter> <crisward> Not sure `welcome` is the right word...
<FromGitter> <bararchy> I made a reverse proxy at work , written both client side and server side from scratch all in pure Ruby , it was the hardest thing I had to do , sockets etc.. Was easy , but compatibility was hell , IE likes it this way , chrome that
snsei has quit [Ping timeout: 255 seconds]
<Papierkorb_> crisward, what's the issue? Do these browsers actually support the codec?
<Papierkorb_> bararchy, standards are there to not be read after all, especially HTTP is hell. The caching mechanism is also some higher form of abstract art.
sp4rrow has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<livcd> I always wondered about RubyMotion's implementation of Ruby
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <crisward> <Papierkorb_> Found the issue - you can see a discussion here. It wasn't a mis-use of the standards, I think the original implementation may have only been tested against chrome. https://github.com/kemalcr/kemal/pull/405
<Papierkorb_> Then Chrome has exceptional handling for broken byte ranges
<FromGitter> <crisward> It probably looks at what it's has been sent, instead of what it's told it's been sent.
<FromGitter> <crisward> It also asks for the data in a slightly different way.
<FromGitter> <crisward> Using Crystal definitely makes you a better debugger 😉
<FromGitter> <crisward> Really looking forward to the next release of Crystal, even it's only for this change - https://github.com/crystal-lang/crystal/pull/4768/files
<FromGitter> <crisward> My logs are full of broken pipe errors without this.
<FromGitter> <crisward> Just doing a `curl -I`to any crystal powered website at the moment chucks out a lovely stack trace....
sz0 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <faustinoaq> > Using Crystal definitely makes you a better debugger ⏎ ⏎ You shoud write a guide/blog about *How to debug Crystal*, it would help a lot of crystal developers 😅
<FromGitter> <codenoid> ^ 👍
<FromGitter> <faustinoaq> @crisward Thanks you for the Kemal PR, I following it Amber too https://github.com/amberframework/amber/pull/279
<FromGitter> <petoem> @crisward i think, somewhere a number is still off by 1
<FromGitter> <petoem> oh, ok the last commit fixed it
<FromGitter> <imonmyown> Hey guys, what's the right way to add two arrays elementwise?
<FromGitter> <crisward> @faustinoaq not sure it would... I just sit mumbling WTF to myself until I spot it... 😉
Poeticode has quit [Changing host]
Poeticode has joined #crystal-lang
<FromGitter> <imonmyown> Or more specifically to add a shifted version of array to itself...?
<FromGitter> <sdogruyol> :D
<FromGitter> <crisward> @petoem Thanks for your input by the way... I was just kicking things until my video played. I should have read the spec and the code more closely.
<FromGitter> <imonmyown> I guess, this is probably the wrong place to ask questions related to crystal programming
<FromGitter> <sdogruyol> why?
<FromGitter> <imonmyown> Just a subtle feeling
<FromGitter> <sdogruyol> I wonder why do you think so
<FromGitter> <crisward> @faustinoaq Looking forward to seeing your video play on https://amberframework.org/
<FromGitter> <sdogruyol> This is the correct place to ask questions
<FromGitter> <petoem> @crisward out of curiosity, whats the header for a normal request (without range set)
<FromGitter> <crisward> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59ccfbc7b20c64242999a0ea]
<FromGitter> <petoem> thanks
<FromGitter> <imonmyown> Well I guess something's wrong with my question or it is just not possible idiomatically enough
<Papierkorb_> `ary_a + ary_b`
<FromGitter> <imonmyown> @Papierkorb_ that's just a concat, I tried it
<Papierkorb_> you may have meant this then `ary_c = ary_a.zip(ary_b).map{|a, b| a + b}`
<FromGitter> <imonmyown> Yeah, that looks like it, thanks :)
<FromGitter> <petoem> @crisward the response should contain `Accept-Ranges: bytes` or else the browser doesn't know that the server supports partial content
<FromGitter> <sdogruyol> @petoem you mean by default?
<FromGitter> <imonmyown> @Papierkorb_ is something like that possible: `c = a.zip(b).reduce(:+)`?
<FromGitter> <petoem> yeah, if there is no `Accept-Ranges`its equivalent to `Accept-Ranges: none`
<Papierkorb_> imonmyown, translated to crystal, that would be the sum. See `Enumerable#sum`)
<FromGitter> <imonmyown> Cool, got it
<FromGitter> <petoem> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges ⏎ ⏎ > The Accept-Ranges response HTTP header is a marker used by the server to advertise its support of partial requests.
<FromGitter> <petoem> > one - No range unit is supported, this makes the header equivalent of its own absence
<FromGitter> <crisward> @petoem that maybe the case, but I can't find any sites that do that...
<FromGitter> <sdogruyol> @petoem interesting
<FromGitter> <petoem> if i remember correctly, chrome for example automatically tries to use partial on mp4 and other video formats
<FromGitter> <crisward> Actually youtube has `Accept-Ranges: none`
<FromGitter> <crisward> Safari does too
<FromGitter> <crisward> Github has nothing
<FromGitter> <crisward> Google has `Accept-Ranges: none`
<FromGitter> <crisward> Perhaps it's more common to say you don't support it?
<FromGitter> <petoem> it depends on the content, if you want to serve something for download
<FromGitter> <petoem> and you don't want people to have to redl again
<FromGitter> <petoem> but you want them to be able to resume
<FromGitter> <petoem> you will have to set Accept-Ranges
<FromGitter> <crisward> @petoem that makes sense. So you're suggesting adding this to all static files?
<FromGitter> <petoem> no, not to all
<Papierkorb_> Why not?
<Papierkorb_> For small files it does no harm, and for larger files it's super helpful. Sharing local files in the office, or putting that PR video on your own server, benefit diretly
<FromGitter> <petoem> it may be good for mp4 and download files like zip, exe, etc. but for site assets like css, html i don't know what side effects it may have
<Papierkorb_> You only advertise that you support byte ranges. The UA may or may not use it. For such assets, it probably won't
<FromGitter> <petoem> you are right, maybe i am too cautious
snsei has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <petoem> @crisward i looked into `Accept-Ranges: bytes` some more. i think adding it to all static files, does no harm. 👍
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <crisward> No issues with gzip? Just wondering why it doesn't seem common...
<Papierkorb_> Uncommon for dynamic data, but CDNs/caches should support it
snsei has joined #crystal-lang
<FromGitter> <crisward> @sdogruyol WDYT?
snsei has quit [Ping timeout: 258 seconds]
<FromGitter> <sdogruyol> @crisward having it on all static files 👍
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <crisward> Added it to the send_file method, which should cover everything.
DTZUZU has quit [Ping timeout: 240 seconds]
Papierkorb_ has quit [Quit: Konversation terminated!]
DTZUZU has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
DTZUZU2 has joined #crystal-lang
DTZUZU has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
<FromGitter> <Willamin> I can't seem to find a simple method like `Dir.entries` that ignores the `.` and `..` directories. I know I can do things like `reject` to filter those out, but surely that's a common enough issue that it's already in the standard library; I'm just not seeing it. Can someone point me in the right direction?
<FromGitter> <zyriuse75> i try to do puts x and crystal tell me undefined variable ??
<FromGitter> <zyriuse75> sorry i make a mistake i did like this puts " var : #{x} "
<FromGitter> <Willamin> you missed a `{` or `do` in between `each` and `|x|`
<FromGitter> <Willamin> thanks for the help!
<FromGitter> <zyriuse75> lol ..
<FromGitter> <zyriuse75> why i didn't see it
<oprypin> Willamin, this was brought up before, it's definitely silly
<oprypin> zyriuse75, https://carc.in/#/r/2ti7
<FromGitter> <bew> @Willamin iirc it will be fixed in next release, they added `Dir.childrens` and `Dir.each_child` for this purpose
<FromGitter> <bew> was added in #4808
cerulean_ has quit [Ping timeout: 240 seconds]
Philpax has quit [Ping timeout: 248 seconds]
flaviodesousa has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
flaviodesousa has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 248 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
cyberarm has joined #crystal-lang
cerulean has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Can values be changed inside static array ?
<FromGitter> <bararchy> or does static is for both size and values
mark_66 has quit [Remote host closed the connection]
<FromGitter> <pawandubey> Is there a good way to design this kind of DSL without using macros everywhere? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59cd2f07b20c6424299adfec]
<FromGitter> <pawandubey> For context this is the DSL I was aiming for for my PEG parser lib
<FromGitter> <pawandubey> And all of those methods have to be called on a `Parser` object.
<FromGitter> <pawandubey> If I use some `with parser yield` shenanigans, that example works fine
<FromGitter> <pawandubey> But the problem is if I want to forward-declare `rule`s, I can't because of the eager evaluation.
<FromGitter> <sdogruyol> why not just yield rule?
<FromGitter> <pawandubey> So I can't define recursive grammars.
<FromGitter> <pawandubey> Because `yield` evaluates the block eagerly
<FromGitter> <pawandubey> And I don't want to `yield rule`, but `yield parser`
<FromGitter> <pawandubey> But if I explicitly yield the parser to the block, then the DSL gets nasty
<FromGitter> <pawandubey> This is how that looks with explicit `yield` for example: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59cd3019614889d4754ea2c6]
<FromGitter> <pawandubey> For any non-trivial grammar it becomes too wordy
<FromGitter> <sdogruyol> that's okay IMHO
<FromGitter> <pawandubey> :(
<FromGitter> <imonmyown> Are class variables accessible from instance methods?
<Papierkorb> bararchy, static array has #[]=
<FromGitter> <imonmyown> Sorry, silly question
<Papierkorb> pawandubey, with `with X yield` and macro magic, your imagination is the limit. You totally can catch block code yielded to your macro, register those (by name? by hash?), and then later call them by their identifier agin
<FromGitter> <pawandubey> I have actually tried that and it's not possible. Had a discussion about this with @bew and there are some catches.
<FromGitter> <pawandubey> If I try to capture the block in conjunction with `with X yield` the catch is that it has to be done inside a macro - which means that I have to make `rule` a macro. That's not something I want to do since `rule` needs to memoize stuff in the near future and that won't be very possible with a macro.
<FromGitter> <pawandubey> I am tracking the lazy-eval/forward referencing problem here and it has links to the code that I have tried https://github.com/pawandubey/pegasus/issues/1
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <imonmyown> Guys, what's the best way to generate a string of known length given a random sampling function generating a `Char`?
<Papierkorb> imonmyown, `String.new(Bytes.new(5){ rand('a'.ord..'z'.ord).to_u8 })`
<Papierkorb> You probably want to loop inside a String.build block instead though.
<Yxhuvud> Papierkorb: when defining grammars, you typically want to declare an action to be done later, so with X yield tend not to be very nice.
<FromGitter> <imonmyown> @Papierkorb Thank you `String.build` is just what I need
<FromGitter> <bew> @pawandubey maybe not wanted by your design, but you could add a level of abstraction, and use the DSL to build a graph of parsing rules, and when you want to parse a string, traverse the graph with the `parser`?
<FromGitter> <bew> or maybe I didn't understood what you're actually doing (ill and tired right now)
<FromGitter> <pawandubey> `Parser.define` builds a tree of rules - which I think is what you are alluding to.
<FromGitter> <pawandubey> Problem is that `rule`s can be composed.
<FromGitter> <pawandubey> Which brings up the forward-referencing problem.
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> can you show an example that doesn't work?
<FromGitter> <pawandubey> In this spec if you move the declaration of `rule(:abcdef)` above the other two, it'll break
<FromGitter> <bew> can't `rule` be a macro?
<FromGitter> <pawandubey> It's collecting the rules into a hash right now
<FromGitter> <pawandubey> in the future I might also want to memoize redeclarations of equivalent rules.
<FromGitter> <pawandubey> From what I understand the only way to do that is to populate a constant at compile time. But I am not sure about that approach - haven't tried it yet.
<FromGitter> <bew> sorry I really don't get it today ^^
<FromGitter> <pawandubey> That is okay. Get well soon. :)
<oprypin> bararchy, static array means static size. values can be changed
<Papierkorb> Whoa Clang sucks. "You just need to put the libtooling tool next to the clang binary!" Yeah, so like, what no one does because you'd be messing with system paths for development. great design.
<Papierkorb> Bonus points: Still no FindClang.cmake distributed with cmake or clang. That's great too.
<FromGitter> <crisward> Is there a way to get travis to use llvm 4.0 ?
<FromGitter> <crisward> it uses "Crystal 0.23.1 [e2a1389] (2017-07-13) LLVM 3.8.1"
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <crisward> It's ok, added `--no-debug` to get around the issue.
<oprypin> crisward, there's no llvm, it's crystal compiled with llvm 3.8.1, u cant change it
<oprypin> travis uses crystal's official shitty ubuntu binaries so yeah
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
<crystal-gh> [crystal] molovo opened pull request #5054: Add Int#ordinal and Int#to_ordinal methods (master...add_ordinal_methods) https://git.io/vd3JG
<FromGitter> <bararchy> So, I got a 2D Matrix ⏎ ⏎ ```matrix : Array(Array(Float64))``` ⏎ ⏎ and I want to get the position(x,y) of the highest value, what is the cleanest way to do it ? [https://gitter.im/crystal-lang/crystal?at=59cd5751cfeed2eb656143c3]
<FromGitter> <pawandubey> What do you mean by highest value?
<FromGitter> <pawandubey> The max value?
<FromGitter> <bararchy> yeha
<FromGitter> <pawandubey> `matrix.min_by { |row| row.min }` I think?
<FromGitter> <pawandubey> Make that `max_by`
<FromGitter> <pawandubey> And `max` instead of `min`
<FromGitter> <pawandubey> https://carc.in/#/r/2tjs
snsei has quit [Remote host closed the connection]
<FromGitter> <imonmyown> @oprypin another question on CrSFML: is it possible to find out character length of a screen-wide string for a given monospace font?
<crystal-gh> [crystal] asterite opened pull request #5055: Let HTML.unescape unescape all HTML5 entities (master...feature/html-entities) https://git.io/vd3UQ
<crystal-gh> [crystal] asterite closed pull request #4674: Implement HTML.escape(string) in terms of HTML.escape(string, io) (master...io-based_HTML.escape) https://git.io/vQgHz
<crystal-gh> [crystal] asterite opened pull request #5056: Regex::MatchData: fix pretty_print for nil captures (master...bug/fix-regex-match-data-pretty-print) https://git.io/vd3Ty
snsei has joined #crystal-lang
<crystal-gh> [crystal] molovo opened pull request #5057: Add time formatters for days with ordinal suffix. Includes specs and docs. (master...add_ordinal_date_formatters) https://git.io/vd3kG
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <eliasjpr> @pawandubey I tried something similar and this is how I approach it https://github.com/amberframework/amber/blob/master/src/amber/validations/params.cr
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 264 seconds]
<oprypin> imonmyown, dividing screen size by http://oprypin.github.io/crsfml/api/SF/Glyph.html#advance%3AFloat32-instance-method might work
<FromGitter> <pawandubey> @eliasjpr Thanks, I'll take a look today.
<oprypin> http://oprypin.github.io/crsfml/api/SF/Font.html#get_glyph%28code_point%3AInt%2Ccharacter_size%3AInt%2Cbold%3ABool%2Coutline_thickness%3ANumber%3D0%29%3AGlyph-instance-method
<oprypin> imonmyown, if not, well.. then it's creating Text objects with string "######..." until its bounding box width fits. bsearch can make that efficient
snsei_ has quit [Remote host closed the connection]
<crystal-gh> [crystal] RX14 closed pull request #5041: Handle malformed http requests (master...bug/4878-malformed-http-headers) https://git.io/vdtM0
<FromGitter> <pawandubey> @eliasjpr It seems like your validators don't need to reference each other - hence forward reference is not an issue.
DTZUZU2 is now known as DTZUZU
<FromGitter> <faustinoaq> > Looking forward to seeing your video play on ⏎ ⏎ @crisward Yeah, Thanks you, the fix PR was merged on amber, the core team will publish a new version of *amberframework* but before we are working in a shiny new website with good updated guides. 😉
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<travis-ci> crystal-lang/crystal#b248857 (master - Handle malformed http requests (#5041)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/281046662
<FromGitter> <imonmyown> @oprypin thanks a bunch, man.
<FromGitter> <bararchy> @pawandubey Thanks :) but this will only bring me the highst number across arrays, not the x\y position
<FromGitter> <pawandubey> @bararchy Why do you think so?
<FromGitter> <bararchy> it returns a single value
<FromGitter> <pawandubey> Yeah it returns the max value in the matrix
<FromGitter> <bararchy> yeha, I need it to return the position of that value
<FromGitter> <pawandubey> Ah, I see.
<FromGitter> <bararchy> as in ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59cd66a9177fb9fe7e15950e]
<FromGitter> <pawandubey> How do you intend to handle duplicate values?
<FromGitter> <bararchy> I wont have them, there wont be repeated
<FromGitter> <bararchy> so first found is good
<FromGitter> <bararchy> I thouat about creating a hash, with each max and the index as key
<FromGitter> <bararchy> but it's not really clean
<FromGitter> <pawandubey> If you want index then you will have to manually traverse the arrays I am afraid.
<FromGitter> <pawandubey> I don't think there's a one liner for it
<FromGitter> <bararchy> Oh, well, damn Q Matrix algorithm
<FromGitter> <bararchy> thanks for the help
<oprypin> traversing in a loop is so much cleaner in this case than trying to come up with something clever
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59cd6913bac826f0540f8ec0]
<FromGitter> <bararchy> How ugly is this ?
<Papierkorb> What about this instead `y = @matrix.index(@matrix.max).not_nil!; column = @matrix[y]; x = column.index(column.max).not_nil!`
<Papierkorb> bararchy,
<FromGitter> <bararchy> yeha, much better :)
<Papierkorb> Groogy: FYI, am slowly tackling C specific things. Also, bindgen should now find clang libraries automatically, making it much more portable. Path assumptions are gone.
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Papierkorb but tbh, we can use column = @matrix.max
<FromGitter> <bararchy> because it will already have the highest value in it
<Papierkorb> Yes you can. Didn't know based on the algorithm you posted if you're looking for x|y, or just for the max value
<Papierkorb> That'd make it `@matrix.max.max` (assuming that #max is not nilable)
<crystal-gh> [crystal] asterite closed pull request #5056: Regex::MatchData: fix pretty_print for nil captures (master...bug/fix-regex-match-data-pretty-print) https://git.io/vd3Ty
<FromGitter> <bararchy> yeha :)
<FromGitter> <bararchy> thanks man, it looks really good now
<Papierkorb> cheers
<FromGitter> <bararchy> ```y = @matrix.index(@matrix.max) ⏎ x = @matrix.max.index(@matrix.max.max)``` [https://gitter.im/crystal-lang/crystal?at=59cd6beecfeed2eb6561c023]
<FromGitter> <bararchy> so this basicly is what I need :)
<Papierkorb> bararchy, btw I convinced the team lead that ML is not the optimal path. Am now happily building a tool using CoreNLP for analysis and building pretty graphs in Neo4J out of thatt :)
<FromGitter> <bararchy> wait, so "ML is not the optimal path" is not ?
<FromGitter> <bararchy> or you meant it is ?
<FromGitter> <pawandubey> @bararchy @Papierkorb no, I don't think `@matrix.max` will return the right value.
<Papierkorb> bararchy, It's able to build simple categories unsupervised by now hehe.
<FromGitter> <bararchy> @pawandubey working
<FromGitter> <bararchy> It's really cool !
<FromGitter> <pawandubey> @bararchy test it with `matrix = [[1,2,3],[0,-1,9],[4,0,5]]`
<FromGitter> <bararchy> @pawandubey https://play.crystal-lang.org/#/r/2tk2
<FromGitter> <bararchy> there can't be negative values
<FromGitter> <bararchy> Papierkorb CoreNLP is really nice
<FromGitter> <pawandubey> `@matrix.max` compares two arrays - so it will return the third array instead of the second.
<Papierkorb> bararchy, No I told him that 1) No one in the company has any knowledge on ML 2) Me neither 3) I'd need at least 6 months with a tutor full-time to not build something completely stupid afterwards (to even think about building anything). And then showed him (Flipcharts ftw!) how the issue doesn't even require any ML-no-one-understands at all (If you disregard CoreNLP, which we didn't train though - their english model works great!)
<FromGitter> <pawandubey> It won't even work with positive values.
snsei has joined #crystal-lang
<FromGitter> <bararchy> but my examples works, it set 1.0 to the right place, read it back, and find the highst score (1.0) placment on the "board"
<FromGitter> <bararchy> i'll try your matrix
snsei_ has joined #crystal-lang
<FromGitter> <pawandubey> Yeah because your example doesn't consider all cases.
<FromGitter> <bararchy> yeha, you are right
<FromGitter> <bararchy> not working
<FromGitter> <bararchy> damn
<FromGitter> <pawandubey> Arrays are not compared like normal objects.
<Papierkorb> bararchy, if @matrix is something like `Array(Array(T))`, then try `@matrix.reduce(Int32::MIN){|max, column| { column.max, max }.max }`
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <pawandubey> Or just do it normally : https://carc.in/#/r/2tkb
<Papierkorb> (Needs another not_nil!)
<travis-ci> crystal-lang/crystal#ff85dab (master - Merge pull request #5056 from asterite/bug/fix-regex-match-data-pretty-print): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/281063665
snsei_ has quit [Remote host closed the connection]
<FromGitter> <bararchy> Thanks @pawandubey it works great now
<FromGitter> <bararchy> (with not_nil!)
<FromGitter> <pawandubey> 👍
<FromGitter> <bararchy> last question then, I need to set specific value, but when doing `matrix[y][x] = value` I get all arrays at positions x change value
<FromGitter> <bararchy> I had this issue before and got it to work, can't remmber what I did
<FromGitter> <bew> how do you init your matrix?
<FromGitter> <bararchy> @matrix = Array(Array(Float64)).new(y, Array(Float64).new(x, 0.0))
snsei has joined #crystal-lang
<FromGitter> <pawandubey> `x, y` generally denotes row, and column. Are you using them in the reverse order?
<FromGitter> <bararchy> this is my set ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59cd706db59d55b8234d02ab]
<FromGitter> <bew> @bararchy I think this sets the same array at multiple places
<FromGitter> <bew> (your init)
<FromGitter> <bararchy> the init is intended
<FromGitter> <bararchy> I want to reset all values to 0.0
<FromGitter> <bararchy> what I want for set though, is to change only the array in `y` and set array[x] values
<FromGitter> <bararchy> ```a = [[0.0.0], [0.0.0]. [0.0.0]] ⏎ change array at postion 1, to have value 1 in position 2``` [https://gitter.im/crystal-lang/crystal?at=59cd711fbac826f0540fbcb8]
<FromGitter> <pawandubey> Ah, your naming is bothering me since it's the reverse of what I am used to. But you are probably modelling it on a graph.
<FromGitter> <bararchy> @pawandubey yeha
<FromGitter> <bararchy> so ^y x>
<FromGitter> <pawandubey> It might be that Crystal does something clever and uses the same array object for the inner arrays. I know Ruby does that with the shorthand `[]` initializer.
<FromGitter> <bew> @bararchy I think you are in this case, look at the example: https://crystal-lang.org/api/0.23.1/Array.html#new(size:Int,value:T)-class-method
<FromGitter> <pawandubey> Yeah, esp > filled with the *same* value in each position.
<FromGitter> <pawandubey> So it takes that second array and puts it into all positions.
<FromGitter> <bararchy> yeha thats my issue
<FromGitter> <bararchy> I want to change it only on single position
<FromGitter> <bararchy> not across all arrays
<FromGitter> <pawandubey> You need to initialize it differently I think then
<FromGitter> <bew> use this instead: https://crystal-lang.org/api/0.23.1/Array.html#new(size:Int,&block:Int32->T)-class-method
<FromGitter> <bew> sth like this should work`Array.new(y) { Array.new(x) { 0.0 } }`
<FromGitter> <bararchy> Ohhhh
<FromGitter> <bew> @bararchy got a *revelation* ...
<FromGitter> <bararchy> Working all the way
<FromGitter> <bararchy> Thanks guys
<FromGitter> <bararchy> I hate those kind of projects hahah
<FromGitter> <bararchy> espically in 1am
<FromGitter> <bararchy> :\
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<oprypin> just realized that `forall` free variables cant be used in the return type annotation. https://carc.in/#/r/2tkf
<FromGitter> <bew> maybe a bug?
<FromGitter> <bew> do you want to add the annotation for the doc? because otherwise you don't need it in this case..