-
Posts
3,437 -
Joined
-
Last visited
-
Days Won
291
Content Type
Profiles
Forums
Downloads
Gallery
Posts posted by hooovahh
-
-
I'm not sure if this helps or muddies the waters. One thing to think about is lets say you have your shutdown message is sent, and your logging part shuts down, but it shuts down, before the DAQ part finishes. The DAQ part could send a message to the logging part waiting for a reply (not sure what kind of message DAQ would wait for a reply for but this is an example) Your DAQ code could wait forever for your logging part to reply and it never will because it has already shutdown. For this reason your messaging system either needs a long timeout in case something goes wrong so you don't wait forever, or have your messaging system be aware of the shutdown messages, and reply to messages that need replies saying to perform the shutdown, without needing the logging part of the code to be running.
This brings up another opinion of mine, and that is that separate running parts of code should never shutdown, unless they all shutdown. So say there was an error in logging and you ran clean up, and this caused the logging code to close and stop. Now we have the same problem as before where DAQ may ask for something from the logging code and it will never see a reply. I've seen in the past were an error would kill some code, but you need to remember other parts of the code may need it to reply or receive messages.
EDIT: Also in my setup each parallel process handles its own errors if the error was not generated by another caller. So DAQ asks logger for something that generates an error, this causes logger to send the error back to DAQ where the error is handled. If logger generated an error on its own it will handle its own error (it has no place to send it). Having a central error system is a novel idea but I too would be worried about system slow down. In my setup any part of the code that will run often should be as streamline as possible. So the messaging system is very minimal because I expect messages to happen all the time. I've also thought about having a central location to keep track of states transitioned in each parallel process. This has alot of benefit when it comes to debugging errors but again I haven't done it yet due to the overhead involved.
-
hooovah, you can get the PID by running "tasklist" from the command line, then just processing the stdout...
no idea how you get the full path though, other than using the Win32 API
ok try this from a command line: wmic process where name="labview.exe"
it returns a whole bunch of guff, but the full path to the executable is in there
Awesome. I modified the command a little to just get the ExecutablePath and ProcessID
wmic process where name="labview.exe" get ExecutablePath,ProcessIdProcessing this will be no problem thanks again.
I do however have a new issue. So I modified my VI be like Phillip showed, and it works when I run the VI, but if I run from the Tools Menu I get "LabVIEW: Configuration token not found." I believe this is because from the Tools Menu I have a new Application which for some reason doesn't like that function (possibly a limitation of the private method). I can get the "App.MenuLaunchApp" which will return the application reference that called it and then use that for modifying the key and restarting. This works as long as I run it from the Tools Menu in an existing VI. If I try from the Getting Started, this reference is also blank. I tried opening a new application instance, with the port settings but this also returns the same error. If I try debugging it then it works. I must be going crazy over such a simple function.
-
All unsaved will be what?!?! Don't leave me hangin'!
I noticed that string got cut off after I posted it but meh this isn't the CR.
You can set the INI variable and restart LabVIEW using two Invoke Nodes. You will have to confirm "Quit will abort all running VIs" and it should start back up with the correct setting.(LV 2012)
Again goes to show the Private methods I'm unfamiliar with.
Even so I tested your code and it does have that dialog about quitting VIs which is nice. It does give the user a chance to save any VIs they have instead of killing it. I would like to point out that my method does takes half the time to perform the goal then yours...of course half in my test meant I saved an extra 5 seconds. In the future I will be using your version because it is less likely to cause lost development work.
no idea how you get the full path though, other than using the Win32 APIThat's the part I couldn't figure out. How to go from PID --> Full Path.
-
is pv.exe bundled with Windows? I cannot find it in my install (hence the reason why you embed it in the code I suppose).
Are you sure you are legally allowed to distribute pv.exe in any form?
Edit: sorry just followed the pv link you included above, so it's not a windows tool, but am still not sure about the distribution of this.
Yeah you are probably right. I certainly wasn't trying to hide the fact that part of the code was not mine, and that it was part of a freeware application. I actually found the download on a site somewhere as just an EXE download without any attribution or history of where it came from. Still the whole two wrongs thing.
I tried for a long time to accomplish what this little EXE program does natively, or using VB calls but couldn't find any thing, just some possible ways to do it in C that I couldn't get to work.
For those not adventurous enough to run random EXEs off the internet, this EXE has many functions but the one I use is given a EXE name, it will provide the PID(s) for those running applications, and the full path on disk to their locations. If you open Task Manager you can see the PID column for all applications, and you can right click and choose Open File Location. This is the functions that I couldn't seem to do with DLL calls to Windows, or VB and .Net calls.
-
The installer doesn't put the ini into the [Public App Data]<Company Name><Application Name> folder, it just creates the folder and unlocks it. If the folder already exists, then nothing happens and your custom ini file remains intact. The default ini that is with the exe is overwritten, but since the ini already exists in the App Data folder, the ini with the exe is not used.
I wasn't talking about the App Data folder, I was talking about normal NI installers and how standard operation is for now with applications I make. I was saying that normally someone would need to change the permissions on the INI file in the Program Files folder if the application is going to Read/Write it. This was done using the command line program icacls but using the "unlock" on that INI file removes the extra step of having to run icacls but will still overwrite the INI (in Program Files)
I understand how you handle INI settings and I will try to use something similar in the future after some initial testing.
-
I don't use private methods often, and as a result I don't know what other methods are available. When I do turn on private methods I find that there are a ton and they some times will slow down my development, because there are so many that I will not use 99% of the time. For this reason I find myself enabling and disabling private methods and I wanted an easier way to turn them on and off. I made this VI (and it's supporting code) to run from the Tools menu of LabVIEW (place in the <LabVIEW>Projects folder) which will change the LabVIEW.ini key, and then restart LabVIEW.
Disclaimer 1: Private methods are not supported by NI and should not be used in build applications, and are generally only used for tools of development.
Disclaimer 2: This set of code contains an EXE (pv.exe) and will be saved and executed from the system temporary folder %temp%. Information about this EXE can be found here.
Disclaimer 3: As stated in the main VI, this will taskkill the version of LabVIEW running, and all unsaved work will be lost.
Any feedback is appreciated, thanks.
EDIT: This code uses OpenG File Library.
-
1
-
-
Sorry I can't edit my own post (too old) but for those having cross link issues like the one I mention, looking at the Files tab in a project explorer will quickly show any VIs not linking to the right files on disk so the tool I mentioned making isn't needed.
-
Occasionally I will be working on multiple projects that at one time split from each other. Because of this there will be many VI with the same name in both projects. To keep things simple I will only open one project at a time, but sometime I will do something stupid and have one project link incorrectly to the other projects VI. A tool I've wanted to make is to open a ref to all VIs in memory, get their paths, and build a tree with a directory view of all VIs loaded. This way I can see quickly which VIs are being called from where on disk. This type of tool could take advantage of this private method because I don't care to load all other dependencies when I open my references. I just need to know the path (and assume all the VIs are already in memory) that I want to scan.
-
This was my first thought also. This is an extremely handy method for performing VI server tasks on a single VI that don't require its static hierarchy to be loaded (psstt... this method can be orders of magnitude faster than Open VI Ref since, not only does it not load static dependencies, it does not load the owning library definition or sibling members).
It is very fast. I did a test on it by having it find all VI recursively in a directory, then open each of them and read the Connector Pane Image, VI description, VI Controls and their descriptions. Finding the VI files took longer than performing all the other operations.
EDIT: Actually I had a bug in my code the timing is not quite correct. On a directory containing 440 VIs (in sub folders too) it took 71ms to find all of them using the Recursive File List. Then it took another 4.8s to open those 440 VI references. The time to read the data was a bit flawed too but is on the order of 8-10 seconds.
-
I didn't know about the 'unlock' switch in the installer, so to get around the user access issues I was using the "icacls" command to set the user permissions. When the ini file is first created under ProgramData, I feed the command "cmd /c icacls "<path to ini file>" /grant BUILTINUsers:(F) /t" to "system exec.vi". This assigns all users full access to the ini file.
This works fine as far as I can tell, but I'm a bit nervous about using commands I don't really understand, so I might switch to the 'unlock' folder method instead when the issue with LV2012 is fixed.
I've used icacls before for setting permission as well (before I knew about the unlock feature). What I did then was install like normal, and then I needed to remember to run the batch file to change INI permissions after the install. Unlock removes this extra step but again will simply overwrite the INI during the install (which is where this topic came from in the first place)
-
Win 7 has some unexpected rules when it comes to the ProgramData folder, you can create and modify files (and folders) but if you switch users, they only have read access. So for this I have my installer create the folder where I will be storing the modified ini (by creating a new destination [Public App Data]<Company Name><Application Name>), and set the folder to unlocked.
Awesome idea. Yeah I was thinking about how all of this would work when switching users as well. I have not run into this myself but apparently there is a bug with 2012 with the unlock that doesn't work properly. Sounds like it is planned to be fixed in the next release
-
This code is still locked. Your code was removed here previously because of this. Either unlock the code or stop trying to submit it to the Code Repository.
-
What I'm doing right now can be considered non-standard. The INI and EXE go into the Program Files folder, and the INI has been "unlocked" by the NI installer. This makes it so anyone on the system has permission to write to it (but no other files). I've known for a while that files under Program Files should not be changed after the installer because of user permissions issues and that the ProgramData is the correct place for this information. To be more standard moving forward I think it would be a good idea to try what bmoyer suggested. I can have the installer install into Program Files the EXE and INI and keep them locked to read-only. Then settings are read from the ProgramData first. If the file doesn't exist (or there is an error in reading the Section/Key) use the INI file in the Program Files. Then when making changes save to ProgramData.
An added benefit I didn't think about with this approach is I can have a "Reset to Default" button that will simply delete the ProgramData INI file, causing the software to use the Program Files INI for settings.
-
Hello all. I have an application. This application has an installer. During the install the EXE and the INI file are installed and the EXE uses the INI and can then write to the INI any settings changed in the application. If I have a new version of the application I make a new version of the installer. The problem (if it is one) is that during the install the new INI will replace the old one and all of the old settings will be lost.
On the one side this is a good thing. This means that when version 2.0 is installed it comes with an INI file that is compatible with the 2.0 of the EXE and will have known good settings. On the other side this means that if there were any custom settings they will be lost. It is possible to run a EXE after an install, so I was thinking one possible solution could be to backup the old INI (sometime before deleting it) then after the install compare the two and any keys and sections that exist in the old and new INI, to be copied so the new INI has the same settings as the old.
Any thoughts on this? Is this a non-issue and installing a new EXE with the new INI is the way to go, with the understanding that old INI settings will be lost? Thanks.
-
1
-
-
Anyways, I reread my own post and I may be coming off as something of a doomsday preacher. Sorry about that to all of you!
No worries. There are days where I come on here and probably say things out of emotion and say things I don't mean to try to get a point across. Password protection, IP protection, and low level LabVIEW secrets on this forum have been a hot topic, and people are very opinionated, which makes for some topics which seem to add nothing to the greater knowledge that this forum is intended for.
I understand your position and feelings about IP and DRM. I also understand what flarn wants to do, and to an extent what drives him in his pursuit of all that is LabVIEW secrets. I too would like to know the dark secrets of LabVIEWs inner workings. I'm always interested in what there is to learn when it comes to LabVIEW, but at some point you cross the line and for everyone that line is different. Laws are intended to make that line the same but in many cases is still a grey area. In my opinion stating that "we need a new password cracker" goes too far, but at the same time I did not know that in 2012 the password scheme was changed to counteract previous flaws. And had it not been for this post I may have never known.
Man I'm all over the place with this post. I congratulate anyone who understood the message I was trying to say.
-
- There is no difference whatsoever between intellectual property and physical property. If you can't see that then you just have to live a while longer and it will dawn on you eventually.
This is just silly. Of course theres a difference. If there was no difference we would use the same word to describe both types of property. In the dictionary if you look up Intellectual Property it will not say "See Physical Property".
I also don't condone releasing anything to break NI's password protection scheme, but I also think it isn't in your place to say that he "WILL get into trouble" if anything is released. What happened to the last guy that released a password cracker that works on all VIs between 7.x and 2011? Well I don't know for sure but his website is still up with the source code, and will even remove the password by uploading a VI.
-
2
-
-
You weren't going mad. I got it too on all the threads so I couldn't post that there was a problem
It was kinda funny because I could see new posts, and my RSS showed new topics, but you couldn't go to the thread.
-
Sorry you made a duplicate topic here and I replied in any case here is what I posted:
I've attached my go at it. This uses two OpenG VIs Remove Duplicates and Search Array. Install the OpenG Array package to get these VIs.
-
It doesn't look like your attached any code. Yesterday there was some LAVA issues so this maybe this is to blame. In either case I've attached my go at it. This uses two OpenG VIs Remove Duplicates and Search Array. Install the OpenG Array package to get these VIs.
-
Not the answer I was hoping for, but I'm not surprised. As tempting as it may be I will try to stay away from XNodes, and stick with 100 polymorphic instances, and OpenG code that can't adapt to every thing I need.
-
Sometimes Ctrl+. helps. And you can almost always close the parent vi using the task bar context menu and it will terminate the blocking sub vi.
This won't work if the SubVI isn't being called in the code yet and is just in memory. I believe this is the situation Minh was describing. I've used several AbortVI functions in the past to be able to abort any VI running (not a close at the moment).
-
The current design won't allow vertical separators as it uses an array of picture controls (so each slot is a fixed width). The new version replaced that with a single picture control and lots of messy code to work out which part of the picture needs to be redrawn when the user interacts with it. The messiness is one of the reasons I've never finished it !
That does sound messy. The other solution I was tossing around in my head, was that each picture could be a separate running VI. Then you can register for a mouse enter/leave for interaction, and mouse down to know which was clicked. I did a quick test here which displays images, and each image is a VI. It's far from perfect, and it actually does resizing (which you wouldn't want to do) but it may give you a new approach.
-
These are pretty much the reasons I've never released the code 'officially'. Actually the XNode dependency and hence the Scripting tools dependency is pretty easy to strip out and replace with 'static' code. I've sort of intended to do so for ages but somehow other things keep getting in the way. Also, I've a very long term, slow burning, project to replace the whole toolbar with something a bit more flexible that could include other types of control, not just a push button.
This is not a feature request by any means, but if you are thinking about making the tool look more native I would suggest having vertical separators and a function that allows for resizing the window, which would collapse buttons into a single button when they all can't fit in the display. See the image of Foxit Reader which collapses the buttons to a >> button which don't fit.
Just a thought.
-
Okay so I've never really dipped my feet in when it comes to XNodes. At the moment I'm not looking to make XNodes just understand using them, and really just get others to tell me it's safe.
The ones for discussion are the Array XNodes, and the OpenG Array XNode. I see the functions this code has and I love the idea of using it. But I know that there is no support from NI for using XNodes, and I've heard NI say that using them can be quite dangerous (without specifically saying what it could do or how to avoid it).
So I want to pose this question. Is the Array XNodes in the Code Repository as safe to use as the normal OpenG array functions? Is there a compelling reason I should not be using XNodes of any kind in an application? I assume Lava would not certify code that was unstable, and I also see that people are using these functions (over 3000 downloads combined). So is there nothing to worry about here? And if these are so great and stable, should I exclusively use these instead of the real OpenG ones?
Error Handling in messaging systems
in Application Design & Architecture
Posted · Edited by hooovahh
I explicitly avoided saying Actor throughout my post because not all of us use the Actor Frame work, and one could design the messaging framework in the way I described...and some of us have.
In my experiences I've never needed to completely destroy a loop, just call the cleanup and init. So I may have my logger close what it is doing and re-read settings but it is always running and listening for other "Actors" to respond to.
My example was a little simplistic. Lets try this instead, a Sequencing Actor calls a DAQ Actor to read some values, the DAQ Actor reads the values then sends them back to the Sequencing Actor with any error that may have happened in the read. I was trying to say that if shutdown happens the DAQ may shutdown, but my call from Sequencing to DAQ will wait forever waiting for the DAQ to reply with the data it requested. Previously I used DAQ and Logging in my example but this makes less sense because I couldn't imagine a time when the DAQ would call Logging and want a reply.
I like this idea but I would want all states transitioned. So I can see what cases in my state machine, in each Actor went where, then where then where etc. This then can give a very detailed view of what states my Actor went to and usually tell me why based on decisions that could have made it do those cases. This central location of states and Actors would need to be a circular buffer of some kind, or possibly logged to TDMS and overwritten, or even just turned on manually. This could open up all kinds of debugging tools. Imagine if the User of my software has a bug that is reproducible I could say turn on this checkbox then make the bug happen. Then this one file could show all the states all actors went to, and with that I can very quickly narrow down what is happening.
I have done this in the past when I expect an error by using the History Probe. Here I will probe the states wire (assuming I use strings as my state) and this probe will show all states that were executed by the Actor. Of course this only works when running in source, but with a State Transition Actor I could use this in an EXE.