As many of you already know, LabVIEW supports an ActiveX server interface to control the LabVIEW environment. You can load and run VIs, get and set properties, etc.
Also, .NET can automatically create a COM Interop assembly for any COM class that has a type library (which LabVIEW does). The problem is that some of the method and property signatures for LabVIEW don't translate correctly - and you're left with doing strange casts, such as are shown in this example.
So, as an exercise, I modified the automatically generated interop assembly for LabVIEW 7.1 to expose the correct APIs. If you are interested in trying it out, shoot me an email at email@example.com. I'm not posting it up yet as I haven't had a chance to really verify it except for some simple tests. Also, if you are interested in the same thing for a different version of LabVIEW, let me know that also.
In case you are curious, here is what I updated...
A, hopefully, final word on ArrayLists, collections, etc. As I mentioned earlier, the .NET framework comes with several types of collections in the System.Collections and System.Collections.Specialized namespaces. But if you love getting the best data structure for your .NET code, you should check out the open source effort by Wintellect called Power Collections for .NET.
Do note that this requires the .NET 2.0 framework to run, so if you want to use it and are running LabVIEW 7.1, please contact me about the patch.
So, in the previous post, we saw the difference between the AraryList and the array. The question is, "How do I convert an ArrayList into a LV array" - and quickly. It is reasonable to just iterate through the ArrayList and build up a LV array manually, if there are only a few elements in the list. But what if there are 1,000? 10,000? etc. etc.
I've created a LabVIEW 7.1 VI that shows how to do this. The first section is an artifact necessary to create an ArrayList with some data in it - you can ignore it since you should already have your ArrayList. But the next two sections show how to convert the ArrayList into an instance of an Array class, and then convert the Array class to a LV array.
I've gotten this question a few times, so I thought it would make a good post. There's some confusion over the concept of an array versus an ArrayList class, and how to convert both into a LabVIEW array. So, let's start with what each actually is.
Sorry that I haven't been posting much, but I'm streched more than I would have thought. The PDC has been great this year, and between sessions, discussions, keeping up with work emails and sleep, there hasn't been much time.
But the good news is that you can get the raw information yourself now. Simply go here to get the information on the sessions and then go here to download the slide decks for the sessions you're interested in.
One presentation I found very exciting yesterday was on the new Monad technology. Although it isn't quite correct to say this, it is the easiest to understand - Monad is the replacement for the Windows command line interface, or shell. In truth, the Monad engine is hosted by a command line window (MSH) and can be hosted in other systems (as it is in the new MMC system), but most people see Monad and the shell as one. We'll stick with that for now.
It can be hard to fully understand the power behind Monad - I've seen it before but it wasn't until the presentation that I really began to understand the power of this thing.
The simple description is that Monad allows command line access to the .NET framework and other .NET libraries. If you have ever created or used command line interfaces (ls, cat, grep, etc.) before to create scripts, you've probably experienced the pain of trying to parse the text output of one tool correctly to feed it into the next tool (usually lots of perl and regex). Monad eliminates this because the output of any command is an object - and thus "piping" the output of one command into the next is really just handing objects around. The efficiency and reliability improvement is profound.
You can begin to imagine the ability to interact with just about any system on Windows via the command line, with standardized parsing, documentation and response.
On the developer side, this is also a major win. I've spent most of my career creating APIs for different things (devices, server applications, etc). But once you have the API, you still need to go off and create an executable that can take command line arguments to pass parameters and select methods. This means creating your own parser for APIs over and over again. I've heard Unix command tools described as an example of a thousand crappy parsers. It isn't far from the truth (although the tools themselves are quite good).
By creating small wrappers around your .NET API (called Cmdlets) you can expose your API in a nice OO manner and all parser work is handled centrally by Monad. This should really lower the bar for more software to provide command line interfaces. And once that happens, the users are empowered because they can now interactively work with the software to "try things out", as well as create scripts to automate common tasks, such as deployments, configuration, diagnostics, etc.
So, what do you wish you could do with NI products and a command line/script interface? Let me hear from you.
I was just thinking about yesterday's keynote and I realized that something very important was missing this year - Red vs. Blue!
For those that don't know about this great series, Red vs. Blue is an example of machinima - the technique of using existing video engines to create movies/shorts. In this case, the Rooster Teeth guys use the XBox and the game Halo to provide the visual portion, while doing voice overs for the story. If you haven't seen it, I strongly recommend it...very funny.
Anyway, last year Rooster Teeth created a special episode of Red vs. Blue for the PDC that was shown before Bill Gates came on. This year, there was more of a motivational, marketing montage instead. Just not the same...*sigh*. I'll have to file a complaint!
If you had not heard, Los Angeles experienced a blackout yesterday when, and I am not kidding, the wrong wire was cut. This resulted in an amazing example of bad luck as a series of failures took place like dominos falling and causes large parts of LA to lose power.
(paraphrased) "I have often said that the software industry must be as reliable as the power utilities. But I meant that we should be more like them, not that they should be more like the software industry"
That had the room rolling! But for the most part, I think we spent the rest of his talk and the resulting demos quite impressed. I'll cover some of the highlights here, but you should check it out for yourself. In fact, you can find a lot of information about today here as well.