Feed aggregator
Perplexity Teases AI Web Browser Called Comet
Read more of this story at Slashdot.
AT&T and Verizon Connect First Cellphone-To-Satellite Video Calls
Read more of this story at Slashdot.
Anthropic Launches the World's First 'Hybrid Reasoning' AI Model
Read more of this story at Slashdot.
Microsoft Quietly Launches Ad-Supported Version of Office Apps for Windows
Read more of this story at Slashdot.
AI Reshapes Corporate Workforce as Companies Halt Traditional Hiring
Read more of this story at Slashdot.
Ellison's Half-Billion-Dollar Quest To Change Farming Has Been a Bust
Read more of this story at Slashdot.
More Than Half of Countries Are Ignoring Biodiversity Pledges
Read more of this story at Slashdot.
Software Firm Bird To Leave Europe Due To Onerous Regulations in AI Era, Says CEO
Read more of this story at Slashdot.
Microsoft Dropped Some AI Data Center Leases, TD Cowen Says
Read more of this story at Slashdot.
Pre-Product AI 'Company' Now Valued at $30 Billion
Read more of this story at Slashdot.
Google To Eliminate SMS Authentication in Gmail, Implement QR Codes
Read more of this story at Slashdot.
Should Climate Change Be Acknowledged In Movies?
Read more of this story at Slashdot.
Apple Announces $500 Billion US Investment Plan, To Hire 20,000 People
Read more of this story at Slashdot.
Meet the Journalists Training AI Models for Meta and OpenAI
Read more of this story at Slashdot.
CodeSOD: Uniquely Expressed
Most of us, when generating a UUID, will reach for a library to do it. Even a UUIDv4, which is just a random number, presents challenges: doing randomness correctly is hard, and certain bits within the UUID are reserved for metadata about what kind of UUID we're generating.
But Gretchen's co-worker didn't reach for a library. What they did reach for was… regular expressions?
function uuidv4() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); }At a glance, this appears to be a riff on common answers on Stack Overflow. I won't pick on this code for not using crypto.randomUUID, the browser function for doing this, as that function only started showing up in browsers in 2021. But using a format string and filling it with random data instead of generating your 128-bits as a Uint8Buffer is less forgivable.
This solution to generating UUIDs makes a common mistake: confusing the representation of the data with the reality of the data. A UUID is 128-bits of numerical data, with a few bits reserved for identification (annoyingly, how many bits are reserved depends on which format we're talking about). We render it as the dash-separated-hex-string, but it is not a dash-separated-hex-string.
In the end, this code does work. Awkwardly and inefficiently and with a high probability of collisions due to bad randomness, but it works. I just hate it.
[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!Fedora Amicably Resolves Legal Threat From OBS Studio Over Downstream Flatpak
Read more of this story at Slashdot.
Useless High-Voltage Power Lines Risk Sparking California Fires
Read more of this story at Slashdot.
Firefly's Moon-Orbiting 'Blue Ghost' Lunar Lander Tracked Earth-Orbiting GPS-Type Satellites
Read more of this story at Slashdot.
Animated 'Avatar: the Last Airbender' Gets Sequel, Plus Two More of Netflix's Live-Action Seasons
Read more of this story at Slashdot.
'Robot' Umpires Come to Major League Baseball (Spring Training) Games
Read more of this story at Slashdot.