Problem passing multiple array lists to a single method

Hi, all:
I have written a generic averaging method that takes an array list full of doubles, adds them all up, divides by the size of the array list, and spits out a double variable. I want to pass it several array lists from another method, and I can't quite figure out how to do it. Here's the averager method:
     public double averagerMethod (ArrayList <Double> arrayList) {
          ArrayList <Double> x = new ArrayList <Double> (arrayList); //the array list of integers being fed into this method.
          double total = 0;//the total of the integers in that array list.
          for (int i = 0; i < x.size(); i++) {//for every element in the array list,
               double addition = x.get(i);//get each element,
               total = total + addition; //add it to the total,
          double arrayListSize = x.size();//get the total number of elements in that array list,
          double average = total/arrayListSize;//divide the sum of the elements by the number of elements,
          return average;//return the average.
     }And here's the method that sends several array lists to that method:
     public boolean sameParameterSweep (ArrayList <Double> arrayList) {
          sameParameterSweep = false;//automatically sets the boolean to false.
          arrayList = new ArrayList <Double> (checker);//instantiate an array list that's the same as checker.
          double same = arrayList.get(2); //gets the third value from the array list and casts it to double.
          if (same == before) {//if the third value is the same as the previous row's third value,
               processARowIntoArrayLists(checker);//send this row to the parseAParameterSweep method.
               sameParameterSweep = true;//set the parameter sweep to true.
          if (same != before) {//if the third value is NOT the same,
               averagerMethod(totalTicks);//go average the values in the array lists that have been stored.
               averagerMethod(totalNumGreens);
               averagerMethod(totalNumMagentas);
               sameParameterSweep = false;
          before = same; //problematic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     return sameParameterSweep;
     }Obviously, the problem is that I'm not passing the array lists from this method to the averager method the right way. What am I doing wrong?

Encephalopathic wrote:
There are several issues that I see, but the main one is that you are calculating average results but then just discarding them. You never assign the result to a variable.
In other words you're doing this:
averagerMethod(myArrayList);  // this discards the resultinstead of this:
someDoubleVariable = averagerMethod(myArrayList); // this stores the resultAlso, do you wish to check for zero-sized array lists before calculating? And what would you return if the array list size were zero?So in solving that problem, I've come up with another one that I can't figure out, and I can't fix this problem until I fix that.
I have several thousand lines of data. They consist of parameter sweeps of given variables. What I'm trying to do is to store pieces of
data in array lists until the next parameter adjustment happens. When that parameter adjustment happens, I want to take the arraylists
I've been storing data in, do my averaging thing, and clear the arraylists for the next set of runs under a given parameter set.
Here's the issue: I'm having the devil of a time telling my application that a given parameter run is over. Imagine me doing stuff to several variables (number of solders, number of greens, number of magentas) and getting columns of output. My data will hold constant the number of soldiers, and for, say, ten runs at 100 soldiers, I'll get varying numbers of greens and magentas at the end of each of those ten runs. When I switch to 150 soldiers to generate data for ten more runs, and so forth, I need to average the number of greens and magentas at the end of the previous set of ten runs. My problem is that I can't figure out how to tell my app that a given parameter run is over.
I have it set up so that I take my data file of, say, ten thousand lines, and read each line into a scanner to do stuff with. I need to check a given line's third value, and compare it to the previous line's third value (that's the number of soldiers). If this line has a third value that is the same as the previous line's third value, send this line to the other methods that break it up and store it. If this line has a third value that is NOT the same as the previous line's third value, go calculate the averages, clear those array lists, and begin a new chunk of data by sending this line to the other methods that break it up and store it.
This is not as trivial a problem as it would seem at first: I can't figure out how to check the previous line's third value. I've written a lot of torturous code, but I just deleted it because I kept getting myself in deeper and deeper with added methods. How can I check the previous value of an array list that's NOT the one I'm fiddling with right now? Here's the method I use to create the array lists of lines of doubles:
     public void parseMyFileLineByLine() {
          totalNumGreens = new ArrayList <Double>();//the total number of greens for a given parameter sweep
          totalNumMagentas = new ArrayList <Double>();//the total number of magentas for a given parameter sweep.
          totalTicks = new ArrayList <Double>();//the total number of ticks it took to settle for a given parameter sweep.
          for (int i = 8; i < rowStorer.size() - 2; i++) {//for each line,
               checker = new ArrayList <Double>();//instantiates an array list to store each piece in that row.
               String nextLine = rowStorer.get(i); //instantiate a string that contains all the information in that line.
               try {
                    Scanner rowScanner = new Scanner (nextLine); //instantiates a scanner for the row under analysis.
                    rowScanner.useDelimiter(",\\s*");//that scanner can use whitespace or commas as the delimiter between information.
                    while (rowScanner.hasNext()) {//while there's still information in that scanner,
                         String piece = rowScanner.next(); //gets each piece of information from the row scanner.
                         double x = Double.valueOf(piece);//casts that stringed piece to a double.
                         checker.add(x);//adds those doubles to the array list checker.
               catch (NoSuchElementException nsee) {
                    nsee.printStackTrace();
               //System.out.println("checker contains: " + checker);
               processARowIntoArrayLists(checker);//sends checker to the method that splits it up into its columns.
     }

Similar Messages

  • Multiple ALV lists in a single spool of a job

    Hi All,
    Executing a custom program in background generates 2 lists in two different spools.
    First list  - ALV Grid displayed as ALV list
    Second List - ALV Blocked List.
    Though both the Spool request numbers generated during the execution of the program are displayed in the JOB LOG of the background job,only the latest spool(ALV Blocked List) is saved under this job.
    We should go to Tx:SP01/02 to view the First list(ALV Grid) generated in the first Spool request.
    Can someone tell me how to get both the lists in a single spool request..(Programmatically)
    Or let me know if there is a way to display both the spool numbers in the Spool list of the job in SM37.
    Thanks in advance.
    Hemanth

    Hi Hemanth,
    maybe you can have a look at the function RSPO_INSERT_SPOOL_CONCATENATE. There is a documentation in the function module transaction.
    Regards
    Frédéric

  • Insert items from two different Multiple Select Lists into a single table

    I need help. I have a training tracking system that tracks the courses taken by employees.
    I have created two multiple select lists, one is SelectEmployees and the other is SelectCourses. I want to insert
    the selected item from those two multiple select lists into Training_Record table.
    Note, SelectEmployees" is from Employee table and SelectCourses is from Courses table. Those two table has no intersetion.
    Train_Record is the table that joins those two together.
    Please advice and your help is appreciate.

    Thank you for your help.
    I tried your code and changed the table/field name to my actual table/field name and the iitem name to actual item name.
    declare
    cursor c_Employees is
    select PERSONNEL_NEW.EMPLOYEEID from PERSONNEL_NEW where PERSONNEL_NEW.EMPLOYEEID in (:P15_SELECTEDEMP);
    cursor c_Courses is
    select COURSES.COURSE_ID from COURSES where COURSES.COURSE_ID in
    (:P15_SELECTEDCOUR);
    begin
    foreach :=r_employee in c_Employees loop
    foreach :=r_course in c_Courses loop
    insert
    into COPYOFTRAINREC ( EMPLOYEEID, COURSEID )
    values ( r_employee.EMPLOYEEID, r_course.COURSE_ID );
    end loop;
    end loop;
    end;
    I got error message as :
    ORA-06550: line 12, column 25: PLS-00103: Encountered the symbol "C_EMPLOYEES" when expecting one of the following: (
    Error
    OK

  • Problem in consolidating two list into a single list ! ! !

    hi guys,
    I have 3 list with each list containing many Object[] like,
    List 1 = [ [1,aaa,bb], [2,bbb,xxx], [3,aaa,yyy], ]
    List 2 = [ [2,bbb,xxx], [4,bbb,zzz]]
    List 3 = [ [1,aaa,bb], [3,aaa,yyy],[5,ccc,www]]
    Now i want to consolidate these list into a single list as below
    List consolidated_list = [ [1,aaa,bb], [2,bbb,xxx], [3,aaa,yyy], [4,bbb,zzz],[5,ccc,www]]
    I can do that by using nested looping statements. But i want to do that in a more optimized way.
    Is there collection set/map that avoids the duplication in its objects.
    How do that? Can anyone help in this issue??
    --Subbu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi peter,
    You are exactly correct. you got exactly what i need.
    Now my doubt is there any readymade collection classes to acheive this without many iterations and looping statements.
    --subbu                                                                                                                                                                                                                                                                                                                                                                                                   

  • Passing an array of objects to a method.

    Hi I'm building a program to act as a CD Collection Database. An array of objects represents the entries: Artist, Album and NUmber of Tracks. What I want to do is in the Menu, user to choose wether he or she wants to Add new CD to collection, print or quit, if he/she does then I call a method addNewEntry, to which i pass the array of objects called array, and I want the user to enter the entries each in turn, after that i want the program to return to the method Menu and ask if he or she wants to quit, print or add new cd. The idea is that the details entered already would be contained in the array of objects [0], so the next set of details go to [1] and then to [2] and so on. I have build up the code at this stage but i get an error while copmiling and im totally stuck. Im a beginner in Java.
    Here is the code:
    //by Andrei Souchinski
    //Mini Project: CD Collection Database
    //Designed for a grade F
    //Defining new class of objects to represent CD database entries.
    //A database entry consists of the artist name, the album name and number of tracks.
    //A single entry can be entered by the user typing the details in and the entry can be printed out.
    import javax.swing.*;
    import java.util.*;
    public class MiniProject
         public static void main (String[] args)     
              System.out.println("\tCD Collection Database\n");
              System.out.println("1. Add new Compact Disk to the Database");
              System.out.println("2. Print out current database entries");
              System.out.println("3. Quit\n");          
              theMenu();
         public static void theMenu()
              CompactDisk [] array = new CompactDisk[20];
              String menu;
              menu = JOptionPane.showInputDialog("What would you like to do?");
              if (menu.equals ("3"))
                   JOptionPane.showMessageDialog(null, "Thank You For Using our Service! \nGoodbye!");
                   System.exit(0);     
              if (menu.equals ("2"))
              if (menu.equals ("1"))
              addNewEntry(array);
              else
                   JOptionPane.showMessageDialog(null, "Please select your choice form the menu");
                   theMenu();
         public int addNewEntry(int newcd[])
                   int i;          
                   newcd[i] = (JOptionPane.showInputDialog("Please enter the name of the Artist"));
                   newcd[i] = (JOptionPane.showInputDialog("Please enter the name of the Album"));
                   newcd[i] = (Integer.parseInt (JOptionPane.showInputDialog("Please enter the number of tracks on this album")));
    //A Compact Disk entry consists of three attributes: artist name, album and number of tracks
    class CompactDisk
         public String artistname; //Instance variables for artistname, albumname and numberoftracks.
         public String albumname;
         public int numberoftracks;
         public CompactDisk(String n, String a, int t)
         artistname = n; //Stores the 1st argument passed after "new Dates" into day
         albumname = a; //Stores the 2nd argument passed after "new Dates" into month
         numberoftracks = t; //Stores the 3rd argument passed after "new Dates" into year
         //When called from the main method, prints the contents of
         //artistname, albumname and numberoftracks on to the screen.
         public void printCompactDisk ()
                   String output = "\n " + artistname + "\n " + albumname + "\n " + numberoftracks;
                   System.out.println(output);
    }

    //by Andrei Souchinski
    //Mini Project: CD Collection Database
    //Designed for a grade F
    //Defining new class of objects to represent CD database entries.
    //A database entry consists of the artist name, the album name and number of tracks.
    //A single entry can be entered by the user typing the details in and the entry can be printed out.
    import javax.swing.*;
    import java.util.*;
    public class MiniProject
         public static void main (String[] args)     
              System.out.println("\tCD Collection Database\n");
              System.out.println("1. Add new Compact Disk to the Database");
              System.out.println("2. Print out current database entries");
              System.out.println("3. Quit\n");          
                theMenu();
         public static void theMenu()
              String menu;
              menu = JOptionPane.showInputDialog("What would you like to do?");
              if (menu.equals ("3"))
                   JOptionPane.showMessageDialog(null, "Thank You For Using our Service! \nGoodbye!");
                   System.exit(0);     
              if (menu.equals ("2"))
              if (menu.equals ("1"))
              addNewEntry();
              else
                   JOptionPane.showMessageDialog(null, "Please select your choice form the menu");
                   theMenu();
         public static void addNewEntry()
                   CompactDisk [] array = new CompactDisk[20];
                   int i = 0;
                   array.artistname = (JOptionPane.showInputDialog("Please enter the name of the Artist"));
                   array[i].albumname = (JOptionPane.showInputDialog("Please enter the name of the Album"));
                   array[i].numberoftracks = (Integer.parseInt (JOptionPane.showInputDialog("Please enter the number of tracks on this album")));
    //A Compact Disk entry consists of three attributes: artist name, album and number of tracks
    class CompactDisk
         public String artistname; //Instance variables for artistname, albumname and numberoftracks.
         public String albumname;
         public int numberoftracks;
         public CompactDisk(String n, String a, int t)
         artistname = n; //Stores the 1st argument passed after "new Dates" into day
         albumname = a; //Stores the 2nd argument passed after "new Dates" into month
         numberoftracks = t; //Stores the 3rd argument passed after "new Dates" into year
         //When called from the main method, prints the contents of
         //artistname, albumname and numberoftracks on to the screen.
         public void printCompactDisk ()
                   String output = "\n " + artistname + "\n " + albumname + "\n " + numberoftracks;
                   System.out.println(output);
    I've edited the code, itcompiles, but gives an error when i ran it..:(

  • Passing Multiple Tax classification in LSMW BAPI method

    Dear All,
    Iam using LSMW BAPI method to create and change material master. I need to pass multiple tax classification values for a single material. How can I do this. The structure used in the BAPI for passing the tax classification data is MLAN. How can I create multiple numbers of this structure. Can anybody help me please.
    Thanks in advance
    Prathib

    do you have this multiple records already in the source? Or not at all in the source?
    background for tax classification
    There is customizing to assign plants to sales organization.
    Each plant has an adress with a country.
    SAP collects all the plant countries and saves them in the tax classification table MLAN.
    Eg. if this material A has a sales org EAST that can sell from plants in JP, AU, and SG
    then you will see these 3 countries in the sales org view segment tax classification
    In case you dont have any tax classification data in the source, then it you can do it like this:
    goto the __END_OF_RECORD__  statement of  E1BP_MLAN segment in your LSMW and enter it directly as code:
    do the transfer_record as often as you need .
    DEPCOUNTRY = 'JP'
    TAX_TYPE_1 = 'MWST'
    TAXCLASS_1 = '1'
    transfer_record.
    DEPCOUNTRY = 'AU'
    TAX_TYPE_1 = 'MWST'
    TAXCLASS_1 = '1'
    transfer_record.
    DEPCOUNTRY = 'SG'
    TAX_TYPE_1 = 'MWST'
    TAXCLASS_1 = '1'
    transfer_record.

  • Passing an array of integers to a method...

    here's the case, i have 2 array of integers parent and child. how can i pass the arrays in a method so i can evaluate the contents of both arrays?
    here's the block of the code that contains what i'm talking about.
    for(int i=0; i<tree.length; i++) {//separate child from parent      
         int[] parent = new int[(tree.length()/2)];
         int[] child = new int[(tree[i].length()/2)];
         for(int j=0, ctr=0; j<tree[i].length(); j++, ctr++) {               
              parent[ctr] = Integer.parseInt(Character.toString(tree[i].charAt(j))); //get the parents
              j++;
              child[ctr] = Integer.parseInt(Character.toString(tree[i].charAt(j))); //get the children
         if(isTree(parent, child)) //evaluate if case is a tree
         System.out.println("Is a tree");
         else
         System.out.println("Is not a tree");
    }//separate child fronm parent     

    geez, thanks... adding "static" did work.. >_< my bad, i'm new in java... and i'm sorry for calling you
    "sir", thanks a lot monica... ^^ by the way, it's 1:00 pm here asia.I'm glad it worked--do you understand what "static" means here?
    No problem about the "sir". I usually use "he" myself, if I don't know whether it should be he/she. And, around here on the forum (and software engineers at most companies), there are certainly more men than women. People tend to look at MLRon and assume my name is "Ron", but that's my last name. :)
    You don't need to call people "sir" or "ma'am" here. Just names or screen names (like MLRon) will do. :)
    Have a nice afternoon, then!

  • How To Send Multiple Spool Lists  from a Single Step in SM37

    We have converted all of our output reports to ALV and now instead of one big spool that contains all the reports generated in a single step we now have multiple spools.  We run the program as a Batch Job in SM37 and have created an entry in the SPOOL LIST RECIPIENT for the job.  The problem is that it only sends one of our lists.  Is there a way to make it send all of the ists?

    You need to write areport program with fm 'RSPO_RETURN_ABAP_SPOOLJOB'  and collect all spools and send it and make this as precedent job after your ALV spool jobs

  • How to pass multiple MDX values for a single parameter into a drill-through report?

    I'm thinking this will be an easy question for any experienced SSRS/MDX developers, at least I hope so!  I've created a report that gives the user the option to choose viewing data for the current/active week, or YTD.  Depending on which link the
    user selects, the report simply calls itself and needs to pass in the parameter value for Active week.  If it's active week, the parameter value will simply be "true".  If it's YTD, the parameter value needs to be both "True" and "False" so the current
    week's data is accounted for as well.  I've set everything up except for the final step, and I have no idea what to type into the Value field below.  I've tried different things: false, as you see below (it errors saying I'm missing the parameter
    value), the value in MDX format: =[School Dates].[Active Week].&[True] (it said I was missing a bracket), a 1 instead of the word true (again, missing a parameter value).  Nothing is working.
    So my question is kindof two-fold: 1) how do you pass in the value at all and 2) more specifically, how do you pass in multiple values (both true & false) ??

    I'm sorry for being so dense, but I'm not quite following, although what I've tried makes me think if I can follow you, it will work :)
    To answer your initial questions, you are correct with both your assumptions:
    1) detailType is the parameter that specificies YTD/Weekly, this is a "report defined" parameter that I am using to determine which Row Group to display (either YTD or Weekly)
    2) SchoolDaysActiveWeek is the parameter that is being set to either true or false -- this is a field in the cube that states whether that record is for the current week or not
    So in following your instructions, well that's the problem I'm not quite following :)
    1) When you say Delete the SchoolDaysActiveWeek parameter from the report only, do you mean to mark the parameter as Hidden?  If so, I've done this.
    2) I'm not quite sure where to use the statement you provided me.  You said to put it in the dataset, but I don't know which dataset.  I assume you mean the "main" dataset (as opposed to the hidden dataset that gets generated when you mark a field
    as a parameter).  If this is the case, the only place I could see that would allow you to use such a statement is in the Filter section of the properties.  I tried this, and it did not generate any errors, but it also kept my report groups from displaying
    -- it just showed a blank report, so I think it probably wasn't bringing back any rows to populate them with.
    I also tried going into the Expression section for the SchoolDaysActiveWeek parameter in the second screenshot and placing the statement there.  When I did this and ran the report, I would get the following error:
    The 'SchoolDaysActiveWeek' parameter is missing a value
    So what am I missing!? 
    Also, thanks for taking the time to respond!!

  • Passing Multiple Selected List Items to a "New Item" Form in Another List with Multiselect Lookup Field

    Hi!
    Version Info:  SharePoint 2013 Server Standard (*BTW...I do not have access to Visual Studio*)
    I have two lists, let's call them
    -Assets
    -Asset Checkouts
    "Assets" is the parent list, and "Asset Checkouts" has a lookup column (multiselect) which is tied to the serial # column in the "Assets" list.
    Basically, what I need to accomplish is this:  I would like to be able to select multiple list items in the "Assets" list, and create a new item in "Asset Checkouts", and pre-fill the multiselect lookup column in the NewItem form
    for "Asset Checkouts" with the values from the selected items in "Assets".
    Any ideas or suggestions on how to do this would be most appreciated!
    Thanks!

    Hi,     
    According your description, you might want to add new item in "Asset Checkouts" list when selecting items in "Assets" list.
    If so, we can achieve it with SharePoint Client Object Model.
    We can add a button in the "Assets" list form page, when selecting items, we can take down the values of columns of the selected items, then click this button which will create
    new item in "Asset Checkouts" list with the values needed.
    Here are some links will provide more information about how to achieve it:
    Use
    SP.ListOperation.Selection.getSelectedItems() Method to get the list items being selected
    http://msdn.microsoft.com/en-us/library/ff409526(v=office.14).aspx
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
    Add ListItem with Lookup Field using Client Object Model (ECMA)
    http://notuserfriendly.wordpress.com/2013/03/14/add-listitem-with-lookup-field-using-client-object-model-ecma/
    Or if you just want to refer to the other columns in "Assets" list when add new item in "Asset Checkouts" list, we can insert the "Assets" list web part into the NewForm page
    of the "Asset Checkouts" list, then when we add new item in the "Asset Checkouts" list, we will be able to look through the "Assets" list before we select values for the Lookup column.
    To add web part into the NewForm.aspx, we need to find the button "Default New Form" from ribbon under "List" tab, then we can add web part in the NewForm.aspx.
    In the ribbon, click the button “Default New Form”:
    Then we can add web part into NewForm.aspx:
    Best regards
    Patrick Liang
    TechNet Community Support

  • Problem passing value from List Item to List Item

    OK I will try to explain what I am trying to do. I have a Form that List Item at the top and they cascade from left to right. When I get to the BPOST_TAG I choose the Bpost then move to EPOST_TAG to choose the Epost. The EPOST_TAG should show all the Epost that go with Bpost you already chose, but it only showing 1 or 2. Below is the example of how should work!
    SYSTEM     COUNTY     ROUTE   BPOST_TAG      EBPOST_TAG
    1 77 80 025 030
    ------- The Return Values Should be as below-------------------------------------------------
    Sy Co Route Dir Bpost Epost Miles Descrption
    1 77 80 1 025 026 ? ?
    1 77 80 1 026 027 ? ?
    1 77 80 1 027 028 ? ?
    1 77 80 1 028 029 ? ?
    1 77 80 1 029 030 ? ?
    1 77 80 2 025 026 ? ?
    1 77 80 2 026 027 ? ?
    1 77 80 2 027 028 ? ?
    1 77 80 2 028 029 ? ?
    1 77 80 2 029 030 ? ?
    The top 5 List Items are based on the first Data Block (PMISCURR) and the bottom 8 columns are based on the second Data Block (PMISCURR1).
    I have PRE-QUERY on the first Data Block (PMISCURR), below is code for the PRE-QUERY.
    DECLARE
    Wh_clause VARCHAR2(200);
    BEGIN
    IF :PMISCURR.SYSTEM is not null then
         Wh_clause := 'SYSTEM = '||:PMISCURR.SYSTEM;
    END IF;
    IF :PMISCURR.COUNTY is not null then
         Wh_clause := WH_CLAUSE ||'AND COUNTY = '||:PMISCURR.COUNTY;
    END IF;
    IF :PMISCURR.ROUTE is not null then
         Wh_clause := WH_CLAUSE ||'AND ROUTE = '||:PMISCURR.ROUTE;
    END IF;
    IF :PMISCURR.BPOST_TAG is not null then
         Wh_clause := WH_CLAUSE ||'AND BPOST_TAG = '||:PMISCURR.BPOST_TAG;
    END IF;
    IF :PMISCURR.EPOST_TAG is not null then
         Wh_clause := WH_CLAUSE ||'AND EPOST_TAG = '||:PMISCURR.EPOST_TAG;
    END IF;
    END;
    OK It's just not my day I can't even get this line-up! :)
    Edited by: Monty on May 5, 2011 2:58 PM

    Hello,
    Simply get the current item value in a When-List-Changed trigger:
    current_value := :block.listitem ;Francois

  • UTL_DBWS - problem passing multiple parameters

    Hi
    I am getting an exception when trying to pass more than one inpput parameter.
    Any idea?
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ArrayIndexOutOfBoundsException

    See
    Oracle 10gR2 WebService Call-In & Call-Out via PL/SQL (Step-by-Step Guide)
    you have to use the add_parameter method.
    SYS.UTL_DBWS.add_parameter(l_call, 'args0', long_type_qname, 'ParameterMode.IN');

  • Problems printing multiple page sizes in a single document

    I print loan documents. When my documents are emailed, they are mixed page size documents of letter and letter. I cannot get the printer to switch page sizes automatically. I have to switch them manually. I am using MAC book pro with OS version 10.9.1 and acrobat reader 11.0.04. This is on a Brother Laser printer model HL5470DW

    The documents are emailed to me as a PDF file with formatting set in the documents.  We do not get a screen that allows us to tell the driver to use the Adobe document page settings.

  • Need Help! Passing an array of objects to a method, dont understand

    Hi, i need to make a method called public Server[] getServers() and i need to be able to see if specific server is available for use.
    I have this so far:
    public abstract class AbstractServer
    protected String serverName;
    protected String serverLocation;
    public AbstractServer(String name,String location)
    this.serverName=name;
    this.serverLocation=location;
    public abstract class Server extends AbstractServer
    public Server(String name,String location)
    super(name,location);
    public class CreateServers
    Server server[];
    public CreateServers()
    public Server create()
    for(int i=0; i<10; i++)
    server=new Server(" ", " "); //i was going to fill in something here
    return server;
    OK NOW HERE IS THE PROBLEM
    i have another class that is supposed to manage all these servers, and i dont understand how to do the public Server[] getServers(), this is what i have tried so far
    public class ServerManager()
    public Server[] getServers(Server[] AbstractServer)
    Server server=null; //ok im also confused about what to do here
    return server;
    in the end i need this because i have a thread class that runs the servers that has a call this like:
    ServerManager.getServers("serverName", null);
    Im just really confused because i need to get a specific server by name but i have to go through AbstractServer class to get it
    Any help?

    thanks for replying...
    ok ill remove the Server.java one to be
    public class Server extends AbstractServer
         public Resource(String name,String locaton)
              super(name,location);
    ok so inside ServerManager.java i should have something like
    ArrayList servers;
    public ServerManager()
    servers=new ArrayList();
    ok but i still dont get how to use that in a method
    say if i put it like this
    public getServers()
    //populate server list in here??????
    ok im still lost...

  • Is possible to pass array/list as parameter in TopLink StoredProcedureCall?

    Hi, We need to pass an array/List/Vector of values (each value is a 10 character string) into TopLink's StoredProcedureCall. The maximum number of elements on the list is 3,000 (3,000 * 10 = 30,000 characters).
    This exposed two questions:
    1. Is it possible to pass a Vector as a parameter in TopLink's StoredProcedureCall, such as
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    Vector strVect = new Vector(3000);
    strVect.add(“ab-gthhjko”);
    strVect.add(“cd-gthhjko”);
    strVect.add(“ef-gthhjko”);
    Vector parameters = new Vector();
    parameters.addElement(strVect);
    session.executeQuery(query,parameters);
    2. If the answer on previous question is yes:
    - How this parameter has to be defined in Oracle’s Stored Procedure?
    - What is the maximum number of elements/bytes that can be passed into the vector?
    The best way that we have found so far was to use single string as a parameter. The individual values would be delimited by comma, such as "ab-gthhjko,cd-gthhjko,ef-gthhjko..."
    However, in this case concern is the size that can be 3,000 * 11 = 33, 000 characters. The maximum size of VARCHAR2 is 4000, so we would need to break calls in chunks (max 9 chunks).
    Is there any other/more optimal way to do this?
    Thanks for your help!
    Zoran

    Hello,
    No, you cannot currently pass a vector of objects as a parameter to a stored procedure. JDBC will not take a vector as an argument unless you want it to serialize it (ie a blob) .
    The Oracle database though does have support for struct types and varray types. So you could define a stored procedure to take a VARRAY of strings/varchar, and use that stored procedure through TopLink. For instance:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    oracle.sql.ArrayDescriptor descriptor = new oracle.sql.ArrayDescriptor("ARRAYTYPE_NAME", dbconnection);
    oracle.sql.ARRAY dbarray = new oracle.sql.ARRAY(descriptor, dbconnection, dataArray);
    Vector parameters = new Vector();
    parameters.addElement(dbarray);
    session.executeQuery(query,parameters);This will work for any values as long as you are not going to pass in null as a value as the driver can determine the type from the object.
    dataArray is an Object array consisting of your String objects.
    For output or inoutput parameters you need to set the type and typename as well:
      sqlcall.addUnamedInOutputArgument("PERSON_CODE", "PERSON_CODE", Types.ARRAY, "ARRAYTYPE_NAME"); which will take a VARRAY and return a VARRAY type object.
    The next major release of TopLink will support taking in a vector of strings and performing the conversion to a VARRAY for you, as well as returning a vector instead of a VARRAY for out arguments.
    Check out thread
    Using VARRAYs as parameters to a Stored Procedure
    showing an example on how to get the conection to create the varray, as well as
    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html on using Varrays in Oracle, though I'm sure the database docs might have more information.
    Best Regards,
    Chris

Maybe you are looking for