Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:46
    caspiano synchronize #12566
  • Oct 05 20:39
    straight-shoota labeled #12529
  • Oct 05 20:39
    straight-shoota unlabeled #12529
  • Oct 05 19:29
    zw963 closed #12529
  • Oct 05 19:01
    HertzDevil labeled #12569
  • Oct 05 19:01
    HertzDevil labeled #12569
  • Oct 05 19:01
    HertzDevil labeled #12569
  • Oct 05 19:00
    lbguilherme synchronize #12569
  • Oct 05 18:59
    lbguilherme synchronize #12569
  • Oct 05 18:57
    lbguilherme opened #12569
  • Oct 05 16:14
    straight-shoota labeled #9803
  • Oct 05 16:14
    straight-shoota unlabeled #9803
  • Oct 05 14:44
    mamantoha closed #12567
  • Oct 05 14:37
    beta-ziliani edited #12568
  • Oct 05 14:35
    beta-ziliani opened #12568
  • Oct 05 13:23
    Blacksmoke16 labeled #12567
  • Oct 05 13:18
    Blacksmoke16 labeled #12567
  • Oct 05 13:06
    mamantoha synchronize #12567
  • Oct 05 13:05
    mamantoha edited #12567
  • Oct 05 13:03
    mamantoha synchronize #12567
From IRC (bridge bot)
@FromIRC
<oprypin> like, instead of making a loop creating a new slice every time this encourages reuse
David Blurton
@davidblurton
I guess I was expecting the client response to have a raw_body property or something
From IRC (bridge bot)
@FromIRC
<oprypin> @davidblurton, but it allows streaming, it does not contain the whole response
<oprypin> abstracting streaming is the whole reason for IO to exist in addition to Slice
David Blurton
@davidblurton
right, I'm looking for a simple way to read the whole body though
I can see that IO is a nice abstraction for reading and writing, but I don't really care about streams here
From IRC (bridge bot)
@FromIRC
<oprypin> @davidblurton, but it's also a nice abstraction for protocol parsing
David Blurton
@davidblurton
I agree, I was using Char::Reader before, until I realised some of the response was binary
so should be easy to swap that for an IO
John Jansen
@johnjansen
anyone got a nice way to timeout an http get
ive done it before, now i cant find the code, or remember what i did
forget i asked … stupid me ;-/
From IRC (bridge bot)
@FromIRC
<RX14> @johnjansen you need to use HTTP::Client.new then set the timeout on that client instance
<RX14> HTTP::Client needs some love to be honest
John Jansen
@johnjansen
yep … didnt think to look first, did i ;-)
From IRC (bridge bot)
@FromIRC
<hightower2> Hey, if I need to write a 16bit unsigned int in little endian order into some buffer, then 1) What buffer do I use? StringBuilder? and 2) How do I write something like that?
John Jansen
@johnjansen
@RX14 might have an answer to that, he was here a little while ago
From IRC (bridge bot)
@FromIRC
<RX14> hightower2, you should look at the write_bytes method on IO
<RX14> String.build yields you an IO instance
<RX14> so you can use that
<RX14> however writing a raw integer to a string is unlikely to be what you want
<RX14> strings shouldn't contain binary data
<RX14> if you're working with binary data, IO::Memory and Bytes should be what you use
<hightower2> @RX14, right, was just about to say that, thanks
Chris Watson
@watzon
Anyone know where stddef.h would come from? I seem to be missing it. Reinstalled clang and gcc already
Never mind, I found it in /usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include, but clang seems to not be picking it up for some reason. I'm trying to use crystal_lib and it keeps telling me /usr/include/sys/types.h:145:10: fatal error: 'stddef.h' file not found
From IRC (bridge bot)
@FromIRC
<hightower2> I am trying to write data to a socket, and invoke some method/callback when the data is actually written out. Is there a built-in way for this?
Doug
@DougEverly
@drosehn see if https://github.com/DougEverly/daemonize.cr works for you
Chris Watson
@watzon
What would the Crystal equivilent of unsigned long be?
Would I do $var_name : Float64?
Zatherz
@zatherz
unsigned long is an integer type
long is, at least on most platforms that crystal targets, Int64
crystal doesn't have things like unsigned, it's separate types, so UInt64
@bararchy @watzon Thanks, I'm gonna use these results for https://gitlab.com/zatherz/magicjson
I'm gonna have an always_ordered option that makes it use force ordered, otherwise I'm gonna use naive w/ reset
Chris Watson
@watzon
Ooh awesome
Good going using GitLab
sevk
@sevk
make crystal as a human language , similar to short english .
Zatherz
@zatherz
what
Chris Watson
@watzon
:confused:
sevk
@sevk
easy++
Chris Watson
@watzon
Anyone know what these would be in a Crystal Lib file?
void numa_init (void);
void numa_uninit (void);
I tried fun numa_init, but it's telling me can't find function numa_init (Exception)
Matias Garcia Isaia
@mgarciaisaia
@watzon doesn't fun numa_init : Void work?
Chris Watson
@watzon
@mgarciaisaia nope. Still says it can't find the function
Oh well, I don't think it's an important one to include
Matias Garcia Isaia
@mgarciaisaia
The Crystal Way™ would be something like:
lib Numa
  fun init = numa_init : Void
  # ...
end
So your code calls Numa.init instead of an ugly, C-like name
Chris Watson
@watzon
Is it possible to wrap static functions? Like https://gitlab.com/procps-ng/procps/blob/master/proc/readproc.c#L89
crystal_lib seems to not like them