Jump to content

Rolf Kalbermatter

Members
  • Posts

    3,837
  • Joined

  • Last visited

  • Days Won

    259

Everything posted by Rolf Kalbermatter

  1. Contratulations Daklu. The next 1000 posts will be a charm .
  2. Congratulations François. Nice achievement.
  3. 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.
  4. 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.
  5. 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.
  6. 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".
  7. 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.
  8. So you have found a solution but find it to complicated? Or what is the problem you still have?
  9. 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 .
  10. And it's a long way to be anything but Windows only. I know of Moonlight but sorry guys that is not cutting it yet for use in an application like LabVIEW on non-windows platforms. Even Mono is still lacking quite a few things to be a true .Net replacement.
  11. It's your application, at least I would hope that, so the answer to both questions can only be given by you. The only thing we can tell you are generic advices or in other words: 1) It's time to close your VI FP when you don't have to show anything to the user or don't have to get information from them anymore. 2) Invert number 1) and you have the answer to that as well.
  12. Well you can access the data and therefore export it to some other place but ODBC indeed is not meant as a management interface to a database. Each database implementation has very different ideas about how its data needs to be managed and that would be almost impossible to put in a generic API that fits all. So this is really mostly left out of ODBC (and ADO and DAO and JDBC and what else generic database APIs you have). A database usually comes with it's own management application that is meant to be used for this task. For MySQL there are also PHP based management tools since MySQL is often used as backend for web servers. Trying to do real management of a MySQL database from within LabVIEW would require a specific VI library to access the MySQL management API. Certainly doable but not something that could be done in a weekend or so. And that is why it most likely hasn't been done by anyone so far.
  13. 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.
  14. The logical and real "fix" would have been to use user refnums, which are available since at least LabVIEW 7 or so. And allow us mere mortals to use them too, without having to revert to reverse engineering them!
  15. My point is that the password does disallow looking at the code, but does not encrypt it in any way. And why should it, if it did this would serve almost no purpose at all, since it would be functionally almost equivalent than removing the diagram altogether. The only difference with that would be that if you remove the diagram and loose the original then you lost all your work, with the password protection as long as you remember the password you still can get at it, even if you loose the unprotected original. But that is a minor difference that would not justify spending much resources at all to be put in LabVIEW, since loosing a password is actually easier than loosing original VIs, if you do some kind of useful backup, and we all do that, don't we? As far as LabVIEW is concerned the password protection still allows LabVIEW to load the diagram and compile it, that is a given and not just an assumption. As such NI can create an internal LabVIEW prototype that would allow opening password protected diagrams. Of course they don't just as there is nobody out there who admits openly to have broken the password protection yet. Bottomline: If the security of your diagram is life threatening to you, don't distribute it, password protected or not. LabVIEW can get at the diagram and so could a sufficiently determined hacker. It's not easy but certainly not impossible. Is it safe enough to prevent usual theft? Yes I believe so! But then I have not used the password feature at all so far and don't feel it useful for the work I do, and I have even released quite a bit of code as open source, so maybe I'm just not paranoid enough to care about the password protection of LabVIEW diagrams .
  16. It's no help I know but this has been an issue as long as LabVIEW has had the Run method (and even before VI server when there was a CIN based VI library to do some simple VI Server like things, around LabVIEW 4).
  17. Please not that this is not exactly a cheap way of determining an array size. The value extraction will create a copy of the array, potentially using quite some memory and also costing performance to do the copy. No problem if your array contains only a few 100 elements but definitely something to think of with an array that could contain 1 million values.
  18. Well, it is unfortunate but not really a problem. If the VI needed recompiling at all, it already is recompiled when opening its reference and if it didn't need, well then why to try to force it anyways? Well and that is where you go wrong. What you propose is no different than removing the diagram code altogether. There LabVIEW can't recompile the diagram on load anymore since it isn;t there so loading a VI into a LabVIEW system that is not the same version or platform breaks the whole hierarchy. With password protection the diagram is still there and LabVIEW can access it for recompilation when necessary. It simply won't let anyone open the diagram to look at the code. Is it absolutely safe? Of course not, the only way to be 100% safe is not to distribute the diagram at all in any way and even better yet not distributing the VI at all since theoretically anyone with enough time at hand can go and try to find the compiled code, analyze that and reverse engineer the original diagram. The only safety here is that locating that compiled code and reverse engineering it is a lot more complicated and time consuming than doing the same with a normally compiled C/C++ program.
  19. No my library wouldn't really help with that although it could probably add such a poll feature somehow. The library really is meant to make use of SSL and other TCP/IP socket functionality almost as simply as the original TCP nodes do. For IPv6 that is already mostly there, ping also with the additional limit of the required administrative rights, that is basically impossible to avoid on most modern OSes. SSL is another issue. SSL supports a lot of different kinds of operations and parameters that all need to be somehow supported. However most of them are obscure, with no examples at all and often seldom used. So for the time being the library supports opening SSL sockets with default settings, but not yet custom certificates and other stuff such as authentication since that requires a way to enter parameters when creating the socket. I have some ideas how to allow doing that but that requires quite some infrastructure and then the chances that anybody is going to use it are still very small. My library doesn't currently support accessing native TCP refnums other than a somewhat hidden feature with separate Get and Set Attribute VIs that can access any of the supported socket attributes also on native TCP and UDP refnums. Unfortunately there is no way of supporting that through the publicly exposed property nodes itself but only through the special VIs, which is not as convenient as the property nodes. Just one more comment. The error handling with WSAGetLastError() is probably never gonna return a meaningful error. (WSA)GetLastError() retrieves a thread local storage value set previously by another function. That assumes that the previous function and GetLastError() are called in the same thread and without any other function in between that could set that value. Since the CLN's are set to execute in any thread this is absolutely impossible to guarantee and in my experience actually almost never happens either. Not even setting both CLNs to execute in the UI execution system would be able to guarantee proper operation, since theoretically there could still execute another call to an API that influences this value, between when LabVIEW calls the recv() function and when it eventually calls the WSAGetLastError(). The only way to guarantee that this is working properly is by locating both calls in an external call library in one single function and call that through a CLN.
  20. Ohh dear a sourceforge project! Well I simply assumed that someone resorting to API export applications for a DLL would certainly not do that for an open source library. Talk about hiring an expensive detective to find out about "secrets" that are in the public domain!!!
  21. Password protected VIs definitely get recompiled on load when they are not in the current LabVIEW version. I'm also not understanding why Open VI Reference should fail to return a VI reference for a password protected VI when you don't provide a password. The password really only is required to make the diagram visible, so the Open BD method and some other operations are all that should fail on such a VI reference, but not the Open VI Reference itself. Have you tried to play with the flags parameter to Open VI Reference? And jgcode can you enlighten me what would be the security issue with allowing to get a VI reference on a password protected VI and being able to execute the Compile method on that? I totally fail to see any security issue with that.
  22. Not being able to look into the XNode I can't really say much about it. But it most likely doesn't just call MoveBlock() only but probably does some other things too, that are not strictly necessary in all situations. Not knowing the exact circumstances it is called in it may do so just to error on the safe side. It's definitely more complex than just calling two LabVIEW manager functions, and possibly XNodes also are limited in the way they are executed. Wouldn't surprise me if XNodes always executed in the single threaded UI Execution system, and that could be a major performance killer.
  23. We can't help you with this. Without documentation for a particular function it's not possible to deduce its parameter list other than by trial and error and disassembling the function in question. Disassembling code is however in some jurisdiction a crime punishable to quite some extend, and it also doesn't guarantee that you find out everything about the possible parameters either. So go and find the creator of that component and get better documentation from them. Failing that, look for a different component that is better documented. Sorry for the sad news but that is how this works and I can't perform magic.
  24. Well if you find a different way to determine the length of a null terminated C string you are definitely a lot smarter than all the C cracks who have worked on the various standard C runtime libraries when implementing strlen(). MoveBlock() operates on a byte array only. There is no way it can determine the length of the source buffer at all. While it could be a typical C string it does not know about that. It's simply a char[] buffer, but char in C does not mean null terminated string at all, it's just the name for a byte sized integer. If you know that you have a null terminated string buffer you could do something like this instead: LStrHandle target = NULL; int len = StrLen(buffer); MgErr err = NumericArrayResize(uB, 1, (UHandle)&target, len); MoveBlock(buffer, LStrBuf(*target), len); LStrLen(*target) = len; This is as fast as it gets and I'm sure the XNode adds some complications to it, since it works for different parameter types too. Another LabVIEW manager call that does this more or less in one call would be: LStrHandle target = DSNewHdlClr(4); LStrPrintf(target, "%s", buffer); Since this incures an extra call to the memory manager function DSSetHandleSize() inside LStrPrintf() it is likely slower than the previous solution.
×
×
  • Create New...

Important Information

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