BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


Coq rouge wrote:

 But using a Matlab script node is more elegant Smiley Very Happy


If you follow the input wires to the source, you'll notice that it starts out as a plain 2D array, which is then converted to dynamic data, split into two, each half forming one of the two inputs to the matlab script node where the are coerced to a scalar. So basically it operates on a 2D array to get a simple scalar, but takes the detour via antarctica and the dark side of the moon. 😄

 

I also wonder what the idea was for the second line in the script. Why not drop it and call the output IL2? 

 

I am not good at predicting outcomes when dynamic data is involved, because we cannot see the actual configuration of "to dynamic", but I have a suspicion that the entire mega-operation could be replaced with about two simple primitives (e.g. index array, array subset, add array elements, or similar)

 

 

 

0 Kudos
Message 481 of 2,635
(11,971 Views)

If found some realy nightmare code here http://forums.ni.com/ni/board/message?board.id=170&thread.id=413574 today. I took one look and decided. NO this one is not for me 😉

Link to code here http://forums.ni.com/ni/attachments/ni/170/413957/1/Zaj-traj-14.04.09-DAQmx-02-7.0.zip. It is far to big to show in a picture. But I warn you it is horrifying



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 482 of 2,635
(11,853 Views)

Oh my. That code could also be posted on the forums for why locals are bad or even under sequencitis.

 

I think the navigation window is a bad thing, but it's almost necessary with this VI.

 

I don't think that I have enough time available to look through that code to help.

 

     Rob

0 Kudos
Message 483 of 2,635
(11,835 Views)
I'll admit it... I got lost! Even with the navigation window, which i don't have on 6.1, i was still left wondering why everything needed to be so big. It scares me! Smiley Surprised


Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 484 of 2,635
(11,825 Views)

Coq rouge wrote:

If found some realy nightmare code


Ouch!

 

This is one of the few cases where we need the navigagion window for the front panel. 😄 All that garbage outside the view is the graveyard of local variables.

 

I like how frame 4 of the big sequence is fully optimized for a 40x core CPU. 😄

Message 485 of 2,635
(11,821 Views)

Coq rouge wrote:

If found some realy nightmare code...


Wow!

 

So for fun I did the replace with flat sequence fllowed by a diagram clean-up. To try and get a handle on how large the resulting diagram was I used a decoration on the diagram to (try and ) suround the code so i could use the size box to tell me how big it was.

 

What I learned.

 

1) The flat box decoration in LV 8.6 has a max size of (only) 16,000 pixels wide (what was NI thinking when they limited it to only 16K pixels?).

2) Using two flat sequences I estimated the diagram to be more than 24,000 pixels wide.

 

After the clean-up the code could be "maintained" but I would not enjoy it (or be comfortable doing so).

 

Nice (ahem cough, cough) find Coq rouge!

 

I think I will have to write some LVOOP code today to counter the effect of seeing that VI.

 

Ben

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

Holy spaghetti batman!

 

This is why you ALWAYS write notes before code.  I am amazed that the code ever worked or did it?


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

Let's say I have dates saved as a string.  Rather than convert them to dates and compare with the In range and coerce function, let's do some string manipulation and multiple compares to compare as strings.  And throw in some unneeded local variables and a sequence structure for good measure.

http://forums.ni.com/ni/board/message?board.id=170&message.id=414671

 

Let's do this.

 

Even though this is simpler, makes more sense, and you can trust it to work. 

Message Edited by Ravens Fan on 06-08-2009 10:58 AM
Download All
Message 488 of 2,635
(11,696 Views)

Once in a while the programmer needs to pad a string with multiple spaces. Unfortunately, the palette only contains a single space constant. Thus we need to be a bit creative and just line up a few of those.

 

I strongly believe that the palette should also contain a constant with two spaces, one with three spaces, one with four spaces, etc. etc.

 

(Wouldn't that be something for the Idea Exchange?!! 🐵

 

Since we are currently limited to a single space constants, we need to resort to complicated code as follows: 😄

 

 

 

(see here)

Message Edited by altenbach on 06-13-2009 02:46 AM
Message 489 of 2,635
(11,632 Views)

Why wouldnt you just append a constant of "        "?

Well, I guess thats more colorful.

Cory K
0 Kudos
Message 490 of 2,635
(11,605 Views)