LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our XNodes Code Repository Files and visit our LabVIEW Wiki XNodes Portal


Tags
(This content has not been tagged yet)
2 Pages V   1 2 >  
Reply to this topic Start new topic
> Jim's Unofficial XNode Coding Challenge
Jim Kring
post Feb 1 2007, 12:13 AM
Post #1


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


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:

Attached Image

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

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Feb 1 2007, 12:13 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
crelf
post Feb 1 2007, 02:18 AM
Post #2


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3740
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


3) You have to share the beer at the Gingerman

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Darren
post Feb 1 2007, 02:36 AM
Post #3


Very Active
***

NI
Posts: 213
Joined: 14-March 06
From: Austin, TX
Member No.: 4441
Using LabVIEW Since:1999
LV:8.6 ,8.5 ,8.0
us_texas United States Nothing Selected


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:
Attached Image
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? wink.gif

-D


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Feb 1 2007, 02:47 AM
Post #4


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


QUOTE (Darren @ Jan 31 2007, 06:48 PM) *
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:
Attached Image
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? wink.gif

-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. yes.gif

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Darren
post Feb 1 2007, 03:12 AM
Post #5


Very Active
***

NI
Posts: 213
Joined: 14-March 06
From: Austin, TX
Member No.: 4441
Using LabVIEW Since:1999
LV:8.6 ,8.5 ,8.0
us_texas United States Nothing Selected


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:

Attached Image

This was my first idea, and would probably be the easiest to wrap with one of these mythical "XNodes" I keep hearing about.

-D


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
daal
post Feb 1 2007, 08:19 AM
Post #6


More Active
**

Premium Member
Posts: 39
Joined: 17-December 03
From: St-Hubert
Member No.: 223
Using LabVIEW Since:1996
LV:8.5 ,8.6 ,.
Canada ca_quebec Nothing Selected


QUOTE (Jim Kring @ Jan 31 2007, 07:25 PM) *
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:

Attached Image

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. thumbup1.gif

Attached File  GetDefaultData.xnode.llb ( 282.07K ) Number of downloads: 352


have a nice day

Dany

--------------------




Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
ned
post Feb 1 2007, 02:39 PM
Post #7


Very Active
***

Member
Posts: 138
Joined: 26-January 06
From: Cambridge, MA
Member No.: 3989
Using LabVIEW Since:1999
LV:8.5 ,8.6 ,.
United States us_massachusetts Nothing Selected


QUOTE (Jim Kring @ Jan 31 2007, 07:25 PM) *
1) Create an XNode (not an External Node) that implements the following code, in order to get the default value of anything:

Attached Image

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.


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Feb 1 2007, 06:09 PM
Post #8


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


QUOTE (DanyAllard @ Feb 1 2007, 12:31 AM) *
Hi, there is my xnode. Finally it's an easy one, you don't have to do any scripting to get the default data. thumbup1.gif


Great work, Dany! I hope you can make it to NI Week to collect your prize smile.gif

QUOTE (ned @ Feb 1 2007, 06:51 AM) *
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 ;-)

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Justin Goeres
post Feb 1 2007, 11:17 PM
Post #9


Extremely Active
****

JKI
Posts: 549
Joined: 13-September 05
From: Cary, NC USA
Member No.: 2992
Using LabVIEW Since:1997
LV:8.5 ,8.2.1 ,7.1.1
United States us_north_carolina us_iowa


QUOTE (Jim Kring @ Feb 1 2007, 10:21 AM) *
but you do win a body shot at Coyote Ugly ;-)


God Bless Coyote Ugly.

--------------------
If you don't like this post, you might also not like my widgets!


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
daal
post Feb 2 2007, 06:12 PM
Post #10


More Active
**

Premium Member
Posts: 39
Joined: 17-December 03
From: St-Hubert
Member No.: 223
Using LabVIEW Since:1996
LV:8.5 ,8.6 ,.
Canada ca_quebec Nothing Selected


QUOTE (Jim Kring @ Feb 1 2007, 01:21 PM) *
Great work, Dany! I hope you can make it to NI Week to collect your prize smile.gif


I don't think I will be at NI Week this year. I made its for the pleasure, not to get the prize biggrin.gif

--------------------




Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
crelf
post Feb 2 2007, 06:59 PM
Post #11


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3740
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


QUOTE (DanyAllard @ Feb 3 2007, 04:24 AM) *
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 thumbup1.gif

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jeff Plotzke
post Feb 2 2007, 07:03 PM
Post #12


Very Active
***

V I Engineering, Inc.
Posts: 131
Joined: 8-February 06
Member No.: 4078
Using LabVIEW Since:2002
LV:8.20 ,8.0 ,7.1
United States us_michigan Nothing Selected


QUOTE (crelf @ Jan 31 2007, 09:30 PM) *
3) You have to share the beer at the Gingerman


QUOTE (crelf @ Feb 2 2007, 02:11 PM) *
Don't worry Dany - I'll step up and accept the award on your behalf thumbup1.gif



Be sure to follow your own rule and share, Chris! tongue.gif


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
crelf
post Feb 2 2007, 07:13 PM
Post #13


I'm a LAVA, not a fighter.
******

V I Engineering, Inc.
Posts: 3740
Joined: 13-October 03
From: Michigan, USA
Member No.: 181
Using LabVIEW Since:1993
LV:8.5 ,. ,.
Australia United States Nothing Selected My Blog


QUOTE (Jeff Plotzke @ Feb 3 2007, 05:15 AM) *
Be sure to follow your own rule and share, Chris! tongue.gif