Jump to content

Could VI tags replace INI file?


Recommended Posts

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...)

Link to comment

QUOTE (normandinf @ Aug 22 2008, 08:11 AM)

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

Link to comment

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 LV code. I can post some examples if that would help.

-John

Link to comment

QUOTE (jlokanis @ Aug 22 2008, 10:20 AM)

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 LV 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.

Link to comment

QUOTE (jlokanis @ Aug 22 2008, 01:20 PM)

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 LV 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 LV classes in 8.6. I'd welcome your example VIs. thanks

Link to comment

QUOTE (normandinf @ Aug 22 2008, 08:04 PM)

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 ?

Link to comment

QUOTE (Antoine Châlons @ Aug 28 2008, 07:31 AM)

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.

Link to comment

QUOTE (crelf @ Aug 28 2008, 04:52 PM)

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 ? :D

Link to comment

QUOTE (Antoine Châlons @ Aug 28 2008, 11:44 AM)

That's right.

QUOTE (Antoine Châlons @ Aug 28 2008, 11:44 AM)

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?

QUOTE (Antoine Châlons @ Aug 28 2008, 11:44 AM)

:D

:D sounds like a pretty intense game of http://en.wikipedia.org/wiki/Chinese_Whisper' rel='nofollow' target="_blank">Chinese Whispers where language is involved too :o

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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