zachk has quit [Read error: Connection reset by peer]
<FromGitter>
<tgwilliams63> So I have what is most likely a pretty stupid question... I'm trying to do ``` if typeof(solution) == Array(Float64) ⏎ ⏎ ```if solution.size > 0 ⏎ all_solutions.push(solution) ⏎ end``` ⏎ ⏎ end``` where the compile time types of "solution" are "Array(Float64) | Bool | Nil". I was kind of expecting the "if typeof" statement to keep me from getting the error about size being an undefined
<FromGitter>
<tgwilliams63> Hmmmm! That definitely makes sense since I only what to do that when the solution is an array. I did a bit more reading and ended up doing ``` ⏎ if solution.is_a?(Array) ⏎ ⏎ ```for now``` [https://gitter.im/crystal-lang/crystal?at=5b286556467bd7268c1b6882]
<FromGitter>
<reiswindy> Yup, that works too!
<FromGitter>
<tgwilliams63> Thank you for the answer @reiswindy! I really appreciate you taking the time to respond
<FromGitter>
<S-YOU> lol
rocx has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
return0e has quit [Remote host closed the connection]
<FromGitter>
<bew> @tgwilliams63 the `is_a?` is the best one for this
<FromGitter>
<tgwilliams63> Thanks @bew! Good to know for future reference
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
troligtvis has joined #crystal-lang
<FromGitter>
<bendietze_twitter> While on work ... IO / HTTP::Server / kemal: is there a way to ouput the full unparsed HTTP request string? Like you would get if you just bind socket with C? :) I need the raw incoming data, just to look at if some parsing looks bad - but the parsing (after output) should going on :)
<FromGitter>
<S-YOU> how many files are you trying to load? @bendietze_twitter
<FromGitter>
<aisrael> @S-YOU I used the same data set downloaded by the `download.sh` in the Go rep. 86 `.csv.gz` files (containing 31 million lines)
<FromGitter>
<S-YOU> @bendietze_twitter , may be overwrite, HTTP::Request from_io, for last resort, if there is no way.
ua has joined #crystal-lang
<FromGitter>
<bendietze_twitter> @S-YOU :) i thought too, but maybe i overlooked something in API
<FromGitter>
<S-YOU> It does not seems to save raw headers as string, as far as I read. May be because copying string has overhead.
<FromGitter>
<bendietze_twitter> @aisrael nice try :) your Go code has to many lines for a quick look, but Crystal code is very short - have you --release?
<FromGitter>
<S-YOU> Go seems to be processing each file on each cpu (likely in parallel), that could be big difference., @aisrael
<FromGitter>
<yxhuvud> ah yes, the crystal code happens in serial. Put every processing in a separate fiber
<FromGitter>
<aisrael> The Go code can run serially and in parallel. My Crystal port is just doing sequential also. While concurrent/parallel *will* speed up overall—from quick testing Crystal takes 30x longer than Go at processing even a *single* .csv.gz file
<FromGitter>
<S-YOU> I will try to write that to use C function only on Crystal and run on each cpu core in parallel.
<FromGitter>
<aisrael> I'm so bothered by this that I'll probably try to isolate each one in turn: Gzip, CSV, and `Time.parse_rfc3339`
<FromGitter>
<bendietze_twitter> @aisrael how does your go code run in sequentiell? Another version?
<FromGitter>
<aisrael> No the Go code checks the env var `GOPAR` if set. If not, it picks the "One file at a time" strategy.
<FromGitter>
<bararchy> @asterite could you remind me how you did the memory profiling to a Crystal program?
<FromGitter>
<S-YOU> -p -s?
<FromGitter>
<bendietze_twitter> @aisrael i didnt know env gopar and cannot find as i am on work, have you a quick link?
<FromGitter>
<bararchy> that's just compile profiling, not runtime
<FromGitter>
<S-YOU> Runtime, i see. valgrind could do?
<FromGitter>
<yxhuvud> memprof should work I suppose
<FromGitter>
<codenoid> hi
<FromGitter>
<codenoid> i have 151M of sql row
<FromGitter>
<codenoid> it's taking about 9m to do select where
<FromGitter>
<bendietze_twitter> Ok, but Crystal is single-threaded at this time - Go is always multithreaded, the scheduler organizes a threadpool, you can lastly only change between one core or parallel (gomaxxprocs > 1) so if you run at least one goroutine it is concurrent while Crystal is not at this time ;) we are on the road to concurrency ;)
troligtvis has joined #crystal-lang
<FromGitter>
<j8r> @bendietze_twitter you mean parallelism
<FromGitter>
<bendietze_twitter> 😄 yes, too :)
<FromGitter>
<bendietze_twitter> But concurrency must, parallel were nice ;)
<FromGitter>
<bendietze_twitter> Yes, but we have no threadpool - real parallelism is when you can choose for example between a for-loop and a parallel-for-loop
<FromGitter>
<bcardiff> @vladfaust it's a resource maintained by jhass. it's already in his plate. But I don't have an ETA
<FromGitter>
<vladfaust> BTW, `record` doesn't allow to auto-cast initialization arguments
<FromGitter>
<bendietze_twitter> Go isnt true parallel, because the scheduler organizes the processor context, you cannot choose between go-cpu1 and go-cpu2 for example. But the scheduler is able to move goroutines between threads and those between cores, so you are limited parallel in go - but parallel
<FromGitter>
<bcardiff> @vladfaust structs are value types. `a.last` resturn anoterh instance of a point.
<FromGitter>
<bew> @vladfaust when you do `a.last` you get a copy of the last Point, then you modify the copy. The Point in the array didn't change
<FromGitter>
<vladfaust> @bcardiff, @bew I don't get why `point` variable is able to handle changes, while referencing a value within array isn't. Shouldn't `point` be immutable as well?
<FromGitter>
<vlazar> Isn't it not `a.last` that returns a copy, but `a.last.x = 43` makes a copy which can be changed?
<FromGitter>
<bew> @vladfaust you are not referencing a value within the array
<FromGitter>
<bcardiff> that is why `point.x = 42` works.
<FromGitter>
<bew> `a.last.x = 42` is the same as `point_copy = a.last; point_copy.x = 42`
<crystal-gh>
[crystal] straight-shoota opened pull request #6218: Add missing JSON field to docs generator output for constants (master...jm/fix/6202) https://git.io/fJKws
<FromGitter>
<vladfaust> So struct arrays hold values instead of references?
rocx has quit [Ping timeout: 260 seconds]
<FromGitter>
<vladfaust> If so, why can't one mutate one of its values? How to access that exact instance of Point within an array and modify it?
<FromGitter>
<bew> (I'm kinda biased as I'm the author of this possible solution ^^)
<troligtvis>
Agree.. I don't see the reason why :>
<FromGitter>
<bararchy> I want to do somethnig like that: https://play.crystal-lang.org/#/r/4bog ⏎ while keeping the same Array and not calling `a[0] = a[0] += 1`
return0e has joined #crystal-lang
<FromGitter>
<bew> Are you looking for Array#map! ?
yopp has quit [Ping timeout: 265 seconds]
troligtvis has quit []
<FromGitter>
<bararchy> I want to be able to pass a Pointer(Int32), and somehow do `ptr.value += 1` , and I managed to explain that terribly lol
<FromGitter>
<Captainfleppo_twitter> So you don’t want to iterate through an array? You only want to +1 the value at the specific pointer adress?
<FromGitter>
<bew> because by doing `pointerof(i)` you get a pointer on the local variable `i`, not on the value in the array
<FromGitter>
<bararchy> oh
<FromGitter>
<bararchy> i see
<FromGitter>
<aisrael> Aha! The good news is that `crystal run --release` brought it down to 11 mins, but still 10x slower than the Go implementation
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<bew> @aisrael you'd better compile first, then run
<FromGitter>
<bew> So `crystal build --release file.cr` then `./file`
<FromGitter>
<aisrael> I just assumed that’s pretty much what `crystal run —release` did (build to a temp file then run that). Let me check
<crystal-gh>
[crystal] sdogruyol pushed 1 new commit to master: https://git.io/fUqdi
<crystal-gh>
crystal/master 5c22fb3 O_o: Serializable, remove version conditions (#6209)
<FromGitter>
<Grabli66> Maybe you should try parallel your program's logic with process fork? I think you can deliver parser logic to child processes.
<FromGitter>
<aisrael> Yes, just `Time.now`
<FromGitter>
<aisrael> (Also, `crystal build —release` first didn’t really do much: still 11 minutes.)
<FromGitter>
<S-YOU> I think read the file by chunks, parse gzip as stream, and parse and callback csv as string would be fastest for that purpose, and not much memory allocation happened.
<crystal-gh>
[crystal] straight-shoota opened pull request #6219: Add support for multiple Etags in If-None-Match header (master...jm/feature/etag-multi) https://git.io/fUgv9
<FromGitter>
<Captainfleppo_twitter> or maybe it aint nesting.. it is just a parameter to make it nilable?
<FromGitter>
<bew> yes
<FromGitter>
<Captainfleppo_twitter> great. Make sense
<FromGitter>
<bew> if you look at the example JSON you'll see
marius has joined #crystal-lang
<FromGitter>
<Captainfleppo_twitter> @bew : I saw that you removed the return type from the method. And then return only if it `success`. By removing it will the compiler then now that it might return something? Like an optional. Or is there an optional type ? `: Joke?` or something.
<FromGitter>
<Captainfleppo_twitter> for example I use fiber and want to return an Array of `Joke`. Will it work the same way?
<FromGitter>
<fgimian> Dear guys, I'm attempting to change the behaviour of the `Process` class. Sadly I can't subclass it because in many places, the class references methods using its own class name (e.g. `Process.fork_internal`). ⏎ ⏎ So I've tried to add my own `initialize` method which has 2 extra paremeters and first calls the original `initialize` method ⏎ ⏎ `````` [https://gitt
<FromGitter>
<bendietze_twitter> @aisrael sorry i had not much time to read the code, but you are running goroutines, so why you don't spawn the Crystal version? The main fiber is 86.times waiting for IO? In this Crystal code you didn't do something while blocking?
<FromGitter>
<bew> @Captainfleppo_twitter yes, it will return a union type, between Joke and Nil, which can be written as `Joke | Nil` or `Joke?`
<FromGitter>
<fgimian> If I change the call to `Process.initialize`, then I end up with `this 'initialize' doesn't explicitly initialize instance variable '@pid' of Process, rendering it nilable`
<FromGitter>
<fgimian> perhaps I need `previous_def` actually
<FromGitter>
<bew> @Captainfleppo_twitter if you want `get_joke` to return `Joke` only, you need to handle the case where `response.type` is not `"success"`, with an `else` clause, and either a raise, or a dummy joke, or something else
<FromGitter>
<Captainfleppo_twitter> yes yes, that I understand :)
Jenz has joined #crystal-lang
<FromGitter>
<Captainfleppo_twitter> @bew sry to bother you. But in this case. IF i would get a `nil` from the response. How can I filter that out so I can return `Array(Joke)` ?
<FromGitter>
<sdogruyol> @bendietze_twitter can you open an issue in Kemal repo?
<FromGitter>
<bendietze_twitter> @sdogruyol yes i will do next time, but tonight i am dreaming of a possible Windows WSL error - i forgot to do all of this on linux 😟 😄 on Windows i lastly got two errors: HTTP::Multipart.parse(env.request) runs into kemal 500 error EOF reading delimeter close_delimeter , and iterating over the env.params.files hash only possible via curl uploads, because input multiple from browser is only one
<FromGitter>
... image tag name... Which one do you prefer? Or whats the correct way to do? :)
<FromGitter>
<bendietze_twitter> Because of that i am searching for an solution to look at the unparsed raw http post request thats incoming to Crystal to check things like boundary and rnrn and all data from browser to clear the things up (yeah, i know, the browser should be correct, but its the first step in my mind: look whats true incoming ;)
<FromGitter>
<sdogruyol> @bendietze_twitter I'm not sure
<FromGitter>
<sdogruyol> I believe, multiple images can be an array or under different names
<FromGitter>
<bendietze_twitter> @sdogruyol yes, i assume, i will try to get closer next time
Philpax has quit [Ping timeout: 256 seconds]
<FromGitter>
<bendietze_twitter> BTW, in my opinion it would be e great benefit to Crystal if we have an solution to view the incoming raw network content to ensure everything is ok - its the only unknown ressource, so while erroring the programmer would be able to check the data :) till now i didn't found one but maybe i haven't looked at all...
<FromGitter>
<bendietze_twitter> I know this comes in chunks, but its just needed for debugging, so its ok to output the data after complete parsing (like in kemal: post ... do ..) - at this time all kinds of requests are done and raw data is completed too, so its just a one time slice :)
<FromGitter>
<sdogruyol> btw long time no see @crisward , how 's it going?
<FromGitter>
<fgimian> @bararchy in this case, because a Hash is mutable, when a shallow copy is done, it will create another instance of the class an assign the new instance variable to the old one, which is essentially going to pass over its memory address. As such, it is actually shared. ⏎ ⏎ Compare this with an immutable type like a String and you'll see the difference: ⏎ ⏎ ``````
<FromGitter>
<fgimian> @bararchy Just one final note. I just looked at the source of JSON in 0.24.2 and ultimately, it does use a similar mechanism to 0.25.0 so I suspect it's another change in the language itself that changed this behaviour. Maybe it would be worth raising an issue on? (FYI I'm still a new guy to Crystal, so perhaps someone else here can confirm if it's worth doing)
<FromGitter>
<fgimian> oh haha nice
alex`` has joined #crystal-lang
<FromGitter>
<fgimian> Here's my newest little "patch" to add functionality
<FromGitter>
<Grabli66> Almost. But i want to check by parent class One
<FromGitter>
<fgimian> ooh gotcha
<FromGitter>
<fgimian> sorry
<FromGitter>
<fgimian> my brain is not working well today, been a long day ... 😫
<FromGitter>
<fgimian> hehehe
<FromGitter>
<crisward> @sdogruyol ok... Not been around here much since we decided to hold off on pushing Crystal in production until it hits a stable release. We have a handful of simple marketing sites using it with a 'proto-type' of a crystal version of our content management system. It works ok, but the immature eco-system around crystal means fewer off the shelf solutions to problems, and a few too many unknowns right now. I'd
<FromGitter>
... like to run both versions in parallel, but that means double the bugs to fix and confusion over support. Good to see a new release come out, hoping it becomes a less rare sight.
<FromGitter>
<fgimian> i think you need to use Macros @Grabli66
<FromGitter>
<Daniel-Worrall> Is it intended that Module#class returns class?
rohitpaulk has quit [Ping timeout: 260 seconds]
Jenz has joined #crystal-lang
<FromGitter>
<hmans> Here is everyone's <3 for today. <3!
<FromGitter>
<meraxes_twitter> This may be a ridiculous question but here goes: https://play.crystal-lang.org/#/r/4bwj ⏎ ⏎ In a parent class I define a class. var with an array of class `Property`. Within child classes, I override the class var with subclasses of `Property`. This blows up. Can I define the parent classes class_var in such a way that it can contain any subclass of `Property`? Or is it even possible to override
<FromGitter>
<faustinoaq> Now, we can see what things are missing in Amber documentation 🎉
Jenz has quit [Ping timeout: 256 seconds]
wontruefree has joined #crystal-lang
hightower2 has joined #crystal-lang
<FromGitter>
<paulcsmith> The new shards 0.8.1 fixes the update command, but is there a way to get the new version of shards or does it require a new version of Crystal?
<FromGitter>
<straight-shoota> you can manually install the latest shards
<FromGitter>
<straight-shoota> see readme
<FromGitter>
<paulcsmith> Ah, thank you!
<RX14>
if you run osx the formula can be updated
<RX14>
release a pkgver 2 with the new shards
<RX14>
i dont have an osx machine to do it
<RX14>
but it's just homebrew
<RX14>
if you can send a PR you can update shards
<FromGitter>
<paulcsmith> I'm not sure I understand. A PR to Crystal?
<RX14>
no
<RX14>
to homebrew
<FromGitter>
<paulcsmith> I use macOS but I'm not familiar with the Crystal or Shards release process
<FromGitter>
<paulcsmith> I'll look into it
<RX14>
homebrew is just a git repository of recipies to install stuff
<RX14>
the crystal core team doesnt have more say than you over what happens with homebrew
<RX14>
as for the linux packages...
<FromGitter>
<paulcsmith> The one problem I see with updating the homebrew package is that people that already have crystal 0.25 would need to reinstall it.
<FromGitter>
<paulcsmith> Who usually handles making a new homebrew release, or is it automated somehow?
<RX14>
no you just send in a pr
<RX14>
change the url
<RX14>
update the hashes
tax has quit [Quit: Leaving]
<RX14>
bump the pkgrel
<RX14>
or whatever homebrew does
<FromGitter>
<paulcsmith> Yeah I get that, I was just curious how the normal release process goes. I assume someone from the core team typically handles it.
<FromGitter>
<paulcsmith> Or is there an automated process?
<RX14>
nah
<RX14>
well its sometimes someome from the core team
<FromGitter>
<paulcsmith> So for example, in cases like this, I think it would be cool if a core team member could run `bin/release mac_os` or something and it would generate rewrite the formula with the newest versions of Crystal and shards, run the tests, and then you just need to open a PR when you're ready
<FromGitter>
<paulcsmith> That way anyone on the core team could release regardless of what OS they are on
<FromGitter>
<paulcsmith> Anyway, not necessarily a priority, but an idea for the future
<RX14>
i mean I could release
<RX14>
i just cant test it
<RX14>
maybe I will
<RX14>
yeah i'll just do it they have CI anyway
<FromGitter>
<paulcsmith> Good point!
<FromGitter>
<paulcsmith> And thank you :)
<FromGitter>
<bcardiff> @paulcsmith that script is neat 😎
Jenz has joined #crystal-lang
<FromGitter>
<paulcsmith> Glad you like it :) Feel free to steal it if you find it helpful
<FromGitter>
<paulcsmith> It made releasing new versions of Lucky way less error-prone and much faster
<FromGitter>
<meraxes_twitter> And it’s bacK. nvm
wontruefree has quit [Quit: bye]
<rocx>
silly newb question: does Process need to be require'd in order to use Process#chroot? i keep getting an error that it's an "undefined method 'chroot' for Process:Class".
<RX14>
what version of crystal
<RX14>
chroot was 0.25.0
<rocx>
(crystal 0.24.1)
<rocx>
...oh.
<rocx>
what unfortunate timing for me to check the API.
<rocx>
the commit added it back in april so i though it would've still been 0.24.*.
<RX14>
0.24.1 was released a loong while ago
<RX14>
0.24.2 was even released before 0.25.0
<RX14>
why aren't you on latest version?
<rocx>
it's the only version in the void linux repos.
<rocx>
think i'll go ahead and upgrade now.
<RX14>
yeah
<RX14>
if its void should be easy to update it yourself
<RX14>
honestly if void was a serious distro you wouldn't have to ask the maintainers to update...
<RX14>
the arch maintainers for crystal are always on it and watching for releases#
<FromGitter>
<LVMBDV> maintainer for the crystal package on void here
<FromGitter>
<LVMBDV> my void install came tumbling down the night before a local ctf so i had to get a new environment working quickly so i switched to debian
<RX14>
yeah but 0.25.1
<RX14>
0.25.2 has been hout for... 3 months?
<RX14>
0.24.2*
<RX14>
and 0.24.1*
wontruefree has joined #crystal-lang
<rocx>
man i am waaaaaaay behind on the release cycle. i literally just caught that there was a package a couple of days ago.
<rocx>
not a fan of the bootstrapping imo but guess it's cool to get it to work like that.
<FromGitter>
<LVMBDV> i was working on a void package dev workflow using docker but other things came up
<FromGitter>
<LVMBDV> could you update the package rocx
<rocx>
i think i can get to it.
dragonkh has joined #crystal-lang
* rocx
remembers the pain it was to update the adobe-flash-player package for void.
<RX14>
crystal should be a lot easier
<dragonkh>
hey guys - sorry I don't come here that much - but I'm super focused on SushiChain crypto project at the moment - but I just wanted to say well done on the 0.25 Crystal release - great work :)
<dragonkh>
I should have said hey people - sorry ladies
<FromGitter>
<LVMBDV> rocx: just try to update the version variables and see where that takes you
<FromGitter>
<LVMBDV> or i could do that and use the CI to debug
<rocx>
i presume `loop do` is no longer valid syntax as well?
<RX14>
yes it is
<rocx>
maybe i falsely remember a PR about getting rid of it.
<RX14>
loop do works fine
<RX14>
its the argument to the block
<RX14>
loop do |i| no longer works
<rocx>
wait wtf was i doing for there to be an "error instantiating method loop()"?
<rocx>
now it works.
<FromGitter>
<LVMBDV> i will try to get the package up to date within this week rocx
<rocx>
i'm on it. just taking a while to get the repo set back up.
<Yxhuvud>
you can do Int64::MAX.times if you need the block argument anyhow. (or hmm. I wonder if UInt64 would work too or loop infinitely)
<wontruefree>
is there an issue or any docs on what it would take to get to static compilation?
<RX14>
yeah, rewriting glibc and openssl
<FromGitter>
<kingsleyh> @girng maybe you would consider using our blockchain project to hook up a real economy using tokens or whatever :)
<RX14>
luckilly someone already did it for us
<RX14>
called it musl and libressl
<RX14>
and then made a distro based on them called alpine
<FromGitter>
<LVMBDV> lol
<RX14>
which is why the only thing crystal supports static linking on is alpine
<wontruefree>
I was looking up that yesterday from some of the conversation
<wontruefree>
I dont understand why a rewrite is necessary is it a licensing issue
<wontruefree>
or an issue with those libraries
<crystal-gh>
[crystal] bcardiff opened pull request #6223: [WIP] Arithmetic with Overflow (master...feature/checked) https://git.io/fmbTP
<RX14>
>30 commits
<RX14>
that'll be a hell of a PR to review
<FromGitter>
<bcardiff> It's >30 for making the review easier actually.
<RX14>
i'm looking forward to reviewing it actually
<RX14>
or lt least looking forward to merging it
<RX14>
and then looking much much more forward to making checked the default
<FromGitter>
<bcardiff> I thought that you most of all would like how the commits are divided.
<FromGitter>
<bcardiff> 👍
<RX14>
debug should always be checked imo
<RX14>
and release should have the option
<RX14>
ah well thats minor
<FromGitter>
<bcardiff> Of course the CI complains a bit in the first round :-P
<Yxhuvud>
the only thing I don't like about that is that unchecked/checked doesn't betray intention all that well. Newbies will have no idea what it is about without having to google it
<RX14>
my browser's too busy crashing to see what the CI broke over
<RX14>
every time I open circleci my whole browser ctrashes
<RX14>
I don't know how they did it
<RX14>
but they have
Jenz has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<FromGitter>
<meraxes_twitter> friends don’t let friends write javascript
<FromGitter>
<LVMBDV> i wrote a javascript "script" to precalculate a kerning table to embed into a crystal app yesterday
<RX14>
i'll be glad if I have the time to write my own CI server for crystal like i've always wanted
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<LVMBDV> it was in javascript because npm has this cool package pdfkit
<FromGitter>
<meraxes_twitter> as in, you can precalculate what width the text will be?
<FromGitter>
<LVMBDV> exactly
<FromGitter>
<LVMBDV> only letters and diagrams were enough tho
<FromGitter>
<bararchy> RX14 that sounds like an interesting Project
<RX14>
i have some ideas
<FromGitter>
<bararchy> where does it stand priority wise between your 9000 other projects?
<FromGitter>
<bararchy> hahahahahah
<FromGitter>
<bararchy> don't get swamped
<FromGitter>
<bararchy> I'm stil waiting on PCHANNEL
pwned has joined #crystal-lang
<pwned>
hi, are there any shards similar to three.js ?
<pwned>
that makes it very easy to visualize some of the neuroevolution stuff I want to program
<FromGitter>
<bararchy> Woot neuroevolution
<pwned>
I wrote a working prototype in ruby but it is kinda slow
<FromGitter>
<bararchy> can you link? sounds interesting
<pwned>
it's dog slow during mutations and crossovers
<pwned>
I wanted to switch to crystal to see if it helps with the speed a little bit
<FromGitter>
<Captainfleppo_twitter> The api im using are having the keys as capitalize. `“Title” : “Jurrassic Park”` is there a way to use `JSON.mapping` or do I have to do a workaround? ⏎ ⏎ ```Syntax error in main.cr:6: expecting token ')', not ':' ⏎ Title: String``` [https://gitter.im/crystal-lang/crystal?at=5b294568a645d134ab0bf1a9]
<pwned>
bararchy I'm looking
<FromGitter>
<bararchy> pwned we got massive improvments
<FromGitter>
<bararchy> also started from Ruby
<FromGitter>
<bararchy> and went to Crystal both memory went down, and speed went up crazy
<FromGitter>
<LVMBDV> @Captainfleppo_twitter JSON.mapping can take a hash literal instead of named parameters, see the doc while i whip up an example: https://crystal-lang.org/api/0.24.2/JSON.html right under usage
<pwned>
it does set me up with a context window and gives me a way to loop on input
<pwned>
however, crsfml doesn't have 3d drawing primitives
<pwned>
(neither does sfml)
<FromGitter>
<bararchy> that's true
<pwned>
I'd have to write my own "primitive group" logic
<pwned>
I would ahve to write a scene graphs and do transforms on those manually
<pwned>
which takes away all the fun from focusing on the actual algorithm
wontruefree has quit [Quit: bye]
zachk has joined #crystal-lang
zachk has joined #crystal-lang
<rocx>
@LVMBDV "Error: you've found a bug in the Crystal compiler. Please open an issue..." yeah it might be a bit more involved than upping the values. appears that i ran out of memory in that compiling.
<FromGitter>
<confact> Hi again guys. I am new with crystal as you guys probably already know. I have problem to call a macro method: compare_versions. i just get `undefined method 'compare_versions'`
<FromGitter>
<LVMBDV> @rocx i'll take a look then
dragonkh has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
<FromGitter>
<bew> @confact you need to call it from a macro
<pwned>
so we don't know the encoding. Madness ensues
<oprypin>
i'm not sure if there is any well regarded json spec
<oprypin>
encoding shouldn't matter, anyway
<oprypin>
it can be handled at an earlier stage
<FromGitter>
<confact> Sorry for being a person who want to avoid anything to do with XML, I don't care about the attributes here, as these XML dont have attributes. I will try to port the XMLConverter to crystal.
<pwned>
would be courteous to mention encoding when you are transmitting through the wire
<oprypin>
confact, maybe you don't want to deal with everything having the type Hash | Array | String
<oprypin>
if you can even define that (it's also not recommended cuz recursive aliases might be deprecated)
<oprypin>
there has to be a better way
<oprypin>
turning into Hash is definitely not it
<oprypin>
though it might work with enough force
<pwned>
generate class from schema!
<pwned>
or use delphi
<FromGitter>
<LVMBDV> rocx i have tried to get xbps running in a chroot then tried a docker image, both failed, i give up for now
<pwned>
I wonder if there is an embedded database engine with the xpath capabilities of mssql
<Yxhuvud>
the from_hash method on xml in activesupport is probably legacy to support providing hashes in a structure meant for nested sql records. remember, rails is old enough to be from the time where it wasn't obvious yet that json would win out.
<pwned>
then you could embed and use a query instead of re-inventing xml
<oprypin>
confact, then just use Crystal's XML classes
<FromGitter>
<schoening> @bendietze_twitter was on a trip to Amsterdam for a week so no progress ^^, and moving apartment right now.. AND got a freelance project I have to try and finish in the next 4 weeks. So it'll be a while ... 😟
<rocx>
lvmbdv: closed some other things out too. no longer getting out-of-memory issues, but some other vauge error. "undefined reference to `LLVMInitializeInstCombine'"
<wontruefree>
it looks like shoutcast has a json format but you might have to enable it on the server
<FromGitter>
<schoening> But one thing I will do in the next few days is make an example repo to get help from all the smart people here to help me stop getting broken pipe errors in my websockets because unless that gets done no game will ever be made.
<FromGitter>
<faustinoaq> > <bararchy> @asterite could you remind me how you did the memory profiling to a Crystal program? ⏎ ⏎ @bararchy Try https://github.com/Groogy/trashman
<FromGitter>
<BenDietze> @schoening no hurry, good luck 👍
<FromGitter>
<Daggerron> @oprypin Oh thanks !
<oprypin>
no idea what you want to achieve with this but w/e
<FromGitter>
<Daggerron> @oprypin It's an handler for my db so that I can read a specific type and make a more general function rather than one for every type
<oprypin>
Daggerron, or maybe you should make one for every type
<FromGitter>
<forkev_twitter> i'm super cheap. I usually just replace all instances of ' to '' and call it a day for internal projects for sql sanitation. I know my risks, but I don't trust *SOME* data formats.