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
BlockChainNetflix
Sep 2, 2011

Jerry SanDisky posted:

ClearCase is an IBM product, meaning that its great when your company can afford a really nice contract with IBM. I pity anyone that has to do in house support of IBM (especially Rational) products.

I was this guy. Soul crushing doesn't even begin to describe this work.

Adbot
ADBOT LOVES YOU

Viggen
Sep 10, 2010

by XyloJW

BLT Clobbers posted:

I was this guy. Soul crushing doesn't even begin to describe this work.

I tried that. Once. I threw up my hands and fixed their CVS repository. The hardest part was training the H-1B designers the concept of 'HTML is text, everything else is binary'.

Of course, then one of them discovered the ^M from their OS was kind of ugly so they set their editor to strip them at the end and proceeded to have a war of diffs for about a day before I broke down and locked everyone's editor rights. Other than needing to call me a handful of time when forking branches and tagging, they ran perfectly fine with that for a few years.

Optimus Prime Ribs
Jul 25, 2007

On different forums I post on I convinced another dude to learn Python, and as an exercise to help him learn he wrote a function for determining if a given number is prime.
That's all well and good, but the solution he came up with is something else:
Python code:
def isPrime(num):
        primeCount = 0
        notPrimeCount = 0
        prime = 0
        for i in range(2,num - 1):
                if num % i == 0:
                        notPrimeCount += 1
                if num % i != 0:
                        primeCount += 1
 
        if notPrimeCount == 0:
                prime = "Prime"
        else:
                prime = "Not Prime"
 
        return prime
 
print isPrime(4)
I get that the guy is still learning Python, but Jesus Christ, how the hell do people think like this? :psyduck:
It's even worse because the guy is apparently employed as a programmer somewhere (according to him, that is).

Mesothelioma
Jan 6, 2009

Your favorite mineral related cancer!

Optimus Prime Ribs posted:

On different forums I post on I convinced another dude to learn Python, and as an exercise to help him learn he wrote a function for determining if a given number is prime.
That's all well and good, but the solution he came up with is something else:
Python code:
def isPrime(num):
        primeCount = 0
        notPrimeCount = 0
        prime = 0
        for i in range(2,num - 1):
                if num % i == 0:
                        notPrimeCount += 1
                if num % i != 0:
                        primeCount += 1
 
        if notPrimeCount == 0:
                prime = "Prime"
        else:
                prime = "Not Prime"
 
        return prime
 
print isPrime(4)
I get that the guy is still learning Python, but Jesus Christ, how the hell do people think like this? :psyduck:
It's even worse because the guy is apparently employed as a programmer somewhere (according to him, that is).

Why not just link him to code academy?

Optimus Prime Ribs
Jul 25, 2007

I gave him links to Learn Python the Hard Way and Think Python, so v:shobon:v

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Part of configuration file parsing in the impressively terrible NoSQLite4j (which the creator posted to reddit, stackoverflow, and linkedin):
Java code:
	if(strLine.startsWith("Column_Oriened"))
	{
		tempStr = strLine.split("=");
		this.Column_Oriented = Boolean.getBoolean(tempStr[1]);

	} 
Along with the misspelling, getBoolean returns true only if the system property named as its argument is "true".
But really I'm pretty sure everything in that project is awful. Like how its error handling is "catch everything and print a stack trace", which is similar to how it handles nulls, "print a complaint to syserr".

In spite of this, the creator appears to have been a lead dev at one company for 2.5 years.

The Gripper
Sep 14, 2004
i am winner

Aleksei Vasiliev posted:

In spite of this, the creator appears to have been a lead dev at one company for 2.5 years.
Commit history makes me sad for anybody on his previous team https://github.com/debarshri/noSQLite4j/commits/master

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

The Gripper posted:

Commit history makes me sad for anybody on his previous team https://github.com/debarshri/noSQLite4j/commits/master
It could be much worse:


(the best part is that most of the non-gibberish commit messages are wrong)

nielsm
Jun 1, 2009



Plorkyeran posted:

It could be much worse:


(the best part is that most of the non-gibberish commit messages are wrong)

Presumably the "fix" one actually didn't fix anything, but just introduced a new bug?

Jewel
May 2, 2009

