<FromGitter>
<nsuchy> @fridgerator No it's on docker
<FromGitter>
<nsuchy> Sorry had to go to dinner, with family earlier so couldn't keep responding
<FromGitter>
<nsuchy> Unfortunately that's not an option as Admins are adding URLs thru the admin panel
<FromGitter>
<nsuchy> It's weird because I can write a script that directly calls the API over HTTP Client
<FromGitter>
<nsuchy> But even hard coding the URL doesn't fix it
<FromGitter>
<nsuchy> when I pass the string over to the shard to handle things further it breaks
<FromGitter>
<fridgerator> @nsuchy docker hosted on what? your local machine?
<FromGitter>
<nsuchy> At ULayer we run our own Proxmox Hypervisor, the customer panel allows people to do stuff like restart their virtual machines and stuff, but with http/client broken, the entire panel is borked until we can figure out the DNS issue
<FromGitter>
<nsuchy> and yes
<FromGitter>
<nsuchy> it's Docker on Windows 10 Pro
<FromGitter>
<nsuchy> I need to move a lot of internal logic into our shard so other people can benefit from it, currently the shard only generates an access ticket and csrf token
<FromGitter>
<nsuchy> but initializing a new Proxmox Object Instance is broken as you can see :(
<FromGitter>
<nsuchy> Nothing at ULayer (aside from maybe some css libs and crystal shards) uses AS
<FromGitter>
<nsuchy> okay wow
<FromGitter>
<nsuchy> really interesting
<FromGitter>
<nsuchy> the same code works fine on production
<FromGitter>
<nsuchy> so the issue connecting to proxmox seems to related to OpenVPN adding routes inside the docker container
<FromGitter>
<nsuchy> So maybe DNS being pushed from OpenVPN is the issue
<FromGitter>
<nsuchy> Production doesn't use OpenVPN since we have our internal network between our Proxmox Nodes
<FromGitter>
<nsuchy> when developers are working on stuff and need to clone production, openvpn handles that
<FromGitter>
<nsuchy> it's essentially staging at localhost
<FromGitter>
<nsuchy> It's greta
<FromGitter>
<nsuchy> okay yeah that's the issue
<FromGitter>
<nsuchy> just started openvpn manually inside our docker container
<FromGitter>
<nsuchy> it breaks dns
<FromGitter>
<nsuchy> the culprit has been found
<FromGitter>
<nsuchy> now to fix dns after openvpn starts
<FromGitter>
<nsuchy> :|
pf_ has quit [Ping timeout: 268 seconds]
<FromGitter>
<nsuchy> looks like openvpn sets 0.0.0.0/0 and blocks access to 127.0.0.11 which is where docker dns sits at, after openvpn starts overwriting dns to a public resolver fixes the issue
<FromGitter>
<kingsleyh> Hi - if anyone wants to help me on my crypto / Blockchain project https://sushichain.io or my trading card game please message me - I canβt pay you sorry - but I could give you some tokens
<FromGitter>
<kingsleyh> Sorry if this message offends anyone
<oprypin>
π
<FromGitter>
<naqvis> @j8r Thanks for raising issue, Iβm out of town and will look into it once iβm back.
alex`` has joined #crystal-lang
myfreeweb has left #crystal-lang [#crystal-lang]
alex`` has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
<FromGitter>
<stergiom> Does `JSON.mapping`allow abstract classes for types?
pf_ has joined #crystal-lang
<FromGitter>
<stergiom> same question if `JSON::Serializable` is used instead
<FromGitter>
<asterite> Only in the next crystal version, probably 0.32.0
devil_tux has quit [Quit: Lost terminal]
<FromGitter>
<stergiom> ahh, that works :-)
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 245 seconds]
<FromGitter>
<kinxer> @asterite What does that mean? `JSON::Serializable` will be able to pick the correct subclass to instantiate if an abstract type is given?
<FromGitter>
<nsuchy> @vlazar Yes exactly like that
<FromGitter>
<nsuchy> But for Crystal
<FromGitter>
<nsuchy> oh wait
<FromGitter>
<nsuchy> it supports crystal
<FromGitter>
<nsuchy> I feel dumb now
<FromGitter>
<nsuchy> next question
<FromGitter>
<nsuchy> I want to store a timestamp in MySQL and then check if an hour has passed
<FromGitter>
<nsuchy> How do I check the difference of the current time and a timestamp in Crystal
<FromGitter>
<nsuchy> I want to stop creating 5 access tokens per page load
<FromGitter>
<nsuchy> For example check if `time.to_s # => 2016-02-15 10:20:30 UTC` is now `time.to_s # => 2016-02-15 11:20:30 UTC` or later
<sorcus>
No ideas about memory usage? Even if i close DB connect and call GC.collect manual the program still using 20GB+ of memory.
<FromGitter>
<bds> I would like a guard clause that covers when a Kemal request.body is empty. Is there an idiomatic way to check this without reading the whole stream with .gets?
<FromGitter>
<Blacksmoke16> isnt there a header you can use?
<FromGitter>
<bds> @Blacksmoke16 great idea, I probably can. ty!
<FromGitter>
<j8r> but if it was me I would put it in a class method of an object, not a macro in the top level namespace
<FromGitter>
<j8r> sorcus: this probably means the code is architectured in a way there is no freeable memory for the GC (some king of recursiveness and/or loops?)
<FromGitter>
<j8r> It is an open source project so I can take a a quick look?
<FromGitter>
<ImAHopelessDev_gitlab> 200m domains? good lord :O
<FromGitter>
<ImAHopelessDev_gitlab> wait, you said domens? what are those
pf_ has quit [Ping timeout: 265 seconds]
<sorcus>
ImAHopelessDev_gitlab: Lol, sorry. It's typo, i mean domains. :-D
<FromGitter>
<ImAHopelessDev_gitlab> hahah, damn that's a lot lol
<FromGitter>
<j8r> sorcus: I have looked at crystal-db's `query_all`. They are several overloads, but one is using an Array
<FromGitter>
<j8r> If you have huge data to process, it could become a bottlemeck
pf_ has joined #crystal-lang
<sorcus>
j8r: Ok, i will rewrite code. Thank you so much.
<FromGitter>
<ilanpillemer> Hi. I must be doing something silly. But as far as I understand Arrays are passed by reference. But when I test in the playground and in code.. they dont seem to be?
<FromGitter>
<tenebrousedge> I might want to audit his course, then. I'm the main Crystal mentor there
<FromGitter>
<ilanpillemer> Its part of a series. A new language every 2 months
<FromGitter>
<ilanpillemer> and you vote on the next language
<FromGitter>
<ilanpillemer> the first language in the course is Crystal
<FromGitter>
<tenebrousedge> how interesting
<FromGitter>
<ilanpillemer> its 4 weeks in.
<FromGitter>
<ilanpillemer> the next one is either Pony, Ocaml or Rosie
<FromGitter>
<ilanpillemer> I love learning languages..
<FromGitter>
<tenebrousedge> It's fun for sure
<FromGitter>
<ilanpillemer> I am also trying to figure out how to contribute to the main codebase as I want to send a pull request so that if the environment variable `TERM=dumb` there are no colors. But the trunk doesnt seem to be builing.
<FromGitter>
<tenebrousedge> but what about the pretty colors?
<FromGitter>
<ilanpillemer> I dont like pretty colours
<FromGitter>
<tenebrousedge> :(
<FromGitter>
<ilanpillemer> they distract me
<FromGitter>
<ilanpillemer> and also I use the acme editor
<FromGitter>
<ilanpillemer> which cant cope with them
<FromGitter>
<tenebrousedge> a method seems kinda superfluous
<FromGitter>
<Blacksmoke16> why not just do like `items << item` :S
<FromGitter>
<Blacksmoke16> vs append(items, item)`
<FromGitter>
<Daniel-Worrall> I have a strange issue. Crystal playground bound on my local ip won't finish code execution. The page loads, but it never gets past `Code Execution Started` β `crystal play -b 192.168.0.21 -v`
<FromGitter>
<Daniel-Worrall> 1) 0.0.1 and 0.0.0.0 both work fine
<FromGitter>
<Daniel-Worrall> It's on WSL if that is going to matter
ht_ has quit [Quit: ht_]
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<absolutejam_gitlab> Been over a month since I wrote some Crystal :)
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<kinxer> @ilanpillemer You're trying to concatenate the array `["c"]` to the array `["a", "b"]`; it seems like what you want is to try to append the string `"c"` to that array, instead.
<FromGitter>
<Blacksmoke16> oh then yea if you want to join two arrays you need to use concat
<FromGitter>
<Blacksmoke16> but i was more so meant why not just do that inline vs having a method that does it?
<FromGitter>
<ilanpillemer> I would normally do it inline
<FromGitter>
<ilanpillemer> this is just picking at the language to understand it better
<FromGitter>
<Blacksmoke16> ah, π
<FromGitter>
<ilanpillemer> once I understand it enough I am going to try fo all the advent of code 2016 puzzles in Crystal
<FromGitter>
<ilanpillemer> I just did all the 2015 ones in Go
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
Nekka has quit [Client Quit]
Nekka has joined #crystal-lang
alex`` has quit [Ping timeout: 240 seconds]
return0e has joined #crystal-lang
alex`` has joined #crystal-lang
return0e_ has quit [Ping timeout: 276 seconds]
<FromGitter>
<ImAHopelessDev_gitlab> Hello
<FromGitter>
<tenebrousedge> how's goes?
<FromGitter>
<ImAHopelessDev_gitlab> fiddling around with nim and annoying everyone on their forum. doing my part.gif
<FromGitter>
<tenebrousedge> ah
<FromGitter>
<jwoertink> @oprypin getting crsfml working on latest crystal?
<FromGitter>
<wontruefree> @ImAHopelessDev_gitlab did you comment on the Issue?
<FromGitter>
<wontruefree> might be worth mentioning
<FromGitter>
<ImAHopelessDev_gitlab> I tried, but then I realized the points asterite made, i can't really rebuke any so I figured I shouldn't embarrass myself π
<FromGitter>
<absolutejam_gitlab> oh you can just define properties and `include` the serializable
<FromGitter>
<ImAHopelessDev_gitlab> yeah the serializable way is nice
<FromGitter>
<absolutejam_gitlab> One thing I never figured out - and by that, I mean spent more than a few seconds looking at - is how to serialize a class/struct from a data structure that might look ambiguous
<FromGitter>
<ImAHopelessDev_gitlab> i like json.mapping too, but i think serializable is more powerful in the long run. plus, it would better to have a non-ambiguous way of statically parsing json at 1.0 i think
<FromGitter>
<tenebrousedge> @absolutejam_gitlab generally Crystal isn't going to handle that kind of ambiguity well. It's going to expect that things are going to be one thing or another
alex`` has quit [Quit: WeeChat 2.6]
<FromGitter>
<Blacksmoke16> @absolutejam_gitlab should check out my serialization shard π
alex`` has joined #crystal-lang
<FromGitter>
<Blacksmoke16> been working on the deserialization side of things lately
<FromGitter>
<absolutejam_gitlab> @tenebrousedge well I assume there's a way to supply some logic myself but I just never looked into it
<FromGitter>
<absolutejam_gitlab> There may well be a better way, but I never really tested it :shrug:
<FromGitter>
<Blacksmoke16> got an example?
<FromGitter>
<absolutejam_gitlab> was a swagger spec I was working off a while back
<FromGitter>
<Blacksmoke16> ah that
<FromGitter>
<absolutejam_gitlab> some of the fields could return different child object types
<FromGitter>
<Blacksmoke16> depending on a key?
<FromGitter>
<absolutejam_gitlab> Been all about go recently so not had a chance
<FromGitter>
<absolutejam_gitlab> yeah usually
<FromGitter>
<Blacksmoke16> i.e. like `{"type": "something", ...}`
<FromGitter>
<absolutejam_gitlab> or if a certain field exists
<FromGitter>
<kinxer> One day I'm going to put the GeoJSON library I wrote on GitHub, and then I'll be able to reference it here... Ambiguous values is a problem I had to solve for that.
<FromGitter>
<Blacksmoke16> tl;dr it just tries deserializing each child type until it finds one that works
<FromGitter>
<Blacksmoke16> or errors if none do
<FromGitter>
<absolutejam_gitlab> that's be awesome
<FromGitter>
<kinxer> Hard agree.
<FromGitter>
<Blacksmoke16> i mean thats what the PR does :p
<FromGitter>
<Blacksmoke16> i.e. parse the data first then deserialized off that, so you have access to discriminator fields and stuff
<FromGitter>
<kinxer> Yeah, that's what I did, too. The ambiguous value I had to deal with was a nested array with an uncertain depth, so I just wrote up a simple tree for it and deserialized it into that, and then I made objects from the tree.
<FromGitter>
<kinxer> I tend to be light on the macros, though, so my implementation isn't as fancy as yours. :P
<FromGitter>
<Blacksmoke16> kinda comes with the territory with using annotations since thats the only way