Regarding Array and ArrayList

Hi all,
if any body knows the difference between Array and Array List Conceptually tell me the differences..
Thanks ,
Naveen

An array is a less dynamic structure than an ArrayList. An array gets a fixed size once it's created. It's memory is allocated upon creation, generally these are sequential memory locations.
An ArrayList provides the same features as an Array: you can acces the contents by index. It add the features of a List to it: getting the head, traversing contents, inserting, appending... It also can grow in size dynamically. This is done by giving each element in an ArrayList a reference to the next element. This allows the elements to be stored throughout the available memory.

Similar Messages

  • Help plz regarding array and DB

    hi ,
    i have a problem regarding sorting.
    I have 1 million records in my DB table.
    When i open my swing application i sort the records in table [ORDER BY col1,col3,col4] like that and want that order record ids .
    upto here no problem.i am getting the ids in array and in my swing application when i go next i get from arrray the next record.
    but the problem is since the volume of the table is large if any addition r deletion to the table is not reflecting in the sorted order array.
    i can simply again call the database and sort it an update the error.but it proved very insufficent way.
    so i am looking something to optmise the sorting.
    i got an idea like using view .but i am looking anybody knows any workaround alogrithm for this.
    sree

    Here is an example taken from the ResultSet API Doc's. Note the constant type of "TYPE_SCROLL_SENSITIVE" for the type of ResultSet. Is this what you are using? (I have not tried this, but it is the solution that is put forth in my books and documents.)
           Statement stmt = con.createStatement(
                                          ResultSet.TYPE_SCROLL_SENSITIVE,
                                          ResultSet.CONCUR_UPDATABLE);
           ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
           // rs will be scrollable, will not show changes made by others,
           // and will be updatable

  • Question regarding selectOneMenu and PROCESS_VALIDATIONS(3) phase

    Hi im a bit lost regarding selectOneMenu and how validation phase all works together.
    The thing is that i have a simple selectOneMenu
    <h:form id="SearchForm">                                                  
         <h:panelGrid columns="3"  border="0">
              <h:outputLabel id="caseTypeText" value="#{msg.searchCaseCaseType}" for="caseType" />                         
              <h:selectOneMenu id="caseType" value="#{searchCaseBean.caseType}" style="width: 200px;" binding="#{searchCaseBean.caseTypeSelect}">     
                   <f:selectItem itemValue="" itemLabel="#{msg.CommonTextAll}" />                                             
                   <f:selectItems value="#{searchCaseBean.caseTypes}"  />                              
              </h:selectOneMenu>
              <h:message for="caseType" styleClass="errorMessage" />
              <h:panelGroup />
              <h:panelGroup />
              <h:commandButton action="#{searchCaseBean.actionSearch}" value="#{msg.buttonSearch}" />
         </h:panelGrid>
    </h:form>Now when i hit submit button i can see that the bean method searchCaseBean.caseTypes (used in the <f:selectItems> tag) is executed in the PROCESS_VALIDATIONS(3) phase. How come? I dont whant this method to be executed in phase 3, only in phase 6.
    If i add the this in the method if (FacesContext.getCurrentInstance().getRenderResponse())
    public List<SelectItem> getStepStatuses(){
         List<CaseStep> caseSteps = new ArrayList<CaseStep>();
         if (FacesContext.getCurrentInstance().getRenderResponse()) {
              caseSteps = getCaseService().getCaseStep(value);     
         List<SelectItem> selectItems = new ArrayList<SelectItem>(caseSteps.size());
         for(int i=0; i < caseSteps.size(); i++){
              CaseStep step = caseSteps.get(i);               
              String stepStatus = step.getStatus() + "_" + step.getSubStatus();           
              selectItems.add(new SelectItem(stepStatus, step.getShortName()));
         return selectItems;
    } Now i get a validation error (javax.faces.component.UISelectOne.INVALID) for the select field and only phase1, phase2, phase 3 and phase 6 is executed.
    Im lost?

    I see. Many thanxs BalusC. Im using your blog very often, and its very helpfull for me.
    I changed now to use the constructor load method instead. But know im getting problem of calling my service layer (Spring service bean). Its seems they havent been init when jsf bean is calling its constructor.
    Can i init the spring service bean from the faces-config file?
    JSF Bean
        public SearchCaseBean() {
              super();
                    //caseService need to be init
              if(getCaseService() == null){
                   setCaseService((CaseService)getWebApplicationContextBean("caseService"));
              fillCaseTypeSelectItems();
              fillCaseStatusSelectItems();
    .....faces-config
    <managed-bean>
              <managed-bean-name>searchCaseBean</managed-bean-name>
              <managed-bean-class>portal.web.SearchCaseBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>          
              <managed-property>
                   <property-name>caseService</property-name>
                   <value>#{caseService}</value>
              </managed-property>
         </managed-bean>

  • How to ask for an array and how to save the values

    I'm supposed to be learning the differences between a linear search and a binary search, and the assignment is to have a user input an array and search through the array for a given number using both searches. My problem is that I know how to ask them how long they want their array to be, but I don't know how to call the getArray() method to actually ask for the contents of the array.
    My code is as follows:
    import java.util.Scanner;
    import java.util.ArrayList;
    public class Main
        private static Scanner input = new Scanner(System.in);
        public static void main (String args[])
            //creates ArrayList
            int List[];
            System.out.println("How long would you like the array to be?");
            int arrayLength = input.nextInt();
            //Initializes array list
            List = new int [arrayLength];
            System.out.println("Please enter the first value of the array");
        public static void getArray(int List[], int arrayLength)
            for(int i=0; i < arrayLength; i++) {
                 System.out.println("Enter the next value for array");
                 List[i] = input.nextInt();
         public static void printArray(int List[])
             for(int i=0; i < List.length; i++)
                 System.out.print(List[i] + " ");
    public class search
        public static int binarySearch(int anArray[], int first, int last, int value)
            int index;
            if(first > last) {
                index = -1;
            else {
                int mid = (first + last)/2;
                if(value == anArray[mid]) {
                    index = mid; //value found at anArray[mid]
                else if(value < anArray[mid]) {
                    //point X
                    index = binarySearch(anArray, first, mid-1, value);
                else {
                    //point Y
                    index = binarySearch(anArray, mid+1, last, value);
                } //end if
            } //end if
            return index;
        //Iterative linear search
        public int linearSearch(int a[], int valueToFind)
            //valueToFind is the number that will be found
            //The function returns the position of the value if found
            //The function returns -1 if valueToFind was not found
            for (int i=0; i<a.length; i++) {
                if (valueToFind == a) {
    return i;
    return -1;

    I made the changes. Two more questions.
    1.) Just for curiosity, how would I have referenced those methods (called them)?
    2.) How do I call the searches?
    import java.util.Scanner;
    import java.util.ArrayList;
    public class Main
        private static Scanner input = new Scanner(System.in);
        public static void main (String args[])
            //creates ArrayList
            int List[];
            System.out.println("How many values would you like the array to have?");
            int arrayLength = input.nextInt();
            //Initializes array list
            List = new int [arrayLength];
            //Collects the array information
            for(int i=0; i < arrayLength; i++) {
                 System.out.println("Enter a value for array");
                 List[i] = input.nextInt(); 
            //Prints the array
            System.out.print("Array: ");
            for(int i=0; i < List.length; i++)
                 System.out.print(List[i] + " ");
            //Asks for the value to be searched for
            System.out.println("What value would you like to search for?");
            int temp = input.nextInt();
            System.out.println(search.binarySearch()); //not working
    }

  • How to save data in a 4D array and make partial plots in real time?

    Hi, this is a little complex, so bear with me...
    I have a test system that tests a number of parts at the same time. The
    experiment I do consists of measuring a number of properties of the
    parts at various temperatures and voltages. I want to save all the
    measured data in a 4-dimensional array. The indices represent,
    respectively, temperature, voltage, part, property.
    The way the experiment is done, I first do a loop in temperature, then
    in voltage, then switch the part. At this point, I measure all the
    properties for that condition and part and want to add them as a 1D
    array to the 4D array.
    At the same time, I want to make a multiple plot (on an XY graph) of
    one selected property and part (using two pull-down selectors near the
    XY graph) vs. voltage. (The reason I need to use an XY graph and not a
    waveform graph, which would be easier, is that I do not have
    equidistant steps in voltage, although all the voltage values I step
    through are the same for all cases). The multiple plots are the data
    sets at different temperatures. I would like to draw connection lines
    between the points as a guide to the eye.
    I also want the plot to be updated in the innermost for loop in real
    time as the data are measured. I have a VI working using nested loops
    as described above and passing the 4D array through shift registers,
    starting with an array of the right dimensions initialized by zeroes. I
    know in advance how many times all the loops have to be executed, and I
    use the ReplaceArraySubset function to add the measured properties each
    time. I then use IndexArray with the part and property index terminals
    wired to extract the 2D array containing the data I want to plot. After
    some transformation to combine these data with an array of the voltage
    values in the form required to pass to the XYGraph control, I get my
    plot.
    The problem is: During program execution, when only partial data is
    available, all the zero elements in the array do not allow the graph to
    autoscale properly, and the lines between the points make little sense
    when they jump to zero.
    Here is how I think the problem could be solved:
    1. Start with an empty array and have the array grow gradually as the
    elements are measured. I tried to implement this using Insert Into
    Array. Unfortunately, this VI is not as flexible as the Replace Array
    Subset, and does not allow me to add a 1D array to a 4D array. One
    other option would be to use the Build Array, but I could not figure
    out if this is usable in this case.
    2. The second option would be to extract only the already measured data
    points from the 4D array and pass them to the graph
    3. Keep track of the min. and max. values (only when they are different
    from zero) and manually reset the graph Y axis scale each time.
    Option 3 is doable, but more work for me.....
    Option 2: I first tried to use Array Subset, but this always returns an
    array of the same dimensionality of the input array. It seems to be
    very difficult, but maybe not impossible, to make this work by using
    Index Array first followed by Array Subset. Option 3 seems easier.
    Ideally, I would like option 1, but I cannot figure out how to achieve
    this.
    Your help is appreciated, thanks in advance!
    germ Remove "nospam" to reply

    In article <[email protected]>,
    chutla wrote:
    > Greetings!
    >
    > You can use any of the 3D display vi's to show your "main" 3d
    > data, and then use color to represent your fourth dimension. This can
    > be accessed via the property node. You will have to set thresholds
    > for each color you use, which is quite simple using the comparison
    > functions. As far as the data is concerned, the fourth dimension will
    > be just another vector (column) in your data file.
    chutla, thanks for your post, but I don't want a 3D display of the
    data....
    > Also, check out
    > the BUFFER examples for how to separate out "running" data in real
    > time.
    Not clear to me what you mean, but will c
    heck the BUFFER examples.
    > As far as autoscaling is concerned, you might have to disable
    > it, or alternatively, you could force a couple of "dummy" points into
    > your data which represent the absolute min/max you should encounter.
    > Autoscaling should generally be regarded as a default mode, just to
    > get things rolling, it should not be relied on too heavily for serious
    > data acquisition. It's better to use well-conditioned data, or some
    > other means, such as a logarithmic scale, to allow access to all your
    > possible data points.
    I love autoscaling, that's the way it should be.
    germ Remove "nospam" to reply

  • I would like to migrate from Aperture. What happens to my Masters which are on a RAID array and then what do I do with my Vault which is on a separate Drive please ?

    I am sorry, but I do noisy understand what happens to my RAW original Master files, which I keep offline on a RAID array and then what I do with my Vault which as all my edited photos ? Sorry for such a simple question, but would someone please help my lift the fog ?
    Thanks,
    Rob

    Dear John ,
    Apologies, as I am attempting to get to the bottom of this migration for my wife ( who is away on assignment ) and I am not 100% certain on the technical aspects of Aperture, so excuse my ignorance.
    She has about 6TB worth of RAW Master images ( several 100 thousand ) which, as explained, are on an external RAID drive. She uses a separate Drive as a Vault . Can I assume that this Vault contains all of her edits, file structures , Metadata, etc ?
    So, step by step........She can Import into Lightroom her Referenced Masters from her RAID and still keep them there ? Is that correct ?
    The Managed Files that are backed up by her Vault , are in the pictures folder of her MacPro, but not in a structure that looks like her Aperture library ? This means Lightroom will just organize all the Managed files, simply by the date in the Metadata ? Am I correct ( Sorry for being so tech illiterate ).
    How do I ensure she imports into Lighgtroom in exactly the same format as she runs her workflow in Aperture ?  ( Projects, that are organized by year and shoot location and Albums within those projects with sub-locations, or species , etc ). What exactly do I need to do in Aperture please to organize Managed Files to create a mirror structure of Aperture on my internal Hard Drive ?
    There are a couple of points I am unsure about in regard to Lightroom. Does it work in the same way as Aperture ? Meaning, can she still keep Master Files on an external RAID and Lightroom will reference them ? If the answer is yes, how do you back up your Managed ( edited ) work in Lightroom ? ( Can you still use an external Drive as a Vault ? ) . Will the vault she uses now be able to continue to back up Managed Files post migration ?

  • Inserting Records in an Array and using a constructor with it

    I badly need help on this! Please please please! I have been studying java for a short time only.
    Anyway, here goes: My project requires the following:
    Employee inputs the no. of video in the shelf. They have four classifications: Drama, Comedy, Action, and Thriller. Each video classification has different rates. The employee creates a video record containing the following information: 1. video ID number, 2. video classification, and 3. Price.
    The employee should display the classifications of videos available and the price. Only the available video tapes would be displayed according to the customer's chosen classification. When the customer chooses the video he wants to rent, the program will register and attach the name of the customer to the video number.
    I only need to use arrays, and NOT database to record the information.

    is it ok i i declare the drama_rate outside the video class?
    i have a list of variables on my videoupdate classYes. It's probably best to declare it static & then you can access it directly:
    public static float drama_rate = 100.0;
    rate = <the class name>.drama_rate;
    so, i should also include a customer no. both in the video and customer class.I would. You may want to list a bunch of videos and who currently has them. This way you don't have to search the customers AND the videos to do this.
    thanks =) i don't know either why we had to validate/invalidate,\
    but our applet doesnt refresh when >it is supposed to, so
    we just used this method. It wouldnt slow down the application, would it?Could you just revalidate()?
    the use of arrays. i havent finished with the program yet.
    i have the design already, i just couldnt put it in code.
    im not familiar with the use of multidimensional arrays-
    can i use this for the video and customer records i will need to store?Not sure what you're using arrays for, but here's an example of something I might do. Maybe it will be useful to you.
    Have you looked at HashMaps? You could use "Customer" as the key and then use an ArrayList of checked out Videos as the value:
    HashMap customers = new HashMap();
    ArrayList videos = new ArrayList();
    //Add the checked out videos to the list
    videos.add(video);
    <etc>
    // Add this customer and the list of videos he has checked out.
    customers.put(customer,videos);
    [\code]

  • ARRAY and records at multiple level ? please help

    Hi experts!!
    I am struck up with a problem. If u can please help me.
    I need a structure of this type.
    create type GRADE as object(
    grade varchar2(30)
    / -- works fine , creates
    create type GRADE_ARRAY as VARRAY(10) of GRADE;
    / -- works fine and creates
    create type SPECIES as object
    Species_number number,
    array_of_grade GRADE_ARRAY
    / works fine
    create type SPECIES_ARRAY as VARRAY(20) of SPECIES;
    -- error comes here.. Can not have multiple level..type error
    and so can not go ahead. In fect I wanted to use next level also. like this.
    The next command remains my dream only then because I could not create the SPECIES ARRAY it self..
    create type TIMBER as object
    timber_mark varchar2(6),
    no_species number,
    array_of_species(20) SPECIES_ARRAY
    the problem is for multiple level ARRAY AND RECORD/object combination..
    I tried with OBJECT AND VARRAY it does only for one level.. not even two level.
    my Mail ID:
    [email protected]
    Thanks and Regards..
    Virendra chauhan

    I think multi-level collections was first implemented in 9.2. You failed to mention what version of the DB you are using.

  • How to create an array of ArrayLists?

    Hello,
    I'm trying to compile the following code:
    ArrayList<Object> arr[];
    arr = new ArrayList<Object>()[size];in order to create an array of ArrayLists. I'm being met with the following compilation error:
    The type of this expression must be an array type but it resolved to ArrayList<Object>
    Can anyone show me how to correctly do this?
    Thanks

    {color:#3D2B1F}This line:
    List<Object>[] arr = new ArrayList<Object>[5];generates the compiler error: "generic array creation" (generics and arrays don't play well together)
    Since you are just parameterizing with Object, you can use non-generic collections:
    List[] arr = new ArrayList[5];Me? I don't like mixing arrays and collections. I would have a list of lists:
    List<List<X>> matrix = new ArrayList<List<X>>();{color}

  • Rookie Question: Swap values? Declare an array and values of its indices?

    Hello,
    I hope this is the right forum: I have a simple Java Problem but i do not get it.
    Is like that: I have to swap values within an array e.g i have one array with 3 indices. Indice 0 (the first indice) has value 12. The middle indice has no value, and the second indice has value 9. How to swap 9 to 12 and 12 to 9 without direct swap, in other words, by using the middle indice that has no value or is zero? And how do i write it in an array?
    My other questions: How do i Declare an array and values of its indices?
    I hope this is the right forum or site at all, in cas enot, i hope you still can help or give me links that could help. I really need this.

    Hi Rookie,
         http://forum.sun.com is the best place to get answers for your queries.
         Answer to you first question:
         array[0]=array[0]+array[2]; // array[0] will have 21, because 9+12.
         array[2]=array[0]-array[2]; // array[2] will have 9, because 21-12.
         array[0]=array0]-array[2];  // array[0] will have 12, because 21-9.   
         Hope your first query is resolved.
         I will answer your next query in my next reply.
    Thanks & Regards,
    Charan.  

  • Charts and graph shown as --array and cluster datatype in block diagram

    Hi friends,
    I new user...
    I have a basic doubt...
    In many examples the graph and charts are shown as "array data type and cluster data type "------in the block diagram panel...
    Please tell me, how these data types are shown as graph and charts in the front panel window.....
    regards
    raja

    These are very basic issues and it should be clear once you study the online help and examples for a while.
    Waveform Graphs
    Plain waveform graphs assume equally spaced data. The x-values are implicit from x0 and dx of the x-axis. By default x0=0 and dx=1, meaning the x-values are the array indices. You can change the offset and multiplier from the properties dialog or programmatically via property nodes.
    If you give a 2D array, there will be multiple graphs. Transpose if needed.
    Alternatively, you can give a cluster of [x0, dx, y-array] and the x-axis will adjust accordingly.
    As another alternative, you can built a waveform datatype and feed it to the graph.
    You can also graph dynamic data.
    XY graphs
    xy graphs are needed if the x-vlaues are not regularly spaced.They take a variety of data formats, so pick what is most approriate for the data
    A cluster of an x-array and a y-array
    An array of clusters, each containing an xy pair
    A complex datatype (it will graph imaginary vs. real or similar).
    Charts
    Charts are different, because they maintain a data history buffer an retain a certain amount of data. Some examples of data inputs:
    A single scalar: it wil be appended to the existing chart data, possibly throwing out the oldest existing point.
    An array: The array data will be appended to the existing chart data.
    A cluster of e.g. 5 points: The chart will have 5 dividual plots, one point gets appended to each plot.
    etc.
    The express xy-graph can be configured as xy chart, etc.
    Sure, it is a bit complicated at the beginning, but the complexity also gives you flexibility to do exactly what you want. Just play around with various scenarios and look at the outcome. The best way to learn!
    LabVIEW Champion . Do more with less code and in less time .

  • Finding top five number in an array of arraylists.

    I have to write a method with a heading
    public static int [] findTopFiveMostSteps ( ArrayList [] temp )i will input an array of arraylists, and I have to write this method
    that will return a integer array containing the top five number in that
    array of arraylists.
    I have no idea how to go on about this
    please help

    How would you do it "manually"? That is, if you just
    had pencil and paper and several lists of numbers,
    what would be the steps? Keep them very simple and
    precise.Socrates would be so proud.
    I was just reminiscing about how I once tried to teach Java to the web designer
    at my last job. I gave him the task of writing:
    static int max(int[] values) He just didn't grok it:
    Me: How would you figure it out by hand?
    WD: I'd look at the numbers and pick the biggest.
    Me: Break that down into steps.
    WD: I'd -- look -- at -- the -- numbers -- and -- pick -- the -- biggest.
    In the end, we tacitly agreed to stop the teaching and hope the manager didn't notice.

  • Newbie - help needed with array and dictionary objects

    Hi all
    Please see the code below. I've posted this code in another thread however the original issue was resolved and this is now a new issue I'm having although centered around the same code.
    The issue is that I'm populating an array with dictionary objects. each dictionary object has a key and it's value is another array of custom objects.
    I've found that the code runs without error and I end up with my array as I'm expecting however all of the dictionary objects are the same.
    I assume it's something to do with pointers and/or re-using the same objects but i'm new to obj-c and pointers so i am a bit lost.
    Any help again is very much appreciated.
    // Open the database connection and retrieve minimal information for all objects.
    - (void)initializeDatabase {
    NSMutableArray *authorArray = [[NSMutableArray alloc] init];
    self.authors = authorArray;
    [authorArray release];
    // The database is stored in the application bundle.
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"books.sql"];
    // Open the database. The database was prepared outside the application.
    if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
    // Get the primary key for all books.
    const char *sql = "SELECT id, author FROM author";
    sqlite3_stmt *statement;
    // Preparing a statement compiles the SQL query into a byte-code program in the SQLite library.
    // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator.
    if (sqlite3preparev2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
    // We "step" through the results - once for each row.
    // We start with Letter A...we're building an A - Z grouping
    NSString *letter = @"A";
    NSMutableArray *tempauthors = [[NSMutableArray alloc] init];
    while (sqlite3_step(statement) == SQLITE_ROW) {
    author *author = [[author alloc] init];
    author.primaryKey = sqlite3columnint(statement, 0);
    author.title = [NSString stringWithUTF8String:(char *)sqlite3columntext(statement, 0)];
    // FOLLOWING WAS LEFT OVER FROM ORIGINAL COMMENTS IN SQLBooks example....
    // We avoid the alloc-init-autorelease pattern here because we are in a tight loop and
    // autorelease is slightly more expensive than release. This design choice has nothing to do with
    // actual memory management - at the end of this block of code, all the book objects allocated
    // here will be in memory regardless of whether we use autorelease or release, because they are
    // retained by the books array.
    // if the author starts with the Letter we currently have, add it to the temp array
    if ([[author.title substringToIndex:1] compare:letter] == NSOrderedSame){
    [tempauthors addObject:author];
    } // if this is different letter, then we need to deal with that too...
    else {
    // create a dictionary to store the current tempauthors array in...
    NSDictionary *tempDictionary = [NSDictionary dictionaryWithObject:tempauthors forKey:@"authors"];
    // add the dictionary to our appDelegate-level array
    [authors addObject:tempDictionary];
    // now prepare for the next loop...
    // set the new letter...
    letter = [author.title substringToIndex:1];
    // remove all of the previous authors so we don't duplicate...
    [tempauthors removeAllObjects];
    // add the current author as this was the one that didn't match the Letter and so
    // never went into the previous array...
    [tempauthors addObject:author];
    // release ready for the next loop...
    [author release];
    // clear up the remaining authors that weren't picked up and saved in the "else" statement above...
    if (tempauthors.count > 0){
    NSDictionary *tempDictionary = [NSDictionary dictionaryWithObject:tempauthors forKey:@"authors"];
    [authors addObject:tempDictionary];
    else {
    printf("Failed preparing statement %s
    ", sqlite3_errmsg(database));
    // "Finalize" the statement - releases the resources associated with the statement.
    sqlite3_finalize(statement);
    } else {
    // Even though the open failed, call close to properly clean up resources.
    sqlite3_close(database);
    NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
    // Additional error handling, as appropriate...
    Message was edited by: dotnetter

    Ok, so I know what the issue is now...I just don't know enough to be able to resolve it!
    it's the tempAuthors objects.
    It's an NSMutableArray which is create on the line before the start of the WHILE loop.
    Having looked through the debugger, I can see that each dictionary object is created (with different codes which I assume are memory addresses) so all is well there. However, on each iteration of the loop in the middle there is an IF...ELSE... statement which in the ELSE section is clearing all objects from the tempAuthors array and beginning to repopulate it again.
    Looking at the containing dictionary objects in the debugger I can see that the tempAuthors object that each contains has the same code (again, I'm assuming this is a memory address) - so if I understand correctly, it's the same object...I assumed that when I created the dictionary using the dictionWithObject call that I would be passing in a copy of the object, but it's referencing back to the object which I then go on to change.
    Assuming the above is correct, I've tried several "stabs in the dark" at fixing it.
    I've tried relasing the tempAuthors object within the ELSE and initialising it again via an alloc...init - but this didn't work and again looking through the debugger it looks as though it was confused as to which object it was supposed to be using on the following iteration of the WHILE loop (it tried to access the released object).
    Having read a little more about memory management can someone tell me if I'm correct in saying that the above is because the tempAuthors object is declare outside the scope of the WHILE loop yet I then try to re-instantiate it within the loop (does that make sense???).
    Sorry for the long post...the more I can understand the process the less I can hopefully stop relying on others for help so much.
    I am continuing to read up on memory management etc but just not there yet.
    Regards
    Wayne

  • Weblogic 10.3 - Arrays and JAX-RPC Web Services

    We are currently looking at migrating from WL 8.1 to WL 10.3, and have an issue with some of our web services (JAX-RPC) with regards to returning String arrays.
    We have a web service method that returns a response object. This response object has many properties that includes a property that is a String array. So the code looks something like this (this is a simplified version):
    <em>public class OurService
    @RemoteMethod
    @WebMethod
    @WebResult(name = "result")
    public ResponseObject lookup(String someParam)
    // build the object and its properties here...
    return responseObject;
    }</em>
    This is what the response object looks like:
    <em>public class ResponseObject
    private String[] someProperty;
    public String[] getSomeProperty()
    return this.</em><em>someProperty</em><em>;
    public void setSomeProperty(String[] </em><em>someProperty</em><em>)
    this.</em><em>someProperty</em><em>= </em><em>someProperty</em><em>;
    }</em>
    So the issue is this. In WL 8.1, the web service generator would recognise the fact that the response object had a property that was a String array and would declare as such in the WSDL file, for example:
    <em><strong> &lt;xsd:element xmlns:tp="java:language_builtins.lang" type="<font color="#ff0000">tp:ArrayOfString</font>" name="someProperty" minOccurs="1" nillable="true" maxOccurs="1"&gt;
    &lt;/xsd:element&gt;
    </strong></em>
    As a result, when the service is called, the property is returned in the SOAP response like this:
    <strong>.
    </strong>
    <div class="e">
    <div class="c" style="margin-left: 1em; text-indent: -2em">
    <em><strong> <span class="m">&lt;</span><span class="t">someProperty</span><span class="t"> soapenc:arrayType</span><span class="m">="</span></strong><strong>xsd:string[2]<span class="m">"</span><span class="m">&gt;</span></strong></em>
    </div>
    <div>
    <div class="e">
    <div>
    <em><strong><span class="b"> </span><span class="m">&lt;</span><span class="t">string</span><span class="t">
    xsi:type</span><span class="m">="</span></strong><strong>xsd:string<span class="m">"</span><span class="m">&gt;</span><span class="tx">string1</span><span class="m">&lt;/</span><span class="t">string</span><span class="b">&gt;
    &lt;string xsi:type="xsd:string"&gt;string2&lt;/string&gt;
    </span><span class="m">&lt;/</span><span class="t">someProperty</span><span class="m">&gt;</span></strong></em>
    </div>
    </div>
    </div>
    </div>
    <strong>.
    </strong>
    But, in WL 10.3, the WSDL entry is:
    <em><strong> &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="InstepCodes" nillable="true" type="xs:string"&gt;
    </strong></em>
    As a result the property is returned in the SOAP response like this:
    <strong> .
    </strong><strong><span class="m"> &lt;</span><span class="t">java:InstepCodes</span><span class="ns">
    xmlns:java</span><span class="m">="</span></strong><strong class="ns">java:com.myservice</strong><strong><span class="m">"</span><span class="m">&gt;</span><span class="tx">string1</span><span class="m">&lt;/</span><span class="t">java:InstepCodes</span><span class="m">&gt;</span>
    </strong><strong><span class="m"> &lt;</span><span class="t">java:InstepCodes</span><span class="ns">
    xmlns:java</span><span class="m">="</span></strong><strong class="ns">java:com.myservice</strong><strong><span class="m">"</span><span class="m">&gt;</span><span class="tx">string2</span><span class="m">&lt;/</span><span class="t">java:InstepCodes</span><span class="m">&gt;</span>
    </strong>The difference here is that WL 10.3 does not return the array of strings as a complex array type, just as a set of repeated elements.
    We need to return the array as we do for WL 8 in WL 10.3, because we have external clients that are parsing the response and looking for the XML in this format. We are not currently in a position to ask them to change.
    Is this a limitation of the JAX-RPC spec, or WL's implementation of it?
    If the service was to return a String array directly from a service method, then it is declared in the WSDL file.
    However, if a service returns an object that within itself has a property that is an array, it does not recognise it like it did with WL 8.1.
    <strong>
    </strong>
    <div class="e">
    </div>

    Thank you for the reply.
    We are using WL Server 8.1 (not Workshop), and moving to WL Server 10g R3.
    We are using the JWSC task to generate the service, which is:
    bq. weblogic.wsee.tools.anttasks.JwscTask+
    Here is an extract from the Ant build file the calls the task.
    &lt;jwsc
    srcdir="src/com/ourservice"
    sourcepath="src"
    destdir="${ear.dir}"
    verbose="false"
    debug="true"
    keepGenerated="true"
    classpathref="ws.class.path"&gt;
    +&lt;module name="${service.name}" explode="true"&gt;+
    +&lt;jws file="OurService.java" type="JAXRPC"/&gt;+
    +&lt;/module&gt;+
    +&lt;/jwsc&gt;+
    As stated in my first post, the service method returns an reponse object and its this that contains the array property. The service method itself does not return an array type. This seems to be the root of the problem, i.e. the declaration of array types is not being propagated down through the object graph the service method returns. Below is the code for the service and the response object.
    @FileGeneration(remoteClass = Constants.Bool.TRUE, remoteClassName = "OurService", localHome = Constants.Bool.TRUE, localHomeName = "OurServiceLocalHome", remoteHome = Constants.Bool.TRUE, remoteHomeName = "++OurService++Home", localClass = Constants.Bool.TRUE, localClassName = "++OurService++Local")+
    @JndiName(remote = "com.ourservice.++OurService++", local = "com.ourservice.++OurService++Local")+
    @Session(ejbName = "++OurService++", type = Session.SessionType.STATELESS, transactionType = Session.SessionTransactionType.CONTAINER, maxBeansInFreePool = "100", initialBeansInFreePool = "20", enableCallByReference = Constants.Bool.TRUE, homeIsClusterable = Constants.Bool.TRUE, homeLoadAlgorithm = Constants.HomeLoadAlgorithm.ROUND_ROBIN, isClusterable = Constants.Bool.TRUE, beanLoadAlgorithm = "RoundRobin", defaultTransaction = Constants.TransactionAttribute.SUPPORTS)+
    +@RoleMappings( { @RoleMapping(roleName = "Admin", externallyDefined = Constants.Bool.TRUE),+
    +@RoleMapping(roleName = "Monitor", externallyDefined = Constants.Bool.TRUE),+
    +@RoleMapping(roleName = "JMS", externallyDefined = Constants.Bool.TRUE) })+
    @WebService(name = "OurServicePort", serviceName = "OurService", targetNamespace = "http://www.ourservice.com/SOA/OurService+_service")+
    +@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)+
    @WLHttpTransport(contextPath = "OurService", serviceUri = "OurService", portName = "
    *OurService+Port")+
    public class OurService
    +{+
    @RemoteMethod
    @WebMethod
    @WebResult(name = "result")
    {color:#ff0000}public ResponseObject lookup(String someParam){color}
    // build the response object...
    return {color:#ff0000}responseObject{color};
    +}+
    This is what the response object looks like:
    public class ResponseObject
    +{+
    private String[] someProperty;
    +public {color:#ff0000}String[] getSomeProperty(){color}+
    +{+
    return this.someProperty;
    +}+
    public void setSomeProperty(String[] someProperty)
    +{+
    this.someProperty = someProperty;
    +}+
    +}+
    From all of this I cant tell how we get the WSDL file to delcare it as an array type, as shown in the JAX-RPC 1.1 spec you mentioned, based on the code we have and the JWSC build task we are using.
    (I appologise for the formatting of this message. It seems to want to insert + everywhere in the code examples, despite me removing them!)
    Edited by: user8013492 on 11-Dec-2008 02:09
    Edited by: user8013492 on 11-Dec-2008 02:11

  • Can�t open array and object manager

    Hello,
    i�ve done a fresh install of SGD 4 on Fedora Core 3.
    Here I am not able to open array and object manager. I see them running in
    the webtop but get no display.
    I get the following logs:
    in wm_errors: X connection to unix:10.0 broken (explicit kill or server
    shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ..skipping...
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ~
    and in error.log
    2005/03/01 18:31:54.951 (pid 20049) pem/circuit #0
    Tarantella Secure Global Desktop Enterprise Edition(4.0) ERROR:
    An error occurred reading on circuit fdcircuit. Reason: (9) Bad file
    descriptor.
    The current operation has failed.
    If persistent, restart the server.
    Restarting the server doesn�t help.
    I�ve also set the xscecurity flag to 0.
    This all works fine with Fedora Core 2
    Anyone any Idea?
    Thanks a lot

    Hi Matthias,
    I had similar problems with (local) X apps.
    via ssh, and I mean they arose with tta vers.
    3.42. The problem seems to appear, because
    both tta and ssh (with X forwarding) are
    using a X-display range from :10 upward.
    So, one simply can resolve this by using a different X-display offset for
    ssh, by setting:
    X11DisplayOffset 100
    (for exsample) in sshd_config.
    Then tta still uses displays :10, :11, ...
    but ssh is using :100, :101, ...,
    (assuming that 90 X/RDP emulator-session are enough in this installation!)
    Don't forget to send a SIGHUP to the master
    sshd after changing sshd_config, telling
    'him' to re-read it's config-file.
    One can verify the effect, by calling
    'ssh localhost' and executing: echo $DISPLAY
    this should give something like:
    localhost:100.0
    Kind regards,
    Tankred
    Matthias wrote:
    Hello,
    not all login authorities are disabled. I have only NT auth. enabled. This
    works fine in EE 3.40 on RH 9 and on SGD4.0 on Fedora Core 2. But seems
    not to run on Fedora Core 3.
    Matthias
    Carmelo wrote:
    Mattias,>>
    >
    http://www.tarantella.com/support/documentation/sgd/ee/4.0/help/en-us/base/indepth/disabled_all_login_authorities.html
    Regards,
    Matthias wrote:
    I think I�ve fixed it.
    I just edited ssh_conf and enabled X11forwarding and it works for me.
    But now I have changed the login authority only to NT auth. and I am no
    longer able to log in to tarantella....
    Matthias wrote:
    Hello,
    i�ve done a fresh install of SGD 4 on Fedora Core 3.
    Here I am not able to open array and object manager. I see them running
    in
    the webtop but get no display.
    I get the following logs:
    in wm_errors: X connection to unix:10.0 broken (explicit kill or server
    shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ...skipping...
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    X connection to unix:12.0 broken (explicit kill or server shutdown).
    X connection to unix:10.0 broken (explicit kill or server shutdown).
    ~
    and in error.log
    2005/03/01 18:31:54.951 (pid 20049) pem/circuit #0
    Tarantella Secure Global Desktop Enterprise Edition(4.0) ERROR:
    An error occurred reading on circuit fdcircuit. Reason: (9) Bad file
    descriptor.
    The current operation has failed.
    If persistent, restart the server.
    Restarting the server doesn�t help.
    I�ve also set the xscecurity flag to 0.
    This all works fine with Fedora Core 2
    Anyone any Idea?
    Thanks a lot

Maybe you are looking for