Array copying question

Hi,
Say I have a 2 dimensional byte array appendixBlock[10][] & another 1 dimensional byte array, say, tempBytes[].
I do this in the code:
String tempString = new String(((String)object).getBytes(), "UTF-16");
byte[] tempBytes = tempString.getBytes();
bytesNum = tempBytes.length;
appendixBlock[appendixIndex] = null;
for(int x=0; x<bytesNum;x++)
appendixBlock[appendixIndex][x] = tempBytes[x];
Am getting NullPointer Exception due to the above. Whereas if I do:
appendixBlock[appendixIndex] = tempBytes;
am not getting any exception. Can anyone please throw some light on what's wrong?

Your second-dimension array isn't initialized.
I mean:
appendixBlock[appendixIndex] = null;
cough Don't you think there should be a byte array in there?

Similar Messages

  • Array Copy Problem

    ARRAY COPY DOESN'T WORK. DO NOT ATTEMPT TO USE IT IN YOUR REPLY TO THIS TOPIC. array copy says that you need the same type of object in the arrays. I'm making a method in a class called SUPERARRAYUTIL where this isn't the case. They all extend from a class i made called SUPERARRAY (in javacase caps tho, i just like to use upper case), but that doesnt help me. I'm short on time and i want to post this right now, so i won have any code right away but here is how i'm gonna do it:
    1) Static method takes parameters superArray array, superArray newelements, and int start
    2) Make a temp array that would be big enough to fit array, and the newelements at postion start in array
    3) copy over array using a for loop, starting at 0 in temp.
    4) copy over newelements using a for loop, starting at start in temp.
    Then i will make non-static methods for superArrayUtil that will use the static methods in superArrayUtil. I will also make a method like System.arraycopy but will call a method called cut to trim the array of new elements and then call this arraycopy to copy it into the dest array, and then another non-static method for that method too.
    Basically i just need ideas or comments cause so far i ran into some weird problems or any suggestions if there's a better way to copy arrays in the general way of array1 into array2 at a starting position.

    Deo_Favente wrote:
    ARRAY COPY DOESN'T WORK.
    YES. YES IT DOES. WHY DO YOU THINK THAT IT DOESNT WORK? WHY DON'T YOU POST WHATEVER CODE THAT YOU DO HAVE THAT IS CAUSING YOU PROBLEMS AND THEN MAYBE WE COULD WORK WITH IT. I THINK THAT'S A BETTER IDEA PERSONALLY, AT LEAST OPPOSED TO WHAT YOU DID HERE._+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I have type-safe generic array copying!

    Check this out. I get no warnings from this, and so far it seems to work fine, and it only takes twice the time of a normal array copy.
    All you have to do is pass in a dummy array of the same type as your inputArray, which under normal circumstances is very doable. The dummy array does not need to have the same dimension as the input array, which lets you use this as a static method in a utility class without feeling the burning need to make it throw an exception.
    It takes advantage of Collections' type-safe toArray() method.
         public static <T> T[] copyArray(T[] inputArray, T[] targetArray)
              return arrayToList(inputArray).toArray(targetArray);
         private static <T> ArrayList<T> arrayToList(T[] inputArray)
              ArrayList<T> returnValue = new ArrayList<T>();
              for(int i = 0; i < inputArray.length; i++)
                   returnValue.add(inputArray);
              return returnValue;

    And I like my tabs, thank you.Many people consider using tabs in code to be
    amatuerish. I can't say I disagree. Tabs are
    represented as different lengths depending on the
    editor. If you are using Eclipse, you can set it to
    insert a number of space when you hit tab instead of
    inserting tabs.I like tabs because they are an abstraction of indentation levels, something you don't get with spaces (unless you use one space per level), and therefore it makes more sense to me to use them. I use editors with good tab sizes that are also adjustable. Plus, I just like them better. So there.

  • Copying arrays, performance questions

    Hello there
    The JDK offers several ways to copy arrays so I ran some experiments to try and find out which would be the fastest.
    I was measuring the time it takes to copy large arrays of integers. I wrote a program that allocates arrays of various sizes, and copy them several times using different methods. Then I measured the time each method took using the NetBeans profiler and calculated the frequencies.
    Here are the results I obtained (click for full size):  http://i.share.pho.to/dc40172a_l.png
    (what I call in-place copy is just iterating through the array with a for loop and copying the values one by one)
    I generated a graph from those values:  http://i.share.pho.to/049e0f73_l.png
    A zoom on the interesting part: http://i.share.pho.to/a9e9a6a4_l.png
    According to these results, clone() becomes faster at some point (not sure why). I've re-ran these experiments a few times and it seems to always happen somewhere between 725 and 750.
    Now here are my questions:
    - Is what I did a valid and reliable way to test performances, or are my results completely irrelevant? And if it's not, what would be a smarter way to do this?
    - Will clone be faster than arraycopy past 750 items on any PC or will these results be influences by other factors?
    - Is there a way to write a method that would copy the array with optimal performances using clone and arraycopy, such that the cost of using it would be insignificant compared to systematically using one method over the other?
    - Any idea why clone() can become faster for bigger arrays? I know arraycopy is a native method, I didn't try to look into what it does exactly but I can't imagine it's doing anything more complicating than copying elements from one location in the memory to another... How can another method be faster than that?
    (just reminding I'm copying primitives, not objects)
    Thanks!
    Message was edited by: xStardust! Added links, mr forum decided to take away my images

    yeh, everyone thinks that at some point. it relies,
    however, on you being perfect and knowing everything
    in advance, which you aren't, and don't (no offence,
    the same applies to all of us!). time and time again,
    people do this up-front and discover that what they
    thought would be a bottleneck, isn't. plus,
    the JVM is much smarter at optimizing code than you
    think: trust it. the best way to get good performance
    out of your code is to write simple, straightforward
    good OO code. JVMs are at a point now where they can
    optimize java to outperform equivalent C/C++ code
    (no, really) but since they're written by human
    beings, who have real deadlines and targets, the
    optimizations that make it into a release are the
    most common ones. just write your application, and
    then see how it performs. trust me on this
    have a read of
    [url=http://java.sun.com/developer/technicalArticles/I
    nterviews/goetz_qa.html]this for more info anda chance to see where I plagiarized that post from :-)
    Thanks for that link you gave me :)
    Was usefull to read.
    About time and money of programming, that is not really an issue for me atm since i'm doing this project for a company, but through school (it's like working but not for money).
    Of course it should not last entirely long but I got time to figure out alot of things.
    For my next project I will try to focus some more on building first, optimizing performance later (if it can be done with a good margin, since it seems the biggest bottlenecks are not the code but things outside the code).
    @promethuuzz
    The idea was to put collection objects (an object that handles the orm objects initialized) in the request and pass them along to the jsp (this is all done through a customized mvc model).
    So I wanted to see if this method was performance heavy so I won't end up writing the entire app and finding out halve of it is very performance heavy :)

  • Copy Array Quick Question

    Just a quick question.
    Say I have an array A = [1,2,3,4,5]
    B = new int[5]
    I understand to copy the elements of A into B we could use a for loop.
    But can somebody explain to me why you can't just go B = A?
    Does this just cause B to point to A?
    So how do arrays work exactly? Is it like in C where each element is actually a pointer to the data, or does Java copy the data directly into the array element?

    Kayaman wrote:
    JT26 wrote:
    Array A=[1,2,3,4,5] ----> Here A is a reference variable which points to memory locations A[0],A[1],A[2],A[3],A[4] which could not be continueous.Actually no. What you have there is a syntax error. And please don't confuse people by talking about non continuous memory locations. That's simply wrong.And 100% irrelevant for the question at hand.
    >
    B = new int[5] -----> Here B is another reference variable points to an array which could hold 5 elemets.That is correct, basically.
    All the five element holders of B could be physically any where in the memory, thus copying the the elements is done via a for loop.No, Java is smart enough to store arrays sequentially in memory. And the smart way to copy large arrays is System.arrayCopy().Or java.util.Arrays.copyOf.

  • Byte Array Copy

    Hello,
    I have a problem that I have to write code to address the issue of modem disconnections while copying data. The problem is that I have to programmactially dial modems and copy programs to a remote windows based system. The issue is that I sometimes get disconnected from the remote site and loose my copy progress. I want to be able to be able to break apart an executable into chunks and copy those chunks to the remote harddrive and if I get disconnect, I will re dial the connection and pick up where I left off so that I dont loose the time that I spent already copying the file.
    I am currently using this method for copying the executables across the dial up connection but need to modify it and to be honest I dont know how. I know I should stuff the executable into some sort of byte array, get the length of that array, and copy each byte array element to the harddrive; loop through the array until the copy is complete. If disconnection or "semaphore timeout" exception is thrown, redial the connection, read the bytes that are already written on the remote locations harddrive, compare the bytes to what is stored locally, and copy those bytes until complete.
    Here is the method that I am using. I understand that I could use NIO to do the copy and it would be faster but I dont want to have to make major changes. I have attempted to search google for answers but only can find methods like this. Which is basically what I have...
        public static boolean uploadPackage(String src,String dst) {
            try {
                InputStream in = new FileInputStream(src);
                OutputStream out = new FileOutputStream(dst);
                // Transfer bytes from in to out
                byte[] buf = new byte[1024];
                int len;
                while ((len = in.read(buf)) > 0) {
                    System.out.println("WRITING BUFFER " + len + " " + in.read(buf));
                    out.write(buf, 0, len);
                in.close();
                out.close();
                return true;
            } catch (IOException e) {
                System.out.println("IOEXCEPTION " + e);
                return false;
        }

    Dukes are worthless.
    Do you have a question? I didn't see one.
    Why do you feel the need to put a bunch of byte arrays to disk? The file itself is ultimately a byte array. Why not just store a file that says what the last byte successfully transferred was. Probably it should also indicate the last file modification date, so you can see if the file has changed out from under you between transfers. Then you can just reload the file and resend the bits you need.
    For that matter, there must be a system that can transfer files in bits. I used to do this with uuencode and split on shell script. I wouldn't be surprised if rsync or something like it has support for something like this.

  • 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.

  • Array copying problems

    I'm sure this is a stupid question, but I'm not immensly knowledgeable about all the ins and outs of Java yet.
    I have 2 arrays of 81 elements, one known as groups and one as tempGrps. I used the System.arraycopy(groups,0,tempGrps,0,81) to copy groups to tempGrps. The problem I am encountering is that when groups is modified after the arraycopy, the same modifications are made to tempGrps. I have a small routine in place that checks the contents of tempGrps. When the arraycopy command is in place, tempGrps has the modifications that are made to groups also made to it. When the command is not there, tempGrps remains empty(this was tested to make sure I wasn't somehow modifying it somewhere else). What is going on here? The entire reason for the tempGrps array was to hold a temporary backup of the groups array.

    Could you explain this please? I mean, when I say
    MyObject = new
    MyObject(objectToCopy);How do I end up with
    the wrong type of Object?Easily: When objectToCopy is a MyCustomObject that is
    derived from MyObject.I think I see what you're saying - though, by explicitly saying that (woops, forgot the reference name there) myObject is of type MyObject, it's obvious you wanted a MyObject out of that ctor call, and since MyCustomObject is a MyObject then I think it's a stretch to say you get the wrong object type back.
    >
    Disclaimer: I haven't really read the article yet and
    don't feel strongly for either side of the argument,
    that's just one problem I've spotted.

  • System Copy Questions R/3 4.6c  + Oracle + Solaris

    dear gurus
    goal system copy in R/3 4.6c + Oracle + Solaris
    I am doing the db export using R3SETUP (quite slow, I have optimize it using split SRT files method)
    I have questions here..
    when I do export I download latest R3szchk, R3load, R3SETUP, R3check, R3LDCTL
    I download from
    Support Packages and Patches - Archive - Additional Components - SAP Kernel -SAP KERNEL 64-BIT - SAP KERNEL 4.6D 64-BIT
    R3szchk, R3load, R3check, R3LDCTL using SAPEXEDB_2364-10001132.SAR (Kernel Part II for Stack Q1-2008)
    R3SETUP using R3SETUP_29-10001132.CAR
    source system : Oracle 8.1.7 - R/3 4.6C - Solaris 9
    my question is
    target system : Oracle 10.0.2 with patches - R/3 4.6C - Solaris 10
    later on when i do import to target system, should I use the same kernel when I do the export, or should I use the one from
    Support Packages and Patches -> Additional Components -> SAP Kernel -> SAP KERNEL 64-BIT -> SAP KERNEL 4.6D_EX2 64-BIT
    another question
    how to speed up the export ? i am stucked with bottle neck in IO, CPU usage is very low, please dont recommend me something related to hardware or disk architecture, if possible recommend me something related to Oracle parameter.
    disk IO  using IO stat showing 100% busy and service time 800-1500
    thanks !

    later on when i do import to target system, should I use the same kernel when I do the export, or should I use the one from
    Support Packages and Patches -> Additional Components -> SAP Kernel -> SAP KERNEL 64-BIT -> SAP KERNEL 4.6D_EX2 64-BIT
    Yes - use that one. It uses the Oracle instantclient instead of the old 9.2 client. Make sure you add "-loadprocedure fast" to the load options, this will enable the fastloader.
    Make also sure you install all the patchsets and interim patches BEFORE you start the data load.
    another question
    how to speed up the export ? i am stucked with bottle neck in IO, CPU usage is very low, please dont recommend me something related to hardware or disk architecture, if possible recommend me something related to Oracle parameter.
    if you disk I/O subsystem can´t deliver more than you are lost with Oracle parameters.
    Markus

  • 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 Module Question

    Hi,
    I am currently working on designing phase for an Array Module. We are planning to track the Array information and store it's content to database. Currently I am finalizing the data model and I have following question.
    --We need to track the Geneology of the Sample through out the whole system (Especially the results of Transfers). Is it better to have all that relationship in one flat table with columns for location (like PlateWell, GelLane…..) and columns for Content (Column like . LocationType  LocationId   ContentType ContentId) or is it better to store all the content of location as a ArrayType? Or is there any other option available in the Market?
    In the first case database rows for that table will increate very very fast plus to find out the geneology of the location in Array , I have to use Connect By Prior which will take good amount of time(Is there any other option available?). I don’t have much idea about second option but I think retrieval individual content is going to be a problem.
    Any help is really appreciated.
    Thanks in Advance
    Raj

    Made a complete example:
    String searchKey = "Juice";
    TreeMap tm = new TreeMap();
    tm.put("soda", "coke");
    tm.put("Juice", "orange");
    tm.put("SODA", "7-up");
    Set set = tm.entrySet();
    Iterator iterator = set.iterator();
    while( iterator.hasNext() ) {
    Map.Entry entry = (Map.Entry)iterator.next();
    if(entry.getKey().equals(searchKey)){
    System.out.println("searchKey '"+searchKey+"' value is: "+entry.getValue());
    What do you think? Anything obvious that can be improved?

  • Array processing question

    Hello,
    I am somewhat new to JNI technology and am getting a bit confused about array processing.
    I am developing a C program that is called by a third party application. The third party application expects the C function to have a prototype similar to the following:
    int read_content(char *buffer, int length)
    It is expecting that I read "length" bytes of data from a device and return it to the caller in the buffer provided. I want to implement the device read operation in Java and return the data back to the C 'stub' so that it, in turn can return the data to the caller. What is the most efficient way to get the data from my Java "read_content" method into the caller's buffer? I am getting somewhat confused by the Get<Type>ArrayElements routines and this concepts of pinning, copying and releasing with the Release<Type>ArrayElements routine. Any advice would be helpful... particularly good advice :)
    Thanks

    It seems to me that you probably want to call the Java read_content method using JNI and have it return an array of bytes.
    Since you already have a C buffer provided, you need to copy the data out of the Java array into this C buffer. GetPrimitiveArrayCritical is probably what you want:
    char *myBuf = (char *)((*env)->GetPrimitiveArrayCritical(env, javaDataArray, NULL));
    memcpy(buffer, myBuf, length);
    (*env)->ReleasePrimitiveArrayCritical(env, javaDataArray, myBuf, JNI_ABORT);Given a Java array of bytes javaDataArray, this will copy length bytes out of it and into the C array named buffer. I used JNI_ABORT as the last argument to ReleasePrimitiveArrayCritical because you do not change the array. But you could pass a 0 there also, there would be no observable difference in the behavior.
    Think of it as requesting and releasing a lock on the Java array. When you have no lock, the VM is free to move the array around in memory (and it will do so from time to time). When you use one of the various GetArray functions, this will lock the array so that the VM cannot move it. When you are done with it, you need to release it so the VM can resume normal operations on it. Releasing it also propagates any changes made back to the array. You cannot know whether changes made in native code will be reflected in the Java array until you commit the changes by releasing the array. But since you are not modifying the array, it doesn't make any difference.
    What is most important is that you get the array before you read its elements and that you release it when you are done. That's all that you really need to know :}

  • Deep and Shallow array copy  again

    I am a Computer Analyst and a Java tutor.
    I am trying to understand the terms Shallow and Deep copy
    for arrays, using an example.
    Can you please tell me if my shallow and deep copy below is correct?
    Does the shallow copy not need any memory allocation?
    public Security( int paramAccountNumbers[], String paramPasswords[] ){
    String passwords[];
    int accountNumbers[];
    // INT ARRAY SHALLOW COPY
    accountNumbers = paramAccountNumbers;
    // STRING ARRAY DEEP COPY
    passwords = new String[paramPasswords.length];
    for( int i=0; i<paramPasswords.length; i++ ){
    passwords[i] = paramPasswords;

    You should use clone to copy arrays that contain only references to immutable objects or primitives.
    // "shallow" copy
    final String[] orig = new String[] {"a", "b", "c"};       
    final String[] copy = orig.clone();
    // or java 6 "shallow" copy
    final String[] orig = new String[] {"a", "b", "c"}; 
    final String[] copy = Arrays.copyOf(orig, orig.length, String[].class);If the array contains references to mutable objects you need to clone each element in the array
    // "deep" copy
    final Date[] orig = new Date[] {new Date()};
    final Date[] copy = new Date[orig.length];       
    for (int i = 0; i < orig.length; i++) copy[i] = (Date) orig.clone();However even this may not be sufficient in some cases, which is why cloning is a bit of a minefield.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Stuck on array of array copy problem

    I've got one array, outputMatrix[][] which is bigger that array matrix[][], and I want to copy matrix into outputMatrix, but off set the copy by a certain amount (to the right by EXTRA_COLUMN_TEXT and down by EXTRA_ROW_TEXT)
    I've tried     for (int i = 0; i < matrix.length; i++ ) {
          System.arraycopy(matrix, 0, outputMatrix[i + EXTRA_ROW_TEXT], EXTRA_COLUMN_TEXT, matrix.length);
    but it fails (java.lang.ArrayStoreException
    ) everytime. What am I doing wrong. I'm really stuck :(

    for(int i=EXTRA_ROW_TEXT, m=0; i<(matrix.length+EXTRA_ROW_TEXT); i++, m++)
    for(int j=EXTRA_COLUMN_TEXT, n=0; j<(matrix(i).length+EXTRA_COLUMN_TEXT); j++, n++)
    outputMatrix(i)(j)=Matrix(m)(n);

  • Math / array / matrix-question

    Hallo everybody,
    first of all: it's not a indesignscripting-  but general math-javascriptquestion. please be patient
    I've got a first (matrixlike-)array (won't change)
    var containers = [
    'container11', 'container12', 'container13', 'container14', 'container15',
    'container21', 'container22', 'container23', 'container24', 'container25',
    'container31', 'container32', 'container33', 'container34', 'container35',
    'container41', 'container42', 'container43', 'container44', 'container45',
    'container51', 'container52', 'container53', 'container54', 'container55'
    and I've got a second array:
    ["container14", "container25", "container34", "container44", "container54"] //this array may contain 3 up to 8 items
    My aim is to check if a part of 5 to 3 items of the second array is part of or equal to a row or column of the matrix-like-array.
    For example: "container34", "container44", "container54" or "container11", "container12", "container13", "container14" (as part of second array) would be a result I#m looking for. Note: I only want to find the 'biggest charge'!
    Hope it's getting clear and one of the math-cracks will have a idea.
    Addittional: there's no MUST to work with arrays. I can also store the data to a object or mixture ... and may fill it with numbers instead of strings ...
    To get it visible:
    https://dl.dropboxusercontent.com/spa/3ftsuc9opmid3j4/Exports/fourWins/fourWins.html
    Items can be dragged and dropped. After every dropp the arrays have to be compared ... and I#m searching for a nice and elegant solution
    May be someone's interested
    Hans

    Hi Hans,
    Just a quick note although your question is solved.
    Provided that your matrix is 5×5 you could easily map any element to a single character in the set { A, B..., Z } (for example).
    Then your problem can be reduced to some pattern matching algorithm, that is, finding the longest part of the input string within a 'flat string' that just concatenates the rows and the columns of the search matrix in the form ROW1|ROW2...|COL1|COL2...|COL5
    And you can create RegExp on the fly to compute the solution(s) with almost no effort:
    const MX_ORDER = 5;
    const MIN_MATCH = 3; // We need at least 3 contiguous items
    var bestMatrixMatch = function F(/*str[]*/ROWS, /*str*/ND)
    // NB: No check is made on ROWS, so make sure you supply
    //     MX_ORDER strings, each being MX_ORDER-sized
        // Put in cache some subroutines
        F.RES_TO_STR ||(F.RES_TO_STR = function()
                return localize("'%1' found in %2", this.result, this.location);
        F.ROWS_TO_HS ||(F.ROWS_TO_HS = function(R, C,i,j)
                for( i=0,C=[] ; i < MX_ORDER ; ++i )
                for( C[i]='',j=0 ; j < MX_ORDER ; C[i]+=R[j++][i] );
                return R.concat(C).join('|');
        // Vars
        var haystack = F.ROWS_TO_HS(ROWS),
            candidates = ND &&
                haystack.match( new RegExp('['+ND+']{'+MIN_MATCH+',}','g') ),
            t, p;
        if( !candidates ) return null;
        // Sort the candidates by increasing size
        candidates.sort( function(x,y){return x.length-y.length} );
        // Grab the matches and keep the best
        while( t=candidates.pop() )
            if( 0 > ND.indexOf(t) ) continue;
            p = 1+~~(haystack.indexOf(t)/(1+MX_ORDER));
            return {
                result:   t,
                location: (p<=MX_ORDER)?('Row #'+p):('Col #'+(p-MX_ORDER)),
                toString: F.RES_TO_STR,
        return null;
    // =================
    // Sample code
    // =================
    var rows = [
        "ABCDE",
        "FGHIJ",
        "KLMNO",
        "PQRST",
        "UVWXY"
    var needle = "EKLMINSX";
    // get the result
    var result = bestMatrixMatch(rows, needle);
    alert(
        "Searching the longest part of '" + needle + "' in:\r\r" +
        ' '+rows.join('\r').split('').join(' ') +
        '\r\r===============\r\r' +
        (result || "No result.")
    @+
    Marc

Maybe you are looking for

  • New firefox 10.0 wont let me open mult windows, only tabs

    new firefox 10.0 wont let me open mult windows, only tabs. I have looked at tools/options/tabs and the open new windows in tabs is not clicked. have rebooted computer with no better results

  • ITunes will not open my iPod

    Ok so every time I open iTunes and connect my iPod video it comes up with a error saying "The software required for communicating with the iPod is not installed correctly. Please reinstall iTunes to install the iPod's software." I used the guide abou

  • Missing package com.sap.tc.logging, where to download it?

    Hi all, I require this package in order to run my program based on webdynpro and Bw. specialing its looking for com.sap.tc.logging.location . The detailed exception is laready posted by me. from where can i download and install this package. In the e

  • Transport consumes too much time

    Hi Maybe this is not an XI related issue at all.. so sry and just point me to the correct forum. We have a "external system - XI - CRM" scenario where external party communicates using SOAP and XI-CRM communication is RFC based. The simplest case is

  • Stored Procedure- Multil level employee hierarchy in the same row

    I have an employee table where I have employee details  which includes the following properties: EmployeeID, EmployeeName, ManagerID, DesignationCode. ManagerID maps to EmployeeID in the Emp table. DesignationCode is to identify the employee designat