Plorkyeran posted:

It could be much worse:


(the best part is that most of the non-gibberish commit messages are wrong)

It will be fine :unsmith:

Catalyst-proof
May 11, 2011

better waste some time with you

Optimus Prime Ribs posted:

On different forums I post on I convinced another dude to learn Python, and as an exercise to help him learn he wrote a function for determining if a given number is prime.
That's all well and good, but the solution he came up with is something else:
Python code:
def isPrime(num):
        primeCount = 0
        notPrimeCount = 0
        prime = 0
        for i in range(2,num - 1):
                if num % i == 0:
                        notPrimeCount += 1
                if num % i != 0:
                        primeCount += 1
 
        if notPrimeCount == 0:
                prime = "Prime"
        else:
                prime = "Not Prime"
 
        return prime
 
print isPrime(4)
I get that the guy is still learning Python, but Jesus Christ, how the hell do people think like this? :psyduck:
It's even worse because the guy is apparently employed as a programmer somewhere (according to him, that is).

If I'm reading this correctly, his definition of a prime number is... a number N for which all numbers N-1...0 are also prime?


Plorkyeran posted:

It could be much worse:


(the best part is that most of the non-gibberish commit messages are wrong)

I do this all the time on my own projects. It's a habit I really need to break, alongside trying to fix multiple things in one feature branch.

Freakus
Oct 21, 2000

WHOIS John Galt posted:

If I'm reading this correctly, his definition of a prime number is... a number N for which all numbers N-1...0 are also prime?
I think you're reading it incorrectly. Think of "notPrimeCount" as a count of the non-trivial divisors for the number "num". Here's a rewrite with variables renamed that might make it a bit clearer:

code:
divisorCount = 0
for i in range(2, num-1):
    if num % i == 0:
        divisorCount += 1
return divisorCount == 0

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

WHOIS John Galt posted:

alongside trying to fix multiple things in one feature branch.

I do this as well and it irritates the poo poo out of me. I'll just get "in the zone" whipping out features, fixes and commits like a mad man and then an hour later I'll realize I did all those on some feature branch I started to correct some minor issue.

seiken
Feb 7, 2005

hah ha ha

WHOIS John Galt posted:

If I'm reading this correctly, his definition of a prime number is... a number N for which all numbers N-1...0 are also prime?

