Half of drivers say illegal parking on double yellow lines is 'significant problem' where they live
And they're OFF! Horse racing goes on STRIKE: Sport stops to protest against proposed tax rise on betting which six-time Champion Trainer says will 'kill communities'
James McAvoy 'punched by man in Toronto bar as security intervene to help him'
Home Office delays £816M English test contract despite market engagement
Plans for an £816 million system to test the English skills of UK visa applicants have stalled, with the Home Office pushing procurement back at least five months after repeated consultations with suppliers.…
Witnesses Tell Congress of UFO Sightings
Read more of this story at Slashdot.
Exact date award-winning ice cream stall will open at popular Essex shopping centre
The Labour left lining up to come for Starmer: As MPs throw their hat in the ring to replace Angela Rayner as Deputy PM... who's the biggest nightmare for Sir Keir - and you?
Pictured: Scene of tragedy after two men were killed in 'freak' glass accident at Hitchin Town FC car park
UK schools give system supplier Bromcom an F for Azure uptime
UK school management information system (MIS) provider Bromcom has had a bad start to the academic year after its Azure-based service left staff struggling to track student attendance, let alone access contact details for parents and guardians.…
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; }