Last comma in array

I think that it wasn't possible in the previous versions of java. The next code compiles fine with jdk1.5.0:
public class Test {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3,};  // <- last comma
        String[] arr2;
        arr2 = new String[]{"a", "b", "c",};  // <- last comma
        float[] arr3 = {,};  // <- last comma
}Is it a bug or a feature?

It'a feature. And it worked (or should have) in previous versions. I think it is a way to ease the work for automated code generation.
Check out the Java Language Specification:
An array initializer is written as a comma-separated list of expressions, enclosed by braces "{" and "}".
The length of the constructed array will equal the number of expressions.
The expressions in an array initializer are executed from left to right in the textual order they occur in the source code. The nth variable initializer specifies the value of the n-1st array component. Each expression must be assignment-compatible (�5.2) with the array's component type, or a compile-time error results.
If the component type is itself an array type, then the expression specifying a component may itself be an array initializer; that is, array initializers may be nested.
A trailing comma may appear after the last expression in an array initializer and is ignored.
http://java.sun.com/docs/books/jls/

Similar Messages

  • How can I make Address Book show names as (Last-comma-First)?

    Hi,
    I tried to tack this onto an old thread, but I'll try here again. Is there a way to show names in the Address Book as "Last-comma-First."? I understand about switching Last/first but cannot seem to find a way to show with a comma. The addresses I imported from my other computer (windows-outlook express) came over with the comma, but how do I do it for new ones, if possible?
    Thanks in advance
    PowermacG5   Mac OS X (10.4.7)  

    Using a comma in the name display was something that Outlook Express did. Address Book does not put a comma in the display and simply shows LastName FirstName. I think you'll find the the export file from Outlook Express was a CSV file. Commas were used to separate all the field names. However, actual name values are not stored with a comma.

  • [svn:cairngorm3:] 21115: updating the md5 and metadata and swc release ( just in case, we missed anything in our last commit)

    Revision: 21115
    Revision: 21115
    Author:   [email protected]
    Date:     2011-04-21 09:13:29 -0700 (Thu, 21 Apr 2011)
    Log Message:
    updating the md5 and metadata and swc release (just in case, we missed anything in our last commit)
    Modified Paths:
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/3.0.18/cairngorm3-3.0.18.pom
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/3.0.18/cairngorm3-3.0.18.pom.m d5
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/3.0.18/cairngorm3-3.0.18.pom.s ha1
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/cairngorm3/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/1.4/contract-1.4.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/1.4/contract-1.4.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/1.4/contract-1.4.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/contract/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/0.16/integration-0.16.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/0.16/integration-0.16.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/0.16/integration-0.16.swc.sha 1
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/integration/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/0.16/integrationParsle y-0.16.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/0.16/integrationParsle y-0.16.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/0.16/integrationParsle y-0.16.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/integrationParsley/maven-metadata.xml.sha 1
        cairngorm3/maven-repository/com/adobe/cairngorm/libraries/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/libraries/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/libraries/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/module/0.15/module-0.15.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/module/0.15/module-0.15.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/module/0.15/module-0.15.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/module/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/module/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/module/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/1.4/navigation-1.4.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/1.4/navigation-1.4.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/1.4/navigation-1.4.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigation/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/1.4/navigationParsley-1 .4.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/1.4/navigationParsley-1 .4.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/1.4/navigationParsley-1 .4.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationParsley/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/1.4/navigationSpringAS -1.4.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/1.4/navigationSpringAS -1.4.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/1.4/navigationSpringAS -1.4.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSpringAS/maven-metadata.xml.sha 1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/1.4/navigationSwiz-1.4.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/1.4/navigationSwiz-1.4.swc .md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/1.4/navigationSwiz-1.4.swc .sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/navigationSwiz/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/1.14/observer-1.14.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/1.14/observer-1.14.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/1.14/observer-1.14.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/observer/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/1.14/observerParsley-1.14 .swc
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/1.14/observerParsley-1.14 .swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/1.14/observerParsley-1.14 .swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/observerParsley/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/1.13/popup-1.13.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/1.13/popup-1.13.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/1.13/popup-1.13.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/popup/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/1.13/popupParsley-1.13.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/1.13/popupParsley-1.13.swc.m d5
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/1.13/popupParsley-1.13.swc.s ha1
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/popupParsley/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/task/1.10/task-1.10.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/task/1.10/task-1.10.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/task/1.10/task-1.10.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/task/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/task/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/task/maven-metadata.xml.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/1.13/validation-1.13.swc
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/1.13/validation-1.13.swc.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/1.13/validation-1.13.swc.sha1
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/maven-metadata.xml
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/maven-metadata.xml.md5
        cairngorm3/maven-repository/com/adobe/cairngorm/validation/maven-metadata.xml.sha1

    word!
    second that.
    This is really hard to follow, even for us who keep an eye on every update and read every single post and have an imagination of update problems out there.
    You tried to make digitalpublishing.acrobat.com (the "dashboard") the one-stop place for downloading and updating all necessary tools. good idea to make this the central point, because adobe.com download sections is a pain in the arse when trying to find updates for secondary tools like the DPS.
    also, make it super-duper clear what version is the current and what versio are currently available. I already wrote about lining up version numbers months ago and you seem to get this working — but it is still a mess. 1.7 vs 1.1.7 vs. 2.0 vs. drop17 vs. 11.4.2.201111104_m_670635 7.5.5.16 (you can imagine where I took the latter from)
    Peter: The bold line in the sticky forum message was added later, as I recall.
    —Johannes

  • [svn:bz-trunk] 18060: tomcat-users. xml had an invalid Unicode character in the last commit

    Revision: 18060
    Revision: 18060
    Author:   [email protected]
    Date:     2010-10-07 06:40:08 -0700 (Thu, 07 Oct 2010)
    Log Message:
    tomcat-users.xml had an invalid Unicode character in the last commit
    Modified Paths:
        blazeds/trunk/servers/apache-tomcat-6.0.29/conf/tomcat-users.xml

    Mugunthan
    Yes we have applied 11i.AZ.H.2. I am getting several errors still that we trying to resolve
    One of them is
    ===========>>>
    Uploading snapshot to central instance failed, with 3 different messages
    Error: An invalid status '-1' was passed to fnd_concurrent.set_completion_status. The valid statuses are: 'NORMAL', 'WARNING', 'ERROR'FND     at oracle.apps.az.r12.util.XmlTransmorpher.<init>(XmlTransmorpher.java:301)
         at oracle.apps.az.r12.extractor.cpserver.APIExtractor.insertGenericSelectionSet(APIExtractor.java:231)
    please assist.
    regards
    girish

  • Auto display the last data in array

    How can I auto display the new data in array without the scroll bar?

    If i understand you, you want show last data of array.
    You have use property node: IndexVals. You write there indexes of array frome there you want show the data.

  • Replace last comma with ' and '

    Hi All,
    please let me know is there any simple way of replacing last comma in as string with ' and '
    eg: 1.  abc,xyz,wuv should be returned abc,xyz and wuv
         2. abc,wuv should be returned abc and wuv
         3. abc,pqr,cuq,wuv should be returned abc ,pqr,cuq and wuv
    DB version : 11.2.0.3
    Thanks,
    DS

    With only SUBSTR and INSTR:
    <LQS with sample_data as ( select 'abc,xyz,wuv' str  from dual union
      2                        select 'abc,wuv' from dual union
      3                        select 'abc,pqr,cuq,wuv' from dual
      4                      )
      5  --
      6  -- actual query
      7  --
      8  select str
      9  ,      substr(str, 1, instr(str, ',', -1)-1)||' and '||substr(str, instr(str, ',', -1)+1)
    10  from   sample_data;
    STR             SUBSTR(STR,1,INSTR(STR,',',-1)-1)||
    abc,pqr,cuq,wuv abc,pqr,cuq and wuv
    abc,wuv         abc and wuv
    abc,xyz,wuv     abc,xyz and wuv
    3 rows selected.

  • Number of rows in last fetch when array festching?

    Hi!
    I know it must be somewhere, but I'm unable to find it in the documentation:
    In OCI 8.1 how can I get the actual number of rows fetched in the last call to OCIStmtFetch() when array fetching?
    E. g. when I have a buffer that can hold 100 column values and the select statement returns 140 rows, the second call to OCIStmtFetch() will only fill 40 items into the buffer. So the code processing the fetched rows should only iterate to 40 and not to 100. Is there a way to get this number with OCIGetAttr()?

    here's an example -
    orc = OCIAttrGet((dvoid *) stmthp_cur, (ub4) OCI_HTYPE_STMT,
    (dvoid *) &rows, (ub4 *) &sizep, (ub4)OCI_ATTR_ROWS_FETCHED,m_errhp);

  • Last element in array is overwriting the entire array

    Hey all,
    Im a java student working on a homework assignment. My issue is:
    I have created two classes. One called Dependent and one called employee
    inside employee i have an array of dependents. The dependents class has methods called getfirstname()
    and getlastname();
    bascially im doing this.
    static Dependent[] Dependents = new Dependent[2];
    Dependents[0] = new Dependent("Ryan", "Karr");
    Dependents[1] = new Dependent("John", "Doe");
    Dependent[0].getFirstName(); // this returns john
    Dependent[1].getFirstName(); // this returns john aswell
    what am i doing wrong? If i take the static off dependents i get an error.
    im sorry if this is sketchy this is my first term taking java.
    my source is below
    Thank you!
    Ryan
    public class Employee
         static Dependant[] dependents;                                                       // Dependents Array
         static int numDependents = 0;                                             // Number of Dependents
         public Employee(int pNumDependents)
              dependents = new Dependant[pNumDependents];                         // Instanciate the dependents array
              String dFirstName;                                                       // Dependents First Name
              String dLastName;                                                       // Dependents Last Name
              Scanner input = new Scanner(System.in);                              // New input Scanner
              for(int i = 0; i < dependents.length; i++)
                   System.out.println("Dependent #" + (i+1));                    // A little bit of direction for the user
                   System.out.println("First Name: ");
                   dFirstName = input.nextLine();                                   // Dependents first name from user
                   System.out.println("Last Name: ");
                   dLastName = input.nextLine();                                   // Dependents last Name from user
                   addDependant(dFirstName, dLastName, this);                    // Add dependent call     
         public static void addDependant(String pFirstName, String pLastName, Employee employee)
                   // Make a new dependent
                   dependents[numDependents] = new Dependant(pFirstName, pLastName, employee);     
                   // Number of the dependent we're on plus one
                   numDependents++;
    }

    That was an example i made up. the error is with the code i posted, It doesnt through an error, it runs. However, when i do run it all the information inside is over written by the last value i entered.
    the code above was for addDependent which i call in the segment below, which obtains data from the user
              String dFirstName;                                                       // Dependents First Name
              String dLastName;                                                       // Dependents Last Name
              Scanner input = new Scanner(System.in);                              // New input Scanner
              for(int i = 0; i < dependents.length; i++)
                   System.out.println("Dependent #" + (i+1));                    // A little bit of direction for the user
                   System.out.println("First Name: ");
                   dFirstName = input.nextLine();                                   // Dependents first name from user
                   System.out.println("Last Name: ");
                   dLastName = input.nextLine();                                   // Dependents last Name from user
                   addDependant(dFirstName, dLastName, this);                    // Add dependent call     
              }

  • Last array element

    Hi
    In run mod, when I add elements in array, I want to see the last element of array automatically.
    How can I do this.(without using vertical scrollbar.)
    Solved!
    Go to Solution.

    In a thousand words or less.  You use property nodes to programatically access objects properties.
    (Yes you have to run it twice to see the result I didn't set a default value)
    Jeff
    Attachments:
    Untitled 4.vi ‏13 KB

  • Array from .txt

    Hi all,
    I have a nice photo gallery which uses an array like this:
    photos = ["portraits/1.jpg", "portraits/2. jpg", "portraits/3. jpg", "portraits/4. jpg", "portraits/5. jpg", "portraits/6. jpg"];
    All is well in the world but now I need to import the array data form a .txt file which has been created by php.
    It writes the data exactly as it is above (without "photos ="). It creates the hard brackets, commas, misses out the last comma
    and inserts a hard bracket and a semi colon. (cool php from a dynamically changing images folder...)
    So the string in the .txt file is:
    ["portraits/1.jpg", "portraits/2. jpg", "portraits/3. jpg", "portraits/4. jpg", "portraits/5. jpg", "portraits/6. jpg"];
    On the main timeline (have to add lots of code afterwards to make the gallery work) how do I set the variable
    "photos" (as an array) and then import the string from the .txt file as it's value?
    I'm using Flash 8  
    All and any help much appreciated 
    Best wishes
    Tony

    Yeah sorry for the twelve bore approach - it should have gone into the AS1&2  first.
    Splattergun by accident not design...

  • Problem while splitting a string based on ' comma '

    Hi,
    I'm trying to upload a file in .csv format into an internal table. For this i'm declaring an internal table it_iflat and a work area wa_xflat as shown below.
    DATA:  it_iflat type table of string,
           wa_xflat type string.
    Now, once i have data in it_iflat..i loop at each record and split it at the occurance of a comma. as shown below.
    DATA:  it_irec type table of string with header line.
    loop at it_iflat into wa_xflat.
         clear it_irec.
        refresh it_irec.
        split wa_xflat at ',' into table it_irec.
    This is working fine when the <b>last column</b> of the excel sheet is populated. But when this field is left blank in the excel sheet..the total number of values that i get in it_irec is one less than the actual.
    Is this happening because the last column doesn't have a value and since its after the last comma..its getting neglected?
    Could anyone please let me know how to resolve this.
    Thanks in advance
    Harsha.

    If there is a value in the last column, then the value should appear in the last column of your itab.
    Maybe try it this way instead.
    report zrich_0001.
    data: it_iflat type table of string,
          wa_xflat type string.
    data: begin of it_irec occurs 0,
          fld1(10) type c,
          fld2(10) type c,
          fld3(10) type c,
          end of it_irec.
    clear it_irec.   refresh it_irec.
    loop at it_iflat into wa_xflat.
      clear it_irec.
      split wa_xflat at ',' into it_irec-fld1
                                 it_irec-fld2
                                 it_irec-fld3.
      append it_itrec.
    endloop.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • User defined func: Unavble to merge two arrays in result list

    Hi
    I am trying to merge two arrays on the basis of "FEE" element in the input file;
    Actually there is an Attribute Name and Value pair array coming in the input file which has 5 pairs already(Notification + 100 , oversize + 8 etc.) see example below;
    <m0:Fees>ZB9</m0:Fees>
    <m:Attribute>
      <m0:Attributename>NOTIFICATION</m0:Attributename>
      <m0:Attributevalue>100</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERSIZE</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERWEIGHT</m0:Attributename>
      <m0:Attributevalue>108</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>SIGNATURE</m0:Attributename>
      <m0:Attributevalue>294</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>RTS</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    The condition is:
    CASE 1. If the FEE doesn't exist in the file then only the Atrribute Name and Value in added to the Array
    CASE 2 If FEE exist then add all the Atrribute Name and Value pairs as well as in the last index of Array add String "Fee" in Attributename and String "ZB9" in  Attributevalue.
    CASE 1 is working fine.
    but in CASE 2 even if i m taking an output array of length Attributename +1 and Attributevalue +1 and trying to add "Fee" and "ZB9" respectively, it never happens.
    Please have a look at the code below;
       //write your code here
    public void ud_Attributename(String[] Fees,String[] Attributename,ResultList result,Container container){
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String array_copy1[]=new String[Attributename.length+1];
              //int len =Attributename.length;
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04"))
                        for(int x=0;x<=Attributename.length;x++)
                             if(x==Attributename.length)
                             array_copy1[x]="Fee";
                             else{
                             array_copy1[x]=Attributename[x];
                             result.addValue(array_copy1[x]);
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    Same way i've used for Attributevalue.
    But the result is
    <ATTRIBUTEPAIR>
    <PAIR>
    <NAME>NOTIFICATION</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Please suggest where i am wrong. ur help is very much appreciated.
    Thnks in advance

    this is i am doing now
       //write your code here
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String attribute_name1[]={"Fee"};
              //String[] Attributename.copyTo(attribute_name1,0);
              //String[] attribute_name1 = (String[]) Attributename.Clone();
              //String fees;
              String array_copy1[]=new String[Attributename.length];
              int len =Attributename.length;
              for(int y=0;y<len;y++){
              array_copy1[y]=Attributename[y];
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
                   else if(Fees[0].equals("ZA1"))
                   Fees[0]="05";
                   else if(Fees[0].equals("ZA2"))
                   Fees[0]="06";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04")||(Fees[0]=="05")||(Fees[0]=="06"))
                        int j=0;
                        for(int a=0;a<=len;a++)
                             if(j==0&&attribute_copy[j]==null)                                   
                                  attribute_copy[j]="Fee";
                             else
                                  //int b=-1;
                                  for(int i=0;i<=len;i++)
                                       if(i==j)
                                       //i=i-1;
                                       attribute_copy[j]=array_copy1[i-1];
                                       break;
                                       else{
                                       continue;}
                        result.addValue(attribute_copy[j]);
                        j+=1;
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    and the result in queue is
    SUPPRESS
    [FEE]
    [NOTIFICATION]
    [NOTIFICATION]
    [OVERSIZE]
    [OVERSIZE]
    [OVERWEIGHT]
    [OVERWEIGHT]
    [SIGNATURE]
    [SIGNATURE]
    [RTS]
    [RTS]
    but in the output i m getting
    <ATTRIBUTEPAIR>
    <REF_HANDLE>0001</REF_HANDLE>
    <PAIR>
    <NAME>Fee</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Notification is missing.

  • Display color array then 1 second later display same array with color change

    Hi there, I'm new to LabVIEW and this is my first post. I'm using LabVIEW 9.0.1
    Please have a look at this simple program attached below; when I've worked out this part of the program, it will be the starting up sequence of a game
    the lights need to be set to white before running the program.. When the program runs the hexadecimal 'array 2' is projected as colors on 'array'. Then 1 second later, a green light is added to the centre and displayed in 'array 4'...
    I am attempting to have the green light go on on the same array after 1 second. As opposed to on array 4...
    When I've figured out how to do this I'll add many more time iterations, whereby a color is changed on each one. Thus making a nice startup sequence.
    any help is appreciated, thanks in advance for your help!
    p.s. add 00FF0000 to the last box in 'array 2' before you hit play.
    Attachments:
    attempt 1.vi ‏10 KB

    I think you should learn about shift registers.
    Your larger program will probably work better and be easier to modify and maintain if you use a state machine in place of the sequence structure.
    Lynn

  • ORA-00932 when trying to pass ARRAY from Java SP to PL/SQL

    Hi all
    I am trying to pass ARRAYs back and forth between PL/SQL and Java stored procedures. But I keep getting:
    ORA-00932: inconsistent datatypes: expected a return value that is an instance of a user defined Java class convertible to an Oracle type got an object that could not be converted
    Here's my PL/SQL:
    create or replace type CONTENTP.sentences_array as VARRAY(1000) of CLOB
    -- I've also tried .. as TABLE of CLOB and varray/table of VARCHAR2
    declare
    proc_clob CLOB;
    arr SENTENCES_ARRAY;
    begin
    SELECT document_body
    into proc_clob
    from documents
    where document_id = 618784;
    arr := processdocument.sentencesplit (proc_clob);
    end;
    PROCESSDOCUMENT package definition:
    CREATE OR REPLACE PACKAGE CONTENTP.PROCESSDOCUMENT AS
    FUNCTION sentenceSplit(Param1 CLOB)
    return SENTENCES_ARRAY
    AS
    LANGUAGE java
    NAME 'com.contentp.documents.ProcessDocument.sentenceSplit(oracle.sql.CLOB) return oracle.sql.ARRAY';
    FUNCTION removeHTML(Param1 CLOB)
    return CLOB
    AS
    LANGUAGE java
    NAME 'com.contentp.documents.ProcessDocument.removeHTML(oracle.sql.CLOB) return oracle.sql.CLOB';
    end;
    Java sentenceSplit code:
    public static oracle.sql.ARRAY sentenceSplit ( CLOB text) throws IOException, SQLException
    Connection conn = new OracleDriver().defaultConnection();
    String[] arrSentences = sent.getsentences ( CLOBtoString (text) );
    ArrayDescriptor arrayDesc =
    ArrayDescriptor.createDescriptor ("SENTENCES_ARRAY", conn);
    ARRAY ARRSentences = new ARRAY (arrayDesc, conn, arrSentences);
    return ARRSentences;
    I have confirmed that the String[] arrSentences contains a valid string array. So the problem seems to be the creation and passing of ARRSentences.
    I have looked at pages and pages of documents and example code, and can't see anything wrong with my declaration of ARRSentences. I'm at a loss to explain what's wrong.
    Thanks in advance - any help is much appreciated!

    I am trying to do something similar but seems like getting stuck at registerOutParameter for this.
    Type definition:
    CREATE OR REPLACE
    type APL_CCAM9.VARCHARARRAY as table of VARCHAR2(100)
    Java Stored Function code:
    public static ARRAY fetchData (ARRAY originAreaCds, ARRAY serviceCds, ARRAY vvpcs) {
    Connection connection = null;
         ARRAY array = null;
         try {
         connection = new OracleDriver ().defaultConnection();
         connection.setAutoCommit(false);
    ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", connection);
    String[] result = new String [2];
    result[0] = "Foo";
    result[1] = "Foo1";
    array = new ARRAY (adString, connection, result);
    connection.commit ();
    return array;
    } catch (SQLException sqlexp) {
    try {
    connection.rollback();
    } catch (SQLException exp) {
    return array;
    Oracle Stored Function:
    function FETCH_TRADE_DYN_DATA (AREA_CDS IN VARCHARARRAY, SERVICE_CDS IN VARCHARARRAY,VV_CDS IN VARCHARARRAY) return VARCHARARRAY AS LANGUAGE JAVA NAME 'com.apl.ccam.oracle.js.dalc.TDynAllocation.fetchData (oracle.sql.ARRAY, oracle.sql.ARRAY, oracle.sql.ARRAY) return oracle.sql.ARRAY';
    Java Code calling Oracle Stored Procedure:
    ocs = (OracleCallableStatement) oraconn.prepareCall(queryBuf.toString());
                   ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", oraconn);
                   String[] originAreaCds = sTDynAllocationVO.getGeogAreaCds();
                   ARRAY areaCdArray = new ARRAY (adString, oraconn, originAreaCds);
                   ocs.registerOutParameter(1, OracleTypes.ARRAY);
                   ocs.setArray (2, areaCdArray);
                   String[] serviceCds = sTDynAllocationVO.getServiceCds();
                   ARRAY serviceCdsArray = new ARRAY (adString, oraconn, serviceCds );
                   ocs.setArray (3, serviceCdsArray);
                   String[] vvpcs = sTDynAllocationVO.getVesselVoyagePortCdCallNbrs();
                   ARRAY vvpcsArray = new ARRAY (adString, oraconn, vvpcs);
                   ocs.setArray (4, vvpcsArray);
    ocs.execute();
    ARRAY results = ocs.getARRAY(1);
    Error I get:
    Parameter Type Conflict: sqlType=2003
    Thanks for help in advance.

  • Commit on thousands of records

    Hello,
    I've encountered the following problem while trying to update records in an Oracle 8i database :
    I have a java program that updates thousands of records from a flat file to the oracle database, the "commit" command is done at the end of the program,the problem is that some records are not updated in the database but no exception is raised !
    If I try to do a commit after each update, the problem seems to be solved, but of course it takes more time to do the massive update, and I think it is not recommended to do a commit after each record?
    Is there a limit to which a commit can be done? (a number of maximum records to be updated)
    Thanks greatly for your help!
    Regards,
    Carine

    If it was a problem with the size of the rollback statements, you would have received an error.
    But are you sure that you don't have any neglected errors (like a when others that does no handling?). In that case you wouldn't receive any error and no rollback would be performed (but a commit instead) resulting in "saving" your already done modifications.
    In the book "expert one-on-one" from thomas kyte, there is a chapter of what exactly a commit does.
    a small extract:
    basicly a commit has a fairly flat response time. This because 99.9 percent of the work is already done before you commit.
    [list]
    [*]you have already genererated the rollback segments in the sga
    [*]modified data blocks have been generated in the sga
    [*]buffered redo for the above two items has been generated in the sga
    [*]depending on the size of the above three, and the amount of time spent, some combination of the above data may have been flushed onto disk already
    [*]all locks have been acquired
    [list]
    when you commit, all that is left is the following
    [list]
    [*]generate a scn (system change number) for our transaction
    [*]lgwr writes all of our remaining buffered redo log entries to disk, and records the scn in the online redo log files as well. This step is actually the commit. if this step occurs, we have committed. Our transaction entry is removed, this shows that we have committed. Our record in the v$transaction view will 'disappear'.
    [*]All locks held by our session are released, and everyone who was enqueued waiting on locks we held will be released.
    [*]Many of the blocks our transaction modified will be visited and 'cleaned out' in a fast mode if they are still in the buffer cache.
    [list]
    Flushing the redo log buffer by lgwris the lengthiest operation.
    To avoid long waiting, this flushing is done continuously as we are processing:
    [list]
    [*]every three seconds
    [*]when the redo log buffer is one third or one MB full
    [*] upon any transaction commit
    [list]
    for more information do a search on akstom.oracle.com or read his book.
    But is must be clear that the commit on itself has no limits on processed rows.
    There's no limit re: commit. There is a limit on the number of rows that can be modified (updt, del, ins) ina transaction (e.g. between commits). It depends on rollback segment size (and other activity). This varies with each database (see your DBA).
    If you were hitting this limit it would normally "rolllback" all changes to the last commit.
    Ken
    =======
    Hello Ken,
    Thanks a lot for this quick answer. The wonder is that I do not get any error message concerning the rollback segment:
    if I do the commit at the end after updating thousands of records, it seems like it was done correctly but I see that only some records have not been updated in the database (thus I would not be hitting the limit as all changes would have been rolledback) ?
    Is there a way to get a return status from the commit ? Should I do a commit after each 1000 records for example?
    Thanks again,
    Carine

Maybe you are looking for

  • How do I erase ALL the files on my MacBook Pro?

    I've just gotten a new MacBook Air and successfully migrated all my data from my MacBook Pro. Now I'd like to clean up my MacBook Pro for my son. I don't want to erase all the applications, but I do want to erase all my files. Is there an easy way to

  • I read stories on my iPod, I can get text on there ok, no quotations? why?

    I want to read stories on my iPod, so when I put them on there they take out all the quotations, so sometimes it's difficult to tell when people are speaking or not. Can anybody help me? Sometimes it works when I was using http://www.ambience.sk/ipod

  • Get-DPMJob doesn't show On-going Consistency Check

    When I use the $jobs=get-dpmJob -dpmservername DPM10 powershell command, the Consistency Check job type that shows a status of "in progress" in the DPM 2012 SP1 Admin Console does not show up in the $jobs list variable under PowerShell. However, on a

  • Number of PROCESS

    Hi, In the initSID.ora, we can specify PROCESS=<number> I new that this is the maximum processes, but what is it ? Anyone can explain more detail ? For LARGE site, what is the optimal setting ? Is it true that smaller value will increase the performa

  • After installing mavericks, my air unexpectedly restarts all the time?!

    Updated to Mavericks yesterday and now my laptop force-restarts randomly every hour or so. Not cool! Apple, what is up? My battery life is also draining quickly but I'm not sure if that's related to the shutdowns or the new OS.