NI Home > Community > NI Discussion Forums

BreakPoint

Showing results for 
Search instead for 
Do you mean 
Reply
Trusted Enthusiast
SteveChandler
Posts: 2,257
0 Kudos

Re: The Boneheaded Code Thread

Kudos Ben! That is the spirit I had in mind for this thread. If this were a book a good title might be "Brave Confessions of the Brain Dead Software Engineer"

 

Let's keep 'em coming!

=====================
LabVIEW 2012


Proven Zealot
Jeff·Þ·Bohrer
Posts: 8,028

Re: The Boneheaded Code Thread

[ Edited ]

OK I'll play too.

Task: Jeff quick set up a vi to cycle a temperature chamber up and down all night with this recording device in the chamber.  We want to make sure these production prototypes do what they are supposed to do (Shut off when either too hot or too cold).  You have 30 Minutes to set up.

 

Here is a simplified recreation.

 

BH.png

 

 

Spoiler
We learned the plastic melts at 137C

 

Spoiler
Spoiler
The AND is bad!!! shouldn't that be an OR?
I've since learned how to use In Range And Coerce

 

 

 

 

 

 

8-Ball Consulting advertising banner

Certified LabVIEW Consultant. The partner you can bank on when you're behind the 8-Ball.
Active Participant
drjdpowell
Posts: 258
0 Kudos

Re: The Boneheaded Code Thread

I must have had a hundred bugs that were due to me reversing the True and False cases, or using Less Than when I should have used Greater Than.  Almost seems like I do it wrong more than 50% of the time.

Proven Zealot
crossrulz
Posts: 9,199

Re: The Boneheaded Code Thread

Yeah, I've been there Jeff.  My recent boneheaded mistake was checking to see if an element want found in an array (Search 1D Array) and set the comparison to >0.  It took me awhile before I realized that it's >=0.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Active Participant
SnowMule
Posts: 915

Re: The Boneheaded Code Thread


drjdpowell wrote:

I must have had a hundred bugs that were due to me reversing the True and False cases, or using Less Than when I should have used Greater Than.  Almost seems like I do it wrong more than 50% of the time.



They're like USB connectors.  50% chance of getting it in the right way the first time, and 80% of the time you get it wrong.

Active Participant
DianeS
Posts: 605

Re: The Boneheaded Code Thread

Odd...I find that if I have a 50% chance of getting it right, I have a 100% chance of getting it wrong.

 

SnowMule is either smarter or luckier than I am.  :smileyvery-happy:

Active Participant
Thoric
Posts: 1,500
0 Kudos

Re: The Boneheaded Code Thread

Also, you're not subtracting the step from the previous value, but the previous value from the step? This means on the first attempt to reverse direction you end up with a negative temperature (once you fix the boolean logic error)?

 

subtract.jpg

Thoric (CLA, CLED and LabVIEW Champion)
Proven Zealot
Jeff·Þ·Bohrer
Posts: 8,028

Re: The Boneheaded Code Thread


Thoric wrote:

Also, you're not subtracting the step from the previous value, but the previous value from the step? This means on the first attempt to reverse direction you end up with a negative temperature (once you fix the boolean logic error)?

 

subtract.jpg



go figure! recreate a bonehead mistake and make another! :smileyembarrassed:

8-Ball Consulting advertising banner

Certified LabVIEW Consultant. The partner you can bank on when you're behind the 8-Ball.
Trusted Enthusiast
GregFreeman
Posts: 2,362
0 Kudos

Re: The Boneheaded Code Thread

[ Edited ]

In benckmarking code, why the @#$@#$!#$!#$!#$!#$!#$ won't my two sums come out the same do my two sums SOMETIMES come out the same:headbang:

 

 

 




CLA, LabVIEW Versions 2010-2013



Knight of NI
altenbach
Posts: 27,634

Re: The Boneheaded Code Thread

Just looking at the picture, they will be the same if you have fewer than 256 matches. :smileyvery-happy:


LabVIEW Champion . Do more with less code and in less time .