<oprypin>
i'm probably missing some of the difficulties of managing multiple processes
<oprypin>
i'm in a "what could go wrong" mode
<Papierkorb>
oprypin: well a manager process has to watch them and restart it if one dies
<oprypin>
no, that's easy
<Papierkorb>
Or something along those lines
<RX14>
oprypin, yes it's easy but it's still more new code in more processes
<RX14>
and new code is bad
<Papierkorb>
Well sure it's easy by itself, and it's probably how I'd do it too. But honestly, whichever doesn't really matter as the current state will hopefully be made obsolete with real multi-threading.
<Papierkorb>
So, as long the solution used isn't stupid in itself..
vikaton has joined #crystal-lang
daemonwrangler_ has joined #crystal-lang
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
mbarbar has joined #crystal-lang
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 260 seconds]
<FromGitter>
<jjjaaayyy> i've come to the conclusion that with a little tweaking, crystal + grub can run on bare metal
<FromGitter>
<jjjaaayyy> well, + a bunch of C libraries, if you want things like file system access
<illyohs>
boop
aroaminggeek[awa is now known as aroaminggeek
aroaminggeek is now known as aroaminggeek[awa
mbarbar has quit [Ping timeout: 268 seconds]
faustinoaq has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 246 seconds]
faustinoaq has joined #crystal-lang
astronavt has quit [Quit: Leaving...]
astronavt has joined #crystal-lang
vivus has quit [Quit: Leaving]
vikaton has quit [Quit: Connection closed for inactivity]
faustinoaq has quit [Ping timeout: 260 seconds]
faustinoaq has joined #crystal-lang
vikaton has joined #crystal-lang
<FromGitter>
<codenoid> helo
snsei has joined #crystal-lang
Groogy_ has quit [Ping timeout: 240 seconds]
Groogy_ has joined #crystal-lang
<FromGitter>
<codenoid> how to check / debug more on nil backtrace error
<FromGitter>
<codenoid> can compiled crystal app use adb ?
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]
aroaminggeek[awa is now known as aroaminggeek
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
vikaton has quit [Quit: Connection closed for inactivity]
<Groogy>
still not as good though, should be able to make it even faster
<FromGitter>
<extremety1989> @Groogy which c lib u use ?
Groogy has quit [Quit: WeeChat 1.9.1]
Groogy has joined #crystal-lang
<Groogy>
@extremety1989 to what part?
<Groogy>
most of it is written in Crystal but for instance I use GLFW3 to open up a window and opengl context, freeimage to parse image data, freetype to load font data
<FromGitter>
<extremety1989> @Groogy oh okey, i never worked with ui
<oprypin>
well no shit, 0.x is always a prerelease
<RX14>
no it's not
<RX14>
it's a release
<RX14>
just not a production quality release
<oprypin>
i dont care what you think, i'm telling you what normal people think
<RX14>
...no?
<oprypin>
"oh they started adding a warning that it's a prerelease? cool. let's update"
<Groogy>
to be honest, if it isn't AUR the maintainers of arch just probably saw "new tag, push it"
<Groogy>
I've had that several times with liri and other stuff
<oprypin>
Groogy, yes, they did, and as I was saying, they had no reason not to push it
<RX14>
oprypin, and most of the people I know wouldn't say that
<RX14>
a prerelease is usually a version suffixed with -pre
<Groogy>
AUR usually have maintaners who does it because they like that project, AUR's biggest problem is usually dependencies going out of sync
<RX14>
just because it's 0.x.x means it's a beta quality release
<RX14>
but it's not a prerelease
<Groogy>
need to restart DE, updated drivers brb
Groogy has quit [Quit: WeeChat 1.9.1]
<RX14>
oprypin, 0.23.1 isn't a prerelease, it's a release, it's just a beta release
<RX14>
prerelease is something different
<oprypin>
i dont care, i'm not the one that you need to convince
<RX14>
sure
<RX14>
but most people I talk to don't think of it your way
<RX14>
which is what you claimed to be true
<oprypin>
i get the point, but i also get the point that after looking at this thing in github for a minute i concluded that it's just a normal release
<RX14>
yes, it doesn't really matter
<RX14>
the effect is the same
<oprypin>
but disregarding that, 0.24.0 looks exactly like 0.23.1
<oprypin>
which is really what people look at
<RX14>
yes the tag should never have been pushed
<RX14>
but then I didn't push it either we just need to release 0.24.1
<RX14>
and then forget 0.24.0 ever happened
Groogy has joined #crystal-lang
<oprypin>
the least you can do now is add <h1>THIS IS A BROKEN RELEASE. DO NOT USE IT
<oprypin>
and delete binaries lol
<FromGitter>
<bew> Groogy cloc handles crystal correctly (Count Line Of Code) of you're still looking for that
<RX14>
oprypin, yeah I should
<RX14>
but it's too late now
<oprypin>
better late than never
<RX14>
probably not true now
<Groogy>
@bew thanks but now I have a crystal script instead :P
<FromGitter>
<bew> if*
<FromGitter>
<bew> You should still try it, it does a lot of cool things :p
<FromGitter>
<unreadable> does anyone know an gl community or gamedev gitter or some chat to talk about graphics stuffs related
<Groogy>
freenode irc has a few
<Groogy>
otherwise I am always here can always tag me
rohitpaulk has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
sz0 has joined #crystal-lang
<FromGitter>
<unreadable> yeah, but that's a crystal room
<FromGitter>
<unreadable> I got this hexchat client preinstalled on my machine, gonna mine for some channels
<Groogy>
##progamming, #reddit-gamedev, #gamedev, ##opengl are my recommendations
<Groogy>
though just saying the programming and gamedev channels seems to have a lot of students? Eh at least people with opinions about everything at least
<Groogy>
and not always helpful
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<unreadable> already on them, but found a good youtube channel with a game engine building
<FromGitter>
<unreadable> I find it to be golden content
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter>
<Rinkana> Do you happen to have a link to the playlist?
<FromGitter>
<unreadable> Once I master the batch tehnique, I'll drop SFML and start creating my gui lib from scratch
<Groogy>
you mean batching sprites?
<Groogy>
You can also do instancing where you do one single drawcall for everything
<FromGitter>
<unreadable> yeah, my main goal is to draw as many squares as possible and one I can control each square in part, to assign than custom shaders and functionallity to make them ui widgets
<FromGitter>
<unreadable> but I'll need to document more on that before
<Groogy>
feel free to look at my code and steal
<Groogy>
or well not straight copy paste but if you get stuck you can look at boleite and steal ideas
<FromGitter>
<unreadable> not a fan of copy pasting, that's not really from scratch
<FromGitter>
<unreadable> there's also in the playlist a whole 2 hours video on batching 😄
<Groogy>
well yeah I meant more you don't learn if you copy paste
aroaminggeek is now known as aroaminggeek[awa
<FromGitter>
<jjjaaayyy> where is boleite
<FromGitter>
<jjjaaayyy> oh the shard
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<watzon> Crystal doesn't have an equivalent to Ruby's `Dir.home` does it?
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
jdnoodle has joined #crystal-lang
<jdnoodle>
hi all, i have some questions about slices and how to properly use them as i am a bit confused with the docs
<jdnoodle>
i am wanting to use uint8 slices with sockets to manipulate data and i am confused about when to use Bytes.new, slice(UInt8), UInt8.slice, Slice.new, etc they all seem the same to me and i was wondering if someone could name some of the differences.
<jdnoodle>
Also I am having troubles setting and changing data within slices. say for instance I have a= UIny8.slice(0x05, 0x02) and I want to add or remove another byte, how is that possible?Likewise if I am receving from a socket .read requires a slice, but do slices auto expand or would I need to create a slice of approriate size before hand?
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
<Papierkorb>
jdnoodle: Slices are static in size and variable in data
alexherbo2 is now known as alex``
<Papierkorb>
jdnoodle: If you want a dynamically sized "Slice" use Array(UInt8) instead. doing `ary.to_unsafe.to_slice(ary.size)` will turn it into a slice.
<jdnoodle>
that actually seems like an easier solution. ill have to check the docs to see if TCPSocket << and .read methods support Array(UInt8)
<Papierkorb>
jdnoodle: UInt8.slice is the same as UInt8[...] is the same as Bytes[...] (Note that `Bytes` is an alias for `Slice(UInt8)`). Personally, I use the Bytes[..] notation
<RX14>
jdnoodle, what are you attempting to do on a higher level
<RX14>
because you don't seem to be thinking about this in the right way
<jdnoodle>
Socks4 client implentation
<jdnoodle>
i need to send raw bytes to intialize the socsk4 connection
<RX14>
you don't want to think about "resizing" or even really modifying a slice
<RX14>
jdnoodle, so you create a slice of those raw bytes and use io.write
aroaminggeek[awa has quit [Ping timeout: 260 seconds]
<RX14>
you don't want to really modify that slice again
<RX14>
you want to use io.write again witha nother slice
<RX14>
assuming youw ant to send dynamic data
<RX14>
I don't know the socks4 protocol
<RX14>
but I wouldn't think it even requires explicitly modifying a slice ever
<RX14>
let alone using realloc
<jdnoodle>
i see, so i would create a new slice for each writing operation discarding the previous slice
<RX14>
yes
<RX14>
but really you wouldn't want to use slices for data that's always the same
<RX14>
for example if you always send the same 2 bytes
<RX14>
in the future we'll probably have binary constants
<RX14>
so that you don't need to use UInt8.slice(0xab, 0xcd)
<RX14>
and there will be no overhead
<RX14>
but for now worry about getting it working then about performance
<jdnoodle>
that would be neat
<RX14>
jdnoodle, if you send me some code i'll be happy to show you how I would do it
<jdnoodle>
sure let me clean up some of it. it is currently in a non functioning state so ill be a minute
<RX14>
and a connection.connect(remote_hostm, remote_port)
<RX14>
which would return a SocksRemoteConnection
<RX14>
thats bad naming
<RX14>
but you get the idea
<jdnoodle>
yea
<jhass>
well, some scripting to learn a protocol is fine IMO, just don't even bother with creating classes or anything then
<jhass>
and be prepared to throw all of it away for the real implementation
<jdnoodle>
ill have to think about the structure a bit more i guess
<jdnoodle>
this was initially just something i could throw into side projects to add socks capabilities but if im going through the effort i might as well do it right
<RX14>
jhass, i like to at least skim the RFC
<RX14>
like
<RX14>
you shouldn't know the protocol off by heart
<RX14>
you should however at least be able to know the arechitecture
<Groogy>
also Papierkorb Cute is really making it easy to make sure things are run properly
<Papierkorb>
Groogy: to put the logic on the same line as the 'when' use `then`
<Papierkorb>
`when X then Y`
<Groogy>
ah cool
<Groogy>
but yeah because of cute, whenever a child changes the layout is notified and when layout changes it will notify the window that it has to resize to fit
<Groogy>
etc.
<Groogy>
it "just works"
<Papierkorb>
Declarative patterns simply rule
astronavt has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
aroaminggeek has joined #crystal-lang
<jdnoodle>
does anyone know of a crystal method that converts quad dot ip addresses to their hex byte representitives? ex: 127.0.0.1 becomes 7f000001 to be used with IO::write_bytes
snsei has joined #crystal-lang
<jdnoodle>
i wrote a one liner for it but was wondering if there was a proper method for use in socket applications
<Groogy>
sounds like something there should be already
<Groogy>
don't work in that area so no idea though
<yxhuvud>
jdnoodle: you are probably looking for ByteFormat.
<jdnoodle>
thats the thing, I am using byteformat but i get a compile error for undefined method to_io for string
snsei has quit [Remote host closed the connection]
<FromGitter>
<paulcsmith> It seems like at this point the compiler knows what the type of `_response` would be. Maybe it's possible, but not right now because Crystal doesn't support it?
<RX14>
nope
<RX14>
well
<RX14>
sure there are some cases where it'd be OK
<RX14>
but the general case is that it's not OK
<RX14>
and so i'd rather say no everywhere than yes but nobody knows where
<FromGitter>
<paulcsmith> Makes sense. Yeah I'd only really need/care about it for raising helpful errors
<FromGitter>
<paulcsmith> Most of the time it's unnecessary
<oprypin>
how about type annotations
<RX14>
oh
<RX14>
guess what
<RX14>
@paulcsmith make the method generic on T
<RX14>
do _response : T
<RX14>
then you can use T
<RX14>
problem solved
<FromGitter>
<paulcsmith> @RX14 I'm not sure I understand. Can I use T to so I can print it in the error message?
<FromGitter>
<paulcsmith> @oprypin It did have a type restriction before, but people did not understand what they needed to do to fix it.
<RX14>
yeah T is a constant
<RX14>
it works because macro defs are run while typing (i presume, not 100%)
<RX14>
and when you make the thing generic on T
<RX14>
you basically say copy this method for every possible value of T
<RX14>
and then you run the same macro for each value of T
<FromGitter>
<paulcsmith> And I think I could use `forall` in another method I was writing
<RX14>
yup thats how we do generic methods in crystal
<RX14>
they're just like generic classes... but only for methods
<RX14>
you can also do stuff like
<RX14>
def foo(bar : T.class) forall T
<RX14>
and then do foo(Bar) and T is now a constant Bar
<RX14>
which you can use in macros
<RX14>
or do all sorts of cool DSL stuff with
<RX14>
which you couldn't before
<FromGitter>
<paulcsmith> Yeah this might cleanup a lot of stuff in Lucky. Great tip 👍
claudiuinberlin has joined #crystal-lang
<FromGitter>
<lhz> Hi. I am experiencing the same issue as describe in the last couple of comments here when building small docker images and trying to access external resources from inside the container: https://gist.github.com/bcardiff/85ae47e66ff0df35a78697508fcb49af Any ideas what is needed to get it working?
astronavt has joined #crystal-lang
<RX14>
have you used docker before
<RX14>
where are you running postgres?
<RX14>
because that error message says localhost
<RX14>
and postgres almost certainly is not running on localhost in docker
<yxhuvud>
paulcsmith: sometimes it is possible to get around the macro limitations by extacting a regular method for just the typeof call (or whatever limitation you are working around - I've used it to let me use generic variables - sure you don't see it while the macro is evaluating, but it usually doesn't matter)
snsei has joined #crystal-lang
<RX14>
i should build a web framework in crystal
<FromGitter>
<paulcsmith> @yxhuvud Very cool. Do you have an example of that?
<FromGitter>
<lhz> RX14: well those comments are not mine, I just have a similar issue (No address found) no matter what URL is used (I have my database living on a server somewhere)
<RX14>
oh ok
<RX14>
well it's the dreaded DNS bug
<RX14>
DNS in docker suuucks
<RX14>
and crystal uses evented DNS which breaks docker's DNS hacks
vivus has joined #crystal-lang
<RX14>
the workaround is to literally shell out to `getent hosts <hostname>` and parse it
<yxhuvud>
@paulcsmith, see also line 47, that use the same technique to hide internal types from the user
<RX14>
huh
<RX14>
i'm wrong?
<FromGitter>
<lhz> RX14: Ouch. So I'll need to add quite a bit more to the container then, for that to work.
<RX14>
thats weird
<yxhuvud>
(and in other news, I need to refactor that code to not be generic all over the place)
<FromGitter>
<lhz> RX14: okay, I will try that. might as well use alpine as base for the final image too, I probably want to be able to run a shell in there at some point
<FromGitter>
<lhz> RX14: thanks!
<RX14>
no like
<RX14>
just use alpine
<RX14>
flat out
<RX14>
no special ldd tricks
snsei has quit [Remote host closed the connection]
<FromGitter>
<unreadable> I've just realized why manastech called their Sinatra framework clone Frank while listening to Frank Sinatra
<RX14>
...
<FromGitter>
<unreadable> well never actually thought of libraries names, I might be wrong though
<FromGitter>
<lhz> Getting "in lib/mysql/src/mysql/read_packet.cr:2: IO is not a module, it's a class" during `shards build` when using Dockerfile from crystal-alpine as template.
<FromGitter>
<lhz> My app is doing `require "mysql"` since it needs to talk to a mysql database using crystal-db, and somewhere in there it is doing `include IO`.
<FromGitter>
<lhz> Is this something that changed between 0.23.1 and 0.24.0-r1?
<RX14>
@lhz IO was changed to a class in 0.24.0
<RX14>
yes
<RX14>
i guess crystal-alpine doesn't have version tags
<FromGitter>
<lhz> RX14: thank you, that got me further, looks like I need some more packages for -lssl, -lcrypto and -lz to be available.
<RX14>
you just need to RUN apk add openssl-dev libz-dev i think
<RX14>
let me check those package named
<RX14>
let me check those package names
<RX14>
it's openssl-dev and zlib-dev @lhz
<RX14>
apk add --update openssl-devzlib-dev
<RX14>
apk add --update openssl-dev zlib-dev
<FromGitter>
<lhz> RX14: that did the trick, thanks a bunch!
<RX14>
no problem
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
alex`` has quit [Ping timeout: 240 seconds]
<hightower2>
Yo, I have code which works fine on Crystal 0.23 and on Crystal 0.24 it produces compile time error: no overload matches 'MyClass.to_yaml' with types (Bool | Enumerable(Int32) | Int32 | Proc(Int32, Bool)), YAML::Nodes::Builder
<hightower2>
Is this something known related to YAML or?
<hightower2>
Hm looks like at least one incompatibility is in Time.new()
<FromGitter>
<sam0x17> does crystalshards.xyz just crawl github or is there manual submission somewhere?
<Papierkorb>
it uses github
<FromGitter>
<sam0x17> thx
sz0 has quit [Quit: Connection closed for inactivity]
aroaminggeek has quit [Read error: Connection reset by peer]
aroaming_ has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
<hightower2>
RX14, it seems I need to use named arguments for more than just kind: (I need to use them for hour, day, minute, second, and millisecond). But then I run into the issue that the place for "millisecond" in 0.24 code contains * in that place, so if I just put ms value, it tells me it expects named argument, and if I put millisecond: ms, it tells me 'no argument named millisecond'
<hightower2>
RX14, so I had to work around that by specifying nanosecond: ms*1000
<RX14>
uhh what
<RX14>
no you do not need to use named arguments for those
<RX14>
the solution is that there *is no milliseconds argument* any more
<Papierkorb>
hightower2: 1000ns = 1µs
<hightower2>
Papierkorb, right, thanks
<RX14>
hightower2, you want Time.new( y, m, d, h, min, sec, nanoseconds: ms * 1_000_000, kind: Time::Kind::Unspecified)
<RX14>
that works
<RX14>
you'll get the hang of calling functions with enough practice
<RX14>
Papierkorb, do you read the mailinglist?
<Papierkorb>
I lurk on it, why?
<RX14>
do you understand this latest eamil from Benny
<RX14>
email*
aroaming_ is now known as aroaminggeek[awa
<Papierkorb>
besides the rambling you mean?
<RX14>
yes
<Papierkorb>
Nothing to answer to, no
<RX14>
he seems to imply that because I said reinventing one wheel in crystal is useless, the entirely of crystal is useless
<Papierkorb>
Maybe it'd be nice to at least fix up that big snippet someone shared into something more crystal-y. besides that, thread's over I guess?
<RX14>
which is like what
<Papierkorb>
¯\_(ツ)_/¯
<Papierkorb>
Whatever someone would respond, the possibility of talking besides one another is super big. People made their point, and right now, there's not much that can be /actually/ improved for anyone involved in that thread. /thread
<hightower2>
What can I use instead of Time#ticks that existed in 0.23?
<RX14>
what are you using it for
<hightower2>
RX14, I was using it as a single-number representation of Time that can then be used for math and feeding back into Time.new. It seems to me that now I could use epoch_f for comparisons, and multiplying it by some factor when I want to feed it back into Time.new( nanoseconds: ...)
<RX14>
you know
<RX14>
adding times doesn't make sense
<RX14>
like that doesn't really answer the question
<RX14>
what exactly kind of math do you want to do to TIme that it doesn't already let you hightower2?
<hightower2>
The math was done on spans
<RX14>
oh ok
<RX14>
you want to multiply/divide timespans?
<hightower2>
RX14, I have a replacement for the "Time" class which I've made to support "partial" dates, like e.g. I can define MyTime.new( month: 3, year: 2017), and this is a partial date whose all other fields are nil (I can't do this with regular Time class because in it all unspecified fields (those that can be unspecified) default to 0)
<hightower2>
So it's not clear if the user really wanted to specify 0, or he wanted to leave the fields unspecified
<hightower2>
Anyway, long story short, it's a system for doing various types of matching on these MyTime objects
<Papierkorb>
What was wrong with #ticks? It's nice as precise timestamp
aroaminggeek[awa is now known as aroaming_
<RX14>
Papierkorb, because it leaked the internal definition of Time
<RX14>
and basically
<RX14>
we changed the way Time is implemented (in my opinion a dumb way)
<RX14>
to store seconds and nanoseconds in 64bit fields
<hightower2>
Though doing x= Time.ticks; t= Time.new( x) is a bit harder now
<RX14>
it's stupid because you're essentially implementing fixed point in Time
<RX14>
hightower2, yes because times are described by 2 fields
<Papierkorb>
wasn't there a push to support int128?
<RX14>
yes Papierkorb
<RX14>
you could have done the whole thing just find with 2 UInt64 fields
<RX14>
but it got merged regardless
<Papierkorb>
Which should represent Time until a point we're all ashes due to the heat death of the universe at which point we have bigger issues than Crystals Time type going bonkers?
<RX14>
and now it's more complex for little gain
<RX14>
Papierkorb, exactly
<RX14>
now we have all the problems of essentially mixing base-10 and base-2
<hightower2>
Now when I sum nanoseconds I'll need to check if they overflow into a second, before I can call Time.new( seconds, nanoseconds)
<Papierkorb>
RX14: all your base belong to Time
<Papierkorb>
lul
<RX14>
...
<RX14>
hightower2, yep
<RX14>
actually the time ctor does that for you
<hightower2>
RX14, does it? I was looking at initialize which says: unless 0 <= @nanoseconds < NANOSECONDS_PER_SECOND raise ArgumentError.new "Invalid time: nanoseconds out of range" end
<RX14>
huh
<RX14>
i thought it did
<RX14>
my bad
aroaming_ has quit [Ping timeout: 248 seconds]
aroaminggeek has joined #crystal-lang
<RX14>
i'm off, night
<hightower2>
RX14, so, my best bet is to use epoch_f?
<hightower2>
Thanks
<RX14>
for simplicity yes
<RX14>
but you will loose precision
<RX14>
:((
<hightower2>
Well, simplicity is out of the door, things become more complicated with these changes
<hightower2>
I also need a macro to detect pre and post 0.24 :)