tag:blogger.com,1999:blog-60870178274127334582024-02-20T10:07:03.246-08:00Coder ZeroMy encounters with the handiwork of the world's original software developer.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-6087017827412733458.post-83129652274043988542015-04-16T15:47:00.001-07:002015-04-16T17:14:21.896-07:00Encountered 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.<br />
<br />
After spending the better part of a day investigating this, I pieced together the workflow of the photo process:<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-66136665875770450142015-03-26T09:38:00.000-07:002015-03-27T11:46:51.587-07:00While removing Internet Explorer 7 and 8 hacks from our codebase, I encountered the following comments:<br />
<br />
- DIE IE7 DIE DIE DIE<br />
- without this, IE7 poops its pants<br />
- IE6 goes missing on the hover state carat, I don't care<br />
- what the hell is up with IE7 ???<br />
- I had to set fixed width for boxes, otherwise IE7 freaks out. Bastard<br />
- IE7 is fucking retarded<br />
- IE7 is again playing the retard, causing lame parens and dashes to drop to the bottom of the container<br />
- hate IE so much<br />
- IE8 requires the following nonsense, naturally<br />
- 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<br />
- IE6 throws a rubbery when it can't understand part of a compound selector (commas)<br />
- but IE is retarded and thus we brute force it<br />
- re-establish cache.mainImage, since IE is a retard<br />
- IE 8 and below do not bubble change events, so lets hack the shit out of it :P<br />
- inevitably, IE6 has to rain on our UTF parade ;_;David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-72409463537435710132014-07-17T18:15:00.000-07:002014-07-17T18:16:44.019-07:00Found the following in a unit test:<br />
<br />
private static final String HDP_MESSAGES = "0000000000000000000000000000";<br />
<br />
When I added a value to an enumeration that represented possible messages to be displayed to the user, I had to add a zero to the string in the unit test for it to pass.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-89032242257421429472014-06-17T15:00:00.000-07:002016-04-10T16:43:57.525-07:00Found some interesting code comments today:<br />
<br />
try {<br />
params.put("bed", propertyInfo.getAttributes().getBedrooms().toString());<br />
} catch (Exception eignore) {<br />
/* who cares */<br />
}<br />
try {<br />
params.put("bath", propertyInfo.getAttributes().getBathrooms().toString());<br />
} catch (Exception eignore) {<br />
/* not me */<br />
}<br />
try {<br />
params.put("price", propertyInfo.getPostingInfo().getForSalePrice().toString());<br />
} catch (Exception eignore) {<br />
/* really it's fine if these don't get set*/<br />
}David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-55983837806268156472014-05-30T15:00:00.000-07:002016-04-10T16:43:30.491-07:00Encountered some technical documentation that instructed to change a property value in a file. To find the property, it instructed to look for the comment "this utterly, utterly sucks".David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-62325997640115088902014-04-28T15:00:00.000-07:002016-04-10T16:43:09.112-07:00Had to follow a chain of eight files across three different repositories to change a static word on a webpage.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-37015355515339462982014-04-11T15:00:00.000-07:002016-04-10T16:42:50.842-07:00Somebody thought pt, il, ntfc, grpd, bfc, hs, hd, nt, ur, pd, lb, ds, op, so, st, blb, bfe, bbs, vs, ut, cy, and et were good variable names.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-28055886379927963112014-01-23T15:00:00.000-08:002016-04-10T16:42:06.684-07:00Found the following code comment today:<br />
<br />
"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!!!"David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-12969659827759374442013-12-20T15:00:00.000-08:002016-04-10T16:41:40.793-07:00While 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.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-73959429145788080682013-12-14T18:26:00.000-08:002017-02-01T00:26:43.642-08:00Who 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.<br />
<br />
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.<br />
<br />
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.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-62529668664852675922013-12-13T18:00:00.000-08:002016-04-10T16:39:14.408-07:00After another day under the stranglehold of my nemesis, I cannot help but wonder, "Who is Coder Zero?"David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-9371371133978410482013-12-12T18:00:00.000-08:002016-04-10T16:37:26.119-07:00Once again, Coder Zero's presence was felt throughout the day, like a thorn in my side.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0tag:blogger.com,1999:blog-6087017827412733458.post-65614478098023163722013-12-11T18:00:00.000-08:002016-04-10T16:36:40.525-07:00Today was another uphill battle with Coder Zero.David Kellerhttp://www.blogger.com/profile/06376949564419122708noreply@blogger.com0