Skip to main content

The Night Sky Is Getting 10% Brighter Every Year

1 month ago
fjo3 quotes a report from The Guardian, written by Tove Danovich: Every year, the night sky is becoming 10% brighter. Eighty percent of people live under light-polluted skies. And while the UN declared a healthy environment -- clean air, clean water -- to be a human right, I believe we also all have a right to darkness as well. This doesn't mean turning off every streetlamp. But do we really need bright white floodlights at the front of every garage? Replacing lights with ones that are bright enough to do the job -- and no brighter -- might make it so I wouldn't have to get in my car and drive for hours to see the night sky as it actually shines above us. To preserve the darkness would mean rules and enforcement around the warmth of the lights, where they point, and how bright they can be. It would mean not putting in three lights when one would do. If we recognized that darkness is something we need, we'd become more careful about chasing it away. [...] Access to darkness is about more than stargazing. The night is its own habitat. Artificial lights confuse animals who use the moon to navigate, whether they're baby sea turtles navigating toward a parking lot instead of the ocean or moths who fly in circles around a lightbulb. Lightning bugs and frogs need darkness to complete their courtship rituals. Migrating birds get thrown off course by the bright lights of big cities. But the effects of light pollution linger even after it's daylight again, becoming visible. Research has shown light pollution is breaking the relationship between plants and pollinators, changing the time of year trees break into flower, and disrupting circadian rhythms for all living creatures. This includes humans. Whether it's artificial lights indoors or creeping in through the window at night, studies have found that we need darkness in order to rest, recover and stay healthy.

Read more of this story at Slashdot.

BeauHD

CodeSOD: Quite a Distance from the Right Solution

1 month ago

Fritz's team needed to see if one point was within a certain distance from a center point. You or I would likely try and answer this question using a simple distance calculation, since that's the question we're trying to answer. But what if you didn't understand distances at all? Then you could write this little piece of genius.

private bool IsWithin(Point point, int radius) { for (int x = -radius; x < radius + 1; x++) { for (int y = -radius; y < radius + 1; y++) { if ((PositionX == point.X + x) && (PositionY == point.Y + y)) return true; } } return false; }

This limits us to integer point values, which itself is fine. This iterates across every coordinate from (x-radius,y-radius) to (x+radius,y+radius) and checks if any of them are equal to our center point, (PositionX,PositionY). Notably, this means we're not checking a radius, at least not in a traditional metric, we're checking a box (or using the taxicab metric). Which if we wanted to check a box, we actually have even easier math than the distance equation- we could do that with pure bounds checking.

I've never thought to try and brute force distance checking, and that feels like a failure of my own creativity. Fritz's team mate at least was able to WTF in a way I wouldn't have considered.

[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
Remy Porter