We collected some hot stories about programming errors for you to have a little fun and learn something new. Keep reading to find out how one programmer broke the Internet by deleting a tiny piece of code and see other not-so-obvious errors.
"Error" is something that can scare even experienced developers. Everyone faces them at some point. Today you'll see that everyone may screw up, and mistakes shouldn't frustrate you. We have already published related articles — Stories about Christmas and New Year Bugs and others are listed in the end.
This story is about the error that turned the Chilean man's life around. In May, 2022, a man in Chile was accidentally paid 165 million pesos (£150,000), 330 times his salary. This happened due a payroll blunder error.
The worker reported about the error to the deputy manager. The manager asked the worker to go to his bank and initiate the return of the excess money. You could think the man got back the money, and the story was over. But it wasn't.
Well, the man promised his employer to show up in the bank and get the amount refunded. However, a day later, he was off the radar. After two days, he appeared and promised to retrieve the amount soon — probably, he was still on the fence :). Diario Financiero reported that, the worker later sent a resignation letter via his attorney, and dropped out of the sight.
The company he was employed has now reached out to various agencies in attempt to get back the money and registered a complaint of misappropriating funds against the employee. Let's hope this story keeps going.
A couple from Lancashire were shocked when their monthly electricity bill had increased from £87 to £53,480,062. "Unfortunately, I don't have this kind of money in my account. It was a massive shock," Mr. Brotherton, a 63-year-old accountant, said.
Nigel and Linda Brotherton had a new electricity meter installed, but an electrician didn't connect the wires correctly. This led to a wrong measure of the electricity usage. Due to this mistake, their power supplier calculated the bill and sent it to their bank account.
"My wife was worried if they had tried to take the money it could have affected our credit rating," Mr. Brotherton said. After the recovering from initial shock, the couple contacted the power supplier, who apologized and promised to correct the wires.
The accident took place a week after iPhone 14 Pro was released. Some owners have reported that their iPhones cause camera shaking when they use TikTok, Instagram, and Snapchat.
Multiple users tweeted the videos of how it looked like — opening the camera in certain apps causes it to shake and produce audible grinding sounds. That's quite a creepy thing. However, if you use the built-in camera, nothing is wrong.
Apple reported that the problem was caused by the software issue and not by the third-party applications. Apple spokesperson Alex Kirschner stated in his email to The Verge, that the company is "aware of the issue and a fix will be released next week". However, Apple didn't explain what exactly had caused the error, and why some users encountered this problem and others did not.
Apple introduced a new feature that could actually help you in car accidents — if your iPhone 14 detects a severe car crash, it can help you contact emergency services and notify your emergency contacts. That's impressive. But what if an accident takes place on rollercoasters? "You're raving, dude", — you think. Well, the iPhone 14 is sure it's possible.
The car accident detection feature has set off false alarms for emergency personnel near Cincinnati's Kings Island amusement park. The same crash detection technology is also featured on the Apple Watch 8. Officials say the fix is simple: Putting the iPhone 14 and the Apple Watch 8 on airplane mode before boarding a rollercoaster. So, here is the burning question — should we expect signs in the amusement park like "turn off your iPhones before you get on the rollercoaster?"
Let's hope that there are only two glitches in the latest iPhone model and there would be nothing that could dishonor the company's impeccable reputation.
On 2021 New Year's Eve, the Windows team decided to wish their Twitter followers a Happy New Year. The official Windows Developer account tweeted the following:
That's C# console code. If you run this app when it's exactly midnight on New Year's Eve, you'll get a "Happy New Year!" message. But if you run it at any other time, it will show you that it's still 2021 — that's how this app should work. But it didn't deliver the expected result.
There is a problem — you can get the New Year greeting at exactly midnight. I mean you will fail to get the greeting if it is one second into 2022 or one second before 2022. Moreover, if it's 2022 now, the app will tell you that it's still 2021 — no matter what the date or time is. It works only for midnight...
The Windows developer realized the error and deleted the tweet. You can watch Scott Hanselman's overly-detailed analysis of the many problems with this code. If you're an early-career developer, you might find this interesting.
In March, 2016, Azer Koçulu, a programmer in Oakland, California broke the Internet around the world by deleting 11 lines of code. Koçulu published his code on npm, a popular tool among JavaScript developers that is used to find and install open-source software.
Koçulu wrote the project and called it "kik". This project was intended to help programmers set up templates for their projects. By chance, the messaging app created in Ontario, Canada, shares the name with the Koçulu's project. On March 11, Koçulu received an email from Bob Stratton, a trademark agent of Kik. Bob Stratton asked Koçulu to change the project's name for legal reasons. Koçulu rejected his suggestion. Here you can find the whole discussion (and find out why two parts failed to reach an agreement). After that, Koçulu intended to take down the packages he had registered on npm. "I think I have the right of deleting all my stuff from NPM" was the email, that ended up the dialogue between Koçulu and Bob Stratton.
After a few days, JavaScript programmers around the world started receiving a strange error message when they tried to run their code:
Npm ERR! 404 'left-pad' is not in the npm registry.
The point is, the code they were trying to run required a package called left-pad, but the npm registry didn't have it. After that, developers were turned to the GitHub repository, where the left-pad was supported. The code that they found looks as follows:
module.exports = leftpad;
function leftpad (str, len, ch) {
str = String(str);
var i = -1;
if (!ch && ch !== 0)
ch = ' ';
len = len - str.length;
while (++i < len) {
str = ch + str;
}
Return str;
}
There are only eleven code lines. This is a single-purpose function, simple enough for most developers to write themselves, but lots of npm packages relied on left-pad to do it for them, which is how this tiny bit of code became so important, but unknown.
Some of the largest, most widely used npm packages platforms have suddenly been broken. React, a JavaScript library for building user interfaces was one of the affected packages. And many smaller websites such as Quartz's own Atlas. Its absence has been felt around the world — developers from Australia, Germany, the United States, and the Czech Republic commented on the left-pad page on GitHub.
In Ontario, where the problem occurred, Kik's developers had left-pad problems as well. Two hours later, they added these 11 lines of code to the npm registry. This situation proved to be a valuable lesson for developers. It helped developers understand that wide interests are more important than the wishes of one author.
I hope that this article set you thinking that mistakes are no big deal. If you are still afraid of programming errors, there are various tools to protect yourself. For example, our company — PVS-Studio — develops the static analyzer that can easily detect even ambiguous programming errors. By the way, we have collected various errors found in open-source projects as well. There are Chromium, Linux core, Tizen OS and even Windows Calculator projects listed, you may find it interesting to look at someone else's mistakes :).
Let me end up with a phrase from The Simpsons episode, where Lenny says: "Everyone makes mistakes, that's why pencils have erasers".
PS: didn't the errors seem funny enough to you? Then here is a collection of hilarious memes about software errors that people have encountered in their daily lives:
1. How?
2. What the hell did I do
3. Well, great...
4. Scuber Diver
5. This is getting ridiculous
6. I don't really know what to say
7. Homonyms are such a bliss to a Virtual Assistant
8. Oh no, my PC ran away
The pictures were originally published on boredpanda.com.
0