01:32
zorp has quit [Ping timeout: 240 seconds]
02:00
deavmi has quit [Read error: Connection reset by peer]
02:00
deavmi has joined #crystal-lang
02:12
f1reflyylmao has joined #crystal-lang
02:13
f1refly has quit [Ping timeout: 272 seconds]
02:40
chachasmooth has quit [Ping timeout: 256 seconds]
02:40
chachasmooth has joined #crystal-lang
05:05
duane has quit [Ping timeout: 258 seconds]
05:06
duane has joined #crystal-lang
05:31
_whitelogger has joined #crystal-lang
05:54
avane has joined #crystal-lang
05:55
<
avane >
hey all. I would like to get a specific portion of a file using hex locations (e.g. 0x123 - 0x125) and store it into a variable. how would I go about doing this?
06:02
<
FromGitter >
<HertzDevil> `IO#read_at(0x123, 3, &.gets_to_end)`
07:43
sagax has quit [Read error: Connection reset by peer]
08:04
yukai has quit [Ping timeout: 260 seconds]
08:11
Human_G33k has quit [Ping timeout: 240 seconds]
08:33
twistedpixels has quit [Ping timeout: 244 seconds]
08:35
twistedpixels has joined #crystal-lang
08:52
sagax has joined #crystal-lang
08:59
HumanG33k has joined #crystal-lang
10:22
zorp has joined #crystal-lang
10:24
zorp has quit [Client Quit]
11:01
Human_G33k has joined #crystal-lang
11:02
HumanG33k has quit [Ping timeout: 260 seconds]
11:02
psydroid has quit [Quit: killed]
11:02
return0e[m] has quit [Quit: killed]
11:02
ryanprior has quit [Quit: killed]
11:09
psydroid has joined #crystal-lang
11:26
ryanprior has joined #crystal-lang
11:26
return0e[m] has joined #crystal-lang
11:35
_whitelogger has joined #crystal-lang
11:40
Andriamanitra has joined #crystal-lang
11:46
Liothen has joined #crystal-lang
12:06
<
FromGitter >
<phykos> hello there
12:06
<
FromGitter >
<phykos> I am looking for something like `Int#chr` but returning a c-like char
12:07
<
FromGitter >
<phykos> I mean `255.times { |i| puts(i.chr) }`
12:07
<
FromGitter >
<phykos> In Ruby it has a different behavious
12:07
<
FromGitter >
<phykos> behaviour
12:12
<
jhass >
STDOUT.write_byte i
12:15
<
FromGitter >
<phykos> yes but I want to save the result to a variable and not write it to the stdout
12:16
<
FromGitter >
<phykos> anyway just tested that line of both Ruby and Crystal and it does the same thing , I missed something
12:16
<
FromGitter >
<phykos> I am implementing the mandelbrot program from benchmarks game and it is slow to print it while iterating
12:17
<
jhass >
You can use String.build to get an IO for building a string
12:17
<
jhass >
but the difference to using a buffered IO shouldn't be big
12:18
<
FromGitter >
<phykos> yeah, this is big brain time
12:22
<
FromGitter >
<phykos> nope, that yields a block and I have to do that 2 times
12:23
<
jhass >
well just put the block around both
12:25
<
FromGitter >
<phykos> 1 - isn't it inefficient? ⏎ 2 - I don't exactly know the capacity of the string, I'll be overallocating stuff
13:59
<
FromGitter >
<asterite> you can do `STDOUT.sync = false` then manually flush
13:59
<
FromGitter >
<asterite> After you call the global `puts` or `print` it always flushes on a terminal, if I remember correctly
16:20
hugopl has joined #crystal-lang
16:28
f1reflyylmao has quit [Ping timeout: 260 seconds]
16:35
f1refly has joined #crystal-lang
16:40
f1refly has quit [Ping timeout: 240 seconds]
16:46
f1refly has joined #crystal-lang
18:05
<
FromGitter >
<Daniel-Worrall> Is select timeout documented anywhere cause I'm only coming across the Issue/PR
18:11
<
oprypin >
hm thinking how to find if there are no zeros in a nested array
18:12
<
FromGitter >
<Blacksmoke16> `array.none? &.zero?`?
18:12
<
oprypin >
`[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]].all?(&.none?(&.zero?))`
18:12
<
FromGitter >
<Blacksmoke16> er if its nested, `array.all? &.none? &.zero?`
18:13
<
oprypin >
is confusing though what do u mean all none xD
18:13
<
FromGitter >
<Blacksmoke16> yea :p
18:13
<
oprypin >
wait `.all?(&.all?(&.>(0)))` actually works?
18:14
<
FromGitter >
<Blacksmoke16> why wouldnt it?
18:47
zorp has joined #crystal-lang
18:54
<
yxhuvud >
oprypin: that's how half my code for aoc looks like :)
18:54
<
oprypin >
oh you're commenting on the prior thing
18:54
<
yxhuvud >
lots of nested levels of &. blocks :)
21:35
<
FromGitter >
<j8r> What does `Object#==`? It's just an abstract def on object.cr, but it works on any `class`
22:03
<
FromGitter >
<j8r> ok thanks
22:05
<
FromGitter >
<j8r> A bit mystic this things
22:05
<
FromGitter >
<j8r> `abstract struct Struct` ?
22:06
<
FromGitter >
<j8r> Also it is said that Struct inherits from Value, which inherits from Object, which is a class
22:06
<
FromGitter >
<Blacksmoke16>
*magic*
22:10
<
FromGitter >
<j8r> I guess, primitives are magic - handled directly by the compiler
22:10
<
FromGitter >
<Blacksmoke16> yea
22:13
<
FromGitter >
<lbarasti> Hi folks, I'm streaming on Twitch tomorrow at 7pm BST. I'd like to talk about Crystal and application metrics. ⏎ Would someone like to join me to explore some Prometheus queries - I'm not well versed in those - and chat about observability?
22:13
<
FromGitter >
<lbarasti> I'll send this again tomorrow, just in case a potential reader misses it :D
22:14
<
FromGitter >
<j8r> you expose Crystal metrics in the Prometheus format, which ones?
22:15
<
FromGitter >
<lbarasti> then add some fiber's heartbeat
22:16
<
FromGitter >
<lbarasti> counting the number of times tasks happen
22:16
<
FromGitter >
<lbarasti> very open ended
22:17
<
FromGitter >
<lbarasti> I'm not an expert on the topic by any means, so wanted to turn this into a conversation
22:17
<
FromGitter >
<j8r> Ha I got something for fibers
22:21
<
oprypin >
@j8r: object
22:21
<
oprypin >
@j8r: Object is entirely fake; Value and Reference are the only true bases
22:23
<
oprypin >
and yes Value itself is still largely fake because it's impossible to create one
22:23
<
FromGitter >
<j8r> the cake is a lie!
22:24
<
FromGitter >
<lbarasti> how unsafe is unsafe_each, I'd like to understand better
22:24
<
FromGitter >
<j8r> better avoiding monkey patching
22:25
<
FromGitter >
<j8r> I think it is ok we don't modify anything
22:25
<
oprypin >
which unsafe_each is it? of which type
22:25
<
FromGitter >
<j8r> *if we don't modify anything
22:25
<
FromGitter >
<lbarasti> 👍
22:26
<
FromGitter >
<j8r> `Thread#unsafe_each`
22:27
<
FromGitter >
<j8r> also, you can have fibers for each thread
22:27
<
FromGitter >
<lbarasti> oh, I see, so if I'm in multi-threaded mode I will be missing out on fibers if I run my snippet
22:27
<
FromGitter >
<lbarasti> that's really useful, thanks