Every emotional moment from the Gilgo Beach killer's sentencing: Rex Heuermann's shocking first words... and the chilling exchange that silenced the room
'Regime change' on hold as new Federal Reserve boss Kevin Walsh takes the reins
A.N. WILSON: The unmistakable link between the depraved sex life of the Left's favourite economist and his ruinous spend, spend, spend policies
Trump turns on the charm after extended 'alpha' handshake with Macron and kisses for Brigitte at Palace of Versailles
Representative Line: Sort This Out
Today's anonymous submitter has spent a long time toiling through many, many tickets. Their effort has been an attempt to "save" their employer from the disaster left behind by by a highly-paid consultant. As one does, our submitter started with the highest priority tickets with the highest severity. Eventually, they whittled down that list, and had some bandwidth to start looking at the pieces of the code which clearly weren't exploding right now (because there were no tickets), but were likely to explode at some point in the future (creating a storm of tickets).
Scanning through the JavaScript, our submitter found a sort function. That was automatically concerning- why was that particular wheel being reinvented?
The first line of the sort function was this:
obj[x._id.account_id] = x.count_totalIn this case, x._id is meant to be the unique identifier from their Mongo DB. That, uh, should be not precisely a UUID (Mongo does its own weird version), but it definitely shouldn't have an account_id field on it. They are storing an arbitrary object as their unique identifier in the database. Which, I'm no Mongo expert, but I don't need to be Flash Gordon to know that's a bad idea.
But setting aside the choice of using random objects as unique identifiers, there's also the other question: how is this furthering the goal of sorting? Why on Earth am I building an object in the form: {"id0": 5, "id1": 7, "id2": 11}? Or am I even doing that? This is the first line of the function, so we're not even doing a loop, it's just {"id0": 5}.
This isn't just an unexploded bomb, it's a mystery: the primary mystery being why hasn't this exploded already? The second mystery is: what's going to happen when your luck runs out?
England 4-2 Croatia - PLAYER RATINGS: Who was Thomas Tuchel's shining star, who 'offered far too little', who was 'indecisive' and which two players got just 3 out of 10? Now use our new tool to give YOUR verdict
The women behind Harry Kane's men: Inspirational mothers who sacrificed so much for their boys to become World Cup heroes
Uzbekistan 1-3 Colombia: Luis Diaz and Co survive scare from World Cup debutants in Mexico City
Lorraine Kelly sparks rumours she is quitting ITV and moving back to Scotland as she 'sells her £2.2m Buckinghamshire mansion'
Essex boy's life saved in UK-first procedure after being told he would be 'unlikely to survive'
Thomas Tuchel reveals details of half-time team talk that inspired England's World Cup victory over Croatia
Trump breaks with decades of US policy in jaw-dropping confession that Iran will have missiles as part of peace deal
World Cup Unfiltered Poll: Which team impressed YOU the most in the opening round of the World Cup? Vote now!
Someone with same name as me ran up £4,763 EDF energy debt - now it says I have to pay the bill: CRANE ON THE CASE
Anger over 'rancid' plans for 350 homes in Essex beauty spot
What REALLY happened to the Titan: Final moments of doomed 22ft sub
'She has not been transparent... the damage has been done': How influencer Elle Darby 'betrayed' thousands of young female fans...as insiders tell MOLLY CLAYTON how she cashed in
UK's longest-running temporary traffic lights to be removed this year
Tesco Moving 40,000 Server Workloads Off VMware Amid Broadcom's 'Abusive Conduct'
Read more of this story at Slashdot.