Check out the related Code Repository Files or visit the LabVIEW Wiki Development Environment Portal
Tags |
(This content has not been tagged yet)
|
![]() |
Aug 22 2008, 01:11 PM
Post
#1
|
|||
![]() Extremely Active Premium Member ![]() Posts: 322 Joined: 18-January 08 From: Montréal, Canada Member No.: 10515 Using LabVIEW Since:2000 LV:8.6 ,8.5 ,.
|
Aside from tagging VIs for code maintenance purposes, I was wondering this morning if I shouldn't experiment with VI tags to replace INI settings that could be changed by the user, but only from the UI. I've seen comments that it would be more secure under certain circumstances.
Any thoughts as to how smart a move that would be in general? I already hear that it's nice to see quickly from a text file what are the settings and I agree. But what about making sure ini keys are properly set? Changing them from inside the VI could enforce that. Besides, there is no way the file could be missing altogether... VI tags are easily found in Invoke node and can contain any data type. (I can foresee a nice OpenG set of VIs for that...)
|
||
|
|
|||
| Ad |
Aug 22 2008, 01:11 PM
Post
#
|
||
|
|
|
||
|
|
|||
Aug 22 2008, 01:51 PM
Post
#2
|
|||
![]() LV R&D Envoy NI ![]() Posts: 1275 Joined: 15-August 06 From: Austin, TX Member No.: 5877 Using LabVIEW Since:2000 LV:8.6 ,6.0 ,.
My Gallery
|
You cannot set tags in the runtime engine because you cannot change the VI (there's no ability to Save).
-------------------- "A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D
|
||
|
|
|||
Aug 22 2008, 02:09 PM
Post
#3
|
|||
![]() Extremely Active Premium Member ![]() Posts: 322 Joined: 18-January 08 From: Montréal, Canada Member No.: 10515 Using LabVIEW Since:2000 LV:8.6 ,8.5 ,.
|
You cannot set tags in the runtime engine because you cannot change the VI (there's no ability to Save). It works on library though. Will there be any way to save them for VIs in the future?
|
||
|
|
|||
Aug 22 2008, 03:13 PM
Post
#4
|
|||
|
Very Active NI ![]() Posts: 219 Joined: 14-March 06 From: Austin, TX Member No.: 4441 Using LabVIEW Since:1999 LV:8.6 ,8.5 ,8.0
|
VI tags are easily found in Invoke node and can contain any data type. (I can foresee a nice OpenG set of VIs for that...) In LabVIEW 8.6 there is a small set of VIs that deal with VI and object tags. They are located at [LabVIEW 8.6]\vi.lib\UserTags. Let me know if you have any feedback on them. -D
|
||
|
|
|||
Aug 22 2008, 05:20 PM
Post
#5
|
|||
|
Very Active Member Posts: 170 Joined: 14-June 05 From: Seattle, WA Member No.: 2411 Using LabVIEW Since:1993 LV:8.5.1 ,8.20 ,7.1.1
|
If you are worried about the user editing an INI file and putting in bad values, my solution is to use a small XML file and an .XSD (schema) file. When the app boots, it reads the xml file for its 'ini' settings. I first validate the XML against the schema to verify it has no errors. If they messed up the XML, then the app will report the error and what line is invalid, then exit.
This is not that hard to do if you have used any .NET functions before in your LabVIEW code. I can post some examples if that would help. -John -------------------- ---------
You mean you still use a keyboard to write your code? How quaint...
|
||
|
|
|||
Aug 22 2008, 05:55 PM
Post
#6
|
|||
![]() Extremely Active Member Posts: 529 Joined: 2-August 05 Member No.: 2680 Using LabVIEW Since:1996 LV:8.5.1 ,8.6 ,.
|
If you are worried about the user editing an INI file and putting in bad values, my solution is to use a small XML file and an .XSD (schema) file. When the app boots, it reads the xml file for its 'ini' settings. I first validate the XML against the schema to verify it has no errors. If they messed up the XML, then the app will report the error and what line is invalid, then exit. This is not that hard to do if you have used any .NET functions before in your LabVIEW code. I can post some examples if that would help. -John Can you post an example. It would be helpful, though I may not be able to use for RT apps where I read ini settings from xml. Thanks, N.
|
||
|
|
|||
Aug 22 2008, 06:04 PM
Post
#7
|
|||
![]() Extremely Active Premium Member ![]() Posts: 322 Joined: 18-January 08 From: Montréal, Canada Member No.: 10515 Using LabVIEW Since:2000 LV:8.6 ,8.5 ,.
|
If you are worried about the user editing an INI file and putting in bad values, my solution is to use a small XML file and an .XSD (schema) file. When the app boots, it reads the xml file for its 'ini' settings. I first validate the XML against the schema to verify it has no errors. If they messed up the XML, then the app will report the error and what line is invalid, then exit. This is not that hard to do if you have used any .NET functions before in your LabVIEW code. I can post some examples if that would help. -John Honestly, it was more a thought experiment kind of question. I recently used lvclass tags when I was playing with cloning classes programmatically. I was wondering if VI tags would be an efficient way to go. Based on AQ's answer, it is not practical at the moment, since it cannot self-modify its own tags, so I'll let that go. I admit that XML has some appeal, especially since it supports LabVIEW classes in 8.6. I'd welcome your example VIs. thanks
|
||
|
|
|||
Aug 25 2008, 11:10 PM
Post
#8
|
|||
|
Very Active Member Posts: 170 Joined: 14-June 05 From: Seattle, WA Member No.: 2411 Using LabVIEW Since:1993 LV:8.5.1 ,8.20 ,7.1.1
|
Can you post an example. Sorry it took so long. I had to make a generic version and add some comments. I posted it in the code repository in development section. Here is a link: XML File Reader in CRID -------------------- ---------
You mean you still use a keyboard to write your code? How quaint...
|
||
|
|
|||
Aug 28 2008, 11:31 AM
Post
#9
|
|||
![]() Extremely Active Premium Member ![]() Posts: 350 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
Honestly, it was more a thought experiment kind of question. I recently used lvclass tags when I was playing with cloning classes programmatically. I was wondering if VI tags would be an efficient way to go. Based on AQ's answer, it is not practical at the moment, since it cannot self-modify its own tags, so I'll let that go. Well... It's not too bad, the fact that the tags can't be modified is a security, no ? I mean.. you can store the default settings into tags and in case the INI has been removed / screwed by someone, then load the default settings from the VI tags, no ? -------------------- ____________________________________________________________________________________
Share what you know, learn what you can. _____________________________________________________________________________________
|
||
|
|
|||
Aug 28 2008, 02:52 PM
Post
#10
|
|||
![]() I'm a LAVA, not a fighter. V I Engineering, Inc. ![]() Posts: 3851 Joined: 13-October 03 From: Michigan, USA Member No.: 181 Using LabVIEW Since:1993 LV:8.5 ,. ,.
My Blog
|
Well... It's not too bad, the fact that the tags can't be modified is a security, no ? No - it's because you can't edit a VI in the RTE. For example, you can open a VI, edit it's diagram or front panel, then save it - tags are part of the VI, so editing the would be like trying to edit the diagram. -------------------- ![]()
|
||
|
|
|||
Aug 28 2008, 03:44 PM
Post
#11
|
|||
![]() Extremely Active Premium Member ![]() Posts: 350 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
No - it's because you can't edit a VI in the RTE. For example, you can open a VI, edit it's diagram or front panel, then save it - tags are part of the VI, so editing the would be like trying to edit the diagram. Yes. I assume it's for the same reason that you cannot change the default value of a control at run time. What I was meaning by "the fact that the tags can't be modified is a security, no ?" is that, in a way, being sure that it will not be modified whatever happens can be interesting for storing default values. Often default/last used values are stored into an INI file, what if the operator deletes or moves the INI file ? Well load the default value fron the VI tag you are sure no one will screw the VI tags This is what I meant by "security". Is there a transparent-babel fish-like animal we could stick into our eye to understand anything written in any form of language ? And what if I stick 42 babel fish into my ears, would it work ? -------------------- ____________________________________________________________________________________
Share what you know, learn what you can. _____________________________________________________________________________________
|
||
|
|
|||
Aug 28 2008, 04:10 PM
Post
#12
|
|||
![]() I'm a LAVA, not a fighter. V I Engineering, Inc. ![]() Posts: 3851 Joined: 13-October 03 From: Michigan, USA Member No.: 181 Using LabVIEW Since:1993 LV:8.5 ,. ,.
My Blog
|
I assume it's for the same reason that you cannot change the default value of a control at run time. That's right. What I was meaning ... is that, in a way, being sure that it will not be modified whatever happens can be interesting for storing default values. Ahhh - I get your menaing now. Yes, you could store constants as tags, but what benefit would that have? Why not just make them constants on the diagram? Unless you're trying to hide the constants? Is there a transparent-babel fish-like animal we could stick into our eye to understand anything written in any form of language ? And what if I stick 42 babel fish into my ears, would it work ? -------------------- ![]()
|
||
|
|
|||
Aug 28 2008, 04:35 PM
Post
#13
|
|||
![]() Extremely Active Premium Member ![]() Posts: 350 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
Ahhh - I get your menaing now. Yes, you could store constants as tags, but what benefit would that have? Why not just make them constants on the diagram? Unless you're trying to hide the constants? Right, no point... other than hiding the constants, so no real point. Just thinking out loud -------------------- ____________________________________________________________________________________
Share what you know, learn what you can. _____________________________________________________________________________________
|
||
|
|
|||