Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:02
    HertzDevil labeled #11546
  • 06:02
    HertzDevil labeled #11546
  • 06:02
    HertzDevil opened #11546
  • 05:20
    HertzDevil synchronize #11379
  • 03:29
    HertzDevil review_requested #11524
  • 03:28
    HertzDevil edited #11379
  • 03:28
    HertzDevil edited #11379
  • 03:27
    HertzDevil synchronize #11379
  • 03:09
    HertzDevil edited #11545
  • 03:08
    HertzDevil edited #11545
  • 03:05
    HertzDevil edited #11545
  • 03:00
    HertzDevil labeled #11545
  • 03:00
    HertzDevil labeled #11545
  • 03:00
    HertzDevil labeled #11545
  • 03:00
    HertzDevil labeled #11545
  • 03:00
    HertzDevil opened #11545
  • 02:44
    neatorobito synchronize #11543
  • 00:57
    oprypin review_requested #11543
  • Dec 06 23:49
    BlobCodes synchronize #11094
  • Dec 06 23:47
    straight-shoota milestoned #11230
From IRC (bridge bot)
@FromIRC
<yxhuvud> well you'd need a pipe or whatever in between
oprypin
@oprypin:matrix.org
[m]
not for the stdout case
it's all programmatic. any write call gets rewritten to a different write call and that's it
and i know about pipes because i certainly needed them in this latest example
From IRC (bridge bot)
@FromIRC
<yxhuvud> unless you want to keep it compatible wth c extensions or whatever, but yeah
oprypin
@oprypin:matrix.org
[m]
ah yea for stuff that directly accesses STDOUT descriptor then you probably need reopen into a pipe
but i think avoiding a pipe+fiber is a more worthy goal than catering to stuff that bypasses official interfaces
From IRC (bridge bot)
@FromIRC
<yxhuvud> both would probably be nice to have. for example to redirect std output for a c extension to avoid spamming the terminal
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Hello there! How can I force some method override to take over something else?
George Dietrich
@Blacksmoke16
define it after the one you want to override
From IRC (bridge bot)
@FromIRC
<SamantazFox_> the problem is that I want to intercept an exception, but I'd like to not have a duplicate of the stdlib for a single line of code
George Dietrich
@Blacksmoke16
feels hacky to override stuff like this
could you not use a HTTP::Handler for this?
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Idk, tbh
<SamantazFox_> I'm entirely open to suggestions!
<SamantazFox_> " You can use a handler to intercept any incoming request and can modify the response. These can be used for request throttling, ip-based filtering, adding custom headers e.g. <code>"
<SamantazFox_> Hmm, but when is it called?
George Dietrich
@Blacksmoke16
that would work, but also would globally silence both of those exceptions, even if they arent from that specific context in your PR
whats the reason these exceptions are being thrown? would it be better to fix the root cause versus just hiding the issue?
From IRC (bridge bot)
@FromIRC
<SamantazFox_> The root cause is simply the user aborting the page loading
<SamantazFox_> they reach <domain>/some/path and either click on a link or on the "Stop" button near the URL bar while the page is still loading.
George Dietrich
@Blacksmoke16
hmm
From IRC (bridge bot)
@FromIRC
<SamantazFox_> crystal-lang/crystal#9065
<SamantazFox_> Here's the issue about that problem ^
<SamantazFox_> That wouldn't be much of a problem if that didn't fill up the logs every time a user is impatient...
George Dietrich
@Blacksmoke16
could just silence the logs from stdlib http stuff
based on https://github.com/crystal-lang/crystal/issues/9065#issuecomment-613559889, id be curious to see if you can reproduce on a simple endpoint or something
From IRC (bridge bot)
@FromIRC
<SamantazFox_> it doesn't happen with a small payload (it's probably being buffered or something)
From IRC (bridge bot)
@FromIRC
<SamantazFox_> (I've tried to delay the response as proposed here: https://github.com/crystal-lang/crystal/issues/9065#issuecomment-961489274, but the browser doesn't seem to time out for localhost)
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Yep, confirmed: Firefox and Vivaldi don't timeout on localhost.
George Dietrich
@Blacksmoke16
SamantazFox_: reproducible example would be super helpful id say
From IRC (bridge bot)
@FromIRC
<SamantazFox_> I'll see that tomorrow. I'mm too tipsy to do anything rn x)
ddd
@Dan-Do
what's the short syntax to convert Slice(UInt32) to Slice(UInt8)?
Here is mine
size = 100
sl = Slice(UInt32).new(size)
sl.to_unsafe.as(UInt8*).to_slice(size * sizeof(UInt32))
oprypin
@oprypin:matrix.org
[m]
@Dan-Do: convert in what sense? not obvious. could be truncating each number, could be splitting low-endian or big-endian
@Dan-Do: also might be a different answer if this this happens to be UTF-32
if you're looking for "system-endian" then your answer is good
ddd
@Dan-Do
I have an array of UInt32, I want to compress it using snappy which input only accepts Slice(UInt8)
Quinton Miller
@HertzDevil
From IRC (bridge bot)
@FromIRC
<riza> since an iterator#next returns (T || Iterator::Stop) -- is there a pretty way to sanitize that Stop type out of the return values type?
<riza> or does it have to be a case statment
<riza> I'm having an awful time attempting to increment two iterators at once
George Dietrich
@Blacksmoke16
Case or if with is_a should do it
From IRC (bridge bot)
@FromIRC
<riza> case fails me because I have two iterators I need to mutually advance
<riza> this is what I tried, anyway: case ; when a === stop || b === stop ; else ... end
<riza> I'm also noticing tonight that ranges can't be decreasing and I'm a little twinging at that too
George Dietrich
@Blacksmoke16
I'd just use the latter approach then
From IRC (bridge bot)
@FromIRC
<riza> I think I'm just going to abandon iterators entirely and twiddle the bits myself
<riza> I was surprised about the decreasing range but that's what ruby does too so there must be some sort of reason