HNHacker News
TopNewBestAskShowJobs

badmintonbaseba

365 karma · joined October 7, 2024

submissionscomments
badmintonbaseba··on Dithering in Colour
Blue noise threshold map works really well on GPUs.
badmintonbaseba··on Carefully but Purposefully Oxidising Ubuntu
Super interesting. Tempting to hook it up with conan to build our dependencies and set it up with our unit tests at least. If incompatibilities are mostly due to the libc then I don't think any of our C++ dependencies would care.
badmintonbaseba··on Carefully but Purposefully Oxidising Ubuntu
What modifications are needed to run through Fil-C, if any? It looks like you forked some of the software to run through Fil-C. Are you subsetting the language, or do those libraries/applications run into some "benign" UB under normal operation that is caught by Fil-C?
badmintonbaseba··on Carefully but Purposefully Oxidising Ubuntu
What about performance?
badmintonbaseba··on Zinc, a systems programming language prototype
Even if you limit "side effects" to observable behavior in the abstract machine sense, it's not entirely clear what is meant by a function to be "pure".

GCC has two attributes for marking functions, "pure" and "const" (not the language const qualifier). C23 introduced the [[reproducible]] and [[unsequenced]] attributes, that are mostly modeled by the GCC extensions, but with some subtle but important differences in their description.

Turns out it's pretty hard to define these concepts if the language is not built around immutability and pure functions from the ground up.

badmintonbaseba··on Dithering in Colour
Apart from implementing it incorrect, an uncalibrated display could also cause this. Check out http://www.lagom.nl/lcd-test/gamma_calibration.php with DPI scaling turned off, at 100% zoom level (how browsers scale images are also horrible, so you want to avoid that).

edit:

Reading back, viewing the gradients also not at 100% zoom level could also itself cause the mismatch, because browsers just suck at image scaling.

badmintonbaseba··on Dithering in Colour
I agree. I think the problem is a banal missing color transformation somewhere in the pipeline, like converting the palette and image to linear colorspace, doing the dithering there and mistakenly writing the linear color values instead of sRGB color values into the image.

Others suggest that the error is using the wrong metric for choosing the closest color, but I disagree. That wouldn't such drastic systematic darkening like this, as the palette is probably still pretty dense in the RGB cube.

Where the linearisation really matters is the arithmetic for the error diffusion, you definitely want to diffuse the error in a linear colorspace, and you are free to choose a good perceptual space for choosing the closest color at each pixel, but calculate the error in a linear space.

Visual perception is weird. But when you squint your eyes to blur the image, you are definitely mixing in a linear colorspace, as that's physical mixing of light intensities before the light even reaches your retina. So you have to match that when diffusing the error.

edit:

It also doesn't help that most (all?) browsers do color mixing wrong when the images are scaled, so if you don't view the dithered images at 100% without DPI scaling than you might get significantly distorted colors due to that too.

edit2:

For comparison this is what imageworsener does:

https://imgur.com/a/XmJKQnz

You really need to open the image in a viewer where each image pixel is exactly one device pixel large, otherwise the color arithmetic used for scaling by viewers is of variable quality (often very poor).

badmintonbaseba··on Stack Traces Are Underrated
That's a good point. I would argue that both that line and the reported `loop.run_until_complete(main_task)` line are important, but then it becomes impossible to have a single linear trace when there are manually scheduled and waited on tasks mixed in.

At that point you have something like a "coroutine frame tree" instead of a "stack trace", where you potentially store multiple parent frames and source lines per coroutine frame. Could be presented something like:

  $ python3 test_stacktrace.py
  Traceback (most recent call last):
  * File "/home/user/tmp/test_stacktrace.py", line 22, in <module>
  |   main_task = loop.create_task(main())
  | * File "/home/user/tmp/test_stacktrace.py", line 24, in <module>
  |/    loop.run_until_complete(main_task)
  * File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
  |   return future.result()
  * File "/home/user/tmp/test_stacktrace.py", line 17, in main
  |   await foo()
  * File "/home/user/tmp/test_stacktrace.py", line 13, in foo
  |   await bar()
  * File "/home/user/tmp/test_stacktrace.py", line 9, in bar
  |   await baz()
  * File "/home/user/tmp/test_stacktrace.py", line 5, in baz
      raise RuntimeError()
  RuntimeError
badmintonbaseba··on Stack Traces Are Underrated
Python asyncio supports meaningful stack traces through async functions just fine.

  import asyncio
  
  async def baz():
      await asyncio.sleep(.1)
      raise RuntimeError()
  
  async def bar():
      await asyncio.sleep(.1)
      await baz()
  
  async def foo():
      await asyncio.sleep(.1)
      await bar()
  
  async def main():
      await asyncio.sleep(.1)
      await foo()
  
  if __name__ == "__main__":
      loop = asyncio.new_event_loop()
      asyncio.set_event_loop(loop)
      main_task = loop.create_task(main())
      try:
          loop.run_until_complete(main_task)
      except KeyboardInterrupt:
          main_task.cancel()
          loop.run_until_complete(asyncio.wait([main_task]))
          pass
