Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
SlightlyMadman
Jan 14, 2005

Just keep in mind that excel spreadsheets are like asbestos: just leave them alone and let them die peacefully, and nobody has to get hurt. The last thing you ever want to do is become in charge of writing an application to replace a bunch of BELOVED SPREADSHEETS. Bonus misery if the people using them are barely computer literate except for their 20 years of experience working with said spreadsheets.

Adbot
ADBOT LOVES YOU

SlightlyMadman
Jan 14, 2005

Yeah, that's the problem in a nutshell. I've been in two situations so far in my career that were similar to that. I used to blame the users for being total idiots who irrationally preferred a piss-poor solution just because it was more accessible, but in retrospect it was all my fault.

The golden rule I go by now is that if I can't replace an existing solution with one they'll find easier to use then it should just be left alone. Sometimes the best solution actually is excel, if it's what everyone there prefers and knows how to use. Eventually enough people will retire or get fired and somebody with a clue will be hired who has the clout and intelligence to coordinate a replacement, but until then there's nothing you can do as a mere developer. If you make them use a new system, they will hate it and intentionally sabotage it every step of the way.

SlightlyMadman
Jan 14, 2005

Since they neglected to put a break in that loop, just add 1,000,000 blank lines to the end of that config file. The site will mysteriously slow down and you can blame it on lovely hosting.

SlightlyMadman
Jan 14, 2005

BonzoESC posted:

You certainly can, it's called "training."

I can't even get most clients to agree to signing a proposal with "testing" on it, let alone "training." We've taken to just putting all that stuff in as "project management" which they mysteriously seem fine with, but you can only make that number so big.

SlightlyMadman
Jan 14, 2005

I can't remember for the life of me, but I was working with some horrible scripting language not long ago that would actually throw AN ERROR if you tried to do that CORRECTLY. Declaring "int i" a second time would tell you that i was already defined. I ended up having to declare all of my iterators at the top of the function.

SlightlyMadman
Jan 14, 2005

Cheesus posted:

Ah, a "classic"...

We allow customers to purchase warranties on our hardware products, but only if the unit is under 4 years old. While it makes sense to have some limit, 4 years seems pretty arbitrary. Maybe 4 for this platform and 5 for another? Whatever, it would be pretty easy to extend it if you needed to if the function was named isEligibleForWarranty() instead of deviceIsFourYearsOld().

To make this better, be sure you call that function in other parts of the code to determine the units age for completely unrelated reasons, and then later end up changing the warranty eligibility to be based on something completely different, but retain the original function name.

SlightlyMadman
Jan 14, 2005

Tell me whoever said that got fired on the spot, because they were clearly high as a kite.

SlightlyMadman
Jan 14, 2005

w00tz0r posted:

That was the tail end of the argument. After he said that, I basically gave up and went to make fun of him on the internet.

Feel free to tell him that the internet thinks he's a complete loving idiot.

SlightlyMadman
Jan 14, 2005

BP posted:

It would allow you to modify the memory storing the object, as long as you can reverse the changes, rather than making a copy of the memory and mutating the copy. This could lead to some memory savings in some cases.

Of course, this isn't the meaning of the const keyword and using it as such could lead to problems in certain situations (multithreaded/read-only memory).

But clearly, if those circumstances aren't present at the exact moment that I'm writing some code, they're not worth taking into consideration.

SlightlyMadman
Jan 14, 2005

yaoi prophet posted:

How often do you need to go from millis to months in a tight loop?

Even if you somehow did end up in a situation like this, you'd probably be better off optimizing the loop itself. If you really and truly need to do some millions of month look-ups, you'd probably still be better off just caching them.

SlightlyMadman
Jan 14, 2005

This is all theoretically true, but libc maintainers are hopefully smart enough to make their own decisions rather than be swayed by the opinions of a guy on the internet. Everyone else happens to fall into the "not a libc maintainer" category, and probably has no business writing code like that.

