RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.0 | 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
kgautreaux has quit [Quit: Connection closed for inactivity]
akaiiro has joined #crystal-lang
<FromGitter> <crash2burn_twitter> got a question, using abstracts seem to work on their own, but once you put them in an array I seem to be running into problems... ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b271c9763cb0b1a2d1ff08a]
<FromGitter> <crash2burn_twitter> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b271cb08cef6c0add8088e6]
<FromGitter> <crash2burn_twitter> i did find an answer in #4806 - to do `baz = Baz.new([bar] of Foo)`
<DeBot> https://github.com/crystal-lang/crystal/issues/4806 (Abstract arrays and instance variables)
<FromGitter> <crash2burn_twitter> understandable but phew, another kind of rough edge
akaiiro has quit [Ping timeout: 264 seconds]
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
akaiiro has joined #crystal-lang
<FromGitter> <OhadRau> can anyone help me figure out why this error is happening? it looks like .as doesn't understand how to deal with this alias, because the types match perfectly: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ (please excuse the million type casts, I have absolutely no idea how to get this to work) [https://gitter.im/crystal-lang/crystal?at=5b273a9cd0546c33e7029b5c]
<FromGitter> <OhadRau> really this doesn't even need to be put into a hash or anything, my optimal solution would just be saving the env.params.json directly but I can't get that to work either
<FromGitter> <OhadRau> for the record, `Hash(String, Array(JSON::Type) | Bool | Float64 | Hash(String, JSON::Type) | Int64 | String | Nil)` is the exact definition of `JSON::Type`, and it's only available as that full type because of the `.as(JSON::Type)`s expanding there
<txdv> looks like a complicated definition
<FromGitter> <OhadRau> I mean it really doesn't need to be that complicated, that's just me trying to coerce the compiler into accepting it
<FromGitter> <OhadRau> it should literally be `user.preferences = {"dashboard" => env.params.json}`
<FromGitter> <OhadRau> (it might've rendered weird in IRC because i edited a few times to fix whitespace)
akaiiro has quit [Ping timeout: 240 seconds]
akaiiro has joined #crystal-lang
<FromGitter> <faustinoaq> Hey, today my country (Panamá) plays for first time in a FIFA World Cup! 😄
<FromGitter> <S-YOU> Awesome. Cheers!
<crystal-gh> [crystal] sdogruyol closed pull request #6211: Update CI to use 0.25.0 (master...ci/update-0.25.0) https://git.io/vhDZ2
<FromGitter> <rishavs> congrats! Mine sucks at anything other that Cricket 😄
fanta7531 has joined #crystal-lang
<FromGitter> <rishavs> Have a very generic question about using sockets vs normal http. ⏎ ⏎ If I want to have a simple HN like site should I go for sockets? or use sockets only when I need realtime notifications/chat etc. ⏎ ⏎ If I had 1000 simultaneous users on my site, would having a socket based backend be very heavy on the servers? ... [https://gitter.im/crystal-lang/crystal?at=5b2761c6f3af564911d5af1e]
Philpax has joined #crystal-lang
<FromGitter> <faustinoaq> @rishavs I 1000 simultaneous users is fine, see: http://kemalcr.com/blog/2016/11/13/benchmarking-and-scaling-websockets-handling-60000-concurrent-connections/
<travis-ci> crystal-lang/crystal#e357700 (master - Update CI to use 0.25.0 (#6211)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/393513450
<DeBot> https://github.com/crystal-lang/crystal/pull/6211 (Update CI to use 0.25.0)
<FromGitter> <rishavs> it will be an interesting exercise to have a websocket only site
<crystal-gh> [crystal] straight-shoota opened pull request #6214: Remove :nodoc: from Time::Format (master...jm/fix/6206) https://git.io/vjuUk
akaiiro has quit [Remote host closed the connection]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
t0nyandre has joined #crystal-lang
<FromGitter> <fgimian> Hola! 😄
<FromGitter> <msa7> Is it bug? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b27806ed0546c33e7033421]
<FromGitter> <yxhuvud> Interesting. Someone managed to cache templates instantiations and generated code for a llvm based c++ compiler. Perhaps something for someone to look into for ideas :D
<FromGitter> <codenoid> hi, how i can hide my process from `ps aux`
<Yxhuvud> add grep -v and filter it out. Seriously, you are not supposed to have hidden processes.
<t0nyandre> Just want to know if anyone uses Vim or NeoVim and have this issue (or have fixed it?); I am trying to open a file on a ftp (4mb ~1400 lines) but it only read ~300 lines and put the file in RO. How can I prevent my Vim from doing this? :P When I download the file locally and open it everything works as expected
<FromGitter> <bararchy> @codenoid There can't be anything with good intentions behind this question hahaha
fanta7531 has quit [Quit: ...]
<FromGitter> <codenoid> @bararchy yes
<FromGitter> <codenoid> but it's for knowledge
<FromGitter> <codenoid> i don't care so much if it's good or bad xD
<FromGitter> <bararchy> lol
<FromGitter> <bararchy> The trick malware uses it create a process with vary similar name to an already running one
<FromGitter> <bararchy> or, hijack a process
<FromGitter> <bararchy> if you can get memory access
<FromGitter> <codenoid> *vary similar name* yes
<FromGitter> <codenoid> but it's totally hidden process
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <faustinoaq> > it will be an interesting exercise to have a websocket only site ⏎ ⏎ Like this one (https://www.youtube.com/watch?v=6KzPGp87YCw) 😄
<FromGitter> <faustinoaq> @rishavs ^^
<FromGitter> <faustinoaq> > Hola! 😄 ⏎ ⏎ @fgimian Hola también! 😄
Ven`` has joined #crystal-lang
<FromGitter> <hmans> What's going on, Crystal world?
<FromGitter> <bararchy> Sup @hmans
<FromGitter> <sdogruyol> @hmans great
<FromGitter> <sdogruyol> how's it going?
<FromGitter> <fgimian> haha hello hello and hi @faustinoaq ;)
<FromGitter> <hmans> Spending some (worky) time with Ruby right now
<FromGitter> <fgimian> i’m about to get sone rest but hope you all have an awesome day / evening
<FromGitter> <hmans> Hey, what'd be a good place to read up on annotations? crystal-book doesn't appear to have a chapter on them yet?
<FromGitter> <S-YOU> Best is the PR? https://github.com/crystal-lang/crystal/pull/6063
<FromGitter> <hmans> I see. Thanks
<FromGitter> <fridgerator> @hmans there is a new crystal-sqlite3 version that supports 0.25.0
<FromGitter> <hmans> @fridgerator Awesome, thanks!
<FromGitter> <hmans> I'm guessing 0.10 hasn't been pushed yet?
<FromGitter> <hmans> shards.xyz still lists 0.9
<FromGitter> <S-YOU> I don't know how shards works, but once github is up, you can use it, imo.
<FromGitter> <fridgerator> I was able to use 0.10.0 in my shard.yml
<FromGitter> <fridgerator> I had to delete my ~/.cache/shards folder
<FromGitter> <hmans> @fridgerator I'll try that. `shards update` wouldn't pick it up so far
<FromGitter> <Daggerron> remove your shard.lock and then ⏎ ⏎ ```shards update``` [https://gitter.im/crystal-lang/crystal?at=5b27ab178cef6c0add81bb0b]
<FromGitter> <fridgerator> There's some caching issue w/ the latest shards version
<FromGitter> <hmans> @fridgerator Is that the regression that was fixed in 0.8.1?
<FromGitter> <fridgerator> possibly
<FromGitter> <S-YOU> or if another shard is depends on old version, old one will be used as I noticed today on another shard.
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duane has joined #crystal-lang
<FromGitter> <hmans> @S-YOU That would be expected behavior, right? (Ignoring the discussion around optimistic/pessimistic version requirements, of course)
<FromGitter> <hmans> Anyway, the updated sqlite shard is working fine here.
<FromGitter> <hmans> This Friday I'm buggering off to a one-week solo code retreat to hack on my Crystal project \o/
<FromGitter> <hmans> The changes I had to make to crankypants to make it work with 0.25 were minimal. The biggest obstacle was having to monkeypatch Sentry. https://github.com/hmans/crankypants/pull/35/files
<FromGitter> <hmans> (There's a PR for Sentry waiting to be merged)
<FromGitter> <S-YOU> I think so
<FromGitter> <BenDietze> Hey guys, reading all the issues about multipart form data i am confused now - is multiple file upload in kemal at this available or not? Cannot construct anymore 😟 :)
<FromGitter> <fredski02> Hello, I come from the JS world. as per this documentation -> https://crystal-lang.org/docs/syntax_and_semantics/the_program.html does :: mean im trying to call a method on that object directly instead of have the program search for it as per the documentation?
<FromGitter> <fredski02> does it have the same use case in the home page HTTP server example? https://crystal-lang.org/ i.e - its used to make sure you're calling HTTP's Server method and not any other server method defined in the global?
<FromGitter> <ok2094> How can I access files from the filesystem?
<FromGitter> <fredski02> @ok2094 https://crystal-lang.org/api/0.25.0/IO.html
<FromGitter> <fredski02> or maybe more specifically -> https://crystal-lang.org/api/0.25.0/File.html
<FromGitter> <ok2094> Thanks :)
<FromGitter> <fredski02> care to answer my question just above yours
<FromGitter> <fredski02> confused by the ::
t0nyandre has quit [Quit: WeeChat 2.1]
<FromGitter> <fredski02> @ok2094
<FromGitter> <fredski02> no worries, just looked at what it means in ruby. thanks community - 15 reads and not a single reply with a relevant link, would've taken 2 seconds
<FromGitter> <fredski02> just when i moan someone replies, typical lol
<FromGitter> <ok2094> Sorry I'm new too @fredski02
<FromGitter> <hmans> If I were interested/able to dedicate time and work to the Crystal project, who should I talk to?
<FromGitter> <hmans> I won't be able to do much hacking on the compiler -- I'm thinking more in terms of project organization, documentation, ...
Jenz has joined #crystal-lang
<Jenz> Anyone know when amber will be patched/released for crystal 0.25?
<FromGitter> <S-YOU> Awesome. Hopefully core team could answer that. @hmans
<Jenz> @hmans, not core-team (far from it), but I suggest you take a look at: https://github.com/crystal-lang/crystal/blob/master/CONTRIBUTING.md
<FromGitter> <hmans> Jenz, noted.
<Jenz> ¯\_(ツ)_/¯
<FromGitter> <hmans> FWIW, I'm aware of the items listed in the Contributions guide. With my question, I was mostly thinking in terms of supporting the project organization in some fashion. Let me give you an example:
Jenz has quit [Quit: Lost terminal]
<FromGitter> <hmans> The Pony language has a really nice weekly "What's new in Pony?" newsletter/feed that gives a high-level overview of things going on in that project, including important code changes/RFCs that just landed.
<FromGitter> <hmans> Threre's no rush, though. I'm just letting my mind wander right now.
<FromGitter> <confact> Hi! How do I get specify how much bytes to get in a HTTP Request? Trying to listen to shoutcast radio from crystal.
Philpax has quit [Ping timeout: 256 seconds]
<z64> @confact you can access `#body_io` on the Response; see the `IO` API on the different read methods you can use on it
<FromGitter> <aisrael> Hmmn. Using Crystal 0.25.0, `File.extname("a.yml")` returns `""`. Should I file a ticket?
<FromGitter> <fridgerator> @fredski02 `::` looks at the top level namespace
<FromGitter> <BenDietze> @aisrael 😕 you are right . running this on 0.25.0 it gives "" to me, but if i copy the source method from github and run this, it gives the correct string 😟
<FromGitter> <BenDietze> this day is confusing to me, better go sleeping at afternoon 😄
<FromGitter> <bcardiff> damn, there is a bug in filenames with length=1
<FromGitter> <fridgerator> @fredski02 The uses are different in those 2 examples though. `::baz` is looking for the `baz` at the top level rather than the one defined in `class Foo`. Whereas `HTTP::Server` is just how your reference something within a module.
<FromGitter> <BenDietze> Yes, my tested filename was diuewhd.deuhd 😄
akaiiro has joined #crystal-lang
<FromGitter> <S-YOU> "aa.yml" is ok, but not "a.yml" xD ⏎ https://github.com/crystal-lang/crystal/commit/5a189cbe66a5ef632d8a5e1c8ba5df6cbcc4caa9
<FromGitter> <S-YOU> dot_index - 1 > (filename.rindex(SEPARATOR) || 0) ⏎ 0 > 0
<FromGitter> <BenDietze> 👍 can't arithmetic anymore :)
<FromGitter> <BenDietze> :)
<FromGitter> <bcardiff> PR are welcome https://github.com/crystal-lang/crystal/issues/6215 :-P
Jenz has joined #crystal-lang
<FromGitter> <S-YOU> not sure removing -1 will works
<FromGitter> <aisrael> Darn and I had my issue all filled up and just waiting to hit "Submit" :D
<FromGitter> <S-YOU> yes, just removing -1 has side effects xD
<FromGitter> <BenDietze> @S-YOU which?
<FromGitter> <S-YOU> tests not passing xD
<FromGitter> <BenDietze> spooky day
<FromGitter> <hmans> <3 Crystal <3 for making Ruby's squiggly heredocs the default
<crystal-gh> [crystal] bcardiff closed pull request #6208: Fix examples in Formatting and Parsing Time (master...patch-5) https://git.io/vhMZp
<FromGitter> <hmans> including Compiler errors on unexpected indentation
<FromGitter> <bcardiff> @hmans thanks for the daily hearts. They are appreciated.
<FromGitter> <hmans> \o/
<FromGitter> <j8r> Some say he'd like to marry Crystal 😏
<FromGitter> <hmans> Well, I'm already married, but if I had to have an affair, Crystal would obviously be my top choice.
<FromGitter> <j8r> Haha Crystal sound like a call-girl name - beware 😆
<FromGitter> <BenDietze> Yes, my wife is killing me daily, but not - softly 😟
<FromGitter> <aisrael> Am trying to compile Crystal 0.25.0 on OS X High Sierra 10.13.5 (with latest Xcode command line tools) from source but getting `Could not locate llvm-config`. If I then go `brew install llvm` and `brew link --force llvm`, I now start getting `ld: symbol(s) not found for architecture x86_64`. What am I missing?
<FromGitter> <BenDietze> maybe the llvm 6 error? dont know
<FromGitter> <aisrael> Thanks. Imma check the issue list
<FromGitter> <S-YOU> I have a fix for #6215, if no one working on it, I will submit for review.
<DeBot> https://github.com/crystal-lang/crystal/issues/6215 (Unable to get extension with File.extname of filenames with length=1)
<FromGitter> <BenDietze> @S-YOU 👍
<FromGitter> <fredski02> @fridgerator cheers mate
<FromGitter> <S-YOU> but, a little issue, not very readable xD
<crystal-gh> [crystal] S-YOU opened pull request #6216: fix extname with one char filename (master...fix-extname) https://git.io/fvoWC
<FromGitter> <alex-kampa> Hello, I have the function "get_group" defined in module SKO::ECDSA ⏎ ⏎ module SKO::ECDSA ⏎ def get_group(c : Symbol) ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b27cf87d0546c33e7041a40]
<FromGitter> <S-YOU> submitted #6216, let me know If I should refactor extname fix.
<DeBot> https://github.com/crystal-lang/crystal/pull/6216 (fix extname with one char filename)
<FromGitter> <reiswindy> @alex-kampa use `def self.get_group`
<crystal-gh> [crystal] asterite opened pull request #6217: Fix File.extname for filenames like "a.yml", and make the method easier to understand (master...bug/6215-file-extname) https://git.io/fvHWj
<crystal-gh> [crystal] S-YOU closed pull request #6216: fix extname with one char filename (master...fix-extname) https://git.io/fvoWC
<FromGitter> <j8r> How can I use this in a non-blocking way, with a channel I believe? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I would like to continue the program while still appending `Array(Chars)` to `@rows` (`Array(Array(Chars))`) [https://gitter.im/crystal-lang/crystal?at=5b27d324aeffcf5c023d9f99]
Jenz has quit [Ping timeout: 260 seconds]
<travis-ci> crystal-lang/crystal#8959b54 (master - Fix examples in Formatting and Parsing Time (#6208)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/393683893
<DeBot> https://github.com/crystal-lang/crystal/pull/6208 (Fix examples in Formatting and Parsing Time)
<crystal-gh> [crystal] asterite closed pull request #6217: Fix File.extname for filenames like "a.yml", and make the method easier to understand (master...bug/6215-file-extname) https://git.io/fvHWj
<FromGitter> <alex-kampa> thx @reiswindy !
<FromGitter> <BenDietze> @j8r what do you mean with this in a nonblocking way? The work must be done, so channels would only be more overhead?
<FromGitter> <BenDietze> If you switch from fiber to fiber this wont be better without concurreny
<FromGitter> <will> @bcardiff I added that code, but I'm not sure if there is something else to do?
<FromGitter> <bcardiff> Thanks @will. Nothing else :-)
<FromGitter> <will> Ok cool, where does it go?
<FromGitter> <j8r> @BenDietze I would like to show the UI while the data are still being parsed
<FromGitter> <bcardiff> I created https://gitter.im/crystal-lang/crystal-db to track all db related repos activity and see if people prefer that to resolve DB specific issues. I think not everybody cares about the discussion in DB so is a way to promote specific discussions.
<FromGitter> <BenDietze> @j8r our problem is we are only single threaded at this moment, so you can switch (with costs) from fiber a to b (simply send your wished datatype and receive channel in other fiber), but one of them must stop :)
<FromGitter> <BenDietze> so if you channel after every item, so at 1000 items there were 1000 switches :)
<FromGitter> <j8r> I can't have concurrent fibers?!
<FromGitter> <BenDietze> at this time not - you can use fibers but without blocking from IO or so there is only one active arithmetic :)
<FromGitter> <BenDietze> so you can switch via channel, but then fiber a starts working and fiber b is in limbus :)
<FromGitter> <bcardiff> `Fiber.yield` would let go the control of the current fiber. If there is no IO and the fiber is mostly about computation it might come handy.
<FromGitter> <BenDietze> But if he runs #each i wouldnt think that the scheduler yields? Without a very crumpy array#each? :)
baweaver is now known as lemur
lemur is now known as baweaver
<FromGitter> <BenDietze> misinterpreted :)
wontruefree has joined #crystal-lang
<FromGitter> <bcardiff> since the each and append is cpu only, the fiber will never release the cpu until it is finished.
<FromGitter> <j8r> I think I will do it a the object level
<FromGitter> <asterite> j8r is `data` an IO?
<FromGitter> <j8r> Its eitheir from either `STDIN.gets_to_end` or `File.open(file)`
<FromGitter> <j8r> Its part of an object creation, I can put it in a fiber
<FromGitter> <bcardiff> Well, the later should yield every now and then (not necesaryly in each line).
<FromGitter> <bcardiff> If you want to process per line then design need to change a bit and approach it as pipelines / channels IMO.
<FromGitter> <asterite> so, replace `Fiber.yield` with `sleep` and you are good to go
<FromGitter> <j8r> It works indeed but then I've directly a `receive` after :/
<FromGitter> <asterite> Or, well, I just re-read it and read "in a non-blocking" way... I don't know what you mean, so nevermind
<FromGitter> <j8r> I've another idea
<FromGitter> <j8r> This is part of a text editor
<FromGitter> <j8r> There is a `FileHandler` object that parse the file/io, and other objects like file manipulation, scrolling/move of the page/cursor and the CLI.
<FromGitter> <j8r> I can spawn a fiber, render the UI and create other objects, and then do a receive
<FromGitter> <j8r> an then redraw the UI accordingly. I think the UI will feel smoother
<FromGitter> <alex-kampa> Re "Error: 'self' was used before initializing instance variable '@g', rendering it nilable" - what's the recommneded way to deal with this. Force the variable type somewhow? And if so, how?
snsei has quit [Remote host closed the connection]
Jenz has joined #crystal-lang
<FromGitter> <bcardiff> @alex-kampa change the code to initialize variables before invoking a method / passing self as argument. If that can't be done, and you want to be on your own without the safety of the compiler: add `@g = uninitialed ... type of g ...`note that `@g`will contain garbage and you are telling the compiler to dont bother you. (and might come back sooner rather than later)
Jenz has left #crystal-lang [#crystal-lang]
That_Guy_Anon has joined #crystal-lang
<FromGitter> <asterite> I wouldn't advise using `uninitialized`. In fact, it should *never* be advised. Just let the instance variable be nilable, and add a `property! g` and use it like `self.g`
That_Guy_Anon has quit [Ping timeout: 240 seconds]
<FromGitter> <bcardiff> yes, the construct of `property! g1` will generate a runtime exception which is better definitely that using a garbage value silently. Maybe that should be added as a suggestion when the user reach the "rendering it nilable"
<FromGitter> <vectorselector> in Time::Format if we say that ⏎ `%s: seconds since unix epoch` ⏎ what is a Time.epoch_ms?
<FromGitter> <vectorselector> i have a timestamp and don't want to .rchop.rchop etc.
<FromGitter> <vectorselector> I want to parse a 13 digit timestamp. I see %s is the pattern for a unix epoch (seconds) but there is no such parsing pattern for epoch_ms in the source code. I used .rchop.rchop.rchop before and it worked, as far as ugly hacks go. ⏎ what is the recommended way to parse 13 digit unix timestamps? (epoch_ms) ⏎ thank you
<FromGitter> <bcardiff> @vectorselector `Time.epoch(seconds : Int) : Time` ?
<FromGitter> <wrq> so I need to print numbers in base 8. does anybody know how I can do that?
<FromGitter> <bcardiff> `number.to_s(base: 8)` https://crystal-lang.org/api/0.25.0/Int.html#to_s%28base%3AInt%2Cupcase%3ABool%3Dfalse%29-instance-method
<FromGitter> <wrq> thanks! I was trying to search through the API docs but there's a lot of junk named Base. I guess it makes sense in to_s.
<FromGitter> <vectorselector> @bcardiff Thank you, but I don't understand exactly. ⏎ myTimestamp is a Float64 raw type from JSON::Any ⏎ ⏎ `Time.parse(myTimestamp.to_s, "%s", Time::Location.local)` does not return valid seconds (because it's 13 digits) ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b27fc389a211e26bb6cf995]
<FromGitter> <bcardiff> the first thing is to be clear what is myTimestamp. Because current epoch has a length of 10. AFAIK
<FromGitter> <vectorselector> `"timestamp": 1514216084304,` ⏎ one example. couchdb. the document is a JSON::Any. ⏎ Context is an ecr rendered in a Kemal route. ⏎ for example `<%= Time.epoch_ms( card["timestamp"].raw.as(Int64) ) %>` ⏎ error message says `cast from Float64 to Int64 failed,` ... [https://gitter.im/crystal-lang/crystal?at=5b27fd864a5db82dd59339b7]
<FromGitter> <bcardiff> `<%= Time.epoch_ms( card["timestamp"].as_f.to_i64 ) %>` your `card["timestamp"]` is been parsed as a float somehow.
<FromGitter> <confact> Does it exist something similar to Gem::Version in Ruby for Crystal? Just want a way to check version numbers. Like 2.2 is newer than 2.1.2
<z64> anyone around that might have an understanding of https://github.com/crystal-lang/crystal/issues/5299 ? this bug is stopping my project right now and i'm not sure where to go from here :(
<FromGitter> <bcardiff> @confact https://crystal-lang.org/api/0.25.0/Crystal/Macros.html#compare_versions(v1:StringLiteral,v2:StringLiteral):NumberLiteral-instance-method
<FromGitter> <bcardiff> that works inside a macro
<FromGitter> <bcardiff> gotta go :-) 9pm here
zachk has joined #crystal-lang
zachk has joined #crystal-lang
<FromGitter> <vectorselector> @bcardiff thank you very much for your kind attention and expertise. I love crystal.
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> I've a doubt that `Array(Array(Char))` is the best, performance wise, to represent a file in a text editor - WDYT? Maybe using Slice?
<oprypin> j8r, it's ok. i'd do array string to start with
<FromGitter> <confact> thanks @bcardiff
<oprypin> i hear "rope" is popular these days
<FromGitter> <j8r> String is a bad idea because a line is very often modified
<FromGitter> <mvlootman> Is there an easy way to compare two Array(Int32) and see if they have the same values (perhaps in different order)?
<FromGitter> <mvlootman> this works ([1,2,3].sort <=> [3,2,1].sort) == 0 ⏎ but is there a better way?
<oprypin> mvlootman, if counts dont matter, use Set
<oprypin> otherwise sort is very good
<FromGitter> <mvlootman> ok, thanks just making sure I didn't miss something in the standard library
<FromGitter> <j8r> I'm wondering, is it better `Array(Char)` or `Array(In32)`?
<FromGitter> <j8r> performance wise, because for now I use `char.ord`
<FromGitter> <j8r> I think I will use this
<FromGitter> <bendietze_twitter> @sdogruyol maybe its just to me, but kemal docs were more beginnerfriendly if you wrote how to iterate over multiple file upload :) my day was fully confusing, but i need some try to find it and without reading source i gave up; there is no intellisense for help at this time 😄 while reading docs i was fully convinced there is only one file ;)
<oprypin> j8r, it's nonsense to do that. just use Char. it's an integer under the hood
<FromGitter> <jwaldrip> Has anyone seen issues with Process.fork with the latest release?
ua has joined #crystal-lang
ua_ has quit [Ping timeout: 240 seconds]
livcd has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 248 seconds]
That_Guy_Anon has joined #crystal-lang
<robacarp> Does Time have an easy to round off the subsecond parts? Or just truncate them with .at_beginning_of_second
<oprypin> well that would be the very nice way to do it if you want to truncate them
<That_Guy_Anon> i know that is probably a stupid question. but since for some reason shards fails to clone a git repo, how can i manually use the zip-file to add something as a dependency
<robacarp> That_Guy_Anon: try removing your ~/.cache/shards folder and trying again
<That_Guy_Anon> eh, still fails. has shards a problem with not using ssh but https?
<Groogy> is there a built in clamp function somewhere? I know of the min/max in Enumerables
<Groogy> i.e anything prettier than `scale = {10.0, {0.1, scale}.max}.min`
<That_Guy_Anon> nevermind, i just mistyped the reponame...twice
<oprypin> Groogy, https://crystal-lang.org/api/master/Number.html#clamp%28min%2Cmax%29-instance-method
<Groogy> ah there thanks
<FromGitter> <BenDietze> I ve been too early pleased... Multiple file upload with kemal with curl no problem because of 3 names (image1, image2, image3), but via browser input multiple is just one name (image) and ends with data of image3 - is input multiple file upload possible in kemal? So, the multipart part isn't ready in Crystal? Long way through issues and sources 😟 @sdogruyol (RFCs are terrible, i know...)
<That_Guy_Anon> out of curiosity: how does it work with the versioning of dependencies? do they get updated automatically?
hightower3 has joined #crystal-lang
<FromGitter> <LVMBDV> is there a *proper* way to embed files in crystal source via macros?
<FromGitter> <LVMBDV> or do i just `{{ system("cat file") }}`
<FromGitter> <LVMBDV> (which shows the output during compilating which is annoying)
akaiiro has quit [Ping timeout: 256 seconds]
hightower2 has quit [Ping timeout: 256 seconds]
<FromGitter> <bcardiff> @LVMBDV maybe you want https://github.com/schovi/baked_file_system ?
<FromGitter> <LVMBDV> cool shard but my case is simpler, the file is json
<FromGitter> <LVMBDV> i know its structure so i just do: ` KERNING_DATA = Hash(String, Float64).from_json({{ `cat res/data/kerning.json`.stringify }})`
<FromGitter> <LVMBDV> oops heh
<FromGitter> <LVMBDV> would be cool to have json parsing in macros
<FromGitter> <bcardiff> https://crystal-lang.org/api/0.25.0/Crystal/Macros.html have `run` and `#\`` that might be helpgul. And you would need to call `.stringify` in the result probably since you want that data as a string
<FromGitter> <LVMBDV> thanks
<FromGitter> <LVMBDV> i was just wondering if i could move the json parsing overhead to compile time as well
<FromGitter> <LVMBDV> not the case it seems
<FromGitter> <bcardiff> you could. but that requires to use the macro run to execute a program that will read the json and output crystal code that mimic that data. Like an .ecr that instead of generating html will generate crystal code
<FromGitter> <LVMBDV> good point
<FromGitter> <LVMBDV> the data is generated by a script so it would be a bit overwhelming to someone trying to understand the flow
<FromGitter> <LVMBDV> but that overhead gotta goooooo
duane has quit [Ping timeout: 256 seconds]
akaiiro has joined #crystal-lang
ua has quit [Ping timeout: 276 seconds]
akaiiro has quit [Ping timeout: 245 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 260 seconds]
akaiiro has joined #crystal-lang
ua has joined #crystal-lang
akaiiro has quit [Ping timeout: 260 seconds]
<wontruefree> I dont know your project but can you read the json at init
akaiiro has joined #crystal-lang
<wontruefree> it seems like alot of work to bake it in at compile time
<wontruefree> but it is an awesome idea for configuration and distribution
<FromGitter> <LVMBDV> i can read the json at init i just rather keep launches fast atm
<FromGitter> <LVMBDV> baking data in is awesome, i <3 ecr
akaiiro has quit [Ping timeout: 248 seconds]
That_Guy_Anon has quit [Quit: Leaving]
<wontruefree> that is a good goal
<FromGitter> <faustinoaq> > read the json and output crystal code that mimic that data ⏎ ⏎ @LVMBDV Try https://github.com/watzon/json-to-crystal
<FromGitter> <fridgerator> thor
wontruefree has quit [Quit: bye]