Jim Kring Posted February 1, 2007 Report Share Posted February 1, 2007 Here are the rules: 1) Create an XNode (not an External Node) that implements the following code, in order to get the default value of anything: 2) License your VI under the BSD license. First one to complete this challenge will get a pitcher of their favorite beer at Gingerman, this year at NI Week (and possibly have thier VI included in the OpenG Toolkit). Cheers, -Jim Quote Link to comment
crelf Posted February 1, 2007 Report Share Posted February 1, 2007 3) You have to share the beer at the Gingerman Quote Link to comment
Darren Posted February 1, 2007 Report Share Posted February 1, 2007 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: 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 Quote Link to comment
Jim Kring Posted February 1, 2007 Author Report Share Posted February 1, 2007 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: 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 I forgot to mention requirement #4: Can't crash LabVIEW. Maybe it's just me, but I've had so much bad luck with the Unflatten From String function (using invalid string/flattened data) that I shutter at the thought of this solution. Your answer wins you a body shot at Coyote Ugly. And yes, there will be photos taken that will end up on the NI Week Blog, for sure. Quote Link to comment
Darren Posted February 1, 2007 Report Share Posted February 1, 2007 Unflatten has been pretty stable for me in LabVIEW 8.2. But fine, here's another way, although this one is 48x48 pixels instead of 32x32: This was my first idea, and would probably be the easiest to wrap with one of these mythical "XNodes" I keep hearing about. -D Quote Link to comment
daal Posted February 1, 2007 Report Share Posted February 1, 2007 Here are the rules:1) Create an XNode (not an External Node) that implements the following code, in order to get the default value of anything: 2) License your VI under the BSD license. First one to complete this challenge will get a pitcher of their favorite beer at Gingerman, this year at NI Week (and possibly have thier VI included in the OpenG Toolkit). Cheers, -Jim Hi, there is my xnode. Finally it's an easy one, you don't have to do any scripting to get the default data. :thumbup: Download File:post-223-1170317628.llb have a nice day Dany Quote Link to comment
ned Posted February 1, 2007 Report Share Posted February 1, 2007 1) Create an XNode (not an External Node) that implements the following code, in order to get the default value of anything: It's not an XNode, but couldn't you do this with "Variant to Data"? Wire "anything" to "type" and an empty variant constant to the variant input. Quote Link to comment
Jim Kring Posted February 1, 2007 Author Report Share Posted February 1, 2007 Hi, there is my xnode. Finally it's an easy one, you don't have to do any scripting to get the default data. :thumbup: Great work, Dany! I hope you can make it to NI Week to collect your prize It's not an XNode, but couldn't you do this with "Variant to Data"? Wire "anything" to "type" and an empty variant constant to the variant input. Ned, this works but is plagued with the same issues as the Unflatten from String primitive (known to crash LabVIEW). So, you don't win the beer, but you do win a body shot at Coyote Ugly ;-) Quote Link to comment
Justin Goeres Posted February 1, 2007 Report Share Posted February 1, 2007 but you do win a body shot at Coyote Ugly ;-) God Bless Coyote Ugly. Quote Link to comment
daal Posted February 2, 2007 Report Share Posted February 2, 2007 Great work, Dany! I hope you can make it to NI Week to collect your prize I don't think I will be at NI Week this year. I made its for the pleasure, not to get the prize Quote Link to comment
crelf Posted February 2, 2007 Report Share Posted February 2, 2007 I don't think I will be at NI Week this year. I made its for the pleasure, not to get the prize Don't worry Dany - I'll step up and accept the award on your behalf :thumbup: Quote Link to comment
Jeff Plotzke Posted February 2, 2007 Report Share Posted February 2, 2007 3) You have to share the beer at the Gingerman Don't worry Dany - I'll step up and accept the award on your behalf :thumbup: Be sure to follow your own rule and share, Chris! Quote Link to comment
crelf Posted February 2, 2007 Report Share Posted February 2, 2007 Be sure to follow your own rule and share, Chris! Bugger! Quote Link to comment
daal Posted February 2, 2007 Report Share Posted February 2, 2007 Don't worry Dany - I'll step up and accept the award on your behalf :thumbup: crelf is the first to ask for the beer... you get the pitcher :thumbup: Quote Link to comment
crelf Posted February 2, 2007 Report Share Posted February 2, 2007 crelf is the first to ask for the beer... you get the pitcher :thumbup: I *knew* being proactive about beer would pay off one day - thanks Dany - I'll think of you fondly whilst drinking it!!! Quote Link to comment
Ton Plomp Posted February 3, 2007 Report Share Posted February 3, 2007 I *knew* being proactive about beer would pay off one day - Normally it pays off directly, like the next morning (this morning... felt like :headbang: ) And I promised a mate to take down his bathroom... Ton Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.