Record number of parking tickets quashed last year after appeals soared to 107,202 amid growing drivers' anger at 'cowboy' operators
CodeSOD: Cancel Catch
"This WTF is in Matlab" almost feels like cheating. At one place I worked, somebody's job was struggling through a mountain of Matlab code and porting it into C. "This Matlab code looks like it was written by an alien," also doesn't really get much traction- all Matlab code looks like it was written by an alien. This falls into the realm of "Researchers use Matlab, researchers may be very smart about their domain, but generally don't know the first thing about writing maintainable code, because that's not their job."
But let's take a look at some MatLab Carl W found:
try if (~isempty(fieldnames(bigStruct)) && isfield(bigStruct,'pathName')) [FileName, PathName] = uigetfile(bigStruct.pathName); else [FileName, PathName] = uigetfile(lastPath); %lastPath holds previous path end catch bigStruct = struct; endThe uigetfile function opens a file dialog box. When the user selects a file, FileName holds the filename, PathName holds the containing path. If the user doesn't select a valid file, or clicks "Cancel", both of those variables get set to 0. It's then up to the caller to check the return value and decide what happens next.
Which is not what happens here, obviously. The developer responsible seems to believe that it maybe throws an exception? And they can just catch it? Carl's best guess is that this is a "weird" way to catch the cancel button. But it does mean that FileName and PathName get set to 0, and those zeros propagate until something finally tries to open those files, at which point everything blows up and the user doesn't know why.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
'They are so rude. The whole family is tainted': Hannah Ingram-Moore's startling new life revealed, the brutal comments from neighbours about her... and why she's desperate to move on from Captain Tom saga
Israel warns British anti-Semitism is out of control and protesters brand PM 'Keir Starmer, Jew harmer' after bloodbath on streets of Golders Green left two hurt: Wave of hate is 'national emergency' and empty words aren't enough, Labour told
Drunk and drugged-up father, 41, is jailed for stealing a 24-tonne bulldozer and smashing it through a Royal Mail trailer during three-hour city rampage
Fans turn on Timothee Chalamet over 'jerk' move toward Tina Fey at star-studded Knicks game with Kylie Jenner
90s alt rock icon who tried to save Kurt Cobain is unrecognizable aged 66... can you guess who he is?
All the similarities between London and New York that spell trouble for the Big Apple as woke Mamdani's latest plan could trigger a wealth exodus
Rebel Wilson is accused of calling actress a 'prostitute' after sharing racy Instagram post of two women - as she is grilled in defamation case
Mission: Impossible star, 66, collapses in LA restaurant as emergency crews swarm scene
The Essex towns on Lidl's 'wish list' where they want to build new supermarkets
Six tonnes of rubbish picked up from side of the A12
Social media sensation announced as food 'headliner' at Essex festival
Plans for 60 homes on floodplain get over 100 objections from villagers
Son 'cannot forgive' driver who killed dad in A12 crash while on phone
Essex deserves major investment as it gives more than it receives, MP says
Social media sensation announced as food 'headliner' at Essex festival
Essex deserves major investment as it gives more than it receives, MP says
Google to sell its TPUs to some customers, who also fancy big-G GPUs
Google Cloud will start selling its custom tensor processing units to some customers, because they want them and the search giant wants to diversify its revenues.…