Raimondi has quit [Read error: Connection reset by peer]
Raimondi^1 has joined #crystal-lang
Raimondii has quit [Ping timeout: 258 seconds]
Raimondi^1 is now known as Raimondi
DTZUZO has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
return0e_ has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
ashirase has quit [Ping timeout: 250 seconds]
tdc has quit [Quit: Leaving]
alexherbo23 has quit [Ping timeout: 255 seconds]
return0e has joined #crystal-lang
<FromGitter>
<Prutheus> @Prutheus ⏎ I am using Kemal: Problem: I have a post request with a lot of data (lot of images, base64 coded) .... but my Kemal is blocking this request, it is too large, how to fix that? ⏎ Please help me
<FromGitter>
<Prutheus> I am using Kemal: Problem: I have a post request with a lot of data (lot of images, base64 coded) .... but my Kemal is blocking this request, it is too large, how to fix that? ⏎ Please help me
<FromGitter>
<Prutheus> Upps. Sorry. But please
alexherbo23 has joined #crystal-lang
<FromGitter>
<watzon> What I wan't to know is why are you sending so many base64 encoded images? Why not send links? @Prutheus
<FromGitter>
<j8r> @Prutheus do a post for each image
<FromGitter>
<j8r> or use another appropriate technology to send the data
<FromGitter>
<Prutheus> because I upload them to my database via that method
<FromGitter>
<Prutheus> @j8r it is right, this would be the best solution, but is it not possible to say to my Kemal to allow larger posts?
<FromGitter>
<Prutheus> I don't want the right solution, I just want to allow a large post
<FromGitter>
<j8r> don't do this, what happens if the connection is lost?
<FromGitter>
<j8r> you will nee to reupload everything?
<FromGitter>
<Prutheus> it is ok, in this system it would be very complex to do separate posts, please help me solve this with allowing a big post
<FromGitter>
<Prutheus> @j8r you know if it is possible?
<FromGitter>
<pynixwang> store image in db is bad idea
<FromGitter>
<pynixwang> post is to big.
<FromGitter>
<pynixwang> maybe
<FromGitter>
<Prutheus> yes it is @pynixwang
<FromGitter>
<Prutheus> but I need to do it, I can't change other things in the system
<FromGitter>
<pynixwang> store in a cloud storage
<FromGitter>
<Prutheus> can you tell me how to allow such big posts in Kemal?
<FromGitter>
<Prutheus> some data + 20 images, resolution mx. 1080p
<FromGitter>
<pynixwang> folder size.
<FromGitter>
<pynixwang> hava a look
<FromGitter>
<Prutheus> circa 1MB
<FromGitter>
<pynixwang> not too big
<FromGitter>
<pynixwang> maybe crystal long string has no optimization.
<FromGitter>
<pynixwang> ...
livcd has joined #crystal-lang
<FromGitter>
<Prutheus> no there is no crash
<FromGitter>
<Prutheus> I just get a not allowed by Access Control Origin
moei has joined #crystal-lang
<FromGitter>
<Prutheus> when I have too much pictures, with just 7 it works.
<FromGitter>
<r00ster91> When there is multithreading, wouldn't it be possible to execute multiple compile stages (the ones you see with `--stats`) at once for faster compile times?
<livcd>
what has the biggest impact on compile time ?
<jhass>
they're stages because the output of one is the input of the next one
<FromGitter>
<r00ster91> ooh right
<jhass>
biggest impact so far are actually LLVM phases, codegen (AST to LLVM IR and LLVM IR to bytecode) and in release builds optimizer pass on the LLVM IR
<jhass>
not saying that there's nothing crystal can do, it probably can generate LLVM IR that's easier to digest for LLVM or simply less of it
ashirase has joined #crystal-lang
<FromGitter>
<r00ster91> yeah Crystal can definitely do something. 30k lines of LLVM IR for a hello world is way way way too much
<FromGitter>
<r00ster91> 69 009 lines of LLVM IR*
<FromGitter>
<r00ster91> not even 30k
<jhass>
well it contains the entire runtime
<jhass>
given all IO is evented by default in crystal that's simply quite a bit
<FromGitter>
<r00ster91> Wouldn't it be at least somewhat better if Crystal would generate LLVM IR that looks like asm.js? So LLVM can convert it to assembly faster. So no newlines or spaces where it's not needed, no comments etc.
<FromGitter>
<r00ster91> unless the user adds `--emit llvm-ir`, then it should generate clean, readable LLVM IR again
<jhass>
you mean generate asm.js assembly or LLVM IR like emscripten?
<jhass>
for the former I cannot imagine that speeds anything up, for the latter somebody has to try, but it would surprise me still to make a big difference
<FromGitter>
<r00ster91> asm.js-like LLVM IR I mean
<FromGitter>
<r00ster91> e.g. ` %91 = icmp ugt i64 %90, %75` becomes `%91=icmp ugt i64 %90,%75`. No extra spaces, newlines or anything. So LLVM can parse it faster
<jhass>
I really doubt it's about raw parsing performance
<jhass>
would surprise me a lot
<jhass>
that is it seemed CPU bound to me, not IO bound
<FromGitter>
<umutuluer> Hi guys
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<umutuluer> Who uses emacs for crystal
<FromGitter>
<pynixwang> no
<FromGitter>
<umutuluer> i have a trouble about crystal mode, emacs says obsolete package and deleted it when it is loading
<FromGitter>
<umutuluer> version is 26.2, system is OSX
<FromGitter>
<pynixwang> vim user
<FromGitter>
<Blacksmoke16> crystal version is 0.26.2?
<FromGitter>
<Blacksmoke16> if so thats 2 minor versions out of date, might be reason for the obsolete package error
<FromGitter>
<vladfaust> Crystal YAML has no support for tags, right? E.g. `foo: !bar baz`
<FromGitter>
<pynixwang> yaml2.0?
<FromGitter>
<vladfaust> 1) 2, I guess
<FromGitter>
<vladfaust> Ah, their specs are more complicated than I thought. Nevermind, then
<FromGitter>
<vladfaust> Well, tags are supported, but it's not easy to get them from `YAML::Any`
<alexherbo23>
I want to write a syntax highlighter for Kakoune editor
<alexherbo23>
Where I can find the list of keywords?
<alexherbo23>
Is there a place documented, or a way to retrieve it from Crystal?
<FromGitter>
<pynixwang> method annotation is implemented
<FromGitter>
<Blacksmoke16> yes
<FromGitter>
<pynixwang> NoInLine.
<FromGitter>
<pynixwang> AlwaysInLine
<FromGitter>
<pynixwang> but it 's primitive
<FromGitter>
<mwlang> When building out a JSON::Serializable class, does it not work until the whole thing is built?
<FromGitter>
<Blacksmoke16> it would just ignore the fields you dont have properties for
<FromGitter>
<advancedwebdeveloper> > no faastruby is a functions-as-a-service thing, didn't you ask two questions around that time? ⏎ ⏎ Sorry, forgot - thanks for the answer
<FromGitter>
<mwlang> I'm using TDD to build a rather big one, but just get back blank results on the first three or four fields I've already coded.
<FromGitter>
<Blacksmoke16> :thinking:
<FromGitter>
<mwlang> ok, I'm going to assume it's me and not the compiler for now. :-)
<FromGitter>
<mwlang> but can it be dynamically determined at runtime?
<FromGitter>
<Blacksmoke16> no
<FromGitter>
<dscottboggs_gitlab> What's the property of an operator called where it doesn't matter what side you put it on? Like how you can do `1_u16 - 1_i32` or `1_i32 - 1_u16` and they both mean the same thing (or don't the point is the word for that property of the `-` operator)
<FromGitter>
<dscottboggs_gitlab> idk how to google that
<FromGitter>
<dscottboggs_gitlab> lol
<FromGitter>
<mwlang> associative.
<FromGitter>
<dscottboggs_gitlab> > the associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses. ⏎ ⏎ No I mean like... lemme think of an example that isn't this way...
<FromGitter>
<dscottboggs_gitlab> never mind I found it
<FromGitter>
<dscottboggs_gitlab> I was looking for "commutative"
<FromGitter>
<Blacksmoke16> @dscottboggs_gitlab did something with that
<FromGitter>
<mwlang> so I would define serializable structs or classes for PriceFilter, PercentPrice, and LotSize in this case.
<FromGitter>
<Blacksmoke16> the challenge is actually picking which one to use
<FromGitter>
<mwlang> and I would want the JSON::Field annotation to pick on the "filterType" name.
<FromGitter>
<dscottboggs_gitlab> the solution I came up with was kinda hacky
<FromGitter>
<mwlang> macros, perhaps?
<FromGitter>
<dscottboggs_gitlab> 1 - an entry in the object had to be placed before anything else, which told what type it was
<FromGitter>
<dscottboggs_gitlab> so `{ "kind": "PriceFilter", .... } `
<FromGitter>
<dscottboggs_gitlab> but it has to be physically first in the file or it raises a runtime error
<FromGitter>
<dscottboggs_gitlab> which is the hacky part
<FromGitter>
<mwlang> as far as I can tell, Binance is consistently presenting the filterType field first for every entry.
<FromGitter>
<Blacksmoke16> seems kinda brittle
<FromGitter>
<dscottboggs_gitlab> the only other requirement is that all of the other stuff inherit from the same interface, which can even just be a blank module or a Union
<FromGitter>
<dscottboggs_gitlab> > seems kinda brittle ⏎ ⏎ I ageee
<FromGitter>
<dscottboggs_gitlab> I'd like it if there was a better solution
<FromGitter>
<dscottboggs_gitlab> you could always just read into `JSON::Any`
<FromGitter>
<mwlang> hmmm....I'm thinking to just have one Filter class.
<FromGitter>
<Blacksmoke16> sec
<FromGitter>
<mwlang> and as many properties as it takes for every permutation out there.
<FromGitter>
<dscottboggs_gitlab> @gring (I guess he's not around anymore 😦 ) discovered that it's not actually any slower to use `JSON::Any
<FromGitter>
<Blacksmoke16> kinda not true
<FromGitter>
<dscottboggs_gitlab> > and as many properties as it takes for every filter type out there.
<FromGitter>
<Blacksmoke16> the initial parsing of it is the same, afterwards serializable is faster
<FromGitter>
<dscottboggs_gitlab> oh I see
<FromGitter>
<mwlang> and do the properties as optional. or am I assuming too much that Json::Serializable will seamlessly skip properties not presented by the server.
<FromGitter>
<dscottboggs_gitlab> yes
<FromGitter>
<dscottboggs_gitlab> it does that
<FromGitter>
<dscottboggs_gitlab> gotta go
<FromGitter>
<mwlang> ok, I'll run with this idea. thanks for chiming in.
<FromGitter>
<Blacksmoke16> if they are nilable
<FromGitter>
<mwlang> I'll make 'em nilable.
<FromGitter>
<Blacksmoke16> or have default valu
<FromGitter>
<Blacksmoke16> otherwise would raise saying expected x to be a y but got nil
<FromGitter>
<Blacksmoke16> prob not super efficient, but prob good enough
<FromGitter>
<mwlang> @Blacksmoke16 thanks for that. That gives me an idea on how to improve what I just wrote (which surprisingly worked on first compile attempt)
return0e has joined #crystal-lang
<FromGitter>
<Blacksmoke16> could prob combine array/single obj into one method
<FromGitter>
<Blacksmoke16> so like if its an array do that else just assume its an obj and return a single one
<FromGitter>
<mwlang> I think, ideally, if I'm getting a bunch of exchange filters back, I ought to just capture them during serializable and then pluck and assign each one to it's own property.
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<mwlang> I recognize that what Binance did here was allow flexibility to add new filters in the future without breaking a structure they have going...so trick for maintaining this library is detecting when a new one comes along later and handling it.
<FromGitter>
<Blacksmoke16> yea, theres not really a way to do that so its bulletproof without keeping up on it
<FromGitter>
<Blacksmoke16> unless they have some file/endpoint that lists them all?
<FromGitter>
<Blacksmoke16> and the schema for each
<FromGitter>
<mwlang> just the documentation
<FromGitter>
<Blacksmoke16> oh well, just add an else block to the switch and if/when that errors you'll know
<FromGitter>
<Blacksmoke16> :S
<FromGitter>
<Blacksmoke16> or better yet, add logging to else block but just skip that one so it still works, just excludes unsupported types
<FromGitter>
<Blacksmoke16> vs raising an exception
<FromGitter>
<Blacksmoke16> holy crap, TIL the forums have a dark theme 💯
<FromGitter>
<Blacksmoke16> now github just needs to get one and ill be set
<FromGitter>
<mwlang> Do I need to write a string to float converter for the JSON serializer or does one already exist?
<FromGitter>
<Blacksmoke16> would have to make one