News for hackers. Stuff that matters.

BrainBacon

Show HN: Unbug 0.5 – Rust runtime debug assertions

https://github.com/greymattergames/unbug/releases/tag/0.5

I'm back again with many improvements to Unbug!My previous post here led to the removal of reliance on nightly Rust, so I'm hoping you helpful folks pick apart my new features too!This new version adds a macro that can insert assertions before failures with the try-operator (?).I also added experimental support for triggering test failures when assertions are run in test mode.I'll be giving a...

( Read More... | no comments | on HN )
Re:Prime Number Grid on Tuesday August 19, 2025 @05:40PM (#44956516)
Not exactly the same, but I made this Ulam spiral generator more than a decade ago.

https://embed.plnkr.co/mdZX6C/

It isn't just doing primes though, instead the size of the dot generated is dependent on the number of even divisors for the number at that position.

Re:The April Fools joke that might have got me fired on Tuesday April 01, 2025 @12:45PM (#43548897)
I did the same thing by accident, except mine was "test", I heard murmors around about some strange message on computers in multiple schools in our district, so I fessed up immediately. Our network administrator was just mildly amused about the whole affair and no punishments were carried out.
Re:Sombrero Galaxy dazzles in new James Webb image on Tuesday November 26, 2024 @07:52PM (#42251796)
You're thinking of a nebula. That’s the remnants of a supernova. A galaxy is an unimaginably large collection of stars. A nebula is still quite large, but several orders of magnitude smaller than a galaxy.
Answering my own question, apparently `brk #1` is insufficient on Apple silicon. That results in just a trap and will prevent the debugger from continuing past the debug statement. From a bit of searching and my experiments `brk #0xF000` was the way to go instead which had the consequence of not always landing on the debug statement, the addition of a nop with `brk #0xF000 \n nop` resulted in the debugger landing on the correct statement.
I didn't come across any good ones when creating this library, but if you're using VSCode, I tried my best to make the README as beginner friendly as possible. I'm open to issues and PRs if anything is unclear. I think part of the issue is that debugging is not yet very common in the Rust ecosystem, partially due to the excellent borrow checker and error messages, but partially due to immature tooling, hence I made this to promote the practice of debugging.
I can understand where you're coming from, but when programming games you generally don't want a breakpoint to be hit more than once since you are running a loop over multiple frames. So in this case the concept of ensure_once is more common, so the shorter inverse is more convenient. Asserts should be enough to get your attention and not to annoy, so orienting it this way is a deliberate choice.
Interesting. Unfortunately, I'm not well versed in assembly, is there a similar trick or requirement in arm and would that include Apple silicon, or is this something specific to `int3` on x86? That may explain why it was inconsistent during my development process, I didn't think to check if the inconsistency was platform dependent.
Thanks! I'll get a PR up shortly!
Thanks, yeah I considered using the instructions directly, but I was hoping for a more cross-platform option. For my purposes, developing in the Bevy engine, nightly isn't a huge blocker. Yeah, it would be really great to just have breakpoint support in stable Rust, thanks for doing the proposal! I'll consider stable support in the meantime.

Show HN: Unbug – Rust macros for programmatically invoking breakpoints

https://github.com/greymattergames/unbug

This project is inspired by some of the asserts in Unreal engine.Due to reliance on core_intrinsics it is necessary to develop using nightly Rust, but there are stubs in place so a production build will not require nightly.I recently released version 0.2 which includes no_std support and adds optional log message arguments to the ensure macro.

( Read More... | 40 comments | 55 points | on HN )
Re:Mozilla's new service tries to wipe your data off the web on Wednesday February 07, 2024 @06:30AM (#39287235)
I just looked through the perks on my Google One and don't see this offering. I don't see it in the premium perks either. Do you happen to have a link? Is it some kind of hidden benefit?
Re:Capturing the ripples of spacetime: LISA gets go-ahead on Thursday January 25, 2024 @09:39PM (#39138344)
According to the ESA "As the orientation and direction of motion of the spacecraft triangle changes along the orbit, it will be possible to determine the direction of incoming gravitational wave sources." - From https://sci.esa.int/web/lisa/-/lisa-technology-interferometr...

Here's a pretty great infographic on how they plan to collaborate with the Athena x-ray observatory to detect black hole mergers ahead of time - https://www.esa.int/ESA_Multimedia/Images/2019/05/How_can_LI...

It ends up being about 0.4 square degrees in the sky that they're able to narrow in on before the event. That narrowing takes roughly a month.

You don't need to pay that much to keep a US number for use abroad. Convert any 2fa you can to use an app like Google Authenticator, then convert your number to Google voice. You can get text messages for free using your old number that way. If you don't want Google involved at all, there are many other time-based authentication apps and you can use www.tossabledigits.com for texts.
Re:How is AI impacting science? on Saturday December 30, 2023 @09:31AM (#38815536)
I wholeheartedly disagree with your assertions on mortality. Global population growth is slowing and is set to peak in the 2060s and will decline afterwards. We're more at risk of not having enough hands to take care of an aging population. An educated populace has fewer children and many countries are already feeling the strain of being below the replacement rate.
Re:Pinterest's simple tech stack to scale to 11M monthly users on Saturday December 23, 2023 @10:36AM (#38744959)
It's called the Psychology of Human Misjudgement https://fs.blog/great-talks/psychology-human-misjudgment/
Re:Building a unikernel that runs WebAssembly – part 1 on Monday October 23, 2023 @08:18AM (#37984609)
A couple unikernel projects that caught my eye in the past may be of interest to you. I have no experience with them, so I can't speak to their quality though.

https://unikraft.org/

https://github.com/nanovms/nanos

Re:Anti-ageing molecule boosts fertility in ageing mice on Wednesday October 18, 2023 @05:47AM (#37926618)
This is not entirely true. Some brain cells and the cells in your eye lens will be there your entire life and could even potentially live longer if they were not limited by the rest of the body. Cancer is definitely a lot more than just immortal cells.
Re:How to Easily Make Your Own Pyramid Salt Crystals on Tuesday October 10, 2023 @05:26AM (#37830030)
The YouTube channel Alex (FrenchGuyCooking) made some nice flakey salt in this video: https://youtu.be/eN6U58LzyHg It's a similar process, but he uses coarse sea salt without any alum or other additives. The results are less uniform, but probably better for human consumption.
Re:Apple fucked us on right to repair (again) on Friday September 22, 2023 @02:59PM (#37616204)
I think cheaply available replacement parts ready from the manufacturer would be a much more desirable deterrent for thieves. Louis Rossman's battle with calibrating the angle sensor on the MacBook Pro is a great indicator that these restrictions aren't always done for security reasons since the part in question is worth pennies.