Jump to content

Darin

Members
  • Content Count

    268
  • Joined

  • Last visited

  • Days Won

    35

Everything posted by Darin

  1. I should have seen from the original post that you are using the wrong function. The function you described takes an existing share (mapped network drive for example) and resolves the mapping (server name from mapped drive letter, for example). You are looking for the URI for a local file, there is a simple .NET function to do that.
  2. Well, there is a lot that could go wrong and not a lot of info to go on. If not working = crash, then I would check the calling convention. Windows API calls not-surprisingly use the WINAPI setting which is very easy to overlook. If not working = non-zero return value then you have to follow the links for system errors, mostly make sure that you are using a valid path from a mapped network drive. Other than that this function should work for you. It is similar to many other Windows API functions. The buffer upon return will have 1 or 3 pointers (these will be U32 or U64 depending on the dll bitness) after the pointers will come the 1 or 3 C strings. If you try to simply return a C string (with some min length of say 1024), you will either get a buffer with some random bytes (the addresses) followed by the string you want, or about 1% of the time, the buffer address you pass in will have a zero in it and you will get just a couple of bytes and no string. In this case you could simply retry and you'll get a different address that probably works. To be totally safe you can use the vi.lib functions to create a buffer with sufficient length (DSNewPtr), and then use GetValueByXNode to dereference a cluster with a single U32 or U64 (depends on dll bitness) and a string (for infoLevel=1) or 3 U32s/U64s and a string (for infoLevel=2). In this case the buffer parameter is simply passed as a pointer sized integer. About all the help I can offer at the moment with no idea what the real failure mode is, and no LV around to show you an example.
  3. Start with a control in your template. Get a reference to that control and cast it to VIRefNum. Then call the 'Make Strict Reference' method using a VI reference to the desired VI. Finally, get the Terminal reference of the VIRefNum and invoke the method 'Change to Constant'. The constant winds up in a different location, if you are OCD like I am then read the position of the control terminal before and write that position to the constant after. It is pretty common to have more scripting versatility with a control or indicator than the corresponding constant.
  4. Holy blast from the past, but back in the day I did create a pure G implementation of a limited subset of ZMTP. Basically I implemented what I needed for REQ/REP and PUB/SUB peers over TCP and some other low-hanging fruit. A few MUSTs and several SHALLs in the RFC were ignored along the way to suit my needs (mostly self-educational). It was strictly version 2.0, no dealing with v1.0 peers (plus it is now at least v4.0). Looking back I will just say that I was not lazy, I was guarding against downgrade attacks.... These days I use 0MQ a lot, but mostly over inter-process connections which requires platform-specific bits so pure-G is out, and at that point I strongly suggest just wrapping libzmq (actually if pressed I would suggest wrapping it in all cases). I do not say this about very many libraries, but this one has been a pleasure to work with across several platforms with many different language bindings. In my use cases I have not run into any problems with my wrappers
  5. If all you are doing is querying a DB you may not notice that you are implicitly inside a transaction. To make changes that are available outside the current session you need to explicitly commit.
  6. As the parent of an autistic child I would be delighted if you could find a different pejorative to use in these situations. Thanks.
  7. My idea is dead in the water because it requires real effort on the part of NI. The good news for your idea is that it probably would make a nice addition to the right-click menu in LV15+
  8. LV15 seems to behave itself. At any rate I would think it is a feature to be able to probe there.
  9. Darin

    VI macros?

    I have managed to do a few cool things with these, and I have also managed to crash LV twice. YMMV
  10. The start case needs the same check to add 1 when the for loop ends without finding whitespace.
  11. Here is an interaction I have had on more than a few occasions: A: I have a random TCP problem Me: Sounds like a Nagle's Algorithm issue. A: I'll try that....Nope disabling Nagle did not help. Me: Sounds like a Nagle's Algorithm issue. A: I tried again, does not look like a problem with Nagle Me: That's odd. Let me know what you find out.... <Time passes> A: Turns out I screwed up, it was actually a Nagle's Algorithm issue. What I am saying is that this sounds like a textbook case of Nagle's algorithm. Until I was really, really sure, I would not look for something besides Nagle to explain the issue, I would look for the reason why it is not being disabled everywhere like you think it should be. One time I even started appending random garbage to the end of every message that was not of a given length.
  12. I'll take the "rube" that properly handles 'NaN' six days a week and twice on Sunday...
  13. Typically I would use a regex to validate a number, for a decimal number you could use ^[+-]?[0-9]+$ with Match Pattern to perform validation. In this case you could also verify that the remaining string is empty when you use Scan from String.
  14. I may or may not have an opinion about 'pipes' being appropriately used in this case, but that is beside the point. If the object is a "pipe with one element" than it is a pipe and that is what it should be called. In the documentation you can create an acronym or initialization or abbreviation, but that is what I think it should be instead of a new name. You define it the first time you use it (or perhaps the first time in each section if you want) and then use the shorthand version. For example, a single element queue is a queue, it does not need a new name. If you get tired of writing it then simply write a single element queue (SEQ) and carry on. A single element pipe (SEP) is one option. I'd rather describe it as a blocking pipe or non-blocking pipe, or as the choice whether or not to enable spooling or buffering on the pipe.
  15. I am running LV12 at the moment so I can not see your VI, but you described it well enough I think. I would suggest a keyed sort of your ItemNames. Use a loop to bundle the item name and its current index into a cluster array (in that order). Sort this cluster array. Create a single cluster consisting of the new name and its old index (the listbox value I presume) and search for this element inside the sorted cluster array. Use the index of the match as the new value of your listbox and update the item names with the sorted strings. For the size of arrays likely to occur in a typical listbox I would sort the strings separately instead of trying to unbundle in a loop.
  16. I prefer the windows shell function to the command line call myself, but Windows is easy either way. Linux is simple, once you know the default file browser (Nautilus, Dolphin, ....). This is easily found by querying xdg-mime. Then it is a simple system exec call to launch the file browser. Mac requires Applescript. Simply use system exec and the osascript command to tell Finder to select the file. In LV14 you may even be able to skip system exec and use the call Applescript function.
  17. From squinting on my iPhone I can tell that your constant '2' should be sqrt(2). Looks good otherwise.
  18. I can make sense of most of the ads I am hit with around here (LV training, hardware and the like). This one has me a little puzzled: Based on my experience at many Chinese restaurants, I could save people $500 and tell them the outlook is not so good.... I am tempted to click, but a bit afraid of the resulting ads. Reminded me of this: http://www.wsj.com/articles/SB1038261936872356908?mobile=y Update: I clicked and now I have tears in my eyes from reading the reviews, you know something is up when there are 132 of them. I can not decide what is funnier though, the joke reviews or the reviewers who do not get the jokes. And my guess is that somehow the ad was chosen based on the name of the MSoft email program which must have cropped up somewhere..... And for more good Amazon reviews I suggest the RAND book of random digits. I am waiting for the audio book read by Betty White....
  19. I have been doing this as long as I can remember using a combination of SyncToy and DropBox. Works great once the tasks are configured in SyncToy. I have various tasks configured, settings, work in progress code, all reuse code. As an added bonus, it functions as a touch-free backup/SCC/package manager safety net which lets me work away worry free on code which is not suitable or ready for the SCC lockdown. And it is just as easy to sync to a USB stick as it is DropBox so I am never without an up-to-date configuration. A few bummers, certain absolute paths and screen coordinate settings can be irritating when copied from machine to machine. Less of an issue for the VM applications. Second, there is no "merge" operation here, so you have to be diligent about keeping things serialized. Again, for my workflow it is more about being able to go from machine to machine and keep working, and not about bouncing around between machines and trying to keep them in sync.
  20. Put an Equals? comparison and you will see that it is in fact a bit-for-bit replica of the input. Right-click your 50.01 constant, select Display Format and up the number of SigDigits to 17-18 and compare. 50.01 simply does not have an exact DBL representation.
  21. Right-click the Table Indicator and 'Create Constant'. What you will notice is that the data type of the Table is a 2-D array of strings and you are creating a 1-D array. Add one more build array and it will work (right-click the broken wire and it will even give you the option to insert Build Array). Transpose the array as desired.
  22. I do not trust individual benchmarks of two operations in parallel. Especially when RT gets involved. Try serializing the two functions and see what the timing difference is then.
  23. Try with a four digit year instead '%Y'. Just a guess.
  24. I have not found much that goes wrong by relating the position to the endpoint. The only tricky thing to remember is that one endpoint can have more than one terminal. Of course I have tried for years to convince people that no purpose is served by allowing terminals, tunnels and the like to be overlapping but I am basically alone on that one. Basically I have stopped sharing scripting code because I get tired of having to check for these kind of special cases that complicate and obfuscate my code. I prefer to keep it for personal use only and then I know that most of these corner cases are ruled out.
×
×
  • Create New...

Important Information

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