Ragged/Jagged Arrays

hey guys i was wondering if you guys could help me a bit^^.
http://bingweb.binghamton.edu/~cs140/Homework/assignment06.html
this is the assignment that i have to do and i am stuck on #3.
here is my code for ArrayDataVer2
package assig6;
public class ArrayDataVer2
     private double[][] sourceArrayOfArrays;
     private double[][] targetArrayOfArrays;
     private double highestLength = 0;
     private int j = 0;
     private int numRows;
     private int i = 0;
     private double[][] twoDimArrVar;
     // This will show as unused until you write
     // the method fillOutTheArrays
     private double targetArraysFillValue = 0;
     * Make targetArrayOfArrays a rectangular array (i.e. not a
     * ragged array), with the same numbers of rows as sourceArrayOfArrays.
     * The number of columns of targetArrayOfArrays should be the maximum
     * length of the rows of sourceArrayOfArrays.
     * Also copy any values in sourceArrayOfArrays to the corresponding positons
     * in targetArrayOfArrays. Put targetArraysFillValue in all the other
     * positions of targetArrayOfArrays.
     * For an example, see the graphic in the assignment.
     public void fillOutTheArrays()
          //i is the array number
          //j is the size of the array number
     //     double[][] twoDimArrVar;                                                  //MAKING 2 ARRAYS INSIDE AN ARRAY
          //numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
          //twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
          //for (int i = 0; i < numRows; i++)
          //     int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
          //     twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
          //     for (int j = 0; j < length; j++)                                   
          //////          double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                    // now round it to 3 places of decimals
          ///          int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
          ///          twoDimArrVar[i][j] = k/1000.0;                                   //ADD
          double arrayTemp[];
          int x = 0;
          int arrayTempLength = 0;
          for (int i = 0; i < twoDimArrVar.length; i++)
               arrayTemp = new double[twoDimArrVar[i].length];
               arrayTemp = twoDimArrVar[i];
               twoDimArrVar[i] = new double[(int)highestLength];
               arrayTempLength = arrayTemp.length;
               while (arrayTempLength <= (x + 1))
                    twoDimArrVar[i][x] = x;
                    x++;
               while (arrayTempLength >= x)
                    twoDimArrVar[i][x] = (int)targetArraysFillValue;
                    //twoDimArrVar[i][x] = twoDimArrVar[i][targetArraysFillValue];
                    x++;
     * Find the maximum length of any "row" of the array of arrays
     * @param array a ragged two dimensional array
     * @return the maximum value of array[i].length
     *                over all rows i, where 0 <= i <= array.length
     public int maxArrayLength(double[][] array)
          int max = 0;
          return max;
     * Simple constructor uses a method to create a random
     * array of arrays
     public ArrayDataVer2()
          newArrays();
     * Call for the creation of the source array by using
     * <code>resetSizeAndContent</code> and
     * copy the source array to a new target array.
     public void newArrays()
          sourceArrayOfArrays = resetSizeAndContent();
          int numRows = sourceArrayOfArrays.length;
          targetArrayOfArrays = new double[numRows][];
          for(int i = 0; i < sourceArrayOfArrays.length; i++)
               targetArrayOfArrays[i] = sourceArrayOfArrays[i].clone();
     * Create a two-dimensional array, i.e. an array of arrays
     * of random size containing random numbers at each position.
     * The array created is ragged
     * (every row can have a different length)
     * @return a random ragged 2-dimensional array
     public double[][] resetSizeAndContent()
                                                            //MAKING 2 ARRAYS INSIDE AN ARRAY
          numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
          twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
          for (i = 0; i < numRows; i++)
               int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
               twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
               if (length > highestLength) highestLength = length;
               for (j = 0; j < length; j++)                                   
                    double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                    // now round it to 3 places of decimals
                    int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
                    twoDimArrVar[i][j] = k/1000.0;                                   //ADD
          return twoDimArrVar;
//     GETTER METHODS USED BY ArrayViewVer2
     public int getNumSourceRows()
          return sourceArrayOfArrays.length;
     public int getNumSourceColumns(int row)
          return sourceArrayOfArrays[row].length;
     public int getNumTargetRows()
          return targetArrayOfArrays.length;
     public int getNumTargetColumns(int row)
          return targetArrayOfArrays[row].length;
     public double getSourceArrayValue(int row, int column)
          return sourceArrayOfArrays[row][column];
     public double getTargetArrayValue(int row, int column)
          return targetArrayOfArrays[row][column];
     public void setFillValue(double d)
          targetArraysFillValue = d;
