Jump to content

Darren

NI
  • Posts

    622
  • Joined

  • Last visited

  • Days Won

    66

Posts posted by Darren

  1. I've never seen that show before...that is definitely my kind of show! Just to get a clarification on the rules...you have to use all 6 numbers in your solution exactly once? And only simple operations (add, sub, mult, div) are allowed? The target number is anything between 0 and 999? What's the name of this show? Looks like it's an old show, and I'm guessing they have other categories on the show besides math (judging from the encyclopedia or dictionary on the host's desk).

    Good stuff,

    -D

    P.S. - I've already written LabVIEW code that solves a puzzle like this, although simpler. I have a game called Numbers Challenge where you are given a card with 4 numbers between 1 and 9, and you have to try to reach the target number (anything between 0 and 20 is possible) using only simple operations and all 4 of the numbers on the card. I wrote a VI that proves that all targets between 0 and 20 are possible with every card. A math whiz gave me the game a long time ago, and I didn't believe him when he said any number between 0 and 20 was possible with every card...but LabVIEW proved he was right!

  2. Here are a couple of screenshots to illustrate the method I described. These are actually snippets of code from the VI Analyzer UI. Here is the code during initialization of the main UI that bundles control references into the typedef cluster...these are references of any controls and indicators that I need to programmatically manipulate throughout the execution of my UI code:

    http://forums.lavag.org/index.php?act=attach&type=post&id=5392

    This cluster is wired to the border of my main event structure for my UI. In any case of the event structure where I am programmatically manipulating UI elements, I simply unbundle whatever references I need from that cluster. If I have a subVI that needs the references, I pass the cluster into the subVI via its conpane, and then unbundle whatever references I need within the diagram of the subVI, as seen here:

    http://forums.lavag.org/index.php?act=attach&type=post&id=5393

    I hope these screenshots help illustrate my method. It's very easy to deal with front panel controls with VI Server when you have access to any of the control references you need at any point on the diagram. If there's another control I need access to, I simply add it to the Bundle By Name (and the typedef). To make things easier for me, I also keep the control references organized alphabetically in the typedef cluster by changing the Cluster Order whenever I add elements to the cluster. This gives me an alphabetized list whenever I operate-click on an Unbundle By Name to select the proper reference to unbundle.

    Let me know if you need any more clarification on this method.

    -D

  3. The way I get around this issue is to create a typedef cluster containing control references to any control I wish to programmatically manipulate within my application. I bundle by name all my control references during code initialization, then unbundle the references whenever I need them in other places in my VI. If I need any of these references in a subVI, the typedef cluster is on the conpane of the subVI so I can unbundle the reference(s) I need within the subVI. Since it's a typedef, I can add control references to it as I develop code. This avoids any array searching for references and makes the code very fast.

    This is the approach I take in all my UI VIs (i.e., any app where I will be programmatically modifying UI elements).

    -D

  4. ...and while we're talking about breakpoints, don't forget the nifty "Remove Breakpoints from Hierarchy" feature in LabVIEW 8.2 that will remove all the breakpoints from the hierarchy of a VI, so you don't have to go searching for any breakpoints you may have left in the diagram of your VI (or any of its subVIs) while debugging.

    -D

  5. Hey now, the fact that I work at NI has absolutely nothing to do with the fact that I'm totally pwning all of you in the LAVA arcade...

    -D

    P.S. - And to further fuel the flames, I will go on record as saying that there is NO WAY you people can EVER dethrone me as the LAVA arcade champion. NO WAY! Well, I guess you'd have a chance if Michael reset all my scores... :)

  6. I've only made it to level 14, and I noticed that the left-most pipe seems to be the "fake" one. I only determined this by losing, then clicking "retry" after losing, since the "retry" lets you start over on the same level you just lost (unfortunately, your score is reset).

    -D

    P.S. - As for having "waaaaay too much time for playing games in the arcade", I'm currently in the middle of 5 weeks of paternity leave, and my older kids (not the newborn) *love* to watch me play [wiki]LAVA[/wiki] arcade games. Plus, it's a good time-killer when trying to rock a baby to sleep... :)

  7. Hmm...I know nothing of these mysterious "XNodes" of which you speak, but I can accomplish what you want with a built-in function and a hidden string constant:

    post-4441-1170297298.png?width=400

    There's an empty string hidden underneath the function and wired to to the required binary string input. You can wire whatever you want to the type input, and you'll get the default value of the data type as an output at the "value" terminal. Turn this thing into a Merge VI, give it a nifty icon, and voila...a "default value retriever". If you insist on an XNode (which, again, I know nothing about), you could wrap this trick up pretty nicely and just use the automatic type propogation of XNode terminals, if in fact such a thing existed...it would get rid of the hidden string constant, anyway.

    I know this won't get me a pitcher of beer, but maybe a bottle of ginger ale? ;)

    -D

  8. Hi John,

    I don't have a way to copy the "attributes" from one control to another...it seems you would just need to create a VI that uses property nodes to get/set all the appropriate properties of the controls. As for the tree contents, I wrote this VI a while back that will duplicate the contents of one tree control into another. It's attached below, saved in LabVIEW 8.0 format. Let me know if you have any feedback, since I plan on shipping this VI in the vi.lib\tree folder in a future LabVIEW release...

    Hope this helps,

    -D

    Download File:post-4441-1169769387.vi

  9. Hmm, apparently I didn't quite grasp the effect my retirement from nugget-writing would have on the LabVIEW community. You guys go ahead with whatever plans you make for writing your own nuggets, but as you can see here, my retirement lasted all of a week. Yes, the nuggets will still be (occasionally) cooking...

    -D

  10. Ah, ok. In that case, I don't know of anything you can do other than to extract each item out of the serial string and cast it to the appropriate datatype, then bundle all of those individual items into a cluster. I don't think you would be able to use Unflatten from String directly because the string data doesn't directly correspond with a cluster datatype containing all those elements.

    -D

  11. The string you're generating for the Value of the tree is incorrect. When the value goes down to 1, the text you display in the tree is "Cycle A - 1 execution", but if you probe the string you're wiring into the Value property, it is "Cycle A - 1 executions". Since this is not a valid tree tag, no line is selected.

    Also, I would recommend keeping an array of the tag names assigned to each row in the tree, and changing the Cell text for a row as it's changed, instead of re-writing the entire contents of the tree every time the number for a single row is changed.

    -D

  12. From the LabVIEW 8.2 Online Help for the And Array Elements function:

    "Returns TRUE if all the elements in Boolean array are TRUE. This function also returns TRUE if Boolean array is empty because TRUE is the identity for the Boolean AND operation. Otherwise, the function returns FALSE. This function accepts an array of any size but returns only a single value based on all values in Boolean array. "

    I remember asking this question a while back...I think lots of people have asked it in the past, which is probably why that sentence is now in the Help. :)

    -D

  13. I wanted to add some File I/O Utility VIs to the palettes in LabVIEW 8.2 that would be helpful for all to use...and I didn't "borrow" that idea from anybody.

    That being said, in my original version of Check if File or Folder Exists.vi, I did return an error on empty path. However, one of my fellow developers in LabVIEW R&D (a Linux guy, no less) filed a bug report against the VI because of the reason Jim described...empty path means "/" on Linux, "My Computer" on Windows, etc. So now the VI functions correctly in the technical sense. I will file a Documentation CAR against the VI so we can add a note to the online help that an empty path is considered a valid path, since it has definitely been a source of confusion (even for the author of the VI!).

    By the way, Check if File or Folder Exists.vi will check the validity of paths to files inside LLBs...I'm not sure if the OpenG version of the VI does that...

    -D

    [Edit]: The LabVIEW Documentation CAR for this issue is 440CTMF2.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.