How can I add a comment to a LabVIEW file using Python 3 - python-3.x

I am trying to create a unique id and attach it to a LabVIEW file so that later I can read back that id and know I am looking at exactly the same file. I must be able to generate the id and read it back programmatically. The information must be hidden from the user accessing the file and persist across operating systems and storage mediums.
I was thinking of just adding it into the file 'comment' section, but it appears the Windows no longer supports file comments.
Any ideas?

I would suggest using the Set Tag method on the VI (with persistence) and saving multiple copies of the VI using the Save Instrument method, where each copy would then have its own unique value of the tag. Note that the method is defined as a scripting method, so you would probably need to enable scripting in the LV options to access it.
I don't think there's any API for enumerating tags, so there would be no way to find the value unless you know what the tag is called. Obviously, it's encoded somewhere in the VI file itself, and presumably it would be possible to extract a list of tags if you know the structure of the file, but that's not knowledge I would expect most students to have.
I'm not sure if you can call the set tag method from Python using an external connection to VI server, but certainly the LV code for this should be pretty simple - basically a for loop with ID generation, a couple of method calls and saving a CSV file so you can keep track of which ID belongs to which student. If you use existing IDs, you don't even need to generate and save the IDs.

Related

Lock rptdesign file

I am trying to find out if it is possible to lock an rptdesign file.
The idea is to run a report as a service, but without being able to change the default parameters. I know I could just hide the parameter window but still the user could edit the rptdesign file and hard code new values.
Does anyone has any previous experience with this?
Is it possible to make an rptdesign file non-editable?
If you want to prevent users by modifying rptdesign file, you should do it on OS level to enable it only for certain users.
If you want to ensure that the report is not modified, you can add hidden field storing md5 sum from report file. I mean that this field can store md5sum from your report file on the disk. Then you can compare it with your original sum.
Anyway your problem is slightly different - you are expecting certain data from your customers and you want to be cheated by them. You can use the method with md5sum but it is rather the matter of trust to them here or any other possibility to access to their database than through the report (e.g. they can give you the direct access to the database or you can agree to store this data in your company, not theirs).
Let me know if this answer helps you better.

How to add User Specific information in Exe File

I have a code on the server-side(application) that links with the client-side(application).
The user signs-up to download the exe(client-side application).
There must be a unique way to identify the user(client app exe) with the info got from sign-up.
So, one of the information must be attached to exe file during the download.
One of the ways I found is using "Portable Executable".
Is it possible to add string data to exe and later retrieve it?
Is there any other possible way to make the exe user-specific? Or is it possible to add the user information along with the downloaded exe?
Yes, it is potentially possible to modify the exe at runtime to put your own stream. You might put the User Specific information in an existing Resource prepared for this "update". This would be the easiest way to avoid to take care about changing other parameter like size, etc.. Another option would be to put the User Specific information in the overlay of the Exe.

How do I search attached files stored in a MS Access 2010 database?

How do I search in MS Access (ver 2010) for data in files attached to records? If I do a "Find" and specify text I KNOW is in an attached txt file to a particular record, there are no hits. While if I have the same data in a Text Field or Memo field, Access finds it. I understood from one of the Access help screens I found that it is possible to search attachments from within Access, but I have not been able to do this yet.
BTW, I did try using the query tool and searching for text I knew was in the attachment, but it was not successful, although it did find the same text within a memo field in another record.
Thx,
jmb
I'm fairly certain that there is no mechanism in Access to find records based on text within a file attachment. A bit of web searching found an earlier question here and the responses seem to agree that there isn't.
One reference from Microsoft here says
By using attachments, you open documents and other non-image files in their parent programs, so from within Access, you can search and edit those files.
but I think that statement could be misinterpreted. I believe what they meant to say was that
"...from within Access you can open an attachment in its parent program and then work on it as usual (e.g., edit it, search it, print it, and so on)."
You can use file system object, open the file as string and search sequentially. That's as close as you'll get

How to get the filename for an attachment if there already is another one with the same filename, instead of getting a random name?

In cases when two attachments with the same filename are attached to a Notes Document, the second file is renamed internally to something like ATTXXXX. Even if the first filename is deleted and document re-saved, the internal filename remains cryptic.
There doesn't seem to be any way to retrieve the original Filename through back-end functions. I have looked high and low in LS but also in the C++ API, and could find nothing. It seems to be a trick that can only be done in the front-end. I am not sure where the information in the file icon graphic is stored, and whether it is accessible. In simple cases it would be possible to do a rename, I suppose (i.e. there is a single attachment and a single file icon graphic).
Could anybody confirm that this is, indeed a limitation of Notes or is there a cool way to solve this?
This is causing me some headaches whilst processing a large number of documents. My customer has trouble believing that there are some things that can only be done in the front end.
You should be able to get the original filename, even with duplicates.
It is not when the file is attached that the name is changed, it is when you detatch it.
You are probably using the .Name property, try the .Source property of the EmbeddedObject, that should return the original filename.
From the help:
If the NotesEmbeddedObject is an embedded object or object link, this property returns the internal name that Notes uses to refer to the source document.
If the NotesEmbeddedObject is a file attachment, this property returns the file name of the original file.
Syntax
To get: source$ = notesEmbeddedObject.Source
It's in the CD records for the rich text -- you will see it if you use NotesPeek to examine the contents of the rich text item. But I don't think it's accessible through the NotesRichText navigator class, so I'm pretty sure you would have to go the C API and parse through the CD records. Or, the MIDAS Rich Text API can probably get it, but that's third party software. I.e., not free.

Saving to SharePoint via WebDAV redirector. Getting new object ID and losing version history

I'm using WebDAV redirector to edit a file on a SharePoint repository. It looks like each time I save the file this way, I get a new object that replaces the previous one. This is causing all the version history to be lost.
Open file is being done via CreateFile with:
filename - Same that is used for Read-Only call to CreateFile (which works)
DesiredAccess: GENERIC_READ | GENERIC_WRITE
dwShareMode: FILE_SHARE_READ SecurityHandle: length is set, but other 2 fields are 0
dwCreationDisposition: OPEN_EXISTING dwFlagsAndAttributes: FILE_ATTRIBUTE_NORMAL
hTemplateFile: NULL
After I write the file to the handle returned by this call, if I get the list item for this file, the object number (ID=) has been incremented. Also, this ID number seems to be prepended to each of the fields in the list item (separated from the actual data by the sequence "#;")
This increment of the ID number (and loss of version history) doesn't happen if I check out, edit, then check in using the web interface; it retains the same ID, and the version history is left intact.
How can I avoid this? I must keep the version history.
I'd recommend to obtain an HTTP trace.
Likely, it will show that the redirector uses a temporary file, and then MOVEs it over the original file.
Fix: use a smarter WebDAV client (Xythos drive may be better).
by using WebDav you are bypassing the SharePoint runtime, which is why you . to ensure that you get the version history you should use the SharePoint apis (web services or OM)

Resources