And then run: $ python3 test_stacktrace.py Traceback (most recent call last): File "/home/user/tmp/test_stacktrace.py", line 24, in <module> loop.run_until_complete(main_task) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/user/tmp/test_stacktrace.py", line 17, in main await foo() File "/home/user/tmp/test_stacktrace.py", line 13, in foo await bar() File "/home/user/tmp/test_stacktrace.py", line 9, in bar await baz() File "/home/user/tmp/test_stacktrace.py", line 5, in baz raise RuntimeError() RuntimeError
badmintonbaseba··on DIY "infinity contrast" TV – with 100% recycled parts [video]
I would be more interested in matching up timing/latency, especially with the OBS processing in the middle.
badmintonbaseba··on There isn't much point to HTTP/2 past the load balancer
boost.beast also only talks HTTP/1.1 AFAIK, so if you want HTTP/2 or /3 on your frontend then you must put it behind a reverse proxy anyway.
badmintonbaseba··on Clean Code vs. A Philosophy Of Software Design
The code is there to explain the comment.
badmintonbaseba··on 'Impossible-to-hack' security turns out to be no security
I think it was downplayed even more. Supposedly the initial email by the researcher only had evidence for leaking database sizes, and I think it's likely that the CEO only got confirmation for this evidence internally and nothing more.
badmintonbaseba··on 'Impossible-to-hack' security turns out to be no security
It looks like the CEO is both clueless and his reports are also probably misleading him. Whoever looked into the security problem probably saw the extent of it. This possibly got downplayed when reported back to the CEO. However rude, the CEO had little reason to lie about the extent of the problem towards the security researcher.
badmintonbaseba··on Tokio and Prctl = Nasty Bug
The name of the tool is on point.
badmintonbaseba··on Tokio and Prctl = Nasty Bug
Presumably the author would like something that's handled by the kernel and not user space, so even a SIGKILL-ed parent process would trigger the reaping of the children.
badmintonbaseba··on Fun with C++26 reflection: Keyword Arguments
My gripe was not the form of initialization of the elements, but forming `b.a1` before `b`'s lifetime has started. It hasn't started before all of the elements are initialized.
badmintonbaseba··on Fun with C++26 reflection: Keyword Arguments
That's a stretch to call it "easy enough", you are explicitly pointing the gun at your foot. That `b.a1` might not be explicitly UB, but that's quite suspect when b's lifetime didn't start yet. Accessing members through `this` in constructors have some special allowance to not make that UB.
badmintonbaseba··on Fun with C++26 reflection: Keyword Arguments
It's mostly C++. You are right to be scared.
badmintonbaseba··on Fun with C++26 reflection: Keyword Arguments
You can build runtime reflection on top of compile time reflection, it's impossible the other way around. Compile time reflection is a superset of what runtime reflection can do.
badmintonbaseba··on Fun with C++26 reflection: Keyword Arguments
You can't easily take the pointer to an other member in a designated initializer. It's still a problem for members that are implicitly initialized by their default member initializer, but that can be sorted out.
badmintonbaseba··on The inevitability of the borrow checker
> As far as I know, there is no way to actually force a C++ class to be heap allocated.

Make the destructor (and possibly the constructors) private, have public factory functions that hand out unique_ptr with a custom deleter, or define a public destroying operator delete (C++20) and use unique_ptr with its default deleter.

badmintonbaseba··on F-strings for C++26 proposal [pdf]
freestanding maybe? Embedded apps often don't shy away from using something like printf, yet they don't like unnecessary allocations.
badmintonbaseba··on Show HN: Audiocube – A 3D DAW for Spatial Audio
Try https://www.youtube.com/watch?v=IUDTlvagjJA
badmintonbaseba··on Google Pixel 4a's old firmware is gone, trapping users on buggy battery update
> Since this is a major release, the Pixel 4a (5G) and Pixel 5 have not been ported to Android 14 QPR2 as part our initial release. We need to determine whether it makes sense to move these end-of-life devices to Android 14 QPR2 or keep them on a legacy extended support release branch based on the last Android 14 QPR1 release.

https://grapheneos.org/releases#2024030600

badmintonbaseba··on Hacking Subaru: Tracking and controlling cars via the admin panel
How is that supposed to work for second hand vehicles?
badmintonbaseba··on Shifting Cyber Norms: Microsoft security POST-ing to you
This just highlights how the security scanning is just theater though. So bad actors can now just have their evil content behind a form, and users get accustomed to the double opt-in workflow anyway.
badmintonbaseba··on 0-click deanonymization attack targeting Signal, Discord, other platforms
> Why should they make which datacenters have a resource cached be obvious public knowledge?

I agree that having it in the header for everyone is maybe too obvious. But you could otherwise infer that from timing.

badmintonbaseba··on The QUIC API OpenSSL will not provide (2021)
Just recently apt listchanges informed me that "curl" (the binary) switched to gnuTLS to support HTTP3 (libcurl remained on openSSL for compatibility). So I assume this is still not fully resolved.
badmintonbaseba··on Take the pedals off the bike
It's the combination of steering and forward momentum the gives the negative feedback. Bike tips left -> steering turns left -> circular path -> (from moving frame of reference) centrifugal force tips the bike back upright.

Without forward movement you miss the centrifugal force that tips the bike back up.

← PreviousPage 3 of 6Next →