when i try to run this, it comes up with multiple errors. does anyone know how to correct this?

package assig6;
public class ArrayDataVer2
     private double[][] sourceArrayOfArrays;
     private double[][] targetArrayOfArrays;
     private double highestLength = 0;
     private int j = 0;
     private int numRows;
     private int i = 0;
     private double[][] twoDimArrVar;
     // This will show as unused until you write
     // the method fillOutTheArrays
     private double targetArraysFillValue = 0;
      * Make targetArrayOfArrays a rectangular array (i.e. not a
      * ragged array), with the same numbers of rows as sourceArrayOfArrays.
      * The number of columns of targetArrayOfArrays should be the maximum
      * length of the rows of sourceArrayOfArrays.
      * Also copy any values in sourceArrayOfArrays to the corresponding positons
      * in targetArrayOfArrays.  Put targetArraysFillValue in all the other
      * positions of targetArrayOfArrays.
      * For an example, see the graphic in the assignment.
     public void fillOutTheArrays()
          //i is the array number
          //j is the size of the array number
     //     double[][] twoDimArrVar;                                                  //MAKING 2 ARRAYS INSIDE AN ARRAY
          //numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
          //twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
          //for (int i = 0; i < numRows; i++)
          //     int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
          //     twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
          //     for (int j = 0; j < length; j++)                                   
          //////          double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                    // now round it to 3 places of decimals
          ///          int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
          ///          twoDimArrVar[i][j] = k/1000.0;                                   //ADD
          double arrayTemp[];
          int x = 0;
          int arrayTempLength = 0;
          for (int i = 0; i < twoDimArrVar.length; i++)
               arrayTemp = new double[twoDimArrVar[i].length];
               arrayTemp = twoDimArrVar[i];
               twoDimArrVar[i] = new double[(int)highestLength];
               arrayTempLength = arrayTemp.length;
               while (arrayTempLength <= (x + 1))
                    twoDimArrVar[i][x] = x;
                    x++;
               while (arrayTempLength >= x)
                    twoDimArrVar[i][x] = (int)targetArraysFillValue;
                    //twoDimArrVar[i][x] = twoDimArrVar[i][targetArraysFillValue];
                    x++;
     * Find the maximum length of any "row" of the array of arrays
     * @param array a ragged two dimensional array
     * @return the maximum value of array[i].length
     *                over all rows i, where 0 <= i <= array.length
     public int maxArrayLength(double[][] array)
          int max = 0;
          return max;
     * Simple constructor uses a method to create a random
     * array of arrays
     public ArrayDataVer2()
          newArrays();
     * Call for the creation of the source array by using
     * <code>resetSizeAndContent</code> and
     * copy the source array to a new target array.
     public void newArrays()
          sourceArrayOfArrays = resetSizeAndContent();
          int numRows = sourceArrayOfArrays.length;
          targetArrayOfArrays = new double[numRows][];
          for(int i = 0; i < sourceArrayOfArrays.length; i++)
               targetArrayOfArrays[i] = sourceArrayOfArrays[i].clone();
     * Create a two-dimensional array, i.e. an array of arrays
     * of random size containing random numbers at each position.
     * The array created is ragged
     * (every row can have a different length)
     * @return a random ragged 2-dimensional array
     public double[][] resetSizeAndContent()
                                                            //MAKING 2 ARRAYS INSIDE AN ARRAY
          numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
          twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
          for (i = 0; i < numRows; i++)
               int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
               twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
               if (length > highestLength) highestLength = length;
               for (j = 0; j < length; j++)                                   
                    double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                    // now round it to 3 places of decimals
                    int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
                    twoDimArrVar[i][j] = k/1000.0;                                   //ADD
          return twoDimArrVar;
//     GETTER METHODS USED BY ArrayViewVer2
     public int getNumSourceRows()
          return sourceArrayOfArrays.length;
     public int getNumSourceColumns(int row)
          return sourceArrayOfArrays[row].length;
     public int getNumTargetRows()
          return targetArrayOfArrays.length;
     public int getNumTargetColumns(int row)
          return targetArrayOfArrays[row].length;
     public double getSourceArrayValue(int row, int column)
          return sourceArrayOfArrays[row][column];
     public double getTargetArrayValue(int row, int column)
          return targetArrayOfArrays[row][column];
     public void setFillValue(double d)
          targetArraysFillValue = d;
