Barron Trump moves into White House as president's youngest son attends NYU in Washington DC
Arm bets on CPU-based AI with Lumex chips for smartphones
Arm has lifted the lid on its latest mobile platform, comprising new CPU and GPU designs plus rearchitected interconnect and memory management logic, all optimized with a coming wave of AI-enabled smartphones in mind.…
ALEX BRUMMER: Everywhere I go in the City, bosses are issuing dire warnings. But Reeves just won't listen
Control freak Starmer fears he can't trust his own party - and this is all the behind-the-scenes drama that proves he's right: DAN HODGES
Passport stamps to be SCRAPPED in 29 European countries this autumn - here's what travellers need to know
Thomas Skinner's future on Strictly is in doubt as BBC insiders brand his behaviour 'a disgrace' after he STORMED OUT of press conference
Chaos at massive cargo port in Los Angeles as dozens of shipping containers tumble into the ocean
Trump greeted by mob of protesters as he FINALLY eats at a DC restaurant he doesn't own
Chilling first images of the moments before Dezi Freeman opened fire and killed two cops as his wife begged to come out - as we reveal exactly how the ambush unfolded
The burglary gangs preying on Cheshire's celebrities: Why stars are being targeted in wealthy footballer belt as Olivia Attwood and Bradley Dack sell up after being burgled three times
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; }