Array output question

Hello,
I'm trying to get this foreach to output to HTML.
What I need help with is how to make this report output the array data.
$MyCollection = @()
$arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
foreach ($cluster in Get-Cluster) {
    Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
  @{n="VM name"; e={$_.Name}},
        @{n="Cluster"; e={$cluster.name}},
  #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
        @{n="Guest OS"; e={$_.Config.GuestFullName}},
        @{n="Notes"; e={$_.Summary.Config.Annotation}},
        ## just using the data already retrieved; far faster
        @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
  $MyCollection += $viewThisVM
} ## end foreach
$MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
Invoke-Expression C:\temp\test.htm
Here is what I know how to do, but need help with the array part, everything else is working great.
#Sample Code
Get-Service | Select-Object Status, Name, DisplayName | ConvertTo-HTML | Out-File C:\Scripts\Test.htm
Invoke-Expression C:\Scripts\Test.htm
Thanks,
-Mike

Hi sneddo,
That is the complete script.
$MyCollection = @()
$arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
foreach ($cluster in Get-Cluster) {
    Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
  @{n="VM name"; e={$_.Name}},
        @{n="Cluster"; e={$cluster.name}},
  #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
        @{n="Guest OS"; e={$_.Config.GuestFullName}},
        @{n="Notes"; e={$_.Summary.Config.Annotation}},
        ## just using the data already retrieved; far faster
        @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
  $MyCollection += $viewThisVM # we can delete this line, I was testing here.
} ## end foreach
$MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
If you test this part in your lab it works great.
$arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
foreach ($cluster in Get-Cluster) {
    Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
  @{n="VM name"; e={$_.Name}},
        @{n="Cluster"; e={$cluster.name}},
  #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
        @{n="Guest OS"; e={$_.Config.GuestFullName}},
        @{n="Notes"; e={$_.Summary.Config.Annotation}},
        ## just using the data already retrieved; far faster
        @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
} ## end foreach
I just need this part to export to a HTML Web Page.
Thanks,

