BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

So, while working with a "python" guru yesterday I asked:

 

"Did I read this right?--

IF value !=TRUE

      statement1

      value==FALSE

...

 

 

So, if it is false do other things and make it false again?" line 234 of main.py disappeared instantly.

 

The point? R-G is not LabVIEW dependant.


"Should be" isn't "Is" -Jay
Message 961 of 2,635
(11,697 Views)

Booleans, schmooleans. I like enums, and you're going to like them too!

 

 

from here

0 Kudos
Message 962 of 2,635
(11,672 Views)

@altenbach wrote:

(Maybe I am completely misunderstanding the answer here, but the question was how to run a loop indefinitely).

 

Q: How do you loop a problem indefinitely?

A:  "Compare to infinitiy. The positive infinity block is in the numeric section. The greater than comparison is in the comparison section. Compare something to infinity and wire the output to the stop icon in the while loop found in the structures section."

 

Really!?



Well that should make the loop go longer because the boolean constant will eventually decay. By continuously comparing a value with infinity the programmer is taking advantage of the Quantum Zeno effect to ensure that the loop does not stop. Ever.

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


Message 963 of 2,635
(11,656 Views)

@Jeff Bohrer wrote:

@SnowMule wrote:

Doesn't get any more efficient than that. :lol3


no, it does not.  write LabVIEW- post it to the forum- Christian removes all the unnecessary gyrations in your R-G code and it works.  What other development enviornment has that optomizer?


Now all we need is a sub-vi to do that programatically 🙂

 

0 Kudos
Message 964 of 2,635
(11,595 Views)

@Hornless.Rhino wrote:

@Jeff Bohrer wrote:

@SnowMule wrote:

Doesn't get any more efficient than that. :lol3


no, it does not.  write LabVIEW- post it to the forum- Christian removes all the unnecessary gyrations in your R-G code and it works.  What other development enviornment has that optomizer?


Now all we need is a sub-vi to do that programatically 🙂

 


 

I would settle on a Nugget by Christian Titled

 

"How I Approach Optimizing Code - Musing by One of the Worlds Best Wire-Slingers"

 

So what would it take Christian?

 

Can we bribe you with Kudos? Are you interested in an old "NI.com/exchange" coffee mug? Or maybe my collection of LTR publications?

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 965 of 2,635
(11,576 Views)

Interesting use for typecast, seen here. 😮

 

(guess it indexes out the first element)

 

0 Kudos
Message 966 of 2,635
(11,529 Views)

It looks prettier than the AND all array elements

0 Kudos
Message 967 of 2,635
(11,487 Views)

@altenbach wrote:

Interesting use for typecast, seen here. 😮

 

(guess it indexes out the first element)

 

 


Does index first element.  I had to try


"Should be" isn't "Is" -Jay
0 Kudos
Message 968 of 2,635
(11,465 Views)

The autor seems to have come up with this "solution" because the case structure would not accept a boolean array at the selector terminal.

 

QUOTE:

"I am getting boolean array which i want to connect to case terminal of different type. So, that is the only reason i converted that 1D array to scalar value by typecast."

 

While the typecast function can sometimes do magic, this is the first time where it was expected to read the programmers mind and somehow process the entire array and digest it into a single boolean that somehow reflects the contents of the original array in a meaningful way. 😄

 

This is another one of those examples where, one at a time, a randomly selected primitive is thrown in, until the wire is no longer broken. At this point, the code must be sound. Darwin would be Proud!

 

 

 

Message 969 of 2,635
(11,451 Views)

I would never have expected that..  That's truly remarkable (or extremely lucky).

 

Maybe someone should suggest that the Case Structure takes boolean arrays at its input.  It would automatically AND all the elements..

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

😉  (I had to put a smiley somewhere)

0 Kudos
Message 970 of 2,635
(11,426 Views)