06-28-2021 01:28 AM
@altenbach wrote:
So somebody posts some convoluted code, I post a reply with a simple demo 1/4 the size of a postcard, but the OP considers it "really complicated" and creates the following much simpler (NOT!) implementation instead, spanning three screens and basically violating every single rule for event structures and sane coding practices.
How does one respond to that? 😄 Sigh!
The only thing missing is another event case in a case structure, he did everything else 😄
07-02-2021 10:11 AM
07-10-2021 02:03 PM - edited 07-11-2021 09:30 AM
(found in here. )
Some random code fragments (At the top as implemented and equivalent alternatives below).
The toplevel VIs are a scary nightmare, covering 40 screens and with all UI interactions done 100% via value property nodes of controls inside disconnected clusters.
(Here is a small section. Not much difference anywhere else on that diagram)
07-17-2021 09:56 AM
Here's a very simple diagram comment explaining that the code will "exit the loop" when an error occurs.
Makes sense? No!
Let me be very clear, the stop function does not exit the loop, it will abort the entire VI and its hierarchy!
(Yes, there are real ways to exit a FOR loop early, e.g. by showing the conditional terminal)
07-26-2021 07:47 AM
The subVI takes an array of parameter names and outputs a corresponding array of parameter values.
This code will only work if the order of elements in the string array matches the order of the enum constants and they both match the order of items in the enum typedef. Of course the proper code would be:
I just not sure how I can go about edifying my cow-orkers.
07-27-2021 08:21 AM - edited 07-27-2021 08:32 AM
Would this resolve the issue of enum order (and allow for some error handling Paul?)
We were after a Rube solution weren't we? 😜
edit:
Of course it might just be simpler to pass an indexed string output of the FOR loop (Format into string) into the subVI thereby using the Enum and eliminating the Rube!😂
Much more edifying for everyone - use of Enums is good, prevents Typos in Strings and updates when type def gets updated.
07-27-2021 08:25 AM
07-30-2021 09:22 AM
@James_W wrote:
Would this resolve the issue of enum order (and allow for some error handling Paul?)
We were after a Rube solution weren't we? 😜
edit:
Of course it might just be simpler to pass an indexed string output of the FOR loop (Format into string) into the subVI thereby using the Enum and eliminating the Rube!😂
Much more edifying for everyone - use of Enums is good, prevents Typos in Strings and updates when type def gets updated.
Good Lord!. Your 1st whack at it is worse than the original crap! And in your 2nd dump you're building an array from constants instead of just using a constant array! Did you study under Rube Goldberg?
08-01-2021 11:37 AM
08-14-2021 01:07 PM - edited 08-14-2021 01:29 PM
Parsing a serial number into a special format (003B006A -> 0x00, 0x3B, 0x00, 0x6A) takes 1.5 feet of code or can almost fit on a postage stamp. Your pick! 😄
If we can assume that the serial number is a hex formatted U32 (maybe we can!), many other solutions are possible, e.g.:
(Still, it is probably more efficient to stay with strings as in the first example)