<crystal-gh>
[crystal] Sija opened pull request #5618: Add additional parameters for Logger#new (master...logger-new-with-named-args) https://git.io/vNguy
illyohs has quit [Remote host closed the connection]
illyohs has joined #crystal-lang
<FromGitter>
<Dillybob1992> is it possible to add something to the array that db.query_all returns? for example ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ im trying to add another named tuple to it but it won't let me [https://gitter.im/crystal-lang/crystal?at=5a63e9275ade18be39a0e793]
qard has joined #crystal-lang
qard has quit [Quit: qard]
hightower4 has quit [Ping timeout: 248 seconds]
<FromGitter>
<j8r> you can also try with a Hash
<FromGitter>
<j8r> ... not sure. Anyway the problem isn't here
<FromGitter>
<j8r> If I'm corret a Named Tuple is immutable, you can't change it's length
<FromGitter>
<Dillybob1992> Where would the problem be?
vivus has quit [Quit: Leaving]
snsei has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
hightower4 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
alex`` has quit [Quit: WeeChat 1.9]
DTZUZU has quit [Ping timeout: 248 seconds]
jnyw has quit [Quit: WeeChat 2.0.1]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
<FromGitter>
<bararchy> If anyone is interested, SHAInet has just released version 2.0.0 with Convolutional neural network support. ⏎ https://github.com/NeuraLegion/shainet
<greenbigfrog>
morning. Not sure if I'm blind, but where can I specify how BigDecimal rounds?
<FromGitter>
<asterite> It's easy, you can benchmark it
<FromGitter>
<Dillybob1992> Really lol
<FromGitter>
<Dillybob1992> Well, crap just started editing mah code. @shelvacu you see?
<FromGitter>
<asterite> Yes, there's no reason the second one should be faster. It deals with unions. The first one will parse directly to a string, no unions involved
<FromGitter>
<asterite> You should always ask for a reason :-P
<FromGitter>
<asterite> Plus the first one is type safe
<FromGitter>
<Dillybob1992> @asterite Yeah, I asked u about that question last week or so, had to scroll all the way up to find out your message. Took me literally 10 minutes cause gitter's search sucks.
<FromGitter>
<Dillybob1992> Well, ima use Hash(String, String) then for now :D
<Groogy>
there is a whole benchmark module built in to the standard lib
<Groogy>
you should check it out, it's quite helpful and easy to use
snsei has quit [Ping timeout: 246 seconds]
<crystal-gh>
[crystal] Sija opened pull request #5620: Allow leading and trailing whitespace in number strings (master...allow-surrounding-spaces-in-number-strings) https://git.io/vNgdV
<greenbigfrog>
somehow running the specs crashes my old shitty laptop I run crystal on
dragonkh has joined #crystal-lang
dragonkh has quit [Client Quit]
<FromGitter>
<asterite> That's the real power of Crystal
<FromGitter>
<bararchy> XD
<RX14>
only heard of that happening on WSL greenbigfrog
<greenbigfrog>
interesting. it's a dell latitude d830
<greenbigfrog>
I guess I'll have to port crystal-pg to use BigDecimal...
<RX14>
even the lower-overhead C FFI than ruby would provide a big boost i suspect
<FromGitter>
<Dillybob1992> is that opengl 3.0?
<Groogy>
That's opengl 4.6
<FromGitter>
<Dillybob1992> o
<Groogy>
Yeah, from what I remember last time I did Ruby and 3D was just the fact looping over objects was insanely expensive for Ruby to do
<FromGitter>
<Dillybob1992> engine i use (godot) use 3.0, i thought that was latest.. lol
<Groogy>
Godot has crystal bindings?
<FromGitter>
<Dillybob1992> i wish
<Groogy>
also I think Godot actually run on OpenGL ES 2.0
<Groogy>
though equivalent would be OpenGL 3
snsei has quit [Ping timeout: 265 seconds]
<FromGitter>
<Dillybob1992> there is a nasty opengl bug on windows only, on nvidia cards. where the initialize of opengl delay scales linearly to the amount of opened instances u have. pretty funny/sad. i reported it
<FromGitter>
<bararchy> I keep getting malformed responses from servers with HTTP::Client, the thing is it's really hard to create a small example :\
<FromGitter>
<bararchy> I guess crystal HTTP::Client wont encode the \n to %0A, so this might be a bug in the URI class
<FromGitter>
<bararchy> though there are two issues here, one, HTTP::Client should not get index error, and two, the URI encoding is not working for newline
<FromGitter>
<bararchy> though, it seems that the issue is a little dipper, testing against other sites will not generate the exception, which means the issue is in the response from the server ?
<greenbigfrog>
How can I read a BigDecimal in a JSON mapping?
<FromGitter>
<l3kn> In ruby there is a list of allowed chars (A-z0-9$_ etc) and everything else will be escaped
<FromGitter>
<l3kn> but you are right, that is not the main issue in your case
<greenbigfrog>
`no overload matches 'BigDecimal.new' with type JSON::PullParser`.... wtf... this has been merged into master and I'm quite sure I'm using master compiler
<FromGitter>
<bararchy> @l3kn we might need to change the escape logic to work on a white list instead of black list, this is better to handle end cases like this
<FromGitter>
<bararchy> @l3kn seems like URI.escape does handle `\n`
<FromGitter>
<bararchy> > puts URI.escape("\n")
<FromGitter>
<bararchy> > puts URI.escape("\n")
<FromGitter>
<bararchy> damn
<FromGitter>
<bararchy> how do I cann the crystal bot ?
<FromGitter>
<l3kn> Oh, I was looking at the wrong `escape` function
<FromGitter>
<l3kn> Forget what I said, the function above that works just like the ruby version
<FromGitter>
<bararchy> yeha, figured :) ⏎ So still there is an issue with the wierd OOB error
<RX14>
the crystal spec suite needs to define *one* data directory and *one* temporary directory (which can be overridden when cross-compiling) and specs need to use them
<RX14>
because the state of cross-compiling the spec suite is just terrible
snsei has joined #crystal-lang
<RX14>
I've just checked out the crystal git repo in C:\data\programming\...\feature\windows-spec on my windows VM
<RX14>
because there's no other way to do it
<RX14>
oh, and windows's suggested tempdir isn't writiable! or something
<RX14>
you can create files in that directory but not delete them
<greenbigfrog>
still getting `no overload matches 'BigDecimal.new' with type JSON::PullParser`
<FromGitter>
<bararchy> RX14 what tempdir does win uses? c:\temp ? or c:\tmp ?
<RX14>
neither lol
<RX14>
it's per-user
<RX14>
in the appdata folder
<FromGitter>
<bararchy> Oh, makes sense
<FromGitter>
<l3kn> @bararchy If there are newlines in the url, "<html>" gets passed to to Response.from_io, instead of something like `HTTP/1.1 404 Not Found`
<FromGitter>
<Dillybob1992> hmm. how would you parse this `Hash(String, String).from_json(%({"cmd":"LOGIN","message":{"password":"test","username":"TestUser92"}}))` since the message is another json part. Is this possible with a Hash defined literal, or would I need to make a class that uses json mapping?
<FromGitter>
<l3kn> I'll see if I can find out why that happens
<RX14>
File spec suite works
<RX14>
but Dir spec suite is just broke
snsei has quit [Ping timeout: 276 seconds]
<FromGitter>
<Dillybob1992> could something like this work? `Hash(String, String | Hash(String, String))`
<RX14>
mostly the glob tests because the specs expect unix paths
<RX14>
and you don't get unix paths
<RX14>
you get windows paths
<RX14>
which is why we need Path class so much
<RX14>
everything is broken
<greenbigfrog>
rx, you have any idea why I'm getting that missing overload error?
<RX14>
yes
<RX14>
Think you have to require an additional file
<RX14>
Read the pr
<greenbigfrog>
yep...
<greenbigfrog>
thanks
<greenbigfrog>
somehow I missed that it was in `big/json`...
<FromGitter>
<l3kn> Not sure what the correct behavior would be, fail when parsing the URI or use escaped paths in the request
<FromGitter>
<l3kn> greenbigfrog: Because it is a `JSON::Any` wrapped around `nil`, if you print it, the print it, it prints the value of the raw element (nil)
<greenbigfrog>
hm. ok. makes kinda sense. how would I check if it's nil though correctly?
<FromGitter>
<l3kn> https://carc.in/#/r/3fa6 that works, probably not the most most elegant solution though
<greenbigfrog>
ok
<FromGitter>
<l3kn> Alternatively, you could create a `Result` class with a nilable `error` property and work with that
DTZUZU has joined #crystal-lang
<greenbigfrog>
ok
<greenbigfrog>
thanks
<greenbigfrog>
and sorry for bothering you all the time
<greenbigfrog>
anyone able to point me towards on where I would start to implement BigDecimal into crystal-pg
<FromGitter>
<l3kn> greenbigfrog: I guess splitting the digits array at the location of the decimal point and converting both halves into BigInts would be all you need to do
<greenbigfrog>
will take a look. thanks
<RX14>
I'm pretty sure that sshing into my windows VM is actually noticeably slower than before due to meltdown patches
<FromGitter>
<l3kn> greenbigfrog: Did you require "pg_ext/big_decimal" in your test code?
<FromGitter>
<bararchy> Oh, RX14 try configuring a DNS , in the Ubuntu shell , I had lots of times that using Ubuntu boxes without DNS configured it will query for ptr until timeout , and only then will it start the session
* greenbigfrog
just realized he might have been trying to reinvent the wheel along...
<hightower4>
Hey, I see that calling HTTP::Request.headers["Some-Header"] returns a concated list of values, but internally it is an array. Is there a way to retrieve actual array content using the public API?
<oprypin>
hightower4, i think #get method
<oprypin>
the api looks terrible, i had to just scan through source code until i didn't see "concat" in one of them
<hightower4>
That's the one, thanks oprypin!
ua has quit [Ping timeout: 256 seconds]
cremes has quit [Quit: cremes]
ua has joined #crystal-lang
brycek has joined #crystal-lang
<greenbigfrog>
is there a way to rescue a rescue without putting one in the other?
<FromGitter>
<xfbs> Wait if you're rescuing a rescue then I think you might be doing something odd or wrong?
<greenbigfrog>
probably... I first need to turn a JSON::Any in a Hash(String, JSON::Any) and after that try to turn it into Array(JSON::Any)
cremes has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
<greenbigfrog>
Shouldn't a begin without a rescue also rescue but just not do anything?
<greenbigfrog>
or apparently not...
<greenbigfrog>
somehow that's what I had expected,,,
duane has joined #crystal-lang
pta2002 has joined #crystal-lang
<pta2002>
hello, i'm trying to run `crystal spec` but it gives an error
<oprypin>
there's no opposition against this idea with `yield` but basically nobody knows how to implement it
<RX14>
you have to do a bunch of AST transformations to make a state machine
<RX14>
it's basically not something we want to work on
<RX14>
it'll probablt get added some point in the future maybe
<FromGitter>
<xfbs> I think I was just super confused because I'm in between languages right now and that's how you do it in python, so I was like, "wait wtf this worked yesterday"
<RX14>
lol
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<xfbs> How do I cast a number to type T? Is that even possible?
<FromGitter>
<jwaldrip> Working on an ORM. Wanted to get some feedback on the Model DSL. Any feedback. I am planning on using a sync paradigm over the typical migration paradigm. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a65222e5ade18be39a61307]
moei has quit [Quit: Leaving...]
<RX14>
looks pretty good
<RX14>
I'd suggest doing it by auto generating migrations based on the modified schema
<RX14>
and the current schema
<FromGitter>
<jwaldrip> Yes
<FromGitter>
<jwaldrip> thats what I am planning
<RX14>
so you "store" the sync
<RX14>
yeah good
<FromGitter>
<jwaldrip> similar to what typescripts typeorm does
<RX14>
otherwise it'll get really broken really quick
<RX14>
and at least that way you can create custom migrations
<RX14>
and the option's always there
<FromGitter>
<jwaldrip> Right, I still want the ability to create custom migrations
<FromGitter>
<jwaldrip> but by default, be able to lean on the syncing of the models to the Db
<FromGitter>
<jwaldrip> This would only require the knowledge of the model DSL to get an app up and running.
<FromGitter>
<jwaldrip> My example was verbose to show the options, but many of those things are inferred.
<RX14>
I assume your constraints are actually passed to the DB
<FromGitter>
<jwaldrip> correct
<RX14>
instead of not being enforced at the DB like activerecord
<RX14>
because thats great
<FromGitter>
<jwaldrip> anything in schema is in the db
<RX14>
yay
<FromGitter>
<jwaldrip> anything outside of schema is in the application
<FromGitter>
<jwaldrip> But I am going lean on the db as much as I can and shy away from application validation wherever possible
<RX14>
i presume that this ORM gets a bit macroey
<FromGitter>
<jwaldrip> small macros... but yes
<RX14>
nice that you managed to get small macros though
<RX14>
i'll have to take a look
<FromGitter>
<jwaldrip> Still working in prototype mode. Most of my macros are not over 10 lines
<RX14>
but just calling them helpers makes them sound too generic
<FromGitter>
<jwaldrip> you mean in the readme?
<RX14>
yep
<FromGitter>
<jwaldrip> k
<RX14>
also I don't quite like the implicit users -> userscontroller magic
<RX14>
personally i'd much rather have
<RX14>
get "/", to: UsersController.new
<RX14>
and then it's actual crystal syntax
<RX14>
and you can tab complete the type name
<RX14>
and there's far less magic and thinking required to convert from the "to" to the actual location of the route
<RX14>
although the .new syntax for calling an instance method is a bit weird
<RX14>
also @jwaldrip, you should be able to replace all of http/request.cr with just `property(path_params : Hash(String, String)) { Hash(String, String).new }`
<RX14>
or leave out the explicit type
<RX14>
actually no because of the :nodoc:
<RX14>
never mind
<RX14>
it makes sense
<FromGitter>
<jwaldrip> So the `to: ""` format is magical yes... but there are alternatives to the form you are looking for
<FromGitter>
<jwaldrip> to: "" was the rails-esque part
<RX14>
yeah
<FromGitter>
<jwaldrip> then there is `controller: UsersController, action: show`
<RX14>
yeah I guess
<RX14>
I kinda prefer just to: "UsersController#show" instead of "Users#show" myself