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> 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]
<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>
<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> 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
<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 😄
<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.
<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]
<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>
<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>
<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
<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
<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)
<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