<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…]
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 😅
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.
<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>
<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>
<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>
<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>
<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>
<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.
<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> 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
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]
<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]
<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. 😉
<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)
<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> 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 [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>
<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.