Computer
iPhone 17 Air Drops Physical SIM Slot Globally, Pushing eSIM-Only Future
Read more of this story at Slashdot.
FAA Warns Airlines About Lithium Battery Dangers After 50 Incidents This Year
Read more of this story at Slashdot.
Bending Spoons Buys Video Platform Vimeo for $1.38 Billion
Read more of this story at Slashdot.
iPhones 17 and the Sugar Water Trap
Read more of this story at Slashdot.
Narrative Podcasts Are Disappearing
Read more of this story at Slashdot.
NASA Says Mars Rover Discovered Potential Biosignature Last Year
Read more of this story at Slashdot.
A $3 Billion Error Draws Apology From South Africa Energy Agency
Read more of this story at Slashdot.
How Britain Built Some of the World's Safest Roads
Read more of this story at Slashdot.
Why Netflix Struggles To Make Good Movies: A Data Explainer
Read more of this story at Slashdot.
Different People's Brains Process Colors in the Same Way
Read more of this story at Slashdot.
Growth Collides With Rising Seas in Charleston
Read more of this story at Slashdot.
AI Darwin Awards Launch To Celebrate Spectacularly Bad Deployments
Read more of this story at Slashdot.
Protect Arctic From 'Dangerous' Climate Engineering, Scientists Warn
Read more of this story at Slashdot.
Witnesses Tell Congress of UFO Sightings
Read more of this story at Slashdot.
CodeSOD: Upsert Yours
Henrik H sends us a short snippet, for a relative value of short.
We've all seen this method before, but this is a particularly good version of it:
public class CustomerController { public void MyAction(Customer customer) { // snip 125 lines if (customer.someProperty) _customerService.UpsertSomething(customer.Id, customer.Code, customer.Name, customer.Address1, customer.Address2, customer.Zip, customer.City, customer.Country, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null, null, false, false, false, false, true, false, null, null, null, false, true, false, true, true, 0, false, false, false, false, customer.TemplateId, false, false, false, false, false, string.Empty, true, false, false, false, false, false, false, false, false, true, false, false, true, false, false, MiscEnum.Standard, false, false, false, true, null, null, null); else _customerService.UpsertSomething(customer.Id, customer.Code, customer.Name, customer.Address1, customer.Address2, customer.Zip, customer.City, customer.Country, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null, null, false, false, false, false, true, false, null, null, null, false, false, false, true, true, 0, false, false, false, false, customer.TemplateId, false, false, false, false, false, string.Empty, true, false, false, false, false, false, false, false, true, true, false, false, true, false, false, MiscEnum.Standard, false, false, false, true, null, null, null); // snip 52 lines } }Welcome to the world's most annoying "spot the difference" puzzle. I've added line breaks (as each UpsertSomething was all on one line in the original) to help you find it. Here's a hint: it's one of the boolean values. I'm sure that narrows it down for you. It means the original developed didn't need the if/else and instead could have simply passed customer.someProperty as a parameter.
Henrick writes:
While on a simple assignment to help a customer migrate from .NET Framework to .NET core, I encountered this code. The 3 lines are unfortunately pretty representative for the codebase
.comment { border: none; } [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!Beer Drinkers Are Mosquito Magnets, According To a Festival Study
Read more of this story at Slashdot.
Executive Director Cindy Cohn Will Step Down After 25 Years With EFF
Read more of this story at Slashdot.
Microsoft To Use Some AI From Anthropic In Shift From OpenAI
Read more of this story at Slashdot.
HHS Asks All Employees To Start Using ChatGPT
Read more of this story at Slashdot.
How Google Is Already Monetizing Its AI Services To Generate Revenue
Read more of this story at Slashdot.