Scientists studying spherical UFO say they've discovered alien technology
Cheryl 'will always do the right thing': Insiders reveal how she will safeguard Liam Payne's £24million fortune after he left it to son Bear
Kylie Jenner and boyfriend Timothee Chalamet FINALLY make their red carpet debut as she shows off her curves in a plunging black gown at glitzy awards show in Rome
Dangerous Fungal Spores May Travel the Globe On 'Stratospheric Superhighway'
Read more of this story at Slashdot.
Living Nostradamus who predicted COVID-19 dishes on Justin Bieber's future in music and his marriage to Hailey
Jennifer Lopez reveals 'promise' she made to twins Max and Emme about her Ben Affleck divorce
Israeli embassy next to Kensington Palace in west London 'was target of Iranian terror plot that posed immediate risk to life' before anti-terror police 'foiled plans with just HOURS to spare'
Sudo-rs make me a sandwich, hold the buffer overflows
Canonical's Ubuntu 25.10 is set to make sudo-rs, a Rust-based rework of the classic sudo utility, the default – part of a push to cut memory-related security bugs and lock down core system components.…
Kate Cassidy breaks her silence after bombshell documents reveal Liam Payne's £24m fortune will not be going her way
CodeSOD: Leap to the Past
Early in my career, I had the misfortune of doing a lot of Crystal Reports work. Crystal Reports is another one of those tools that lets non-developer, non-database savvy folks craft reports. Which, like so often happens, means that the users dig themselves incredible holes and need professional help to get back out, because at the end of the day, when the root problem is actually complicated, all the helpful GUI tools in the world can't solve it for you.
Michael was in a similar position as I was, but for Michael, there was a five alarm fire. It was the end of the month, and a bunch of monthly sales reports needed to be calculated. One of the big things management expected to see was a year-over-year delta on sales, and they got real cranky if the line didn't go up. If they couldn't even see the line, they went into a full on panic and assumed the sales team was floundering and the company was on the verge of collapse.
Unfortunately, the report was spitting out an error: "A day number must be between 1 and the number of days in the month."
Michael dug in, and found this "delight" inside of a function called one_year_ago:
Local StringVar yearStr := Left({?ReportToDate}, 4); Local StringVar monthStr := Mid({?ReportToDate}, 5, 2); Local StringVar dayStr := Mid({?ReportToDate}, 7, 2); Local StringVar hourStr := Mid({?ReportToDate}, 9, 2); Local StringVar minStr := Mid({?ReportToDate}, 11, 2); Local StringVar secStr := Mid({?ReportToDate}, 13, 2); Local NumberVar LastYear; LastYear := ToNumber(YearStr) - 1; YearStr := Replace (toText(LastYear),'.00' , '' ); YearStr := Replace (YearStr,',' , '' ); //DateTime(year, month, day, hour, min, sec); //Year + Month + Day + Hour + min + sec; // string value DateTime(ToNumber(YearStr), ToNumber(MonthStr), ToNumber(dayStr), ToNumber(HourStr), ToNumber(MinStr),ToNumber(SecStr) );We've all seen string munging in date handling before. That's not surprising. But what's notable about this one is the day on which it started failing. As stated, it was at the end of the month. But which month? February. Specifically, February 2024, a leap year. Since they do nothing to adjust the dayStr when constructing the date, they were attempting to construct a date for 29-FEB-2023, which is not a valid date.
Michael writes:
Yes, it's Crystal Reports, but surprisingly not having date manipulation functions isn't amongst it's many, many flaws. It's something I did in a past life isn't it??
The fix was easy enough- rewrite the function to actually use date handling. This made a simpler, basically one-line function, using Crystal's built in functions. That fixed this particular date handling bug, but there were plenty more places where this kind of hand-grown string munging happened, and plenty more opportunities for the report to fail.
The clash between 'vile' Nicola and Victoria that REALLY sparked the feud between Brooklyn and the Beckhams, as friends reveal to KATIE HIND family's fury at attacks on Romeo's girlfriend Kim
Heart-stopping moment dog owner jumps into pool to save clumsy pooch TWICE: 'No survival instincts'
How 10,000 tiny pearls were secretly brought to the UK for Queen Elizabeth's wedding dress
Popular food now linked to PARKINSON'S disease as doctors issue urgent warning
Revealed: How Prince William keeps proving to be a true statesman - and the secret role he played at the Pope's funeral talks
Army vet comes back from the dead to forgive his killer as eerie impact statement played during sentencing hearing
Jim Carrey slashes $10M off LA home but still no takers after admitting he's banking on Sonic sequels for cash
Why did James Corden miss David Beckham's big night? Pal was 'surprisingly' absent from party attended by all the footballer's best friends - that son Brooklyn skipped
The truth behind Nicole Kidman's shock new look: Stylist reveals if A-list star's new pixie cut is the real deal
AI of Dead Arizona Road Rage Victim Addresses Killer In Court
Read more of this story at Slashdot.