-
Posts
3,903 -
Joined
-
Last visited
-
Days Won
269
Content Type
Profiles
Forums
Downloads
Gallery
Everything posted by Rolf Kalbermatter
-
Using OpenG Zip Tools On 64-bit LabVIEW
Rolf Kalbermatter replied to MatthewHarrison's topic in OpenG General Discussions
Well, the DLL has to be the correct one for the actual LabVIEW platform of course. But since OpenG ZLIB is distributed as OpenG package, the package installer can make sure that the correct DLL is installed depending on the current LabVIEW version and platform. But what I want to avoid is any platform specific settings in the VI interfaces to the DLL. That would make distribution and maintenance of the library rather more complicated. I don't have a seperate wrapper DLL but have combined all the code (zlib, minizip, and wrapper code) into one library. This library is compiled into whatever platform shared library format is required including Win32, (Win64 hopefully soon), Mac OSX, Linux, and VxWorks 6.1 and 6.3. All of them are included in the ogp, with the MacOS X shared library being zipped up first to avoid loosing the resource fork of the files, and then the OGPM or the VIPM takes care to install the one that is required for the current LabVIEW version the package is installed into (and unzips the library through a custom post install step in the package for the MacOS X plaform). All the VIs and other help files are supposed to be platform independent and stay that way if possible at all. And the wrapper code is where I have spend some time in to make that independence happen. And the delivery takes a little longer since I went for a Dell Latitude machine. Also there are company internal delivery paths that add some time to this too . -
It's not "Other Thread 1" but "Other 1" execution system really. There is a difference in that since LabVIEW 7.0 or so, an execution system has by default assigned more than one thread each. If your code is truely thread safe and doesn't use TLS then this is no problem at all, but it means that eventhough all your VIs execute in the LabVIEW execution system "Other 1" they may not always run in the context of the same thread but anyone of the 4 or 8 threads assigned to this LabVIEW execution system.
-
No no. I fixed the mismatch of course. Without the fix I get error 1097 from the CLN which is logical since there is an exception that gets catched by the CLN wrapper in LabVIEW. Without fix it won't even work correctly. With fix I get the weird look, although maybe it's a Win XP quirk or something.
-
Something must be bad with this VI as it crashes on my system. Win XP SP3 fully updated. LabVIEW 2010. The third parameter of SetWindowLongA is a DWORD and that is an unsigned 32 bit value, not a signed 64bit value. And there is a strange line under the title bar where the background shines through.
-
Using OpenG Zip Tools On 64-bit LabVIEW
Rolf Kalbermatter replied to MatthewHarrison's topic in OpenG General Discussions
The zlib library is most likely not a problem. I have used the latest source code too. It's either an oversight in the Call Library Node configuration since I attempted to make the wrapper functions so that they will work in 32 bit and 64 bit without modifications to the VIs or something in the wrapper code that goes wrong. I'll take a look at it when I have installed the new machine. -
Using OpenG Zip Tools On 64-bit LabVIEW
Rolf Kalbermatter replied to MatthewHarrison's topic in OpenG General Discussions
Well I'm soon going to get a new machine and it will most likely come with Windows 7 installed (not really happy about this but I probably have to bite the bullet at some point). One advantage will be that it is going to be 64bit and therefore I can do some debugging of my own. My first dry exercise with just compiling a 64 bit DLL, did crash on Jim's computer, so there must be something still wrong with the DLL. -
AES 128 LabVIEW via php - Please Review
Rolf Kalbermatter replied to Justin Reina's topic in Calling External Code
I have to echo that. Got it myself too some years ago and at a slightly higher price if I remember correctly, but it has been worth the money for sure. Comprehensive library of cryptography functions all implemented in pure G. And the implementation looks clean and works well as far as I could see. No rocket science as I had written my own MD5 and SHA256 routines at that time but writing even one of those functions yourself costs you way more in time and money than this whole package. -
Don't worry, your language is quite fine. DLL functions are only executed in the single threaded UI Execution system, if you set them like that in the Call Library Configuration. Otherwise they are called in whatever thread is currently available for the execution system, the current VI is executing in. But unfortunately the "Call in single threaded UI context" is not so much to avoid race conditions in the call sequence itself. You can already avoid that by using proper data flow, making sure functions execute sequentially instead of parallel. The issue is much more complicated than that. So could a DLL for instance use thread local storage to store state between function calls. This is a nice way to avoid passing context values between function calls and works perfectly in C, since you typically call a DLL all from the same thread. In LabVIEW this fails miserably since each execution system has a number of associated threads and LabVIEW will pick one of them which is free to call your function in. So not only different functions in your DLL can get called from different (random) threads but also the same function when called multiple times. So it is not as easy when you deal with DLL function calls. Your DLL may be not thread safe because of using global resources such as variables or hardware , but if you know about that and take care about avoiding race conditions through semaphores or simply proper dataflow there is no real problem in executing the DLL functions from other execution systems than the LabVIEW UI one. Off course this is not an option for a library you are going to distribute simply because it is almost impossible to describe the necessary limitations to most of your potential users but the most advanced ones. On the other hand your DLL may be so called thread safe but use thread local storage and that makes it almost impossible to call your DLL functions safely from other execution systems than the UI one. And there are various other issues that are complicating the whole topic. For your case it means you REALLY need to understand what are the requirements of the used DLL in terms of multithreading. UI execution system is the safe one because it avoids all these potential snake pits, but at the cost of serializing any and all calls done in it and therefore quickly causing performance issues. LabVIEW multithreaded calling of DLL functions on the other hand has quite a few potential gotchas but gives you a way of avoiding serialization of functions.
-
Another case of someone not finding the forest because of all the trees . It's part of the LabVIEW online documentation for quite some time already. Based on that document too. Help->LabVIEW Help...->Fundamentals->How LabVIEW Stores Data. Opening the help and searching for flatten would have given you this in less time than it took to write your post.
-
creating an "image display" control ref
Rolf Kalbermatter replied to Antoine Chalons's topic in Machine Vision and Imaging
LabVIEW scripting was an adhoc feature until 2010. Meaning it was developed and implemented as people inside NI came with some use cases for tools, either internal or for inclusion with LabVIEW. As such it's support of methods and object type is quite scattered. Adding method X to object Z didn't mean that this method was automatically added to all other objects. And adding new objects type such as - let's call it for now - the binary custom control, didn't mean that all the scripting methods from similar objects were implemented and depending where it was placed in the object hierarchy it only inherited limited scripting support from more generic object types. With scripting now being an official part of LabVIEW, this will probably slowly improve, but the play field created already so far is way to large to cover it in one or two LabVIEW upgrades alone. If it doesn't work in 8.5 then that is most likely just the way it is and there is no way around that but to upgrade (or not use that feature). Once you start working with scripting more you will quickly notice that you run into methods and properties that are there but either do nothing or return an error such as "Not implemented" until you upgrade to a newer version. And sometimes it simply crashes until you upgrade. Not much we can do. If LabVIEW would be open source we could take those fixes and backport them to earlier versions, but I will probably be retired when LabVIEW gets open source, if ever. -
Have you read the actual document that describes the flatten format of LabVIEW data? For the fundamental datatypes like skalars and structs it can't get much more standard than the default C data format. The only LabVIEW specifics are the prepended string and array sizes, and the structure alignment of 1 bytes, as well as the default big endian byte order. It only gets LabVIEW specific when you talk about the aforementioned array sizes that get prepended, complex numbers and extended precision datatype, and other LabVIEW specific datatypes such as timestamps, refnums, etc. As to Open Source there exists an implementation although not in C but in LabVIEW. Checkout the OpenG lvdata Toolkit. Feel free to translate that to a C library or any other language of your choice .
-
I'm sure you are not working with Windows anymore, since Windows changes the way of working and data formats with every new version. Not sure you will find another solution though without at least some of that problem too . As to flattened dataformat changes, lets see, one incompatible change at version 4.0 since LabVIEW was introduced as multiplatform version in 1992. (Version 4.0 was around 1995.) Sounds at least to me like a VERY stable dataformat.
-
Looks almost like an implicit (and definitely not legal) I8 cast is done somewhere. This is something NI really will want to investigate, since such errors are a terror for any LabVIEW user.
-
Weird reasoning. The LabVIEW variant is not the same as an ActiveX Variant. LabVIEW does wrap ActiveX variants in its own variant to make them compatible diagram wise, but the actual internal implementation of LabVIEW variants is NOT an OLE/ActiveX Variant. And the same applies to the flattened format which is just as proprietary as the other flatten formats, although fairly well documented, except for the Variant. NI usually does a good job in maintaining compatibility with documented behavior but reserves the right to change any non-documented detail at any time. In case of the flatten format they changed the typedef description internally with LabVIEW 8.0 and in the mean time even documented that new format but maintained a compatibility option to return the old flatten typedef. The actual flattened data format stayed the same, except of course was extended to support new datatypes (I/U64, Timestamps, etc.). The only real change in flattened data itself was in LabVIEW 4 when they changed the Boolean to be an 8 bit value instead of a 16 bit value (and boolean arrays changed to be arrays of 8 bit integers, whereas before they were packed). Other changes in the flatten data format were in various versions in how refnums got flattened but NI does not document most refnums internals and therefore it's internal implementation is private and can not be relied upon. But if you know where refnums are you can usually skip them in the datastream without version dependency (almost ). And claiming ActiveX Variants are a standard is also a bit far reaching. It's a Windows only implementation and many other platforms don't even have such a beast.
-
I left it open on purpose. It can be quite a decision
-
Things like this give Mondays a bad name...
Rolf Kalbermatter replied to Daklu's topic in LAVA Lounge
Any plans on moving to Europe? -
Contratulations Daklu. The next 1000 posts will be a charm .
-
Congratulations François. Nice achievement.
-
you clearly missed some, mostly from february 2010 but also later. I reported them but not sure who gets those reports. I think I reported some of them already last year.
-
Reinventing the Image indicator
Rolf Kalbermatter replied to brainmort's topic in Machine Vision and Imaging
Just to confirm! There is no way you can create your own custom control for LabVIEW. While the image control is located in kind of an external resource, some sort of DLL, it uses a completely proprietary and undocumented interface to integrate into and interact with the LabVIEW user interface. And all the meaty functions which do the real image drawing and what else of that control, are implemented in the LabVIEW kernel itself. Since we can't extend that kernel - it is located inside LabVIEW.exe - there is no way for people outside NI to do something like that. -
What are the most useful vision functions?
Rolf Kalbermatter replied to brainmort's topic in Machine Vision and Imaging
Well as you go on with this project you will soon find that it takes A LOT of time and effort to write such a thing, and therefore it is likely that your Open Source library is only ever going to support a fraction of the functionality of IVision and you will understand why they didn't make the entire OpenCV API fully accessible in LabVIEW. IVision as it is, is a really large task in itself to accomplish already and contains quite a bit of work to make the OpenCV API work with good performance from LabVIEW. Sure you could go and simply create LabVIEW wrapper VIs for the OpenCV functions directly without any intermediate DLL but you will soon find out that the VIs created in such a way are kind of hard to develop and maintain and the performance of such a solution is likely going to suffer. The LabVIEW ecoverse is kind of small, and while Open Source can and does work in some areas image acquisition is probably not the most likely one. It requires quite a bit of domain knowledge, a very good programming knowledge and a large amount of time to maintain, and all that for a very small user base. Small because the professionals will use IMAQ Vision anyhow, since it is backed up by NI support, semi professional might go for IVision because of the cost, and the poor students will take whatever is there if they can get it for free, but only really do the minimalistic stuff of accessing a webcam and storing an image to disk, with an occasional simple image analysis function if they even have the time and guts to dive into the theory of how to use that. -
EMP/Ethernet
Rolf Kalbermatter replied to Ravikumar's topic in Remote Control, Monitoring and the Internet
Besides that there are examples in LabVIEW that show you how to do simple TCP/IP communication as already mentioned by Tim, this request is so unclear and brutal at the same time that the only thing I can come up with is "Homework hustler". -
Sending an array of clusters to a C dll
Rolf Kalbermatter replied to c_w_k's topic in Calling External Code
There are some serious trouble and some minor nitpicks. First thing is your initialization of the string cnt value before you allocate the string handle with NumericArrayResize(). This can't work, since the cnt element is just another element inside the memory buffer of the handle. Therefore it does not yet exist. In fact the (*((*(CamArray))->CamInfo[deviceIndex].SerialNumber))->cnt = strlen(String); must crash since you dereference the (*(CamArray))->CamInfo[deviceIndex].SerialNumber value which is still a NULL handle from the previous DSSetHSzClr(). And if you hadn't used the function with Clr in it, the value would be not necessarily NULL but still as invalid a memory address as NULL is. So you can't initialize cnt before you allocated the string handle with NumericArrayResize() and in fact I make it a rule to always only initialize cnt AFTER I have filled in the data. The same potential error is done in the FillError function. Potential because the string may be not NULL if the VI that passed in the error cluster had put a non-empty string in there. Another issue although not fatal is that you do not need to account for the 4 bytes of the dim (for string its the cnt) integer when you use NumericArrayResize(). This function accounts for the dim integer already when allocating the necessary memory handle (but it doesn't fill in the dim/cnt value. You do need to account for the dim/cnt size when using the DSNewHandle(), DSNewHdlClr() and DSSetHandleSize() functions since this are low level memory manager functions that make no assumptions about the content of the handle. Last but not least strncpy() is a rather tricky function. It's semantics happen to work for this specific case, since a LabVIEW string does not need to be NULL terminated and strncpy() does not insist on adding that NULL character to the end if the count value happens to be equal or smaller than the actual characters in the source string. So while strncpy() actually works perfect for this use case with LabVIEW string handles I try to avoid this function at all costs since when used with normal C strings it often can result in unterminated strings in the memory buffer which can cause all kinds of buffer overrun errors. Call of MoveBlock() or memcpy() is much more clear in this respect since it does what one expects and nothing more or less. -
Then let it send you a confirmation email. In there all activation codes are listed and can be copy-pasted enblock into the activation wizard. Had to do that here because the wizard seemed not able to connect to the activation server, while it could actually have me send the email, so go figure .