This is the error i get:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 12
     at assig6.ArrayDataVer2.fillOutTheArrays(ArrayDataVer2.java:67)
     at assig6.ArrayViewVer2$FillOutArraysListener.actionPerformed(ArrayViewVer2.java:224)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Window.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)

Similar Messages

  • How to reverse array display order?

    Is there a way to reverse the way labview displays array data?  When using a boolean array I would like the LSB to be on the right side.
    I know that you can use the reverse array function, but that changes the actual data. I would rather just change how the data is displayed.  Also I have quite a few and don't want to have to add that to all of them.
    Thanks

    It should be fairly trivial to add a reverse array before displaying the data. Keep in mind, when you display the data on the Front Panel, you can keep a parallel branch wire on the Block Diagram that is not affected by the Reverse Array.
    Also, if you are displaying many of these arrays, perhaps you could use a 2D array on the Front Panel to show all bitmaps at once? Or, a 1D array that contains a cluster of the Boolean array if the Boolean arrays are ragged/jagged. Using this method would be scalable, meaning you would need only 1 Reverse Array for N arrays you want to display.
    And smercurio_fc is right about the XControl being able to display a reversed array. But if you're not willing to drop Reverse Array in a few places, you're probably not willing to bite off the non-trivial task of creating an XControl (there's a moderate learning curve for getting the hang of creating a good XControl).
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • Associative  array binding - poor performance

    Dear All
    i have very very low performence when i am inserting a binary array using associative array bind. i mean when i insert huge jagged binary array.
    the jagged array has
    BinarryArray[0][0]........BinarryArray[0][8000]
    BinarryArray[1][0]........BinarryArray[1][8000]
    BinarryArray[3600][0]........BinarryArray[3600][8000]
    BinarryArray[0] - i have 8000 byte end so on. total is 3600 X 8000
    that means 28,800KB hence to ~28MB.
    the C# code is as follows
    string strInsert "Insert Into T Values(t.SEQUENCE.currval, :paramArr);
    OracleCommand objCommand = new OracleCommand;
    OracleParameter objParam = new OracleParameter(paramArr, OracleDbtype.blob, 8000, system.data.ParameterDirection.Input,true,0,0,"ColumnName", system.data.DataRowVersion.Curren, BinarryArray);
    objCommandtext = strInsert;
    objCommand.ArrayBindCount = BinarryArray.Length;
    objCommand.Parameters.Clear();
    objCommand.Parameters.Add(paramArr);
    objCommand.ExecuteNonQuery();
    In generall the Insertion is good for each row in the array i get separate row in the DB but it works so slow.
    why??????
    see the code below

    well??

  • Getting sum of each column in 2D array

    hi,
    i want to get sum of each column from 2D array. i did public static void main(String[] args) {
              double sum=0.0;
                   int[][] arr={
                             {1,2,8},
                             {2,2,3},
                             {2,2,5},
                             {1,2,8},
                             {1,1,9},
                             {2,2}
                   int i=0,j=0;
                   int len=arr.length;
                   while(j!=len){
                        sum=0;
                        for(i=0;i<arr.length;i++){
                        sum+=arr[i][j];
                        System.out.println("sum is:" +sum);
                        j++;
         }but it doesnot work for jagged array...somebody please help!
    thankx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Stop assuming the rows in your matrix are all the same length. Arrays know how long they are. Use that information to determine if the current column exists in that row.

  • Count the number of values in a two dimensional array

    i am trying to figure out how to count the number of values in a two dimensional array.
    numScores = student[i][j].length;This doesn't work, i am trying to find a way of counting the columns

    Object[][] o;
    int tot = 0;
    for(int x = 0 ; x < o.length ; x++)
       tot += o[x].length;
    }If it's not a jagged array, however, this would be easier:
    int tot = o.length * o[0].length;

  • Read two different arrays and display

    I have a text file, which has 1000 of entries in the way mentioned below:
    Kozos customer
    sabze employee
    I am reading the content of text file and saving as an arrays.
    $global:Content = get-content info.txt
    $global:Name=$Content | foreach {
    $hashTab=@{Name="" ; Info=""}
    $hashTab.Name, $hashTab.Info=$_.Trim() -split '\s+'
    New-Object PSObject -Property $hashTab
    $global:Names=$ServerList | select -ExpandProperty Name
    $global:Infos=$ServerList | select -ExpandProperty Info
    How do I read two arrays, I mean read the values of two arrays one by one and display the result as:
    Names Infos
    Kozos Customer
    sabze employee

    We get that you are unable to do this, but it is still not clear precisely what it is that you want, a two-dimensional array, or a structure such as SeanQuinlan suggested? Also:
    there seems no reason for any of the variables to be global in scope.
    Where is the $serverlist variable defined?
    what relationship is there between the file you mention and the data in the $serverlist variable?
    Your code has three arrays, $name, $names, and $infos; which two of these do you want to combine into a single array? If $names and $infos, would this work for you:
        $namesNinfos = $serverlist | select name,info
    I suggest that you describe your situation without trying to state it in powershell (as that is partly where your problem lies). You could, for example, show sample content of the file and each of the two arrays, and show what this would look like in your
    desired two-dimensional array, perhaps like this:
    file info.txt
    Kozos customer
    sabze employee
    array 1:
    Kozos
    sabze
    array 2:
    customer
    employee
    resultant 2D array
    column 1 2
    row
    1 Kozos customer
    2 sabze employee
    As an aside, it could be that we are getting confused by the term "array". languages such as fortran and basic support multidimensional arrays in which each element is addressed by a set of integer indices, the most common form being row and column, as in
    a spreadsheet.
    In Powershell, arrays are generally one dimensional, with a single numerical index being used to select a single element ($row3 = $array[2]). That element can optionally have multiple values if it is defined as an array or a hash. This is referred to as
    a "jagged array" as each element of the array may not all have the same number of sub-elements as each other.
    Powershell also supports true multidimensional arrays, however, these seem fairly rarely used, I suspect because jagged arrays generally provide more easily used functionality.
    You can get more details on this from
    here and
    here.
    This, then, leads to my final question:
    what type of two-dimensional array are you looking for, and how will your script be processing it?
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • Split 2D array to 1D arrays by row

    Hi
    I am trying to do 2 things with arrays and their dimensions. They both seem quite basic, but I can't figure out how to do them...
    1. Split a 2D array of size 2 x N into two 1D arrays of length N.
    2. Reshape a 2D array of size m x n into a 1D array of length mn, then do the inverse procedure and get it back to a 2D m x n array. (After doing some manipulation, interpolation, etc.)
    Thanks!

    Justin_Reina wrote:
    Back to the original question -
    1. Split a 2D array of 2xN into (2) 1D arrays of len N
         This code achieves this. It uses the cluster datatype to conceptually & visually segment
          the problem-statement's solution - try to make a cleaner visual solution
    A cleaner visual solution would be to just leave it as a 2D array! The existing display of rows and columns is very clear and easy to view and understand! Why all that song and dance of using complicated hierachical structures? Since when did the word "split" mean "wrap it into a complicated structure for easier viewing"?
    Justin_Reina wrote:
     I don't care about ragged 2D arrays, AKA 'sloppy programming' ... See the answer above
        for my clarifications.
    Ragged arrays have nothing to do with sloppy programming. They are a valid data structure useful for certain scenarios.
    Justin_Reina wrote:
    So ummm, thanks for your direct & public sarcasm but I would suggest that occur on the side in email in the future...
    Well, a public post deserves a public answer. I am probably not the only one confused by your post dangling from the end of an ancient solved thread so a public clarification is beneficial to all. Besides, your e-mail address is probably not public and even if I had it, e-mailing somebody out of the blue would need a very, very good reason. I rarely do that.
    I just asked for clarification and pointed out what parts of your posts confused me in the context of the original thread. No sarcasm anywhere.

  • How to reverse Pen-tilt display/cursor?

    Took a screen shot of a Youtube vid, then took a screen shot of the screen shot. Essentially, I don't have that grey box anymore. I dropped the pen and it swapped it to the cursor. So now I see the tilt and brush shape instead of the circle and the grey box is completely gone. How do I get the box back?

    It should be fairly trivial to add a reverse array before displaying the data. Keep in mind, when you display the data on the Front Panel, you can keep a parallel branch wire on the Block Diagram that is not affected by the Reverse Array.
    Also, if you are displaying many of these arrays, perhaps you could use a 2D array on the Front Panel to show all bitmaps at once? Or, a 1D array that contains a cluster of the Boolean array if the Boolean arrays are ragged/jagged. Using this method would be scalable, meaning you would need only 1 Reverse Array for N arrays you want to display.
    And smercurio_fc is right about the XControl being able to display a reversed array. But if you're not willing to drop Reverse Array in a few places, you're probably not willing to bite off the non-trivial task of creating an XControl (there's a moderate learning curve for getting the hang of creating a good XControl).
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • How to add elements into Object[][] type of list, in runtime?

    I have Object list, ie.
        final Object[][] data = {
            {"January",   new Integer(150) },
            {"February",  new Integer(500) },
            {"March",     new Integer(54)  },
            {"April",     new Integer(-50) }
        };How can I dynamicly add new elements in it, at the runtime?
    Thank you in advance!

    Do I have to remove 'final' for that, and then add
    elements?
    No. you can't change an array's size.
    You can do this
    Object[][] arr = new Object[numRows][numCols];But once you've created it, its size can't change.*
    I don't know what you're doing, though, and what actual data you're putting in, but Object[][] holding rows of [String, Integer] is almost certainly a poor data structure. Think about creating a class the represents one "row" here and then create a 1D array of that class.
    * Okay, you can kinda sorta effectively "change" the size of second and subsequent dimensions, since a multidimensional array is an array of arrays. I wouldn't recommend it though: int[][] arr = new int[3][2]; // a 3 x 2 rectangular array of int--it's  an array of array of int, with 3 "rows", each of which is an array of int with 2 elements.
    arr[0] = new int[10]; // now it's a jagged array whose first row has 10 elments instead of 2Here we haven't changed an array's size, just replaced one of its elements, which is also an array, with a new, larger array.

  • Channel contract mismatch when implementing ISerializable

    Hello,
    I am trying to retrieve an object via an OperationContract Channel
    but when I try to implement ISerializable for that class, I receive a CommunicationException client side. The serialization and deserialization work fine server side. 
    The exception additional information says: "the server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
    Basically, I am using a WCF service (self-hosted) very similar to what is described here:
    https://msdn.microsoft.com/en-us/library/ms731758(v=vs.110).aspx
    In my case, the operation contract expose is a get property that returns an object A (a container of data really). One of the fields of this object is also an object, B. Now, B is a very simple class that contains only three jagged arrays, and three get properties
    that transform the jagged arrays to multidimensional arrays.
    Serialization, deserialization and operation contract work fine in this setup. When class B implements ISerializable, the channel returns the exception. ISerializable is implemented in the following way:
    constructor: (not sure the details are important but nevertheless) reads the entries in Serialization info and if the serialized file contains the jagged arrays it just makes the assignment, if it contains the multidimensional arrays, it converts them
    to jagged and makes the assignment.
    GetObjectData: only adds to SerializationInfo the jagged arrays.
    If you are wondering, this is done to keep retro-compatibility with an old version of class B (serialization is not only used by Channel, I also use it to save data). 
    Thanks,
    Leo

    Hi LeoBrl,
    >>the server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
    For your issue, it will be better if you can try to post a simple reproduce project in here.
    Besides, for troubleshooting this issue, please try to enable the WCF Tracing to help get more detailed error information.
    #How to configure WCF Tracing:
    https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Count the all null values in the given table

    Suppose a table has n number of rows and columns .
    can any one tell the query to count the number of null values present in the table.
    For example :
    select * from tname:
    A      B
    cc    jhghf
    hff      -
    -       kjh
    tys     -
    -        gyrfg
    jjgg      -
    jfgh      -
    -        uytg
    10 rows selected..
    now to count the null vales in the table we can use --->   select count(1)-count(a)+count(2)-count(b) as ncount  from tname;
                                                                                      o/p:
                                                                                              ncount
                                                                                               11
    now my questions is we have n number of columns now pls tel tell me how to count the nulls present in table..?
    Thanks in Advance.

    Object[][] o;
    int tot = 0;
    for(int x = 0 ; x < o.length ; x++)
       tot += o[x].length;
    }If it's not a jagged array, however, this would be easier:
    int tot = o.length * o[0].length;

  • Huge performance difference for this?

    So I was optimizing a large piece of code and found that looping through a 2-dimensional array by row is a LOT faster than by column.
    If you look at the code below, the accessor to the row is moved from the outer loop to the inner loop in the second test, because it traverses the array by columns first.
                            double row[] = table[j]; Since the inner loop is more expensive with this change, it should be slower. That's fine.
    But how much slower? Running it on a dual 2GHz Pentium/Windows XP, the latter is 10x slower - consistently.
    Does anyone know why? I looked at the byte code and it's not obvious why the difference is so big. Maybe the memory cache is kicking in here because accessing row-wise has better locality? It's a pure guess and it would be great if someone can offer an explaination (or even better suggestions to make it faster :)).
    Thanks a lot!
        public void aggrArrByRow( final int numRow, final int numCol )
            final double table[][] = createArray( numRow, numCol );
            final double result[] = new double[ numCol ];
            Runnable r = new Runnable() {
                public void run() {
                    for( int i=0; i<numCol; i++ ) result[i] = 0.0;
                    for( int j=0; j<numRow; j++ )
                        double row[] = table[j];
                        for( int i=0; i<numCol; i++ )
                            result[i] += row;
    timeit( "aggrArrByRow of " + numRow + "x" + numCol + " table", r );
    public void aggrArrByCol( final int numRow, final int numCol )
    final double table[][] = createArray( numRow, numCol );
    final double result[] = new double[ numCol ];
    Runnable r = new Runnable() {
    public void run() {
    for( int i=0; i<numCol; i++ ) result[i] = 0.0;
    for( int i=0; i<numCol; i++ )
    for( int j=0; j<numRow; j++ )
    double row[] = table[j];
    result[i] += row[i];
    timeit( "aggrArrByCol of " + numRow + "x" + numCol + " table", r );
    public static long timeit( String label, Runnable r )
    long start = System.currentTimeMillis();
    r.run();
    long end = System.currentTimeMillis();
    System.out.println( label + " took " + (end-start) + " ms" );
    return (end-start);

    But how much slower? Running it on a dual 2GHz
    Pentium/Windows XP, the latter is 10x slower -
    consistently.
    Does anyone know why? I looked at the byte code and
    it's not obvious why the difference is so big.
    Maybe the memory cache is kicking in here because
    se accessing row-wise has better locality? It's a
    pure guess and it would be great if someone can offer
    an explaination (or even better suggestions to make
    it faster :)).Yep, that's probably it. I have some experience with some BLAS libraries (ATLAS and MKL), and they typically perform matrix multiplication 8-10x faster than "naively" coded routines. Most of this advantage is gained in cache blocking. Perhaps surprisingly, relatively little of that advantage is from pipelining and other processor features (for large matrices, anyway).
    To make it faster, you could try dropping the use of Java jagged arrays and use C style arrays instead. Then you'll be guaranteed to have the entire matrix in the same area of memory, not just the rows. Or, if you have to iterate the elements multiple times, see if you can decompose the problem in such a way that you can perform multiple passes on smaller blocks of data.
    Good luck.

  • Complex parameter use

    Hi,
    I'm a newbie to PL/SQL development as well as odp.net.
    I need to bind data from stored procedures via parameteres, that has some really complex structure. E.g.:
    procedure GetDeliveryNoteList(
    PIN in GetDeliveryNoteList_IN,
    POUT in out TAB_GetDeliveryNoteList_OUT
    type WPSADM.GETDELIVERYNOTELIST_IN as object(
    CUSTOMER_ID varchar2(255),
    DOC_COUNT number,
    DOC_NUM varchar2(255),
    DATE_1 date,
    DATE_2 date,
    ORDER_ID number
    type WPSADM.TAB_GETDELIVERYNOTELIST_OUT as table of TypeGetDeliveryNoteList_OUT;
    type WPSADM.TYPEGETDELIVERYNOTELIST_OUT as object(
    DOC_KEY number,
    DOC_NUM varchar2(255),
    DOC_DATE date,
    DOC_SALE_PRICE number,
    COMPLAINT_INFO varchar2(255),
    ARCH_KEY number,
    ARCH_DESC varchar2(255),
    ARCH_NAME varchar2(255),
    ARCH_MIME varchar2(255),
    KOD_LEK varchar2(6),
    NAZEV_LEK varchar2(30),
    CISLO_OBJ varchar2(255)
    The question is, how do I create such a parameters. I can get data, using simple params like varchar2:
    OracleParameter parm = new OracleParameter();
    parm.OracleDbType = OracleDbType.Varchar2;
    parm.Value = TextBox1.Text;
    parm.Direction = ParameterDirection.Input;
    cmd.Parameters.Add(parm);
    OracleParameter parm_out = new OracleParameter();
    parm_out.OracleDbType = OracleDbType.Varchar2;
    parm_out.Size = 1000;
    parm_out.Direction = ParameterDirection.Output;
    cmd.Parameters.Add(parm_out);
    cmd.CommandText = "INFO.INVOICES.JK_echo_par";
    cmd.CommandType = CommandType.StoredProcedure;
    OracleDataReader dr = cmd.ExecuteReader();
    dr.Read();
    label1.Text = parm_out.Value.ToString();
    But the Oracle Type is much more complex.
    Any suggestions?
    TIA, JiKra

    Hi,
    See if this thread helps:
    Re: Invalid Parameter Binding - Jagged Array to User Defined Structure Type
    Greg

  • Creating 2D List - Need Help

    Hi all,
    I need help with creating a "ragged" 2D array. The situation is that the columns have a static length which I know in advance but the number of rows needs to be defined per coloum seperatly. i know that i can create a ragged 2D array by setting the rows and looping throuh the rows setting the length (i.e. number of columns) but I have the opposite values. is this possible??

    Number of rows per column? A 2d array is basically
    one column with M rows and each row is N items wide.
    So define one collection object, I'll use a List for
    the sake of argument. This is that one column with M
    rows. For each row, add a List as an element in this
    column, and add N elements to this row List. There
    you go, a variable column length and each row is of a
    variable length as well.The issue i have is when defining the 2d array i.e. lets say of type int
    int[][] array = new int[M][N]
    I do not know M but do know the value of N. only after I have defined this section I can then continue to define M for each N .. any ideas?

  • Java double[m][n] vs. double[m * n]

    I was picking through the Jama - NIST/Mathworks matrix libraries - and noticed they use double[][] for a backing store. I was expecting a packed array. I was under the impression that packed arrays were favorable - for performance reasons - because the elimination of one bounds check, fast block filling, etc... Is there any data documenting the performance delta between packed and jagged arrays? Honestly I would preffered to code w/ the jagged.
    Regards,
    Monty

    CuriousJorj wrote:
    I was picking through the Jama - NIST/Mathworks matrix libraries - and noticed they use double[][] for a backing store. I was expecting a packed array. I was under the impression that packed arrays were favorable - for performance reasons - because the elimination of one bounds check, fast block filling, etc... Is there any data documenting the performance delta between packed and jagged arrays? Honestly I would preffered to code w/ the jagged.There's no data on these things because there's no easy way to measure it generally. It all depends on your requirements, your JVM, your code.
    A jagged array could theoretically even be faster for some cases (for example when you access all elements of one row after each other, because you save the calculation (which you could optimize away the other way as well)).
    I'm going to assume you know about the whole "no premature optimization" rule and have actually thought about it before investigating it. And I'm only assuming that because I'm to lazy to repeat the whole thing right now.

Maybe you are looking for

  • Editing XMP metadata in Bridge for checked-out files?

    Our custom connector does not implement the WRITE_XMP_METADATA Capability because we do not want to change the XMP of a file in our DAM system without checking in a new file version. However, when a file is checked out through Adobe Drive, we would e

  • CPU upgrades, RAIDing system drive, and more

    Final Cut Studio user... editing on an iMac is murder... need more power Scotti! I intend to buy a Mac Pro next week, either BTO or retail, not sure yet! I know that CPUs on Mac Pro's are socketed and not soldered. Yipee! Is it confirmed that CPUs ar

  • Creating a Custom DataNavigator like BindingNavigator

    Hi All, I wan to create a custom BindingNavigator from dotNetbar ribbon control. Like wise in the property window we choosing a button as DeleteItem/ AddNewItem button, MoveNext button respectivaly for their operation of a .Net BindingNavigator. So I

  • Loading movie clip to stage with button click AS3

    I'm trying to figure out how to load a movie clip to the stage with a button click and have the movieclip close again using a close button. Does anyone have a step by step on how to do this or links to some tutorials. Below is an example of what I'm

  • Missing posts in my Tracker...

    Hi, I noticed today that some of my post won't appear in my tracker... I often use my tracker to see which of my posts have been answered to, and this is tha very first time I notice that a post is missing... Why ? can it this be fixed ? this post do