SlightlyMadman
Jan 14, 2005

rjmccall posted:

So, to paraphrase, your opinions are above reproach because anyone smart enough to not need them is smart enough to ignore you.

Something like that. At least I'm not a dick, though.

SlightlyMadman
Jan 14, 2005

tef posted:

No, you're a moron :3:

I'd rather work with a mediocre programmer who knows his limits, than a genius who doesn't.

SlightlyMadman
Jan 14, 2005

I like to give code like that the benefit of the doubt, and assume there was more code there at one point that made that at least somewhat logical, then that code was removed and it didn't occur to him to refactor. Then again, in some ways that's even worse.

SlightlyMadman
Jan 14, 2005

OriginalPseudonym posted:

This is the true reason for source control. Not for rollbacks, but for laughs after the fact.

"svn blame" is possibly the best thing to ever have happened in computer history.

SlightlyMadman
Jan 14, 2005

Optimus Prime Ribs posted:

I'm not really sure what this was supposed to be used for. Written by some dude a year ago, who left where I work before I got there.
This is all that was in the file. :iiam:

php:
<?
$gConfig = array();
require "../../../config/config.php";

$db_connection_str = "host=" . $gConfig['db']['event']['host'] . " dbname=" . $gConfig['db']['event']['name'] . " user=" . $gConfig['db']['event']['user'] . " password=" . $gConfig['db']['event']['password'];
$db_connection = pg_pconnect($db_connection_str);

$stmt = "select * from _event where event_id = " . $_POST['event_id'];

$result = pg_query($db_connection, $stmt);
if( pg_num_rows($result) > 0 ){
    $handle = fopen("../site/config/config.txt", "w");
    fwrite($handle, $_POST['event_id']);
    fclose($handle);
    $url = "index.php";
}
else{
    $url = "index.php?error=event_id_error&&event_id=" . $_POST['event_id'];
}

header( "Location: $url" );
?>

How quickly you forget! Clearly it's there to write out this config file:

Optimus Prime Ribs posted:

Found this in the backend for our CMS:
php:
<?
$current_event_id = "";
if(file_exists("../site/config/config.txt")){
    $config_file_lines = file("config/config.txt");
    foreach( $config_file_lines as $config_file_line ){
        if( trim($config_file_line) != "" ){
            $current_event_id = trim($config_file_line);
        }
    }
}?>

SlightlyMadman
Jan 14, 2005

OriginalPseudonym posted:

In a week you'll have found the PHP script that's being run by cron that posts back to that config file.

No, it loads that script that pulls the event id from config.txt, then writes it to the database.

SlightlyMadman
Jan 14, 2005

qntm posted:

I just want you to know that I laughed at this. The other guy didn't get it, but I did. Well done.

I don't get it, what the gently caress's a COBOA?

SlightlyMadman
Jan 14, 2005

Gazpacho posted:

Yeah yeah, misindented code. Worked on some for four years, then later worked in a job where the offshore devs regularly sent misindented code for review and refused to correct it to standards. Cry me a river and go learn Python you baby. :twisted:

At my last job, the CTO had the most horribly formatted code I'd ever seen in my life. I ended up using python for as much of my new development as I possibly could, just to avoid him going in and mangling my code. He tried to mess with it a few times but he could never get anything to compile so we just reverted his changes. He was also a terrible programmer, so this was quite a blessing.

What about an svn hook that runs a whitespace formatter, and if it passed some threshold of changes, rejected the commit. In my experience, anyone who can't think straight enough to format their whitespace has other problems too.

Adbot
ADBOT LOVES YOU

SlightlyMadman
Jan 14, 2005

Thermopyle posted:

I've never worked anywhere with a CTO, but it seems odd that one would be writing code.

It was a small company, and they gave many of the senior employees "officer" or "director" titles when they couldn't afford to give us raises. If that sounds screwed up and like they didn't know how to run a business, it's only the tip of the iceberg.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply