Encountered a bug where if a user uploads a photo, and then rotates the photo, and then rotates the photo again, the second rotation produces an error, but only if the user is not logged in. After looking into this for a bit, I discovered that the rotation code checked if the photo was associated with a user, and if it was, it tried to access the user's info. But if the user was not logged in, the code would produce an error. The part that baffled me was why the photo was associated with a user when the user was not logged in.
After spending the better part of a day investigating this, I pieced together the workflow of the photo process:
1) Non-logged-in user uploads a photo. The photo's info is saved to memory with no user associated with it. The photo's info is then saved to the database. However, for whatever reason, the database requires that a photo has an associated user, so a fake user is stored.
2) User rotates the photo. The photo's info is retrieved from memory, which has no user associated with it. Then the actual rotation occurs, and stuff is written to the database. The photo's info is then retrieved from the database and written back to memory. However, since the database has a fake user associated with the photo, that fake user is written to memory.
3) User rotates the photo again. The photo's info is retrieved from memory, but this time, the photo is associated with a fake user. Then the actual rotation occurs, but since this time the photo is associated with a fake user, the code tries to access the user's info, and since the user is not logged in, the code blows up.
Coder Zero
My encounters with the handiwork of the world's original software developer.
Thursday, April 16, 2015
Thursday, March 26, 2015
While removing Internet Explorer 7 and 8 hacks from our codebase, I encountered the following comments:
- DIE IE7 DIE DIE DIE
- without this, IE7 poops its pants
- IE6 goes missing on the hover state carat, I don't care
- what the hell is up with IE7 ???
- I had to set fixed width for boxes, otherwise IE7 freaks out. Bastard
- IE7 is fucking retarded
- IE7 is again playing the retard, causing lame parens and dashes to drop to the bottom of the container
- hate IE so much
- IE8 requires the following nonsense, naturally
- IE6 is not good software. One sign of this is that we need to set position absolute here to make this thing display in IE6
- IE6 throws a rubbery when it can't understand part of a compound selector (commas)
- but IE is retarded and thus we brute force it
- re-establish cache.mainImage, since IE is a retard
- IE 8 and below do not bubble change events, so lets hack the shit out of it :P
- inevitably, IE6 has to rain on our UTF parade ;_;
- DIE IE7 DIE DIE DIE
- without this, IE7 poops its pants
- IE6 goes missing on the hover state carat, I don't care
- what the hell is up with IE7 ???
- I had to set fixed width for boxes, otherwise IE7 freaks out. Bastard
- IE7 is fucking retarded
- IE7 is again playing the retard, causing lame parens and dashes to drop to the bottom of the container
- hate IE so much
- IE8 requires the following nonsense, naturally
- IE6 is not good software. One sign of this is that we need to set position absolute here to make this thing display in IE6
- IE6 throws a rubbery when it can't understand part of a compound selector (commas)
- but IE is retarded and thus we brute force it
- re-establish cache.mainImage, since IE is a retard
- IE 8 and below do not bubble change events, so lets hack the shit out of it :P
- inevitably, IE6 has to rain on our UTF parade ;_;
Thursday, July 17, 2014
Tuesday, June 17, 2014
Found some interesting code comments today:
try {
params.put("bed", propertyInfo.getAttributes().getBedrooms().toString());
} catch (Exception eignore) {
/* who cares */
}
try {
params.put("bath", propertyInfo.getAttributes().getBathrooms().toString());
} catch (Exception eignore) {
/* not me */
}
try {
params.put("price", propertyInfo.getPostingInfo().getForSalePrice().toString());
} catch (Exception eignore) {
/* really it's fine if these don't get set*/
}
try {
params.put("bed", propertyInfo.getAttributes().getBedrooms().toString());
} catch (Exception eignore) {
/* who cares */
}
try {
params.put("bath", propertyInfo.getAttributes().getBathrooms().toString());
} catch (Exception eignore) {
/* not me */
}
try {
params.put("price", propertyInfo.getPostingInfo().getForSalePrice().toString());
} catch (Exception eignore) {
/* really it's fine if these don't get set*/
}
Friday, May 30, 2014
Monday, April 28, 2014
Friday, April 11, 2014
Thursday, January 23, 2014
Found the following code comment today:
"There is so much duplication in this code with other files in the mobile directory that it hurts my head. We need to fix this at some point! I mean, what the *bleep*! Can you really just keep re-writing the SAME EXACT CODE OVER AND OVER AGAIN AND NOT FAIL SO SHAME!!!"
"There is so much duplication in this code with other files in the mobile directory that it hurts my head. We need to fix this at some point! I mean, what the *bleep*! Can you really just keep re-writing the SAME EXACT CODE OVER AND OVER AGAIN AND NOT FAIL SO SHAME!!!"
Friday, December 20, 2013
While investigating a bug, I discovered that the problem was caused by tightly coupled code under assumptions that no longer hold. When I found the offending function, I saw the comment, "This whole method exhibits terrible separation of concerns." So Coder Zero knew that he was writing garbage code, but was bothered only enough to leave a note saying so instead of fixing it.
Saturday, December 14, 2013
Who is Coder Zero?
In pretty much every software company, there is an existing codebase. And the daily job of the programmers in these companies is to build upon the existing codebase. And in pretty much all instances, the codebase is undocumented, tightly coupled together under narrow assumptions that no longer hold, brittle to the point that any small change will have an unforseen ripple effect in some dark corner of the code, and is generally a giant piece of garbage.
All day long, these programmers battle their way through the mountain of manure, simply trying to add some useless feature that some program manager thinks is important. All day long, they swear incessantly at the idiot who originally wrote the code. But they have no idea who this idiot is. Most probably, the idiot has long left the company, having moved on to build another codebase that will cause future programmers to think about jumping out the window. To most programmers, the author of the codebase is just some mythical figure that seems almost inhuman to them.
So who is this mysterious author of the world's legacy code? Who is this person that infects the codebase of every company across the globe? Nobody really knows. This person is known only as Coder Zero.
All day long, these programmers battle their way through the mountain of manure, simply trying to add some useless feature that some program manager thinks is important. All day long, they swear incessantly at the idiot who originally wrote the code. But they have no idea who this idiot is. Most probably, the idiot has long left the company, having moved on to build another codebase that will cause future programmers to think about jumping out the window. To most programmers, the author of the codebase is just some mythical figure that seems almost inhuman to them.
So who is this mysterious author of the world's legacy code? Who is this person that infects the codebase of every company across the globe? Nobody really knows. This person is known only as Coder Zero.
Friday, December 13, 2013
Thursday, December 12, 2013
Subscribe to:
Posts (Atom)