From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Top LabVIEW Rookie Mistakes


@Steven8R wrote:

I am running into nightmares trying to re-use code (in projects).  A simple save-as to the new location doesn't work 90% of the time because of all the sub-vi's break.  Another example is a driver I downloaded for stepper motors. It consists of a few folders, and I made a nice .lvlib wrapper. I had to move this project in it's entirety to a different location, and a bomb went off, even doing the "save-as" moves.


A good reuse strategy is often hard to define.  I rarely have problems copying code from one project to another.  That's something you should probably take to another thread.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 21 of 47
(2,747 Views)

for(imstuck) wrote:

I actually have this as an interview question. Notice the for loop with the empty array. Gets um every time, although the clear errors and the split queue reference wire should be a hint...Smiley Very Happy

 


 

 


That is just evil!  I like it!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 22 of 47
(2,745 Views)

@Steven8R wrote:

It's funny you mention NOT using projects... I am no expert (just finished Core3) and am about 20% grayer struggling with "code re-use" vs. projects.  I know C/C++, VB, etc; and design circuit boards.  In those cases, I can write a nice re-usable module (say a driver). As mentioned, copy & paste in Windows is all I need to re-use.  I am trying to "pull together" existing code here at the lab that is literally sitting in numerous folders across a couple different letter drives (I feel you wincing). But that's another story for now.

 

I am running into nightmares trying to re-use code (in projects).  A simple save-as to the new location doesn't work 90% of the time because of all the sub-vi's break.  Another example is a driver I downloaded for stepper motors. It consists of a few folders, and I made a nice .lvlib wrapper. I had to move this project in it's entirety to a different location, and a bomb went off, even doing the "save-as" moves.

 

One thinig that I feel wasn't covered well in CORE2 / CORE3 was say "implementing" or "heres how to" implement good strategies for code-reuse.  I asked a question and the instructor said to save and rename everything so there aren't naming conflicts. But that seems counter-intuitive.

 

In another simpler example, I wrote a module (call it ModuleA) that I want to use in many different applications. ModuleA has a few subVI's.  If I want to add it to new project in another location, how can do it without breaking it? On simple VI's to reuse I copy the code and paste it into another VI and give it a new name, seems like all I can do.

 

Anyways, sorry for the book, but a good lesson with examples and how-to's on code reuse with respect to the above (say code with many subVIs) would be great!! Worth many Kudos!!

 

Thanks,

 

Steve


I am less experienced than Steve- and I have not attempted to use Projects yet. Quite terrified to try until I know more about them, based on the discussion in this thread and elsewhere. It can look ugly to a more experienced developer, but functional applications can be created without projects. I have even reused quite a bit of code! 🙂

Just haven't had the bandwidth to start on the core classes toward CLAD certification, but hope to sometime in the coming months!

 

Jeff

Jeffrey Zola
0 Kudos
Message 23 of 47
(2,700 Views)

@G-Money wrote:

I will be writing a series of 6 articles over the next few months on top LabVIEW rookie mistakes. Readers will be encouraged to add their own LabVIEW rookie mistakes that they want others to know about to this thread. I also want this to be an open discussion of the article topics so I'll be responding to questions as each new one is released.

 

No action will be happening with this forum thread now, but subscribe so that when discussions start you can take part.


Grant, Three ideas have inspired firestorms in one day.  Is it possible to spawn off a few new threads and simply leave links to those theads here.  I want your input to us users to expand and some points might benefit from  "A chat amoung ourselves." 

 

Something like a nugget foundation on better practices...or a why do you do that series. 

 

Lets chat about projects and namespacing

 

 


"Should be" isn't "Is" -Jay
Message 24 of 47
(2,691 Views)

@for(imstuck) wrote:

I actually have this as an interview question.

 


 

 


 

I would use this to see whether people have a good knowledge of LV (i.e. look at what they say when they look at the code and see if they look like they know what they're talking about), but I don't think that I would count it against people if they got it wrong. I think the answer is 3, but this is the kind of thing which can be very confusing.


___________________
Try to take over the world!
Message 25 of 47
(2,662 Views)

Here's a simple one.

 

Is a number NaN?  Just put it into the Equal? function and wire a constant of NaN to it.  Problem is this doesn't work and you need to use the primative Not a Number?

 


I guess the bigger issue here is using floating point number comparison.  Is voltage equal to 0? Well no it is equal to 0.000000123.

Message 26 of 47
(2,636 Views)

@JÞB wrote:

@G-Money wrote:

I will be writing a series of 6 articles over the next few months on top LabVIEW rookie mistakes. Readers will be encouraged to add their own LabVIEW rookie mistakes that they want others to know about to this thread. I also want this to be an open discussion of the article topics so I'll be responding to questions as each new one is released.

 

No action will be happening with this forum thread now, but subscribe so that when discussions start you can take part.


Grant, Three ideas have inspired firestorms in one day.  Is it possible to spawn off a few new threads and simply leave links to those theads here.  I want your input to us users to expand and some points might benefit from  "A chat amoung ourselves." 

 

Something like a nugget foundation on better practices...or a why do you do that series. 

 

Lets chat about projects and namespacing

 

 


Here's a proper link to Jeff's project thread:http://forums.ni.com/t5/LabVIEW/Why-do-you-not-use-projects-When-to-use-them/m-p/2381188#U2381188


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 27 of 47
(2,624 Views)

Sure. Link away. I think a healthy discussion on using projects is good. File management is a big topic that should be talked about.

0 Kudos
Message 28 of 47
(2,614 Views)

tst wrote: 
I would use this to see whether people have a good knowledge of LV (i.e. look at what they say when they look at the code and see if they look like they know what they're talking about), but I don't think that I would count it against people if they got it wrong. I think the answer is 3, but this is the kind of thing which can be very confusing.

Yup the answer is 3. And, you're right I don't use it as an all-or-nothing question by any means. I don't even expect them to get it right. If they are writing code like this I wouldn't want to work with them anyways Smiley Very Happy. But we do get weird things from customers that we have to modify, help with, consult on, or support. I wouldn't put it past some of them to hand off something like this to us. If (when?) the interviewee gets it wrong, I give them hints and see how they think through it. It tells me a lot more than whether or not they get the answer. I want to see how they think about the fact the queue reference is split, that I need a clear error VI (what could cause an error: no SR on the reference), there are shift registers on the error wires, and how queues between two loops work. The output itself is relatively meaningless to me, especially in a situation where they may be nervous.

0 Kudos
Message 29 of 47
(2,569 Views)

Fun and Games!

I'm a rookie, but I was able to pick up some of these issues with this code. Must be learning something!

 

I wonder if you could elaborate a bit on your comment about splitting the queue reference.

After all, queues must be split between producers and consumers.

Are you referring to the unnecessary split which puts "Exit" onto the queue?

Is it just bad coding which still works, or are there other subtle issues with this?

 

Thanks,

Jonathan.

 

 

0 Kudos
Message 30 of 47
(2,448 Views)