-
Posts
4,940 -
Joined
-
Days Won
308
Content Type
Profiles
Forums
Downloads
Gallery
Posts posted by ShaunR
-
-
I did a little research and it appears that this is not as simple as I thought. Serializing access to a shared resource seems to be a potential trouble spot for any kind of software. The only way to guarantee that a race condition does not occur is for process A to lock the file, and for process B to wait for the lock to be released. By accident I have created a poor-man's file lock by deleting the original file after reading, although there is still a narrow window where a race condition can still occur. Does anyone know if there is a "file lock" vi and a "wait for lock" vi? Can I do this from the command line in Unix using the system exec vi?
Ok, here is an idea I got from the internet:
- Check for the existence of sharedfile.lock
- If sharedfile.lock exists, wait 10ms, go back to step 1
- Create sharedfile.lock
- Open sharedfile.txt
- Overwrite sharedfile.txt with new value
- Delete sharedfile.lock
Does this sound like it would work?
Why not just use the "Deny Access" vi (should be in LV7.0 - under file IO>>advanced file functions).
-
A really interesting article on the register today.
How hard is it to tx data and power through metal? My mains plugs do it pretty well
-
ShaunR
It's interesting I didn't know that . Thanks. I Use Firefox and i did what you said but it just pasted it as an image and not converted to code. How can we differentiate a simple png file from a snippet?
If you are having difficulty with firefox. Open the image in a new tab before dragging to the desktop. It can be a bit of a pain in firefox. (it's even worse in chrome)
You can tell it's a snippet because it has the hand,arrow and lv icon in the top left of the diagram image. It also has the labview version in the top right.
-
Thanks Neville But it's a png file.
If you are using exploere, just drag the image from explorer to an empty diagram.
If you are using firefox, drag it to your desktop then drag it from there to an empty diagram.
VI snippits are png image files with the actual code embedded in the image. When you drag the png image to a diagram, labview will re-create the code.
-
My preference is to take the risk that flattened data will maintain compatible with future versions of labview.
Good choice. Just stick some length bits on the front (u64) and you are good to go.
-
Can't help with the problem. But maybe can explain how it is different
It is a "plug-in" control and resides in the "\resource\PlugInControls" directory. As far as I'm aware, it is an undocumented interface allowing controls to be created from external DLLs and resources. I have a feeling it was the way NI was going for custom controls before they decided on Xcontrols.
-
Sorry to hear that dude. I'm in a slightly different position that I'm about to throw in the towel.
But JKI seem to be sucking up any and all LV programmers. Maybe there's a chair there with your name on it already
-
Well. My 2 cents.
In practical terms; to transmit data over TCPIP you only need to know the length (ignore transport layers-at the application layer). How you bundle that data into the payload is irrelevant as long as you know how many bytes you are expecting. So simplest and most effective is a n-bit length and then your payload. You can use delimiters, but then you cannot send binary data without escaping it all and/or you have to put a lot more logic into your software to keep reading and testing data to find the end.
That ticks all your boxes, for sending and receiving. It's the payload, however, that you need to decide how to package to make it "future" proof. Abstract the interface from the data and treat them separately. Once you have decided on how you are going to package it, it will either be a simple case of adding a length byte and transmitting, or the packaging will dictate that you use delimiters and (probably) some bloaty engine to parse it.
-
It's a few months old, and there are signs that the post is all made up, but still its very funny if you're a programmer. My favorite quote.
Definitely "L-Vish". Explains 2011 to us halflings
-
If I did, wouldn't that be a type of self-abuse, so to speak?
Touche
-
I wouldn't expect language like that from you of all people, Crelf.
Are you going to give yourself a warning?
-
(did I mentioned he looks good in a kilt?).
Budgie smugglers underneath?
-
Ok, I decided to do my own benchmarking as I am interested in overhead.
<snip>
Code is in LabVIEW 8.2.1
Don't forget to turn off debugging
-
I also had the same issue. Apparently this has been identified as a bug in 2010 (http://forums.ni.com...HS/td-p/1176967).
Better make that 2009 too
-
A simple (not fool-proof) way is just to read the volume serial number of the USB stick. There's the "Windows API" in the CR tat will allow you to do that.
Alternatively, you could read the device ID out of the windows registry.
-
Your proposal will work well. It''s a centralised system and is proven to work well on small scale apps
You could also consider a "de-centralised" system where each "module" (your serial thingies) is a producer AND consumer so that data can not only be streamed from them, but control messages can be sent to them.
Consider, for example, that your new UI module wants to stop one (or all) of the serial modules - a common requirement. In a centralised system, the responsibly for that lies with the messaging node (your consumer) since it is the only part that is aware of the "STOP" message. At that point, things can get ugly as the app grows since now it's no longer just a consumer (just processing data), it's also a controller - so the responsibility boundary becomes blurred.
In a decentralised system, you can (don't have to...but can) pass the message straight from the UI to one or all of the modules directly. It doesn't stop you having a centralised processing point for data being emitted from the modules. It's just a little more "modular" in terms of how everything can fit together.
-
Well. I've got no idea what you are talking about.
However. A LV picture speaks a thousand words so a quick glance at your code and it looks like you are just wanting to detect sign changes between 2 arrays of doubles?
If this is correct then I would do something like this:
-
Well that the DLL call is done in the UI thread may be just a byproduct. What I was meaning to say is that the execution of the entire XNode may be forced into the UI thread. I have never bothered to look into XNodes and how they work, but it wouldn't surprise me if they are more of a quick and dirty hack added to LabVIEW than a properly designed feature, which might be one of the reasons that it never made it into a public feature. And taking the shortcut of executing XNodes in the UI thread would make creating such a feature much easier. Of course it's not ideal to do it that way but hey I have no idea what the intended use cases were so it may have made perfect sense.
Xnodes don't quite work like that (you would think it was similar to an Xcontrol...But it isn't) They are basically pre-packaged script nodes that are programmed to generate code when executed. So the xnode in question has lots of script to create a CLN and all the function parameters to interface to the DLL. The result is that at some point (not sure exactly when, maybe after compilation, or when you press the run button) the xnode runs, then creates the code and it is this generated code which runs in the place of the xnode - In this case a CLN in the UI thread.
It's a lot of [script] code to generate a relatively small amount of real code that could have been created as you described and wrapped in a polymorphic VI for the adapt-to-type (no need for the intermediary DLL then and it wouldn't have to execute in the UI thread).
-
Well that the DLL call is done in the UI thread may be just a byproduct. What I was meaning to say is that the execution of the entire XNode may be forced into the UI thread. I have never bothered to look into XNodes and how they work, but it wouldn't surprise me if they are more of a quick and dirty hack added to LabVIEW than a properly designed feature, which might be one of the reasons that it never made it into a public feature. And taking the shortcut of executing XNodes in the UI thread would make creating such a feature much easier. Of course it's not ideal to do it that way but hey I have no idea what the intended use cases were so it may have made perfect sense.
Xnodes don't quite work like that (you would think it was similar to an Xcontrol...But it isn't) They are basically pre-packaged script nodes that are programmed to generate code when executed. So the xnode in question has lots of script to create a CLN and all the function parameters to interface to the DLL. The result is that at some point (not sure exactly when, maybe after compilation, or when you press the run button) the xnode runs, then creates the code and it is this generated code which runs in the place of the xnode - In this case a CLN in the UI thread.
It's a lot of [script] code to generate a relatively small amount of real code that could have been created as you described and wrapped in a polymorphic VI for the adapt-to-type (no need for the intermediary DLL then and it wouldn't have to execute in the UI thread).
-
Looked at the config file port in the installer but hadn't played with it yet. So in this case, I could have the installer set up the cDAQ in MAX and configure the names of the cDAQ and the module to use? Then just use the serial number and a unique PC identifier in the file name to track usage as Shaun mentioned? Or is there something I'm missing here? Or something even easier or slicker?
-Ian
Depends on which way you are looking at it.........
Set it up once in MAX (make sure it all works). Export an nce file. Add it you your project. and set it in the installer. Once you build your installer you will only need to put it on a CD or USB stick or whatever and install it on any machine So effectively you use MAX to create your hardware "template" and then roll that out with the installer which will take care of configuring the target machines hardware. Your software will always use the same taks/channels regardless of which machine it is on and, as long as you put the C ID and DEV ID somewhere (file name is good if you just want to see at a glance in xplorer without opening files), you'll be able to track the results to the hardware.
I would suggest also adding the date to the file name (e.g 2001-01-21) in that order then when you view the results you can sort them in explorer. Additionally, you can set the file date as a directory name and store your results by date making it easy to identify what was tested on which days. But it's just personal preference (one directory with lots of files or a few directories with a few files)
-
Use the same name (in the tasks/channel/hardware configuration) or all the DAQ devices (say cDAQ).
In your results file also save the DAQ devices serial number (you can read this using a property node shown below) and the computers ID (anything that identifies a unique computer - computer name, network card, IP address, HD serial etc). This way the executable will run on any suitcase, with any PC/DAQ (as long as they are all the same) but will save data that is traceable to a particular suitcase PC and/or a particular cDAQ.
-
I know in labview only string can write and read also performed in string formet but how i can send hex commands to port and as well it send only hex not strings.
Can you explaine how we can acheive this...thankj you...
-
In my opinion, a true singleton is not possible in LabVIEW.....
<snip>
.....I don't think it would be that hard to have a true singleton in LabVIEW if one change was made to how LabVIEW works.
A normal non re-entrant VI is a singleton
-
Benchmarked in 7.1.:
1 million iterations
straight wire through 186 ms
error case structure 306 ms
so the case structure costs about 120 ns.
Hey, just checked without any wire (so a clear error vi).
424 ms!
So this is most likely slower due to the buffer reuse in above cases.
Test in newer version: takes more than 500ms and the difference between straight wire and error case struct is almost gone.
Felix
Set the vi to subroutine (assuming you are using a sub-vi vi in a for loop) and you'll probably halve those times
AES 128 LabVIEW via php - Please Review
in Calling External Code
Posted
Vartor provide a "Crypto Pack" which (IMHO) is well worth the $20 especially as it comes with full source. It has (amongst other things) AES.