ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | Fund Crystals 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
<FromGitter> <drosehn> you have a much better understanding of UTF-8 than I do!
<FromGitter> <drosehn> I'll save a copy of that for when I do have some time to investigate more. thanks!
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 246 seconds]
<travis-ci> crystal-lang/crystal#e5deb09 (master - Implement Hash notation for examples in docs (#3550)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176199309
<DeBot> https://github.com/crystal-lang/crystal/pull/3550 (Implement Hash notation for examples in docs)
Raimondii has joined #crystal-lang
Raimondi has quit [Remote host closed the connection]
Raimondii is now known as Raimondi
<FromGitter> <jots_twitter> riffing off of @Papierkorb: https://gist.github.com/anonymous/841f7594125243f3ea8e652524d073fa ⏎ 2 things: it looks like IO is not the slowdown, it is just the comparison of the character. also, looks like reading into a buf for the final read is not right, or not null terminated or something. Is it a bug?
onionhammer has quit [Ping timeout: 245 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
<FromGitter> <drosehn> what happens if you change `nbytes += 1` to `nbytes += c.size`
<FromGitter> <jots_twitter> it's a UInt8. so always 1 byte
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
<FromGitter> <drosehn> Hmm. I haven't tried to run this, but won't `buf.each` always process all 4096 bytes?
<FromGitter> <drosehn> ... but I'm heading home. g'night for now.
<FromGitter> <jots_twitter> maybe so, i change it to this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=582bbbf5e462097a30551ed8]
mgarciaisaia1 has joined #crystal-lang
phase_ has joined #crystal-lang
Philpax has joined #crystal-lang
mgarciaisaia1 has quit [Ping timeout: 248 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 246 seconds]
mgarciaisaia has joined #crystal-lang
onionhammer has joined #crystal-lang
onionhammer has quit [Ping timeout: 256 seconds]
mgarciaisaia has quit [Quit: Leaving.]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
mgarciaisaia has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <jwoertink> Has anyone dealt with datetime fields in a postgres database using the crystal-pg shard?
<FromGitter> <jwoertink> I'm currently doing `DB.exec({Time}, "SELECT created_at FROM members")`, but I'm running in to an error
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=582becdb31c5cbef430069ec]
mgarciaisaia has quit [Quit: Leaving.]
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
phase_ has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
snsei has joined #crystal-lang
onionhammer has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
Philpax has quit [Ping timeout: 268 seconds]
snsei has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Read error: Connection reset by peer]
Guest22552 has joined #crystal-lang
mark_66 has joined #crystal-lang
snsei has joined #crystal-lang
optikfluffel has joined #crystal-lang
gloscombe has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 265 seconds]
Guest22552 is now known as soveran
soveran has joined #crystal-lang
soveran has quit [Changing host]
pawnbox has quit [Ping timeout: 248 seconds]
j2k has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<FromGitter> <luislavena> @jwoertink `Time` does not have a default serialization mechanism. There are some tickets discussing that and talking about setting an standard, but nothing solved yet.
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
x0f has quit [Ping timeout: 260 seconds]
hako has joined #crystal-lang
x0f has joined #crystal-lang
optikfluffel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mgarciaisaia has joined #crystal-lang
hako has quit [Ping timeout: 248 seconds]
mgarciaisaia has left #crystal-lang [#crystal-lang]
matp_ has quit [Read error: Connection reset by peer]
matp has joined #crystal-lang
j2k has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
<FromGitter> <bcardiff> @jwoertink check https://crystal-lang.org/api/0.19.4/JSON.html#mapping-macro (converter option) and https://github.com/crystal-lang/crystal/issues/3106 (it was *just* fixed it on master).
snsei has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] asterite closed pull request #3521: Allow HTTP::Client block initializer to be used when passing an URI (master...http-client-blocks) https://git.io/vX0dm
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #3534: Fix broken link in class.cr documentation (master...fix-broken-class-link) https://git.io/vXKZx
<coderobe> how do i correctly turn a YAML.mapping into a string?
<crystal-gh> [crystal] asterite closed pull request #3542: JSON.mapping setter/getter generation control (master...feature/json_mapping_setter_getter) https://git.io/vXPwL
pawnbox has quit [Ping timeout: 268 seconds]
<BlaXpirit> i dunno, put quotes around it
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vXydT
<crystal-gh> crystal/master 7e62375 Luis Lavena: Automatically unpack Tuple when sorting arrays...
pawnbox has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gloscombe has quit [Ping timeout: 260 seconds]
gloscombe has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #3553: Time: JSON and YAML serialization using ISO 8601. Fixes #3106 (master...feature/time_json_yaml) https://git.io/vXyFw
<coderobe> "in /usr/lib/crystal/yaml/to_yaml.cr:12: no overload matches 'MyYamlMapping#to_yaml' with type YAML::Emitter"
<coderobe> ...
coderobe has quit [Read error: Connection reset by peer]
coderobe has joined #crystal-lang
<travis-ci> crystal-lang/crystal#8f053fb (master - Allow HTTP::Client block initializer to be used when passing an URI (#3521)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/176374035
<DeBot> https://github.com/crystal-lang/crystal/pull/3521 (Allow HTTP::Client block initializer to be used when passing an URI)
<FromGitter> <overnet> Hi All!
<FromGitter> <overnet> I have a question
<FromGitter> <overnet> What is the maximum size of regex in crystal?
<FromGitter> <overnet> some_string.match(/some_regex/)
<FromGitter> <overnet> what is the max posible size of some_regex ?
<FromGitter> <luislavena> @overnet Crystal's Regex is backed by PCRE, looking for PCRE limits might be useful
<FromGitter> <luislavena> s/looking/searching
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <overnet> @luislavena Thank you. But still, I found that crystal has alot lower limit than ruby
<FromGitter> <overnet> is it posible to increase this limit in crystal?
Philpax has quit [Ping timeout: 260 seconds]
coderobe has quit [Read error: Connection reset by peer]
coderobe has joined #crystal-lang
<FromGitter> <luislavena> @overnet if you already confirmed the limit, can you submit a ticket with the regex and the comparison against Ruby?
<FromGitter> <luislavena> AFAIK it might require a special compilation of PCRE to increase the default limits (not sure if these can be done at runtime)
<travis-ci> crystal-lang/crystal#d414252 (master - Fix broken link in class.cr documentation): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/176374757
<FromGitter> <overnet> I have tried in ruyb genarate long regex with 2607295 characters long, it works fine in ruby no errors
<FromGitter> <overnet> and have tried in chrystal regex with 33001 characters already rises an error
<FromGitter> <overnet> regular expression is too large at 33001 (ArgumentError) ⏎ [4560340706] *CallStack::unwind:Array(Pointer(Void)) +82 ⏎ [4560340609] *CallStack#initialize:Array(Pointer(Void)) +17 ⏎ [4560340568] *CallStack::new:CallStack +40 ⏎ [4560317593] *raise<ArgumentError>:NoReturn +25 ... [https://gitter.im/crystal-lang/crystal?at=582c70dadf5ae96645657a82]
<RX14> i think the best answer here is *don't do that*
<FromGitter> <overnet> @FromIRC why?
<RX14> if you need a regex that long you're doing something wrong
<RX14> If you have a regex that long it suggests to me you're automatically generating regular expressions, and so there's probably a bwatter way to do it
<RX14> if it's a big "or" list then there's much more efficient matching structures
jhass has quit [Ping timeout: 246 seconds]
<RX14> for example radix trees
<FromGitter> <jwoertink> Thanks @luislavena and @bcardiff for the answers!
jhass has joined #crystal-lang
<coderobe> my bouncer just died, has anyone mentioned me in the past 30 minutes or so?
<RX14> coderobe, no
<coderobe> k
<FromGitter> <overnet> Yes you are right, I have to generate these regexes, but I need to combine them with regexes entered by user manualy. For example:
<FromGitter> <overnet> /user\s?enters\?some\s?regex\s?here\s?(very_long_machine_regex)\d+\s?users\s?regex_again(very_long_machine_regex_again)
<FromGitter> <overnet> it creates one super long regex
<FromGitter> <overnet> and it works in ruby but very slow
<RX14> what is the very long machine regex matching?
<RX14> and what is the whole thing meant for?
<travis-ci> crystal-lang/crystal#8f053fb (master - Allow HTTP::Client block initializer to be used when passing an URI (#3521)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176374035
<DeBot> https://github.com/crystal-lang/crystal/pull/3521 (Allow HTTP::Client block initializer to be used when passing an URI)
<FromGitter> <overnet> I need to segment milion of keywords like ("buy train tickets", "sell train tickets", "sell toys" )
<FromGitter> <overnet> very_long_machine_regex it is a library of some keywords that related to each other some how
<FromGitter> <overnet> htere is example of very_long_machine_regex
<FromGitter> <overnet> r = /(\s|^)train(\s|$)|(\s|^)naked(\s|$)|(\s|^)plane(\s|$)|(\s|^)flights?(\s|$)|(\s|^)bus(\s|$)|(\s|^)rail(\s|$)|(\s|^)scores?(\s|$)|(\s|^)results?(\s|$)|(\s|^)streaming(\s|$)|(\s|^)streams?(\s|$)|(\s|^)railway(\s|$)|(\s|^)recipe(\s|$)|(\s|^)cake(\s|$)|(\s|^)sydney\sopera(\s|$)|(\s|^)hard\srock(\s|$)/ ⏎ => /(\s|^)train(\s|$)|(\s|^)naked(\s|$)|(\s|^)plane(\s|$)|(\s|^)flights?(\s|$)
<FromGitter> ... |(\s|^)bus(\s|$)|(\s|^)rail(\s|$)|(\s|^)scores?(\s|$)|(\s|^)results?(\s|$)|(\s|^)streaming(\s|$)|(\s|^)streams?(\s|$)|(\s|^)railway(\s|$)|(\s|^)recipe(\s|$)|(\s|^)cake(\s|$)|(\s|^)sydney\sopera(\s|$)|(\s|^)hard\srock(\s|$)/
<FromGitter> <overnet> so if I have a segent "trevel tickets" user will enter regex to find all keywords that releted to trevel tickets
<FromGitter> <overnet> (buy|sell(very_long_machine_regex)tickets)
snsei has joined #crystal-lang
<FromGitter> <overnet> from array of keywords ["buy train tickets", "sell train tickets", "sell toys"] this regex will return
<FromGitter> <overnet> "buy train tickets", "sell train tickets"
snsei has quit [Read error: No route to host]
snsei has joined #crystal-lang
<FromGitter> <overnet> that's what I need to implement and crystal I think is good for it just has a regex size limit
<travis-ci> crystal-lang/crystal#110b555 (master - JSON.mapping setter/getter generation control): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176375046
<travis-ci> crystal-lang/crystal#7e62375 (master - Automatically unpack Tuple when sorting arrays): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176377482
shawn42 has joined #crystal-lang
<RX14> @overnet could you try matching the beginning regex, then searching for the valid words, then verify it ends with the end regex
coderobe has quit [Ping timeout: 265 seconds]
<travis-ci> crystal-lang/crystal#d414252 (master - Fix broken link in class.cr documentation): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176374757
<crystal-gh> [crystal] MarquisdeGeek opened pull request #3554: Added Bernoulli sample (master...feature/bernoulli_sample) https://git.io/vXS3k
coderobe has joined #crystal-lang
j2k has joined #crystal-lang
<FromGitter> <maiha_twitter> Found that `FileUtils.rm_rf` exists in master branch. Can't wait 0.19.5! :)
<FromGitter> <johnjansen> @asterite whens the next release
soveran has quit [Remote host closed the connection]
mark_66 has quit [Remote host closed the connection]
<FromGitter> <paulcsmith> Is there a way to get the project root? That would make the request statements a bit less brittle. Right now if I do something like `require "../foo" and I move my file to a deeper folder then the require will break :(
<FromGitter> <paulcsmith> I'm also curious how people are handling html sanitization in .ecr templates. It seems that ECR can't be extended to automatically sanitize inputs, so are people using a helper method that escapes the content? Something like Rails used to do `<%= h my_content %>`?
coderobe has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] asterite closed pull request #3553: Time: JSON and YAML serialization using ISO 8601. Fixes #3106 (master...feature/time_json_yaml) https://git.io/vXyFw
coderobe has joined #crystal-lang
<FromGitter> <asterite> @johnjansen I just tried your code about counting newlines, in my case it works a bit more than twice as fast as in Ruby. How long is each line in that CSV?
<FromGitter> <asterite> Or better, how many lines are there in that CSV file?
<FromGitter> <johnjansen> @asterite about 1M
<FromGitter> <asterite> I see. Yes, with longer lines and few lines Ruby is faster. I'll try to investigate why
<FromGitter> <luislavena> @paulcsmith re: ECR, you can use `<%% %>` and `<%%= %>` to control escape. Seems is not documented but was added in pull #2004
<DeBot> https://github.com/crystal-lang/crystal/pull/2004 (ECR: support comments (<%# %>) and escapes (<%% %>))
pawnbox has quit [Remote host closed the connection]
<FromGitter> <paulcsmith> @luislavena Interesting. I'll try that out!
<FromGitter> <paulcsmith> Thanks
<FromGitter> <sdogruyol> @luislavena thanks
pawnbox has joined #crystal-lang
<FromGitter> <luislavena> @asterite I was look at the Rust implementation of wc to see we could get similar results: https://github.com/uutils/coreutils/blob/master/src/wc/wc.rs
<FromGitter> <luislavena> s/look/looking
<FromGitter> <paulcsmith> @luislavena Sadly, it looks like that escapes the string, but doesn't do HTML escaping. Thanks for the tip though!
<FromGitter> <luislavena> @paulcsmith I guess you will need to HTML.escape in that scenario
<FromGitter> <paulcsmith> Ok sounds good. I'll just try to remember that :D Thanks
snsei has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 246 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <asterite> @johnjansen So, we are not using LibC's memchr, which seems to be pretty fast compared to Indexable#index. That's one optimization we can make. I'm sure there are others. It's just that Ruby has like 20 years ahead optimizing all of that C code...
sustained has joined #crystal-lang
sustained has quit [Changing host]
sustained has joined #crystal-lang
sustained has left #crystal-lang [#crystal-lang]
gloscombe has quit [Quit: Lost terminal]
<FromGitter> <sdogruyol> @asterite which one is more effective? Struct or Hash?
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vXSrt
<crystal-gh> crystal/master da1b6a0 Ary Borenszweig: YAML.mapping setter/getter generation control
<crystal-gh> crystal/master c551b35 Ary Borenszweig: Updated Changelog
<FromGitter> <asterite> Mmm... depending for what, they are completely different things. But if you can use a struct instead of a hash, yeah, that will be much more efficient
<FromGitter> <sdogruyol> @asterite thanks a lot for the explanation :)
<FromGitter> <johnjansen> thanks @asterite, so whens the next release ?
<RX14> every release I think "we're doing to have parallelism in the next release"
<RX14> and it never happens
<RX14> and i'm sort of glad
<RX14> because it means I never have to think about thread-safety in my code
<BlaXpirit> you wish..
<RX14> i sort of feel that crystal is fast enough just to take the nodejs route and tell people to cluster processes across cores
<BlaXpirit> the thread safety requirements are still there, but weaker, meaning you're more likely to forget about them
<RX14> well
<BlaXpirit> nodejs has a proper concurrency model that indeed does not require thread safety
<RX14> the thing is that memory operations will always be single-threaded
<RX14> you have to think about memory safety but if your method never does IO then you can act like it's in a mutex
<RX14> which is pretty nice
pawnbox has quit [Ping timeout: 246 seconds]
j2k_ has joined #crystal-lang
j2k has quit [Ping timeout: 244 seconds]
j2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> Would anybody mind if I'd contribute Enumerable#find_index?
<Papierkorb> *`Enumerable#find_index`?
<travis-ci> crystal-lang/crystal#3c276a7 (master - Time: JSON and YAML serialization using ISO 8601. Fixes #3106): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176445159
<DeBot> https://github.com/crystal-lang/crystal/issues/3106 (Object#to_json(io) definition missing)
<RX14> Papierkorb, what does it do?
pawnbox has joined #crystal-lang
<Papierkorb> RX14: Like #find, but returns the index of the element instead of the element itself
<RX14> isn't that just #index ?
<Papierkorb> find_index is basically == enum.index(enum.find{ .. })
<RX14> no index with block
<Papierkorb> Ah now I see
<Papierkorb> Did not expect a block version
<Papierkorb> And/or, expected it to be called #find_index
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 265 seconds]
<Papierkorb> Weird that I have such issues finding it in the docs alone. never had that many issues with rubys doc. and there's nothing wrong with the crystal docs for these methods. Dunno why.
<FromGitter> <overnet> @<RX14>are you Zoro? Why are you hiding your name? Did you ever try to parse to parse the large regex and split it on the smaller ones without changing a meaning of original one? By your answers and sugestions I found out that crystal is a nice and powerful language with a huge limitation. Thank you every one for the help!
<RX14> am i who?
<FromGitter> <overnet> Zoro
<RX14> no idea who that is
<FromGitter> <overnet> I spell it wrong => Zorro
<RX14> i only go by the name RX14
<FromGitter> <overnet> ))
<FromGitter> <overnet> @<RX14> Sorry man, just massages from you shows on my screen like => From IRC (bridge bot) @FromIRC
<RX14> yes]
<RX14> well
<RX14> thats just because I prefer IRC
<RX14> instead of haveing a web app open all the time
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<travis-ci> crystal-lang/crystal#c551b35 (master - Updated Changelog): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/176462176
ddffg has joined #crystal-lang
ddffg has left #crystal-lang ["Leaving"]
<FromGitter> <drosehn> FWIW, splitting up regex's often makes sense, and can help both readability and performance. Sometimes I'll match the first part of a string, and then save away the rest of the string using `rem = $~.post_match`, and then process that.
<FromGitter> <drosehn> Sometimes it's the *middle* of the string which is very unambiguous, and thus the easiest and cheapest to match. So then I'd save `lhs = $~.prematch ; rhs = $~.post_match`, and process those parts separately.
<FromGitter> <drosehn> Maybe I should say "distinctive" instead of "unambiguous".
j2k has joined #crystal-lang
soveran has quit [Remote host closed the connection]
gewo has quit [Ping timeout: 252 seconds]
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
gewo has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]