On my first programming lesson I could not figure up how to store some content with NULL bytes (such as a webpage) in C++ string and the teacher did not know it either.
This is the exact situation that I always liked to show my students, because it shows the power of abstractions, in this case the c++ string object, and the danger of making assumptions about data. And then, finally, showing them how it is very much possible, and it was designed into the library in order to accommodate such use cases. Basically, I used it as a tool to help them better understand the data representation of strings, as well as for them to learn something deeper about the c++ standard library.
Off-topic out of the gate, I'll recall that on my very first attempt to write a program in Modula II on our university's Vax, I accidentally inserted a # character at the top of the file. The compiler output wasn't very user friendly, and I was relatively green at interpreting compiler output anyway. So the fact that basically every line of my program was considered a syntax error was deeply baffling to me. It was a long day (and evening) in the lab before I figured that one out. I expect it was character building. Or something.
A bit more on-topic, although this one is not strictly my story: at British Airways, working on the cabin crew's manifest documents, we had an issue where the printout kept aborting a short way in. It turned out that any time a sick passenger needing special assistance was noted in the records the problem would occur. After a lot of head scratching someone (not me) spotted that there was a special handler to end the printout if there was an "INVALID" field in the dataset and the test literally said something like:
It sounds really stupid now, but I was working with threads in Java. There are two ways to implement a thread, either implementing the interface runnable or extending the class thread. I originally had a class that implemented runnable with a custom method called getState(). To initialize a thread while using runnable, you have to pass the runnable object to a thread as a constructor parameter. The class thread also has a method called getState() and I spent an embarrassing amount of time wondering why I had totally different values than expected.
That time I discovered that a specific (since forgotten) version of Webpack would crash and burn if I imported an SVG icon with the word "add" in its file name.
Took me 5 days to find it. 30 seconds to fix it. (add.svg --> plus.svg)
There was a time I had a tricky bug to solve, a important email wasn't being delivered to customers, I had to do this to discover the 1-line change:
1. Simulate the email and check whether it was being received by the mail provider (Gmail), turns out that it was received by Google but Google spam filters rejected the email, we could see the sender/subject but we couldn't see the content.
2. Print the email content in the code just before sending it, all seem correct here.
3. Do monkey-patching to a Ruby library that was in charge of sending the email to the SNTP server, println says that we are sending the right data.
4. Capture the traffic (Wireshark) sent by the app to the SMTP server just to make sure we are sending what needs to be sent, turns out that the email content wasn't what I expected, it was something like a Ruby object's default hash + some weird characters.
Apparently, the library in use wasn't working with the object we were sending, which caused the email content to become a random string, this triggered Google spam filters causing it to reject the email, the solution was as simple as changing a line from `email.body` to `email.body.string`.
TL;DR (of the problem): customers from a single country—and only that country—were (sometimes) unable to checkout on an e-commerce website and, after months of trying to sort out the issue, the solution turned out to be very facepalm-worthy.
8 comments
[ 4.8 ms ] story [ 314 ms ] threadThis is the exact situation that I always liked to show my students, because it shows the power of abstractions, in this case the c++ string object, and the danger of making assumptions about data. And then, finally, showing them how it is very much possible, and it was designed into the library in order to accommodate such use cases. Basically, I used it as a tool to help them better understand the data representation of strings, as well as for them to learn something deeper about the c++ standard library.
A bit more on-topic, although this one is not strictly my story: at British Airways, working on the cabin crew's manifest documents, we had an issue where the printout kept aborting a short way in. It turned out that any time a sick passenger needing special assistance was noted in the records the problem would occur. After a lot of head scratching someone (not me) spotted that there was a special handler to end the printout if there was an "INVALID" field in the dataset and the test literally said something like:
Invalids, therefore, were a problem :)For anyone confused, note etymology #2 here: https://en.wiktionary.org/wiki/invalid
Took me 5 days to find it. 30 seconds to fix it. (add.svg --> plus.svg)
1. Simulate the email and check whether it was being received by the mail provider (Gmail), turns out that it was received by Google but Google spam filters rejected the email, we could see the sender/subject but we couldn't see the content.
2. Print the email content in the code just before sending it, all seem correct here.
3. Do monkey-patching to a Ruby library that was in charge of sending the email to the SNTP server, println says that we are sending the right data.
4. Capture the traffic (Wireshark) sent by the app to the SMTP server just to make sure we are sending what needs to be sent, turns out that the email content wasn't what I expected, it was something like a Ruby object's default hash + some weird characters.
Apparently, the library in use wasn't working with the object we were sending, which caused the email content to become a random string, this triggered Google spam filters causing it to reject the email, the solution was as simple as changing a line from `email.body` to `email.body.string`.
TL;DR (of the problem): customers from a single country—and only that country—were (sometimes) unable to checkout on an e-commerce website and, after months of trying to sort out the issue, the solution turned out to be very facepalm-worthy.