Similar Messages

  • How do I get an array output on a Formula Node?

    My problem is simply that I cannot figure out how to get an output on a Formula Node to be an array. Documentation states that "you must declare local arrays and output arrays in the Formula Node" but doesn't say anything more than than. Attempts to put something like "float32 out[100];" for an array output called "out" fail.
    If anybody knows how you can do this or even knows if it is possible I would appriciate your help.
    Thanks,
    Naveen

    I found a typo in the formula node I was doing that was making the output not be an array. I don't think I was getting the error before but I was going to put together an example VI to attach here and I found it. So, thanks for your help even tho it was a stupid little mistake on my part.

  • New to Graphics, trying to display array output in a single window

    I am trying to figure out how to use the GUI components of JAVA.
    What I am trying to do is take my packaged array output and list it in a single window. All that ever prints is last array data set. The last keeps overwritting the previous. How do I keep the previous data shown while listing the next in the array?
    Below are my three classes. The Frame Class is the class containing the display method. It is called near the bottom of the Product Class.
    Product.java
    // Inventory Program Part 4
    /* This program will store multiple entries
    for office supplies, give the inventory value,
    sort the data by Product Name,
    and output the results using a GUI */
    import javax.swing.text.JTextComponent;
    import javax.swing.JLabel;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JOptionPane; //Uses class JOptionPane
    import java.util.Scanner; //Uses class Scanner
    import java.util.Arrays; //Uses class Arrays
    public class Product
         private String productBrand[]; // Declares the array
         public void setProductBrand( String brand[] ) // Declare setProductBrand method
              productBrand = brand; // stores the productbrand
         } // End setProductBrand method
         public String getProductBrand( int counter )  // Declares getProductBrand method
              return productBrand[ counter ]; // Returns data using counter to define the element
         } // End method getProductBrand
         public double restockingFee( double value ) // Declares restocking Fee method
              double fee = 0; // Declares variable fee
              fee = value * 0.05; // Calculates the sum of values
              return fee;  // Returns the restocking fee
         } // End method restockingFee     
         public String inventoryValue( double value[] , int number, String name[] ) // Declares inventoryValue method
              OfficeSupplies myOfficeSupplies = new OfficeSupplies();  //Creates OfficeSupplies Object
              Product myProduct = new Product();
              double total = 0; // Declares variable total
              for ( int counter = 0; counter < number ; counter++ )
                   total += ( value[ counter ] + myProduct.restockingFee( value[ counter ] ) ); // Calculates the sum of values
                        return String.format( "%s$%.2f", "Total Inventory Value: " , total );  // Returns the total value
         } // End method inventoryValue
         // main method begins execution
         public static void main( String args[] )
              Scanner input = new Scanner( System.in ); //Creates Scanner object to input from command window
              Product myProduct = new Product(); //Creates Product object
              OfficeSupplies myOfficeSupplies = new OfficeSupplies();  //Creates OfficeSupplies Object          
              //Prompt for maxNumber using JOptionPane
              String stringMaxNumber =
                   JOptionPane.showInputDialog( "Enter the number of products you wish to enter" );
              int maxNumber = Integer.parseInt( stringMaxNumber );     
              String prodName[] = new String[ maxNumber ]; // Declares prodName array
              int numberUnits[] = new int[ maxNumber ]; // Declares maxNumber array          
              float unitPrice[] = new float[ maxNumber ]; // Declares unitPrice array
              double value[] = new double[ maxNumber ]; // Declares value array
              String brand[] = new String [ maxNumber ]; // Declares brand array
              String stringNumberUnits[] = new String [ maxNumber]; // Declares array
              String stringUnitPrice[] = new String [ maxNumber ]; // Declares array
              int productNumber[] = new int[ maxNumber ]; // Declares array
              for ( int counter = 0; counter < maxNumber; counter++ ) // For loop for the number of products to enter
                   productNumber[ counter ] = counter;
                   myOfficeSupplies.setProductNumber( productNumber ); // Sends the Product name to method setProductNumber                         
                   //Prompt for product name using JOptionPane
                   prodName[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Product Name" );
                   myOfficeSupplies.setProductName( prodName ); // Sends the Product name to method setProductName
                   //Prompt for brand name using JOptionPane
                   brand[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Brand name of the Product" );
                   myProduct.setProductBrand( brand ); // Sends the Brand name to method setProductBrand
                   //Prompt for number of units using JOptionPane
                   stringNumberUnits[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Number of Units" );
                   numberUnits[ counter ] = Integer.parseInt( stringNumberUnits[ counter ] );
                   myOfficeSupplies.setNumberUnits( numberUnits ); // Sends the Number Units to the method setNumberUnits
                   //Prompt for unit price using JOptionPane
                   stringUnitPrice[ counter ] =
                        JOptionPane.showInputDialog( "Enter the Unit Price" );
                   unitPrice[ counter ] = Float.parseFloat( stringUnitPrice[ counter ]);
                   myOfficeSupplies.setUnitPrice( unitPrice ); // Sends the Unit Price to the method setUnitPrice
                   value[ counter ] = numberUnits[ counter ] * unitPrice[ counter ]; // Calculates value for each item
                   myOfficeSupplies.setProductValue( value ); // Sends the product value to the method setProductValue
              Arrays.sort( prodName, String.CASE_INSENSITIVE_ORDER ); // Calls method sort from Class Arrays
                   Frame myFrame = new Frame();
                   myFrame.displayData( myProduct, myOfficeSupplies, maxNumber );
              // Outputs Total Inventory Value using a message dialog box
              JOptionPane.showMessageDialog( null, myProduct.inventoryValue( value, maxNumber, prodName ),
                   "Total Inventory Value", JOptionPane.PLAIN_MESSAGE );
         } // End method main
    } // end class ProductOfficeSupplies.java ----> This is the data container
    // Inventory Program Part 4
    /* Stores the array values */
    public class OfficeSupplies // Declaration for class Payroll
         private int productNumber[];
         public void setProductNumber( int number[] ) // Declare setProductNumber method
              productNumber = number; // stores the product number
         } // End setProductNumber method
         public int getProductNumber( int counter )  // Declares getProductNumber method
              return productNumber[ counter ];
         } // End method getProductNumber
         private String productName[];
         public void setProductName( String name[] ) // Declare setProductName method
              productName = name; // stores the Product name
         } // End setProductName method
         public String getProductName( int counter )  // Declares getProductName method
              return productName[ counter ];
         } // End method getProductName
         private int numberUnits[];
         public void setNumberUnits( int units[] ) // Declare setNumberUnits method
              numberUnits = units; // stores the number of units
         } // End setNumberUnits method
         public int getNumberUnits( int counter )  // Declares getNumberUnits method
              return numberUnits[ counter ];
         } // End method getNumberUnits
         private float unitPrice[];
         public void setUnitPrice( float price[] ) // Declare setUnitPrice method
              unitPrice = price; // stores the unit price
         } // End setUnitPrice method
         public float getUnitPrice( int counter )  // Declares getUnitPrice method
              return unitPrice [ counter ];
         } // End method getUnitPrice
         private double productValue[];
         public void setProductValue( double value[] ) // Declare setProductValue method
              productValue = value; // stores the product value
         } // End setProductValue method
         public double getProductValue( int counter )  // Declares getProductValue method
              return productValue[ counter ];
         } // End method getProductValue
    } // end class OfficeSuppliesFrame.java ------> Contains the display method
    import java.awt.Color;
    import javax.swing.text.JTextComponent;
    import javax.swing.JLabel;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JOptionPane; //Uses class JOptionPane
    public class Frame extends JFrame
         public Frame() //Method declaration
              super( "Products" );
         } // end frame constructor
         public void displayData( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
              //Here I attempted to use an array to output all of the array data in a single window
    //          JTextArea myTextArea[] = new JTextArea[ maxNumber ]; // Declares myTextArea array to display output
              JTextArea myTextArea = new JTextArea(); // textarea to display output
              // For loop to display data array in a single Window
              for ( int counter = 0; counter < maxNumber; counter++ )  // Loop for displaying each product
    //               myTextArea[ counter ].setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
    //                add( myTextArea[ counter ] ); // add textarea to JFrame
                   myTextArea.setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
                   add( myTextArea ); // add textarea to JFrame
              } // End For Loop
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              setSize( 450, maxNumber*400 ); // set frame size
              setVisible( true ); // display frame
         public String packageData( Product myProduct, OfficeSupplies myOfficeSupplies, int counter ) // Method for formatting output
              return String.format( "%s: %d\n%s: %s\n%s: %s\n%s: %s\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f",
              "Product Number", myOfficeSupplies.getProductNumber( counter ),
              "Product Name", myOfficeSupplies.getProductName( counter ),
              "Product Brand",myProduct.getProductBrand( counter ),
              "Number of Units in stock", myOfficeSupplies.getNumberUnits( counter ),
              "Price per Unit", myOfficeSupplies.getUnitPrice( counter ),
              "Total Value of Item in Stock is", myOfficeSupplies.getProductValue( counter ),
              "Restock charge this product is", myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ),
              "Total Value of Inventory plus restocking fee", myOfficeSupplies.getProductValue( counter )+
                   myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ) );
         } // end method packageData
    }

    Lets pretend that your assignment was to manage a list of employees of a store, and that each employee is identified by their name, position, and hourly wage. If you created a program along the lines of your current product program, I picture you creating three separate ArrayLists (or arrays), one for each variable, something like this:
    import java.util.ArrayList;
    public class MyEmployees1
        private ArrayList<String> names = new ArrayList<String>();
        private ArrayList<String> positions = new ArrayList<String>();
        private ArrayList<Double> hourlyWages = new ArrayList<Double>();
        public void add(String name, String position, double wage)
            names.add(name);
            positions.add( position);
            hourlyWages.add(wage);
        public void removed()
            // TODO: I am nervous about trying to manage this!
        //.......... more
    }This program tries to manage three separate parallel arrays (arraylists actually). They are parallel because the 3rd item in the names list corresponds to the 3rd item in the positions list and also the hourlywages list. If I wanted to delete data, I'd have to be very careful to delete the correct item in all three lists. If I tried to sort one list, I'd have to sort the other two in exactly the same way. It is extremely easy to mess this sort of program up.
    Now lets look at a different approach. Say we created a MyEmployee class that contains the employee's name, position, and wage, along with the appropriate constructors, getters, setters, toString method, etc... something like so:
    import java.text.NumberFormat;
    public class MyEmployee
        private String name;
        private String position;
        private double hourlyWage;
        public MyEmployee(String name, String position, double hourlyWage)
            this.name = name;
            this.position = position;
            this.hourlyWage = hourlyWage;
        public String getName()
            return name;
        public String getPosition()
            return position;
        public double getHourlyWage()
            return hourlyWage;
        public String toString()
            // don't worry about these methods here.  They're just to make the output look nice
            NumberFormat currency = NumberFormat.getCurrencyInstance();
            return String.format("Name: %-15s    Position: %-15s    Wage: %s",
                    name, position, currency.format(hourlyWage));
    }Now I can create a MyEmployees2 class that holds a single list of MyEmployee objects, like so:
    import java.util.ArrayList;
    public class MyEmployees2
        private ArrayList<MyEmployee> employeeList = new ArrayList<MyEmployee>();
        public boolean add(MyEmployee employee)
            return employeeList.add(employee);
        public boolean remove(MyEmployee employee)
            return employeeList.remove(employee);
        public void display()
            for (MyEmployee employee : employeeList)
                System.out.println(employee);
        public static void main(String[] args)
            MyEmployees2 empl2 = new MyEmployees2();
            empl2.add(new MyEmployee("John Smith", "Salesman", 20));
            empl2.add(new MyEmployee("Jane Smyth", "Salesman", 25));
            empl2.add(new MyEmployee("Fred Flinstone", "Janitor", 15));
            empl2.add(new MyEmployee("Barney Rubble", "Supervisor", 35));
            empl2.add(new MyEmployee("Mr. Spacely", "The Big Boss", 45));
            empl2.display();
    }Now if I want to add an Employee, I only add to one list. Same if I want to remove, only one list, and of course, the same for sorting. It is much safer and easier to do things this way. Make sense?

  • Array output from formula node with input variable as array size

    Hi,
    I have created a formula node with an array output called al, but I get an error "you have connected a scalar type to an array with that type".
    I declare the output as follows..
    float64 al[len_as];
    where len_as is an scalar input to the formula node.
    It only works when I put a number as.
    float64 al[5];
    ,but I don't know beforehand how many elements I need, so I cannot use this.
    Please help! This is so stupid.
    Thanks

    Don't define your array in your formula node.
    Initialize the array as the size you want and pass it in as an input into the formula node.
    Are you sure you even need to use a formula node?  Can you implement your formula using all native LabVIEW functions?
    Message Edited by Ravens Fan on 10-07-2009 11:51 PM
    Attachments:
    Example_VI_BD.png ‏3 KB

  • Array output from formula node

    How to get an array output from the formula node.I am trying to use a for loop inside the formula node and want an array output.

    You cannot place a For or While Loop inside the formula node.
    Here is what the Help Description says about the syntax inside the Formula Node:
    Formula Node
    Evaluates mathematical formulas and expressions similar to C on the block diagram. The following built-in functions are allowed in formulas: abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, cot, csc, exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2, max, min, mod, pow, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt, tan, tanh. There are some differences between the parser in the Mathematics VIs and the Formula Node.
     Place on the block diagram
     Find on the Functions palette
    Refer to Creating Formula Nodes and Formula Node Syntax for more information about the Formula Node and the Formula Node syntax.
    Note  The Formula Node accepts only the period (.) as a decimal separator. The node does not recognize localized decimal separators.
    <SCRIPT type=text/javascript>if (typeof(writeVarRefs)=="function"){writeVarRefs("763");}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvrthelp763) != "undefined"){document.writeln(lvrthelp763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvfpga763) != "undefined"){document.writeln(lvfpga763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvemb763) != "undefined"){document.writeln(lvemb763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvpdahelp763) != "undefined"){document.writeln(lvpdahelp763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvtpchelp763) != "undefined"){document.writeln(lvtpchelp763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvblackfin763) != "undefined"){document.writeln(lvblackfin763)}</SCRIPT>
    <SCRIPT type=text/javascript> if(typeof(lvdsp763) != "undefined"){document.writeln(lvdsp763)}</SCRIPT>
    Example
    Refer to the Create Function with Formula Node VI in the labview\examples\general\structs.llb for an example of using the Formula Node.

  • Variable size array output from dynamic dispatch class method on FPGA

    I have a Parent class on the FPGA that will serve as a template/framework for future code that will be developed. I had planned on creating a child class and overriding a couple methods. The child class constant would be dropped on the block diagram so the compiler wouldn't have any trouble figuring out which method (parent's or child's) should be used (i.e. the parent's method will never actually be used and won't be compiled with the main code). The output of one of the methods is an array. This array will have a different size depending on the application. I defined the array size as variable. In the child method, there is no question about the size of the array so the compiler should be able to figure it out. However, when I try to compile, I get an error about the array size. I can't figure out any way around it. Any thought would be greatly appreciated! 
    Thanks, Patrick
    Solved!
    Go to Solution.
    Attachments:
    FPGA Test.zip ‏1194 KB

    Wait what?
    Can we use dynamic dispatch VIs on FPGA?  Really?  I was completely unaware of this.  Obviously the dependencies need to be constant and known at compile time but...... This would have saved me a lot of headaches in the last few months.
    Since which LV version is this supported?
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • The arrays class question

    consider the code below
    int[] list = {2, 4, 7, 10};
    java.util.Arrays.fill(list, 7);
    java.util.Arrarys.fill(list, 1, 3, 8);
    System.out.print(java,util.Arrays.equals(list, list));i understand line 2, it gonna fill 7 into the array,so the output would be Line 2: list is {7, 7, 7, 7}
    my question is line 3, how come the output would be {7, 8, 8,7} what does 1 and 3 represent in a arrary?
    the line 4 output would be {7, 8,8,7} again why?
    Thank you guys whoever is gonna take to respond me questions

    zerogpm wrote:
    but which 2 lists were comparing ? since i have list list with the same name1) You're not comparing lists, you're comparing arrays.
    2) You're comparing a single array with itself.
    3) Objects, including arrays, do not have names. Classes, variables, and methods have names. Objects do not.

  • Array Cast Question Puzzling me

    The question below puzzles me. The answer states that the result is a class cast exception because o1 is an int [] [] not a int []
    But I thought the point of line 7 is to say "I know it is a 2D array but I want to cast it to a 1D array - I know I am losing precision here".
    Given:
    1. class Dims {
    2. public static void main(String[] args) {
    3. int[][] a = {{1,2,}, {3,4}};
    4. int[] b = (int[]) a[1];
    5. Object o1 = a;
    6. int[][] a2 = (int[][]) o1;
    7. int[] b2 = (int[]) o1;
    8. System.out.println(b[1]);
    9. } }
    What is the result?
    A. 2
    B. 4
    C. An exception is thrown at runtime
    D. Compilation fails due to an error on line 4.
    E. Compilation fails due to an error on line 5.
    F. Compilation fails due to an error on line 6.
    G. Compilation fails due to an error on line 7.
    Answer:
    3 C is correct. A ClassCastException is thrown at line 7 because o1 refers to an int[][]
    not an int[]. If line 7 was removed, the output would be 4.
    &#730; A, B, D, E, F, and G are incorrect based on the above. (Objective 1.3)

    While you could approximate casting a 2D array to a 1D array in C/C++ by just grabbing a pointer to your first array and then overrunning array bounds (relying on how C/C++ allocates 2D arrays and the lack of bounds checking), Java's strong typing and bounds checking makes this impossible.
    If you want to do something similar in Java, you will need to create a new 1D array of the proper size and copy the elements stored in your 2D array into this new array. That being said, a database is almost guaranteed to be a better solution.

  • LabVIEW DLL 2D Array output deallocati​on

    Hey everyone,
    I am using a custom built DLL made with LabVIEW.  One of the functions outputs a 2D array of data by "handle".  I can catch the 2D array from the function just fine from within my C program, however I have a question about deallocating the memory allocated by the LabVIEW DLL for the 2D array.
    I call the DLL function repeatedly in a loop and as this occurs the RAM used on my machine continues to increase until it is full or I exit the program.  There are no other dynamically allocated peices of data within the C program that could be causing this.
    The question is, can I call free() on the 2D array handle safely?  Is this the correct way to deallocate the 2D arrays passed out of LabVIEW DLL functions?  One dimension of the 2D array is always the same size, but the other dimension varies per call.
    Here is an example (I have renamed function calls and library headers due to security reasons):
    #include "DLLHeader.h"
    int main(void)
        ResponseArrayHdl myArray = NULL;
        DLL_FUNC_InitializeLibrary();
        DLL_FUNC_ConfigurePortWithDefaults("COM3");
        DLL_FUNC_StartAutoSend(9999999);
        while(DLL_FUNC_IsTransmitting())
            DLL_FUNC_GetAllAvailableResponseMessagesByHndl(&my​Array);      // gets the 2D array
            // do something with array data here!
            free(myArray);   // is this the appropriate way to clean up the array?
            Delay(0.05);
        DLL_FUNC_GetAllAvailableResponseMessagesByHndl(&my​Array);      // gets the 2D array
        // do something with array data here!
        free(myArray);   // is this the appropriate way to clean up the array?
        DLL_FUNC_ShutdownLibrary();
        return 0;
    from DLLHeader.h:
    typedef struct {
        } ResponseMessage;      // created by the LabVIEW DLL build process
    typedef struct {
        long dimSize;
        ResponseMessage Responses[1];
        } ResponseArray;
    typedef ResponseArray **ResponseArrayHdl;   // created by the LabVIEW DLL build process
    I want to make sure this is an appropriate technique to deallocate that memory, and if not, what is the appropriate way?  I am using LabVIEW 7.1 if that matters.  The C program is just ANSI C and can be compiled with any ANSI C compliant compiler.
    Thanks!
    ~ Jeramy
    CLA, CCVID, Certified Instructor

    Tunde A wrote:
    A relevant function that will be applicable in this case (to free the memory) is the "AZDisposeHandle or DSDisposeHandle". For more information on this function and other memory management functions, checkout the " Using External Code in LabVIEW" reference manual, chapter 6 (Function Description), Memory Management Functions.
    Tunde
    One specific extra info. All variable sized LabVIEW data that can be accessed by the diagram or are passed as native DLL function parameters use always DS handles, except the paths which are stored as AZ handles (But for paths you should use the specific FDisposePath function instead).
    So in your case you would call DSDisposeHandle on the handle returned by the DLL. But if the array itself is of variable sized contents (strings, arrays, paths) you will have to first go through the entire array and dispose its internal handles before disposing the main array too.
    Rolf Kalbermatter
    Message Edited by rolfk on 01-10-2007 10:43 PM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Adding arrays - confusing question

    I am in the process of writing a java program where I have to add arrays. The question asks:
    This program asks you to assume that your computer has the very limited capability of being able to read and write only single-digit integers and to add together two integers consisting of one decimal digit each. Write a program that can read in two integers of up to 40 digits each, add these digits together, and display the result. Test your program using pairs of numbers of varying lengths. You must use arrays in this problem.
    I think I understand up to there is says"Write a program that can read in two integers of up to 40 digits each" from there I am lost.
    Can anyone help explain what is needed?
    This is what i have so far:
    import java.util.*;
    public class add
        public static void main(String[] args)
          Scanner in = new Scanner(System.in);
          int x = in.nextInt();
          int y = in.nextInt();
            int[] a = {x};
            int[] b = {y};
            int[] ab = new int[a.length + b.length];
            System.arraycopy(a, 0, ab, 0, a.length);
            System.arraycopy(b, 0, ab, a.length, b.length);
            System.out.println(Arrays.toString(ab));
    }

    Yeh, sorry about that didn't have the time to go ahead and drag some of the code over when I first found this forum, first thing I tried a quick compile and run just to see what problems I'd get and I got this runtime error of: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7
         at java.lang.String.charAt(String.java:687)
         at Joseph_Ryan_P2.main(Joseph_Ryan_P2.java:36)
    I threw in some print statements to see how far it gets before the error occurs and it seems to be right before the for loop(see code below)
    In this program I'm reading in from a text file that will read two numbers from the same line that are seperated by a space and eventually add them, is the best way to do that by using a tokenizer or some sort of space delimiter? Or is there an easier way? If the tokenizer is best how would i go about that I haven't learned too much about them besides the fact that they exist so far.
    Thanks for any help you or suggestions you guys can give.
    //Joseph_Ryan_P2.java
    //Big Integer Program
    //Description:
    //     Design and implement a BigInteger class that can add and subtract integers with up to 25 digits. Your
    //     class should also include methods for input and output of the numbers.
    // Must Use Arrays
    import java.io.*;               //neccessary imported libraries
    import java.util.*;
    public class Joseph_Ryan_P2          
         public static void main(String[] args)          //the programs main method
              try
                   Scanner scan = new Scanner(new File("BigInts")); //Scanner to read in from plaintext file
              String numline = scan.next();
              int x=0;
              int [] big1 = new int [numline.length()];
              System.out.println(numline);
                   int [] big2 = new int [numline2.length()];
                   String numline2= scan.nextLine();
                   System.out.println(numline2);
              for(int i = numline.length() - 1; i >= 0; i++)
              char current = numline.charAt(i);
              int d = (int) current - (int) '0';
                   big1[i] = d;
              }//end for loop
              }//end try
              catch(FileNotFoundException exception)
    System.out.println("The file could not be found.");
    catch(IOException exception)
    System.out.println(exception);
    } //end catch statements
         }//end main
    }//end class

  • Problem in array output, pls help!

    i made an array:
    public class Estudyante
         String studentNo;
         String studentName;
         String address;
         String phone;
         String email;
         public void displayDetails()
              System.out.println(studentNo);
              System.out.println(studentName);
              System.out.println(address);
              System.out.println(phone);
              System.out.println(email);
    public class StudentFinder
         //define the variables of the class
         Estudyante estObjects[];
         //initialize the variables
         public StudentFinder()
              //creating an array of 3 estudyantes
              estObjects = new Estudyante[3];
              //creating objects of all the three elements in an array
              for(int ctr = 0; ctr !=estObjects.length;ctr++)
                   estObjects[ctr] = new Estudyante();
              //assigning test values
              //estudyante 1 details
              estObjects[0].studentNo = "0001";
              estObjects[0].studentName = "Rez";
              estObjects[0].address = "Pasig";
              estObjects[0].phone = "111-1111";
              estObjects[0].email = "[email protected]";
              //estudyante 2 details
              estObjects[1].studentNo = "0002";
              estObjects[1].studentName = "Reza";
              estObjects[1].address = "Manila";
              estObjects[1].phone = "222-2222";
              estObjects[1].email = "[email protected]";
              //estudyante 3 details
              estObjects[2].studentNo = "0003";
              estObjects[2].studentName = "Reza Ric";
              estObjects[2].address = "Malate";
              estObjects[2].phone = "333-3333";
              estObjects[2].email = "[email protected]";
         //declare the method of the class
         public void displayFinder()
              //add the code for displaying estudyante details
              for (int ctr = 0;ctr != estObjects.length;ctr++)
                   estObjects[ctr].displayDetails();
                   //the displayDetails() method is present in the Estudyante class
         //code the main() method
         public static void main(String args[])
              StudentFinder finderObject;
              finderObject = new StudentFinder();
              finderObject.displayFinder();
    problem:
    when i run this in command prompt, it displays all the 3 sets of details
    question:
    how will i display the set of details i want and not all of them?
    eg: i only want the details of studentNo = "0001"
    so in command prompt i execute
    java StudentFinder 0001
    how will i be able to get the details for studentNo = "0001" only and how will i display "No such student" if the studentNo asked for is not in any of the details.

    Hi KikiMon,
    In your displayFinder() method you'll have to take an argument, specifying which Student to display. Like this:
    public void displayFinder(String target)
    for (int ctr = 0;ctr != estObjects.length;ctr++)
    if(estObjects[ctr].studentNo.equals(target)) {
    estObjects[ctr].displayDetails();
    An in your main you'll have to forward a commandline argument like this:
    public static void main(String args[])
    StudentFinder finderObject;
    finderObject = new StudentFinder();
    finderObject.displayFinder(args[0]);
    Later,
    Klaus

  • 2D array output in a loop

    Hello,
    I need output data (several array string) from FOR-loop to 2D array. I use Replace array subset inside the loop (after array initialize). Output works (I see each step right string in its right place), But each next loop clear all previous strings to 0 0 0 . Finally stay only the last string in result array (see fig). Output to file works perfectly.
    Similarly, no result outside of loop. 
    WHY?
    I'm beginner...
    Solved!
    Go to Solution.

    Hi zazra,
    But outside Out_array 2 and Out_array are empty (grey zero fields). 
    THINK DATAFLOW!
    Those two array indicators stay empty UNTIL the FOR loop finishes!
    How to use out_array 4 - data outside the loop?
    Either finish the FOR loop - or use a local variable (as easiest, but not the only solution)…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Stored procedure, returning array output

    i am new to oracle and stored procedure and i have tried to do this but, still no luck, can anyone help me out?
    my stored procedure & package is as follows;
    create or replace package prebooking
    is
        type tr_contract_data
        is
            record (
                    custcode  customer_all.custcode%TYPE        ,
                    des       rateplan.des%TYPE                 ,
                    dn_num    directory_number.dn_num%TYPE      ,
                    cd_sm_num contr_devices.cd_sm_num%TYPE
        type tt_contract_data
        is
            table of tr_contract_data
            index by binary_integer;
        procedure customer_data (
                                    pc_custcode             in  customer_all.custcode%TYPE,
                                    pc_customer_name        out varchar2                  ,
                                    pc_customer_address_1   out varchar2                  ,
                                    pc_customer_address_2   out varchar2                  ,
                                    pc_user_lastmod         out varchar2
        procedure contract_data (
                                    pc_custcode             in  customer_all.custcode%TYPE,
                                    pt_contract_data        out tt_contract_data
    end prebooking;
    drop public synonym prebooking;
    create public synonym prebooking for prebooking;
    grant execute on prebooking to wpa;
    -- EOF: PREBOOKING.plh
    create or replace package body prebooking
    is
        procedure customer_data (
                                    pc_custcode             in  customer_all.custcode%TYPE,
                                    pc_customer_name        out varchar2                  ,
                                    pc_customer_address_1   out varchar2                  ,
                                    pc_customer_address_2   out varchar2                  ,
                                    pc_user_lastmod         out varchar2
        is
            cursor c_customer_data ( pc_custcode customer_all.custcode%TYPE )
            is
                select ccline1  || ' ' || ccfname || ' ' || cclname         customer_name,
                       ccstreet || ' ' || ccaddr2 || ' '     || ccaddr3 ||
                                   ' ' || cccity  || ' zip ' || cczip   ||
                                   ' ' || ccline4                           customer_address_1,
                       ccstate  || ' ' || ccline6                           customer_address_2,
                       b.user_lastmod                                       user_lastmod
                from ccontact_all a,
                     customer_all b
                where b.customer_id = a.customer_id
                  and a.ccbill = 'X'
                  and b.custcode = pc_custcode;
        begin
            open c_customer_data ( pc_custcode );
            fetch c_customer_data into pc_customer_name     ,
                                       pc_customer_address_1,
                                       pc_customer_address_2,
                                       pc_user_lastmod      ;
            close c_customer_data;
        end customer_data;
        procedure contract_data (
                                    pc_custcode             in  customer_all.custcode%TYPE,
                                    pt_contract_data        out tt_contract_data
        is
            cursor c_contract_date ( pc_custcode customer_all.custcode%TYPE )
            is
                select h.custcode,
                       g.des,
                       e.dn_num,
                       d.cd_sm_num
                from curr_co_status      a,
                     contract_all        b,
                     contr_services_cap  c,
                     contr_devices       d,
                     directory_number    e,
                     rateplan            g,
                     customer_all        h
                where h.customer_id = b.customer_id
                  and b.co_id = a.co_id
                  and b.co_id = c.co_id
                  and b.co_id = d.co_id
                  and c.dn_id = e.dn_id
                  and b.tmcode = g.tmcode
                  and c.cs_deactiv_date is null
                  and h.custcode = pc_custcode;
        begin
            for c in c_contract_date ( pc_custcode )
            loop
                pt_contract_data (nvl (pt_contract_data.last, -1) + 1).custcode  := c.custcode ;
                pt_contract_data (     pt_contract_data.last         ).des       := c.des      ;
                pt_contract_data (     pt_contract_data.last         ).dn_num    := c.dn_num   ;
                pt_contract_data (     pt_contract_data.last         ).cd_sm_num := c.cd_sm_num;
            end loop;
        end contract_data;
    end prebooking;
    -- EOF: PREBOOKING.plhand i am using the following php code to do this
    <?php
      $conn=OCILogon("USER", "USER", "DB");
      if ( ! $conn ) {
         echo "Unable to connect: " . var_dump( OCIError() );
         die();
      $collection_name = 1.1;     
      $stmt = OCIParse($conn,"begin PREBOOKING.CONTRACT_DATA(:INN, :OUTT); end;");
      OCIBindByName($stmt, ":INN", $collection_name, 200);
      //OCIBindByName($stmt, ":", $collection_desc, 100);
      $blobdesc = OCINewDescriptor($conn, OCI_D_LOB);
      OCIBindByName($stmt, ":OUTT", $blobdesc, -1, OCI_B_BLOB);
      $blobdesc->WriteTemporary($binary_junk, OCI_B_BLOB);
      OCIExecute($stmt);
      OCILogoff($conn);
    ?>the error i get when i run this code is;
    Warning: OCI-Lob::writetemporary() [function.writetemporary]: Cannot save a lob that is less than 1 byte in C:\apachefriends\xampp\htdocs\POSP\oci53.php on line 18
    Fatal error: Call to undefined function OCIDefineArrayOfStruct() in C:\apachefriends\xampp\htdocs\POSP\oci53.php on line 19

    Hi Varun,
    To combine the first xml-formatted column to one XML, If you want to do that in SQL server, you can reference the below sample.
    CREATE PROC proc1 -- the procedure returning the resultset with 3 columns
    AS
    DECLARE @XML1 VARCHAR(MAX),
    @XML2 VARCHAR(MAX),
    @XML3 VARCHAR(MAX);
    SET @XML1='<person><name>Eric</name></person>'
    SET @XML2='<book><name>war and peace</name></book>'
    SET @XML3='<product><name>product1</name></product>'
    SELECT @XML1 AS col1,1 AS col2,2 AS col3
    UNION ALL
    SELECT @XML2,2,3
    UNION ALL
    SELECT @XML3,2,3
    GO
    CREATE PROC proc2
    AS
    DECLARE @TbL TABLE(id INT IDENTITY, col1 VARCHAR(MAX),col2 INT,col3 INT)
    INSERT INTO @TbL EXEC proc1
    SELECT id as '@row' ,cast(col1 as xml) FROM @TbL FOR XML PATH('XML'),TYPE
    GO
    EXEC proc2
    DROP PROC proc1,proc2
    /*output
    <XML row="1">
    <person>
    <name>Eric</name>
    </person>
    </XML>
    <XML row="2">
    <book>
    <name>war and peace</name>
    </book>
    </XML>
    <XML row="3">
    <product>
    <name>product1</name>
    </product>
    </XML>
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Complier output question

    I've been working on a java assignment that requires me to write a command line program which will read data from a text file, store the data in a vector and then save the vector to another file in a serialized form. I have written this program using the Kawa complier software.
    I have, what I believe to be, a working program; it complies without reporting any errors, but when I try to run the program, I get the following message in the complier output window.
    'Exception in thread "main"'
    Can someone tell me what this means?
    Thanks.

    Thanks for the suggestions, but I found a solution for it after posting the question. Another problem has come up now though.
    As I stated, the program is supposed to read the data from a text file, store it in a vector, and output it to another file in serialized form.
    The input file consists of many records of computers and peripherals. Each record uses four lines of the input file, and is displayed like this:
    Description (String)
    Price (float)
    VAT Price (float)
    Quantity (integer),
    Now I think the output file is supposed to look the same as the input file, but the one my program generates doesn't. My program code is as follows:
    import java.util.*;
    import java.io.*;
    import java.lang.*;
    class TextToVector
         public static void main(String [] args) throws IOException
              try
              Vector v = new Vector(); //creates the vector
              String inFile = new String ("C:/My Documents/V3/Data/stocklist.txt ");     //Informs the program of the name, type & location of the source file
              FileOutputStream outFileStream = new FileOutputStream("C:/My Documents/V3/outfile.dat ");     //Instructs the program where to create the output file, what type of file it should be & what to name it
              //the command paths used in these lines can be modified to read/send a file from/to
              //where ever the user wants, the user must also set these identical paths in
              //the "Interpreter Options" for this to work correctly
              ObjectOutputStream objOutStream = new ObjectOutputStream(outFileStream);
              objOutStream.writeObject(v);     //writes the object to the vector
              objOutStream.flush();                     //purges the objOutStream
              outFileStream.close();                     //closes the objOutStream
              catch (IOException e)
              System.out.println("Exception Writing File ");
              System.exit(1);
    public Vector readRecord(String inFile, Vector v) throws IOException
              String inString = new String(" ");
              String D = " ";
         float P = 0.0f;
         float V = 0.0f;
         int Q = 0;
              int count=0;
              BufferedReader buffReader = null;     //enures the BufferedReader is empty before beginning to read the source file
              buffReader = new BufferedReader(new FileReader (inFile));     //used to read & record each line of the source file
    try
         while((inString = buffReader.readLine()) !=null)
         count++;
         if(count==1)
         inString = buffReader.readLine();
         D = inString;
         if(count==2)
         inString = buffReader.readLine();
         P = (Float.valueOf(inString)).floatValue();
         if(count==3)
         inString = buffReader.readLine();
         V = (Float.valueOf(inString)).floatValue();
              if(count==4)
         inString = buffReader.readLine();
         Q = (Integer.valueOf(inString)).intValue();
         if(count==5)
         //System.out.println("Description " + D + " Price " + P + " VATPrice " + V + " Quantity " + Q);
         StockItem record = new StockItem(D,P,V,Q);
         v.add (record);
         count=0;
    buffReader.close();
    return v;
    catch(IOException e)
    System.out.println(e.toString());
    return v;
    class StockItem implements Serializable
         private String D;
    private float P;
    private float V;
    private int Q;
         StockItem()
         D = " ";
         P = 0.0f;
         V = 0.0f;
         Q = 0;
         StockItem(String Description, float Price, float VATPrice, int Quantity)
         D = Description;
         P = Price;
         V = VATPrice;
         Q = Quantity;
         public String getDescription()
    return D;
    public float getPriceValue()
    return P;
    public float getVATPriceValue()
    return V;
    public int getQuantityValue()
    return Q;
    Can anyone see anything wrong with this? I'd appreciate any suggestions. Thanks.

  • Air Output Question

    I've been playing around with the free trial of RH8 and I
    have some questions regarding the Air output:
    1. If I add a comment, is there a way I can edit it? I tried,
    but so far haven't been able to do so (I would think that I would
    in case there's a typo or something).
    2. Also, is there a way to show which topic a comment applies
    to. Say I decide to set my comments to "Show All," is there a way
    to see what topics each comment applies to?

    Hi Moranis,
    To answer your queries.
    1. Edit is not there. Currently you can add and delete
    comments.
    2. You can sort the comments by topic after you do show all.
    sharona27lily,
    Let me answer your queries.
    Comments by different users are managed on a shared network
    location. End user whoever is giving comments on the AIR output
    doesn't need anything else. In fact RH8 is needed for producing AIR
    output. Commenting will be done without RH8.
    Let me know if you have more queries.
    Vivek.
    Adobe Systems.

Maybe you are looking for

  • "Index: 0, Size: 0" error when using lexical references

    I got "Index: 0, Size: 0" when using lexical references in data template. Can any body tell me what happen? The detail error is: [042308_084608187][][EXCEPTION] java.lang.IndexOutOfBoundsException: Index: 0, S ize: 0 at com.sun.java.util.collections.

  • Ipod won't play any files!

    I am using a fully updated ipod and itunes.This morning my son accidently disconnected my ipod while it was flashing do not disconnect.I was using Anapod explorer 8.9.6. Now none of my files will play at all. When I cue them up the ipod just cycles t

  • Where to download Oracle 9i client for Redhat Linux?

    We have our Oracle 9i database running on another UNIX machine and need to install Oracle 9i client with sqlplus to be installed on Redhat Linux. So, can someone tell me where I can download it?

  • Timeout Object Problem: Can't recreate scaling error

    In my movie there is a function that scales 3D objects over time using a timeout object. The 3D objects are in an array that is shuffled each round, and based on the outcome of the array shuffle, some 3D objects are scaled and some are not. I have be

  • Netweaver 7.20 ABAP Trial Version - user and passwords

    after installation I tried the suggested names bcuser/ minisap, sap*/minisup but they do not work. Can somebody tell me, what combination of names and password will work in version 001? Thank you for your help.