BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

I Rubed myself..  I feel soiled..  And I had just taken a bath...  Darn!!

 

Here's the RG code    (found here http://forums.ni.com/t5/LabVIEW/1-s-complement-with-Hex-string-conversion/m-p/1178155#M511531)

 

 

Obviously, there was no need for the For loop to count the number of 1's in an array.  Just do this:

 

 

 

Nevertheless, all that code is useless because I am still not sure what the OP wanted the 1's complement of.  Of course, reading this code does not help either:

Maybe it's too hot and I'm due for a cold beer..  and...

 

 

Message 721 of 2,565
(12,847 Views)
Ray, Actually the top might be more efficient memory wise, because it does not need to allocate the i16 array. The bigger flaw is that you are summing in 16 bits, so an oveflow is easily possible for moderately sized arrays. 🙂
0 Kudos
Message 722 of 2,565
(12,836 Views)

 


@altenbach wrote:
Ray, Actually the top might be more efficient memory wise, because it does not need to allocate the i16 array. The bigger flaw is that you are summing in 16 bits, so an oveflow is easily possible for moderately sized arrays. 🙂

 

Good comment Christian,

 

I agree, the memory is not as efficient.  Plus I do not know how long of a string this has to work with (I didn't read the other thread from the OP). 

Now as for the overflow on summing the 16 bits, I also don't know the verdict on that one.  I'm not sure if the OP wants to create some sort of checksum using 1's complement or why he needs 1's complement.  I'm not even sure he knows if or why he needs it.  A very very quick look into the other post and I saw Dennis suggesting something about a checksum.  If I have some extra time between compiles, I'll read the other thread and try to figure out what's going on.  😉

 

Justy in case you are wondering, I didn't realize there was a parallel thread until someone mentionned it.

 

The fun of coding in the dark..  If you did that, would that make you a Dark Knight?

Message 723 of 2,565
(12,818 Views)

Look at this: I made it much samller. What you see is the navigation window and then a blow up of what is in the window.

 

19121i06D7C46EC8E96E93

 

This was the code to replace it:

 

19123i0D732B6F4465E390

 

 

 

Tim
GHSP
Message 724 of 2,565
(12,741 Views)

 


aeastet a écrit :

Look at this: I made it much samller. What you see is the navigation window and then a blow up of what is in the window.



 

 

Superb catch !

I'm sure Altenbach would comment that this code is perfectly suited for parallel processing...

Where did you find that master piece ?

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 725 of 2,565
(12,731 Views)

 


@chilly charly wrote:

 


aeastet a écrit :

Look at this: I made it much samller. What you see is the navigation window and then a blow up of what is in the window.



 

 

Superb catch !

I'm sure Altenbach would comment that this code is perfectly suited for parallel processing...

Where did you find that master piece ?


 

Here

 

http://forums.ni.com/t5/LabVIEW/There-must-be-a-better-way-of-doing-this/td-p/1165913

Tim
GHSP
0 Kudos
Message 726 of 2,565
(12,747 Views)

 


aeastet wrote:

chilly charly wrote:   Where did you find that master piece ?

Here

 

http://forums.ni.com/t5/LabVIEW/There-must-be-a-better-way-of-doing-this/td-p/1165913


Aaaarghhh !..

 

 

The original signature (CC) was not mine !  :D:D:D

 

 

 

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 727 of 2,565
(12,745 Views)

I did not think about parallel loop here. I have to remember that I have that option now.

Tim
GHSP
0 Kudos
Message 728 of 2,565
(12,737 Views)

Saw this today:

 

If an outer while loop contains an event and another inner while loop and  both the event and inner while loop are separate, then is there any possibilty that the execution comes out of the inner while loop when the event occurs and after executing the event it comes back to the inner while loop where it was previously executing,

Richard






Message 729 of 2,565
(12,653 Views)

 


@broken Arrow wrote:

Saw this today:

 

If an outer while loop contains an event and another inner while loop and  both the event and inner while loop are separate, then is there any possibilty that the execution comes out of the inner while loop when the event occurs and after executing the event it comes back to the inner while loop where it was previously executing,


Do you have a link? This is actually a perfectly legitimate question, and the answer is 42. 😄

 

Message 730 of 2,565
(12,645 Views)