Nah, the code is actually technically correct, I guess, just the variables are terribly-named and like 80% of the lines are unnecessary (and it doesn't break early).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Thermopyle posted:

I do this as well and it irritates the poo poo out of me. I'll just get "in the zone" whipping out features, fixes and commits like a mad man and then an hour later I'll realize I did all those on some feature branch I started to correct some minor issue.
git makes it so easy to move commits between branches that I don't really bother creating features branches in advance anymore. Instead I just work off master, and if I need to switch to working on something else I create a branch then, and reset master to origin/master.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Plorkyeran posted:

git makes it so easy to move commits between branches that I don't really bother creating features branches in advance anymore. Instead I just work off master, and if I need to switch to working on something else I create a branch then, and reset master to origin/master.

I'm really embarrassed to say that I use git and didn't really know this. This is due to me first learning the minimum I needed to know about git during a time crunch and then lazily not ever reading about it more.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

seiken posted:

(and it doesn't break early).

That way it's more secure.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Plorkyeran posted:

git makes it so easy to move commits between branches that I don't really bother creating features branches in advance anymore. Instead I just work off master, and if I need to switch to working on something else I create a branch then, and reset master to origin/master.

git checkout -b my-new-branch origin/master :eng101:

seiken
Feb 7, 2005

hah ha ha

This is an interesting thing I didn't know about before, at the same time as being a completely ludicrous defense of the actual code in question. Well done

seiken fucked around with this message at 22:59 on Jan 2, 2013

ivantod
Mar 27, 2010

Mahalo, fuckers.

seiken posted:

Nah, the code is actually technically correct, I guess, just the variables are terribly-named and like 80% of the lines are unnecessary (and it doesn't break early).

And it's also not necessary to test numbers all the way up to N-1, it's enough to go to sqrt(N) because if there is no divisors by that point there can't be any afterwards. Not to mention many other possible optimisations.

Optimus Prime Ribs
Jul 25, 2007

ivantod posted:

And it's also not necessary to test numbers all the way up to N-1, it's enough to go to sqrt(N)

Won't you need to use sqrt(N)+1 to prevent false positives with low values (like 8 or 10)?

Zamujasa
Oct 27, 2010



Bread Liar

Plorkyeran posted:

It could be much worse:


(the best part is that most of the non-gibberish commit messages are wrong)



:sigh:

seiken
Feb 7, 2005

hah ha ha

ivantod posted:

And it's also not necessary to test numbers all the way up to N-1, it's enough to go to sqrt(N) because if there is no divisors by that point there can't be any afterwards. Not to mention many other possible optimisations.
Obviously there are many faster ways to do it but missed optimizations like that probably aren't nearly so much of a horror as the other fundamental ones present (like huge sections of pointless code). You may as well say it's a horror not to implement AKS in baby's first python function.

seiken fucked around with this message at 23:17 on Jan 2, 2013

Rothon
Jan 4, 2012

seiken posted:

Obviously there are many faster ways to do it but missed optimizations like that probably aren't nearly so much of a horror as the other fundamental ones present (like huge sections of pointless code). You may as well say it's a horror not to implement AKS in baby's first python function.

Actually implementing AKS would be a horror. It's extraordinarily slow and complex. Everyone just uses Miller or Miller-Rabin instead.

PrBacterio
Jul 19, 2000

Optimus Prime Ribs posted:

Won't you need to use sqrt(N)+1 to prevent false positives with low values (like 8 or 10)?
The usual way to do it is to have the terminating condition of the loop being testDivisor^2 > N, obviously.

Catalyst-proof
May 11, 2011

better waste some time with you

Freakus posted:

I think you're reading it incorrectly. Think of "notPrimeCount" as a count of the non-trivial divisors for the number "num". Here's a rewrite with variables renamed that might make it a bit clearer:

code:
divisorCount = 0
for i in range(2, num-1):
    if num % i == 0:
        divisorCount += 1
return divisorCount == 0

Oh oh I see :doh:

Coffee Mugshot
Jun 26, 2010

by Lowtax

Thermopyle posted:

I'm really embarrassed to say that I use git and didn't really know this. This is due to me first learning the minimum I needed to know about git during a time crunch and then lazily not ever reading about it more.

Since it came up, I might be good to mention git add -p, which allows for staging hunks. So even if it's the same file, you could commit the different changes to different branches.

ToxicFrog
Apr 26, 2008


Rainbow Pony Deluxe posted:

Since it came up, I might be good to mention git add -p, which allows for staging hunks. So even if it's the same file, you could commit the different changes to different branches.

git gui lets you do this a bit more conveniently, too; right click and "stage/unstage hunk" or "stage/unstage line".

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
And if you use emacs (lol), use magit. Has a fancy thing for staging/unstaging hunks that's p. awesome.

Bunny Cuddlin
Dec 12, 2004
I'm usually good about my commit messages even on personal stuff, but among things like "added javascript to toggle user pane" and "added date constraints to posts list" is stuff like "God is fake" and it's become a real problem because at work I actually put ", and God is not real." into the description of a work item. I removed it immediately after but it's there in the revision history. Nobody noticed and it's been closed for 3 months so I think I'm in the clear.

Civil Twilight
Apr 2, 2011

Suspicious Dish posted:

And if you use emacs (lol), use magit. Has a fancy thing for staging/unstaging hunks that's p. awesome.

As does SourceTree if you're on a Mac. I use it for anything remotely complicated, which saves me the trouble of ever learning to use git properly. :smith:

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
Fortunately I'm too OCD about the quality of my commit messages, even when it's a project I'm working on myself. But on the project I'm currently on now, since it's hosted on Github, that keeps me pretty honest.

The biggest problem I have is re-training myself to do very fine-grained commits. I keep the Github native app open in the background so that I can switch to it every once in a while to commit once I've done some work, but I usually find myself getting "in the zone" and making a lot more changes than I should for a single commit, and then it kills my productivity to have to go in and selectively check files to figure out what should go in what commit.

Catalyst-proof
May 11, 2011

better waste some time with you
Exactly. What usually ends up happening is at the end of the day/week I spend way too much time trying to dissect the commits with git add -i into two or three (and sometimes five or six) different branches. Complicating that is me desire to make sure each commit can reasonably have tests run against it or what not in case I need to go back and bisect. It's frustrating and I imagine it will take a lot more practice before I'm making good atomic commits.

how!!
Nov 19, 2011

by angerbot
I've never understood the need people have to sperg out about commit. How often do you *really* have to go back over your history to find a particular commit?

The number of times a bad commit message has negatively effected me: 0.

I had a co-worker a while back who was one of those source control nazis. He'd freak out and yell at you if each commit message wasn't at least 2 sentences. I would always ask him "how does this effect you in any way" and never got an answer.

Bunny Cuddlin
Dec 12, 2004

how!! posted:

I've never understood the need people have to sperg out about commit. How often do you *really* have to go back over your history to find a particular commit?

The number of times a bad commit message has negatively effected me: 0.

I had a co-worker a while back who was one of those source control nazis. He'd freak out and yell at you if each commit message wasn't at least 2 sentences. I would always ask him "how does this effect you in any way" and never got an answer.

I have to fix things in other people's code all the time. It's a huge pain in the rear end searching through diffs to find where a change was made because half the devs here leave the commit message completely blank.

Anecdotal evidence aside, it's fairly easy to think of a scenario where a lovely/missing commit message hurts someone. Is typing two sentences really that hard? Why wouldn't you?

Tayacan
Dec 8, 2012

Fucking nerd
It affects me. If I'm working on a project with other people, I expect them to make sensible commit messages, so I can tell at a glance what they've made. Doesn't have to be long, just a sentence like "fixed the foo bug in the bar feature" or whatever, so I know what's going on.

how!!
Nov 19, 2011

by angerbot

Bunny Cuddlin posted:

I have to fix things in other people's code all the time. It's a huge pain in the rear end searching through diffs to find where a change was made because half the devs here leave the commit message completely blank.

Anecdotal evidence aside, it's fairly easy to think of a scenario where a lovely/missing commit message hurts someone. Is typing two sentences really that hard? Why wouldn't you?

why would you need to look through commit history to fix a bug? Just fix the bug. I've fixed many bugs, and can't tell you of a single time where I had to look through the history in order to fix it.

When I first started out, I used to do the long, thorough commit message every time. Until I realized its just wasted effort.

b0lt
Apr 29, 2005
git blame -> git show <commit id> ->
code:
$ git show 1936bcf4
commit 1936bcf40eccf43776672e8337bb73aa66c877cc
Author: how!!	
Date:   Tue Jul 3 04:13:48 2012 -0700

    aoweruaoiwer

Bunny Cuddlin
Dec 12, 2004

how!! posted:

why would you need to look through commit history to fix a bug? Just fix the bug. I've fixed many bugs, and can't tell you of a single time where I had to look through the history in order to fix it.

When I first started out, I used to do the long, thorough commit message every time. Until I realized its just wasted effort.

Look I don't give a poo poo that you can diagnose and fix a bug without looking through commit history. That's bullee, for you but maybe someone on your team isn't as good as you are. If writing 2 sentences when you check in some work will save that person a headache, just do it. What is the argument against it exactly?

Edit: and in response to your first question, there are plenty of bug reports that say "Feature X worked in version y, but now in version z it does not." Well, wouldn't it be handy if we had some quick one or two sentence descriptions of all changes made to that code file between version y and z?

Bunny Cuddlin fucked around with this message at 19:38 on Jan 3, 2013

Adbot
ADBOT LOVES YOU

Mogomra
Nov 5, 2005

simply having a wonderful time

how!! posted:

why would you need to look through commit history to fix a bug? Just fix the bug. I've fixed many bugs, and can't tell you of a single time where I had to look through the history in order to fix it.

When I first started out, I used to do the long, thorough commit message every time. Until I realized its just wasted effort.
A lot of times there are "bugs" that aren't actually bugs, but something management wanted, and then promptly forgot about. If you look through the commit log to see what the reasoning was for that bit of code, it can help out a lot. If the commit message is gibberish, you're just out of luck.

That and your coworkers wont hate you! :v:

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