BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


@PeterFoerster wrote:

So how do we improve on that? Easy: We replace the data type of the User Event with Array, to make it more scalable.


I would have used an enum.  Then you wouldn't have to do the search to figure out which one changed.

 

But still, RT = no font panel.  Therefore I have to ask where is the command parser from the Windows System telling your RT to do whatever those buttons did?


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 1721 of 2,565
(11,079 Views)

Well, it was a Linux RIO, so there is a Front Panel. However, in this case we just used front panel communication, since it is just the configuration program and it doesn't have to run deterministically.



Remember Cunningham's Law
0 Kudos
Message 1722 of 2,565
(11,051 Views)

@PeterFoerster wrote:

Well, it was a Linux RIO, so there is a Front Panel.


That is only on the 903X series cRIOs.  And if you have those, why not just enable the front panel usage and then you have all of your events!


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 1723 of 2,565
(11,035 Views)

(Seen here)

 

Getting a time string aparently involves the following:

  • unbundle
  • built array
  • autoindexing for loop
  • shift register
  • empty string diagram constant
  • state machine with
    • multicase case structure
    • number to string conversions
    • string concatenations
  • etc.

 

Of course there are probably simpler alternatives 😄

 

 

 

 

 

Message 1724 of 2,565
(10,818 Views)

@altenbach wrote:

(Seen here)

 

Getting a time string aparently involves the following:

  • unbundle
  • built array
  • autoindexing for loop
  • shift register
  • empty string diagram constant
  • state machine with
    • multicase case structure
    • number to string conversions
    • string concatenations
  • etc.

 

Of course there are probably simpler alternatives 😄

 

 

 

 

 


Answering the why in your image Christian.

 

NO SYNTAX!

 

The top version does not require looking up any secret codes.

 

SIlly Wizard (smiley-wink)

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 1725 of 2,565
(10,746 Views)

@Ben wrote:

@altenbach wrote:

(Seen here)

 

Getting a time string aparently involves the following:

  • unbundle
  • built array
  • autoindexing for loop
  • shift register
  • empty string diagram constant
  • state machine with
    • multicase case structure
    • number to string conversions
    • string concatenations
  • etc.

 

Of course there are probably simpler alternatives 😄

 

 

 

 

 


Answering the why in your image Christian.

 

NO SYNTAX!

 

The top version does not require looking up any secret codes.

 

SIlly Wizard (smiley-wink)

 

Ben

 

You might need a "Trixie Belden" secret decoder ring.  

Spoiler
Or was that "**bleep** Tracy"... I always get confussed!

 Time format code are both in the help file and, available from the numeric FP object property editor.

 

 

Pshht. secrets that are given away in cereal boxes.....


"Should be" isn't "Is" -Jay
0 Kudos
Message 1726 of 2,565
(10,750 Views)

I've gone the middle road on several occations with Date/time rec --> Format into string before learning those special specifiers. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 1727 of 2,565
(10,719 Views)

My own blunder, can't learn unless you're willing to accept criticism! Especially from the great altenbach!

 

This is my code to find the indices of the array the OP wanted between 1 and -1 ..

 

ArrayComp.png

 

Here is the simpler and order of magnitude faster route posted by altenbach, most simple one but also more posted that are better for memory allocation and speed here..

ArrayComp2.PNG

CLD | CTD
Message 1728 of 2,565
(10,514 Views)

Stumbled across this in some legacy code today.  I'm assuming there used to be something useful where this is, but given the state of this code I wouldn't bet on it.

 

What.png

 

 

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 1729 of 2,565
(10,356 Views)

@ChrisK88 wrote:

My own blunder, can't learn unless you're willing to accept criticism! Especially from the great altenbach!

 

This is my code to find the indices of the array the OP wanted between 1 and -1 ..

 

ArrayComp.png

 

Here is the simpler and order of magnitude faster route posted by altenbach, most simple one but also more posted that are better for memory allocation and speed here..

ArrayComp2.PNG


Regardless, I would probably still tend to use In Range and Coerce in place of the Absolute / Less than pairing. The snippet's perfect when all you ever want to do is return indices for values within symmetrical limits, but if you suspect there's a possibility of wanting to compare for assymetrical limits, it's preferable to do so now so that the limits can be updated later on without changing code.

 

At the same time, the snippet answered the question that was asked, and that's just me projecting my requirements for scalability onto someone else 🙂

---
CLA
Message 1730 of 2,565
(10,308 Views)