Using a class within a Vector

ok,
I writing a bank program where a user types in a string which is then broken into tokens. The tokens are separated using .nextToken( ) and the first token is used to determine what command the user wants to perform.
My problem is that I am trying to place a class that Ive created within the vector and I cant seem to be able to get the tokens into the right place or retrieve them when they are needed.
Here is what I have so far, ps I am very new to java.
Project3Functions func = new Project3Functions();
Vector vect = new Vector();
do
String firstLine = func.getLineInput();
StringTokenizer tok = new StringTokenizer(firstLine," ");
String hold = tok.nextToken();
if(hold.equals("newAccount"))
int index = Integer.parseInt(tok.nextToken());
vect.setSize(index);
vect.add(index, new Account());
vect.add(index, Account.firstname = tok.nextToken());
vect.add(index, Account.lastname = tok.nextToken());
System.out.println("a new account was created");
public class Account
static String firstname = "";
static String lastname = "";
I am trying to create a new Account in the position <index> within the vector but I dont think Im referencing firstname and lastname correctly. Also how would I get firstname and lastname out of the vertoc to print them on the screen?
Please someone help me.

Your first problem is that you are defining firstname and lastname as static in your Account class. This means that no matter how many new accounts you create, there will only be one firstname and lastname, which are shared between them. their value will be whatever you set them to most recently.
I think I know why you think you did that, however, and that leads to your second problem. You got complaints from the compiler because you tried to use Account.firstname to set firstname, etc. This only works for static variables. With your code, you are adding three new items to your vector for each new account you create, and you are adding them all to the same index. The last one wins! The other two die.
Make your Account variables non-static and change the adding code:vect.add(index, newAcct = new Account());
newAcct.firstname = tok.nextToken();
newAcct.lastname = tok.nextToken();You should also take care that you only vect.setSize(index); when vect.size() < index; otherwise, if you have items up to 10, and then add an item at 6, items 7 through 10 will be irretrievably lost.
Doug

Similar Messages

  • How to import .jar files in order to use the classes within this file

    hello guys,
    I'm just wondering how can i import .jar files in order to uses the classes within this file.
    let's take an example:
    i have a folder in which I have many .jar files which contain classes to be called. the full path of this folder is set in the Classpath inside the enviroment variables.
    so does anyone have any idea how can i import these .jar files so i can use the classes?
    thank you.

    Hi,
    My problem is that: I created a Serializable class in a project. And I added this project (first project) to another project (second project). First project is appearing in the second project' s Libraries folder. No problem. I want to create a jar file from second project. i.e. I want to Build second project (I use NetBeans IDE). I am using Build Main Project tab under Run. It is falling out. I am finding it second project' s jar file under its folder. I am clicking on it. But it is NOT WORKING. Do you know WHY. Could you help me please?
    Thanks,

  • Function module equivalent to SWE_EVENT_CREATE while using ABAP classes

    Hi there,
    I used to use SWE_CREATE_EVENT to fire the events linked to my BOR objects, in order to start certain workflows.
    Now I am using ABAP classes within the WorkFlows, and the name of the classes MUST (in my case) be longer than 10 characters, and SWE_EVENT_CREATE is cutting the name so it does not work
    Do you know any FM equivalent to start an event from a ABAP class (SE24) object?
    I have tried to use SAP_WAPI_START_WORKFLOW, but I cannot find the way to include my object in the container. Any ideas on this point would be welcome as well
    Thanks so much,
    Miguel

    Thanks for such a quick reply,
    You were right. I actually did follow Jocelyn's blogs, but somehow I skipped the raising event section.
    Just for information, the URL with the solution to this problem is:
    /people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow
    Have a good one

  • Using Classes within Vector

    ok,
    I writing a bank program where a user types in a string which is then broken into tokens. The tokens are separated using .nextToken( ) and the first token is used to determine what command the user wants to perform.
    My problem is that I am trying to place a class that Ive created within the vector and I cant seem to be able to get the tokens into the right place or retrieve them when they are needed.
    Here is what I have so far, ps I am very new to java.
    Project3Functions func = new Project3Functions();
    Vector vect = new Vector();
    do
    String firstLine = func.getLineInput();
    StringTokenizer tok = new StringTokenizer(firstLine," ");
    String hold = tok.nextToken();
    if(hold.equals("newAccount"))
    int index = Integer.parseInt(tok.nextToken());
    vect.setSize(index);
    vect.add(index, new Account());
    vect.add(index, Account.firstname = tok.nextToken());
    vect.add(index, Account.lastname = tok.nextToken());
    System.out.println("a new account was created");
    public class Account
    static String firstname = "";
    static String lastname = "";
    I am trying to create a new Account in the position <index> within the vector but I dont think Im referencing firstname and lastname correctly. Also how would I get firstname and lastname out of the vector to print them on the screen?
    Please someone help me.

    Don't use static fields in Account - that means that they are shared by all instances. Try something like:
    if(hold.equals("newAccount"))
      int index = Integer.parseInt(tok.nextToken());
      vect.setSize(index); // be careful! if index < size, then you will lose elements
      Account acct = new Account();
      acct.firstname = tok.nextToken();
      acct.lastname = tok.nextToken();
      vect.add(index, acct);
      System.out.println("a new account was created");
    public class Account
    String firstname = "";  //consider using get and set methods
    String lastname = "";
    }To get the data out,Account acct = (Account) vect.get(index);
    System.out.println("firstname = " + acct.firstname + ", lastname = " + acct.lastname);

  • Use Non Class VIs within Class

    I suppose this is a theory of OOP question.
    Say I have 2 classes, 1 is used to set the voltage on a power supply, and another is used to update a user interface.  They are not really related at all in that there is no common parent class and there is essentially no relationship between them.
    Now, I write a subVI that is some sort of specialized random number generator.  What if I want to use that VI within a method of each of the two classes I created above.  Where does this subVI belong?
    I can think of the following options, but I'm not sure what the best one is.  I would really love to hear your suggestions because it's been bugging me for a while:
    1) Create a method within each class that has the random number generator functionality.  I don't like this idea because I will be duplicating code.
    2) Simply choose to store the VI as part of my project and not include it within the classes.  What I don't like about this is that if I decide to reuse my code/class in another project, I will need to copy VIs that are not part of my class with it.
    3) Create some sort of "utilities" class that would hold all of these miscellaneous VIs and then use methods from this class.  I could pass an object of this utilities class into each class so I would have access to the methods.  But this seems to be pretty complicated.
    So that's the dilemma.  I'm wondering how all of you have chosen to solve this problem.  Thanks!
    Solved!
    Go to Solution.

    Create a reuse library.  I recommend looking at VI Package Manager.  You can create "packages" of reuse code and "install" them into each version of LabVIEW.  Then anybody can use them since they are in one nice location.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Triggering Java class within wls using Autosys

    Is it possible to trigger a Java class within the weblogic server externally using an utility like Autosys ?

    Dont know autosys that well but I would guess you would have to invoke java
    and run a starter class.
    There is a good product out there called Flux which is an all java based
    scheduling system that has some great scheduling features and is made
    to trigger either Session Beans, Add entrys to JMS Queues/Topic or
    fire a java class when a scheduled event is fired.
    try
    www.simscomputing.com
    Anil wrote:
    Is it possible to trigger a Java class within the weblogic server externally using an utility like Autosys ?

  • Cannot find a Vector within a Vector

    Yo. Another noob askin about elements within a Vector.
    I'm working on a OOP project in BlueJ. First time doing so, so my code is still kinda procedural (with many listeners in the same document, etc etc)
    I'm creating a simulation of a 7-a-side football game. I have stored the players of each team into a vector (e.g Vector 'Chelsea' would contain 7 player objects).
    I've only created three teams for simplicity, and stored these three Vectors into another Vector called 'teams'.
    (the whole purpose of storing them in vectors btw, is so I don't have to pass many different player objects as arguments -
    i can just send the vector, and extract them within the Listener classes)
    I'm now in the new class (Start_game) and i've passed the vector to the class.
    When I use the statement:
                     if (teams.contains(Arsenal))
                                  +some code+
                     }I get the error message: cannot find variable 'Arsenal', when I try to compile the program.
    Here's the code for the first class:
    * Write a description of class MainWindow here.
    * @author (your name)
    * @version (a version number or a date)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.util.Vector;
    import javax.swing.BoxLayout;
    public class Choose_player
        String t_chosen1;
        String t_chosen2;
        TextArea playerinfo1;
        TextArea playerinfo2;
        Vector teams = new Vector();
    //    Vector Arsenal = new Vector(4); // this will store Player objects with "Arsenal" in their team variable
        Vector Arsenal = new Vector(4);
            Player Adebayor = new Striker();
            Player Walcott = new Striker();
            Player Fabregas = new Midfielder();
            Player Denilson = new Midfielder();
            Player Gallas = new Defender();
            Player Eboue = new Defender();
            Player Lehmann = new Goalkeeper();       
    //    Arsenal.insertElementAt(Adebayor, 0);
    //    <Player>Arsenal</Player>.addElement(<Player>Adebayor);
        // learn collections - BIG TYME - refer to java site (url is in txt file)
        Vector Chelsea = new Vector(4); // this vector will store the Player objects whose team variable
                                        // contains the String "Chelsea"
            Player Drogba = new Striker();
            Player Anelka = new Striker();
            Player Lampard = new Midfielder();
            Player Phillips = new Midfielder();
            Player ACole = new Defender();
            Player Terry = new Defender();
            Player Cech = new Goalkeeper();
    //        int w = Chelsea.Size();
        Vector ManU = new Vector(4);    // this vector will store the Player objects whose team variable
                                        // contains the String "ManU"
            Player Rooney = new Striker();
            Player Tevez = new Striker();
            Player Giggs = new Midfielder();
            Player Ronaldo = new Midfielder();
            Player Ferdinand = new Defender();
            Player Brown = new Defender();
            Player Sar = new Goalkeeper();
        public void mainfalse(String t1, String t2)
            this.t_chosen1 = t1;
            this.t_chosen2 = t2;
            Frame m_frame = new mainframe("Select Captain", t_chosen1, t_chosen2, teams);
            m_frame.setSize(1200, 700);
            m_frame.setVisible(true);
        class mainframe extends Frame
            Vector teams;
            public mainframe(String title, String t_chosen1, String t_chosen2, Vector teams)
                super(title);
                this.teams = teams;
                setLayout(new FlowLayout());
    //            setLayout(new GridLayout());
    //            setLayout(new CardLayout());
    //            setLayout(new RelativeLayout());
    //            setLayout(new BoxLayout(m_frame, - FINISH EDITING BoxLayout statement
    // -------- ADD PLAYERS TO VECTOR -------- //           
                Arsenal.addElement(Adebayor);
                Arsenal.addElement(Walcott);
                Arsenal.addElement(Fabregas);
                Arsenal.addElement(Denilson);           
                Arsenal.addElement(Gallas);
                Arsenal.addElement(Eboue);           
                Arsenal.addElement(Lehmann);           
                Chelsea.addElement(Drogba);
                Chelsea.addElement(Anelka);           
                Chelsea.addElement(Lampard);
                Chelsea.addElement(Phillips);           
                Chelsea.addElement(ACole);
                Chelsea.addElement(Terry);           
                Chelsea.addElement(Cech);
                ManU.addElement(Rooney);
                ManU.addElement(Tevez);           
                ManU.addElement(Giggs);
                ManU.addElement(Ronaldo);           
                ManU.addElement(Ferdinand);
                ManU.addElement(Brown);           
                ManU.addElement(Sar);
                teams.addElement(Arsenal);
                teams.addElement(Chelsea);
                teams.addElement(ManU);
    // --------------- FIRST TEAM - CAPTAIN SELECTION ----------------      
                java.awt.List playerList1 = new java.awt.List(5);
                // CREATES A BOX WITH A LIST OF TEAMS (it can view 5 before needing a scroll bar)
                // (full specification needed when declaring -
                // java confused with List in 'awt', and list in 'util'.
                if (t_chosen1.equals("Arsenal"))
                    playerList1.add("Adebayor");
                    playerList1.add("Walcott");
                    playerList1.add("Fabregas");
                    playerList1.add("Denilson");
                    playerList1.add("Gallas");
                    playerList1.add("Eboue");
                    playerList1.add("Lehmann");
                } // if the chosen team is Arsenal, display chosen teams to be Arsenal players
                else if (t_chosen1.equals("Chelsea"))
                    playerList1.add("Lampard");
                    playerList1.add("Drogba");
                    playerList1.add("Anelka");
                    playerList1.add("Wright-Phillips");
                    playerList1.add("Cole");
                    playerList1.add("Terry");
                    playerList1.add("Cech");
                } // if the chosen team is Chelsea, display chosen teams to be Chelsea players
                else if (t_chosen1.equals("Manchester United"))
                    playerList1.add("Ronaldo");
                    playerList1.add("Rooney");
                    playerList1.add("Tevez");
                    playerList1.add("Giggs");
                    playerList1.add("Ferdinand");
                    playerList1.add("Brown");
                    playerList1.add("Sar");
                } // ditto
                add(playerList1);
                playerList1.addItemListener(new p_list_Listener1(playerList1));
                // add itemListener to 'playerList' object
                // - pass playerList object to listener to use getSelected() method
                playerinfo1 = new TextArea(10, 38);
                add(playerinfo1);
    // --------------- SECOND TEAM - CAPTAIN SELECTION ---------------- - same as above, for team2
                java.awt.List playerList2 = new java.awt.List(5); // CREATES A BOX WITH A LIST OF TEAMS (it can view 5 before needing a scroll bar)
    // add "Adebayor" as a selectable Captain for the Arsenal team
                if (t_chosen2.equals("Arsenal"))
                    playerList2.add("Adebayor");
                    playerList2.add("Walcott");
                    playerList2.add("Fabregas");
                    playerList2.add("Denilson");
                    playerList2.add("Gallas");
                    playerList2.add("Eboue");
                    playerList2.add("Lehmann");
                // add "Lampard" as a selectable Captain for the Chelsea team           
                else if (t_chosen2.equals("Chelsea"))
                    playerList2.add("Lampard");
                    playerList2.add("Drogba");
                    playerList2.add("Anelka");
                    playerList2.add("Wright-Phillips");
                    playerList2.add("Cole");
                    playerList2.add("Terry");
                    playerList2.add("Cech");
                // add "Christiano Ronaldo" as a selectable Captain for the Manchester United team           
                else if (t_chosen2.equals("Manchester United"))
                    playerList2.add("Ronaldo");
                    playerList2.add("Rooney");
                    playerList2.add("Tevez");
                    playerList2.add("Giggs");
                    playerList2.add("Ferdinand");
                    playerList2.add("Brown");
                    playerList2.add("Sar");
                add(playerList2);
                playerList2.addItemListener(new p_list_Listener2(playerList2));
                playerinfo2 = new TextArea(10, 38);
                add(playerinfo2);
    // ------ CHOICE MENU & TEXTFIELD - CHOOSE PLAYER TO SHOW ATTRIBUTES IN TEXTFIELD - TEAM 1 ---------
                Choice p_choice1 = new Choice();
                // new dropdown menu - choosing which player's info to display
                p_choice1.add("-- Choose player to display info --");
                if (t_chosen1.equals("Arsenal"))
                    p_choice1.add("Emmanuel Adebayor"); //Striker
                    p_choice1.add("Theo Walcott"); //Striker
                    p_choice1.add("Cesc Fabregas"); //Mid
                    p_choice1.add("Denilson"); //Mid
                    p_choice1.add("William Gallas");//Def
                    p_choice1.add("Emmanuel Ebou�");//Def
                    p_choice1.add("Jens Lehmann");//Keeper
                else if (t_chosen1.equals("Chelsea"))
                    p_choice1.add("Didier Drogba");//Striker
                    p_choice1.add("Nikolas Anelka");//Str
                    p_choice1.add("Frank Lampard");//Mid
                    p_choice1.add("Shaun Wright-Phillips");//Mid
                    p_choice1.add("Ashley Cole");//Def
                    p_choice1.add("John Terry");//Def
                    p_choice1.add("Petr Cech");//Keeper
                else if (t_chosen1.equals("Manchester United"))
                    p_choice1.add("Wayne Rooney");//Str
                    p_choice1.add("Carlos T�vez");//Str
                    p_choice1.add("Ryan Giggs");//Mid
                    p_choice1.add("Christiano Ronaldo");//Mid
                    p_choice1.add("Rio Ferdinand");//Def
                    p_choice1.add("Wes Brown");//Def
                    p_choice1.add("Edwin van der Sar");//Keeper
                add(p_choice1);
                TextField nameField1 = new TextField("", 30);
                add(new Label("Name"));
                add(nameField1);
                TextField ageField1 = new TextField("", 30);
                add(new Label("Age"));
                add(ageField1);
                TextField teamField1 = new TextField("", 30);
                add(new Label("Team"));
                add(teamField1);
                TextField speedField1 = new TextField("", 30);
                add(new Label("Speed"));
                add(speedField1);
                TextField defenceField1 = new TextField("", 30);
                add(new Label("Defence"));
                add(defenceField1);
                TextField accuracyField1 = new TextField("", 30);
                add(new Label("Accuracy"));
                add(accuracyField1);
                TextField positionField1 = new TextField("", 30);
                add(new Label("Position"));
                add(positionField1);
                Vector fields1 = new Vector(8, 2); // PASS TO CHOICE LISTENER
                fields1.add(nameField1);
                fields1.add(ageField1);
                fields1.add(teamField1);
                fields1.add(speedField1);
                fields1.add(defenceField1);
                fields1.add(accuracyField1);
                fields1.add(positionField1);
                p_choice1.addItemListener(new ChoiceListener(fields1, teams, p_choice1, t_chosen1));
                // pass the teams vector to variable, to:
                // 1) create players
                // 2) call methods to show their different attributes in each field
    // ------- CHOICE MENU & TEXTFIELD - CHOOSE PLAYER TO SHOW ATTRIBUTES IN TEXTFIELD - TEAM 2 ---------           
                Choice p_choice2 = new Choice();
                p_choice2.add("-- Choose player to display info --");
                if (t_chosen2.equals("Arsenal"))
                    p_choice2.add("Emmanuel Adebayor"); //Striker
                    p_choice2.add("Theo Walcott"); //Striker
                    p_choice2.add("Cesc Fabregas"); //Mid
                    p_choice2.add("Denilson"); //Mid
                    p_choice2.add("William Gallas");//Def
                    p_choice2.add("Emmanuel Ebou�");//Def
                    p_choice2.add("Jens Lehmann");//Keeper           
                else if (t_chosen2.equals("Chelsea"))
                    p_choice2.add("Didier Drogba");//Striker
                    p_choice2.add("Nikolas Anelka");//Str
                    p_choice2.add("Frank Lampard");//Mid
                    p_choice2.add("Shaun Wright-Phillips");//Mid
                    p_choice2.add("Ashley Cole");//Def
                    p_choice2.add("John Terry");//Def
                    p_choice2.add("Petr Cech");//Keeper
                else if (t_chosen2.equals("Manchester United"))
                    p_choice2.add("Wayne Rooney");//Str
                    p_choice2.add("Carlos T�vez");//Str
                    p_choice2.add("Ryan Giggs");//Mid
                    p_choice2.add("Christiano Ronaldo");//Mid
                    p_choice2.add("Rio Ferdinand");//Def
                    p_choice2.add("Wes Brown");//Def
                    p_choice2.add("Edwin van der Sar");//Keeper
                add(p_choice2);
                TextField nameField2 = new TextField("", 30);
    //            nameField1.setText("Here, you store the name");
                add(new Label("Name"));
                add(nameField2);
                TextField ageField2 = new TextField("", 30);
                add(new Label("Age"));
                add(ageField2);
                TextField teamField2 = new TextField("", 30);
                add(new Label("Team"));
                add(teamField2);
                TextField speedField2 = new TextField("", 30);
                add(new Label("Speed"));
                add(speedField2);
                TextField defenceField2 = new TextField("", 30);
                add(new Label("Defence"));
                add(defenceField2);
                TextField accuracyField2 = new TextField("", 30);
                add(new Label("Accuracy"));
                add(accuracyField2);
                TextField positionField2 = new TextField("", 30);
                add(new Label("Position"));
                add(positionField2);
                Vector fields2 = new Vector(8, 2); // PASS TO CHOICE LISTENER
                fields2.add(nameField2);
                fields2.add(ageField2);
                fields2.add(teamField2);
                fields2.add(speedField2);
                fields2.add(defenceField2);
                fields2.add(accuracyField2);
                fields2.add(positionField2);
                p_choice2.addItemListener(new ChoiceListener(fields2, teams, p_choice2, t_chosen2));
                // pass the teams vector to variable, to:
                // 1) create players
                // 2) call methods to show their different attributes in each field
    // --------------- add START GAME button ----------------           
                Button c = new Button("Start Game");
                add(c);
                c.addActionListener(new startgameListener(teams));
    // --------------- WINDOW CLOSER LISTENER ----------------
                addWindowListener(new WindowCloser()); // no object relation - you are adding a listener to the FRAME
    // --------------------- p_list_listener1 - listener for playerList1 ------------------
        class p_list_Listener1 implements ItemListener
            java.awt.List playerslist;
            public p_list_Listener1(java.awt.List playerslist)
                this.playerslist = playerslist;
            public void itemStateChanged(ItemEvent evt)
                String sth = playerslist.getSelectedItem();
    // ----------- PLAYER BIO'S ------------ //
    // ---- ARSENAL:
                String adebayorBio = "Emmanuel Adebayor (born 26 February 1984 in Lom�) is \na Togolese " +
                                    "football player of Nigerian descent who \ncurrently plays for Arsenal.";
                String walcottBio = "Theo James Walcott (born 16 March 1989 in \nStanmore, London) is an " +
                                    "English footballer of Caribbean \ndescent renowned for his pace, who " +
                                    "currently plays for \nArsenal, having signed there from Southampton on" +
                                    " 20 January 2006.";
                String fabregasBio = "Francesc Cesc F�bregas Soler (born 4 May 1987 in Arenys \nde Mar, " +
                                    "Catalonia, Spain) is a Spanish footballer \nwho plays as a central " +
                                    "midfielder for Arsenal in the \nEnglish Premier League and for the" +
                                    " Spanish national team.";
                String denilsonBio = "Den�lson Pereira Neves, known as Den�lson (born on \nFebruary 16, 1988 " +
                                    "in S�o Paulo, Brazil) is a Brazilian \nfootballer who usually plays as" +
                                    " a midfielder. He plays for English \nside Arsenal and is currently the" +
                                    " captain of \nthe Brazil under-20 national team.";
                String gallasBio =  "William Gallas, (born 17 August 1977 in Asni�res-sur-Seine), \nis a French" +
                                    " international footballer of Guadeloupian \ndescent who currently plays for " +
                                    "and captains \nArsenal in the English Premier League.";                   
                String eboueBio = "Emmanuel Ebou� (born June 4, 1983 in Abidjan, C�te d'Ivoire) \nis an Ivorian " +
                                  "football player who currently plays for \nArsenal.";
                String lehmannBio = "Jens Lehmann (German, born November 10, 1969 in Essen) is an award-winning German football goalkeeper who plays for Arsenal and for the German national team. He was voted Best European Goalkeeper twice in his career, and he has been selected for three World Cup squads.";
    // ---- CHELSEA:        
                String lampardBio = "Frank James Lampard, Jr. (born 20 June 1978) is an \nEnglish football " +
                                    "player currently at Chelsea and \npreviously with West Ham United and Swansea City.";
                String drogbaBio = "Didier Yves Drogba T�bily (born March 11, 1978 in Abidjan, C�te d'Ivoire) is a footballer from C�te d'Ivoire who currently plays for Chelsea in the English Premier League.";                   
                String anelkaBio = "Nicolas Anelka (born March 14, 1979 in Versailles, France) is a French footballer who plays in the forward position.";
                String phillipsBio = "Shaun Cameron Wright-Phillips (born 25 October 1981 in Greenwich, London) is an English football player of Jamaican and Grenadian descent.";
                String coleBio = "Ashley Cole (born 20 December 1980, Stepney, London) is an English footballer of Barbadian descent. Cole plays left back for Chelsea and for the England national team.";
                String terryBio = "John George Terry (born December 7, 1980 in Barking, London) is an English professional footballer. Terry plays as a centre back and is the captain of Chelsea in the English Premier League and officially for the England national football team.";
                String cechBio = "Petr Cech (born 20 May 1982 in Plze?, Czechoslovakia, now Czech Republic) is a Czech international football goalkeeper who is currently contracted to English Premier League football club Chelsea F.C., for whom he has played since July 2004.";
    // ---- MANU:
                String ronaldoBio = "Cristiano Ronaldo dos Santos Aveiro, OIH (pronounced \n[k?i??ti?nu ?u?na?du])," +
                                    "(born 5 February 1985 in Funchal, \nMadeira), better known as Cristiano Ronaldo, is a " +
                                    "\nPortuguese professional footballer. He plays both for \nthe English Premier League club " +
                                    "Manchester United and \nthe Portuguese national team."; 
                String rooneyBio = "Wayne Mark Rooney (born 24 October 1985 in Liverpool, Merseyside) is an English footballer who currently plays for the English Premier League club Manchester United and the England national team.";
                String tevezBio = "Carlos Alberto T�vez (born on 5 February 1984 in Ciudadela, Buenos Aires) is an Argentine footballer who currently plays for Premier League club Manchester United. He was described by Diego Maradona as the 'Argentine prophet for the 21st century.'";
                String giggsBio = "Ryan Joseph Giggs OBE[1] (born Ryan Joseph Wilson on 29 November 1973 in Ely, Cardiff) is a Welsh footballer currently playing for Manchester United in the English Premiership, and formerly for the Welsh national team prior to his retirement from international football on 2 June 2007.";
                String ferdinandBio = "Rio Gavin Ferdinand (born 7 November 1978 in Peckham, London) is an English footballer of mixed St Lucian,and Anglo-Irish descent. He plays at centre-back for Manchester United in the Premier League and at the international level for the England national football team.";
                String brownBio = "Wes 'Baked Bean' Michael Brown (born 13 October 1979 in Longsight, Manchester) is an English football player who plays as a defender for Manchester United.";
                String sarBio = "Edwin van der Sar (born 29 October 1970 in Voorhout) is a Dutch professional footballer who plays as a goalkeeper. He is captain of the Dutch national team and plays club football for Manchester United in the English Premier League.";
    // --------- TEAM BIO'S DONE!!!!!! ---------- //           
                try
                    if (sth.equals("Adebayor")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(adebayorBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Walcott")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(walcottBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Fabregas")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(fabregasBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Denilson")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(denilsonBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Gallas")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(gallasBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Eboue")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(eboueBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Lehmann")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(lehmannBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
    // if CHELSEA TEAMS               
                    else if (sth.equals("Lampard"))  // if the user selects "Chelsea", show Chelsea's Bio
                        playerinfo1.setText("" + lampardBio);
                        playerinfo1.setEditable(false);                        
                        //t_chosen = sth;               
                    else if (sth.equals("Drogba")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(drogbaBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Anelka")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(anelkaBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Wright-Phillips")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(phillipsBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Cole")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(coleBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Terry")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(terryBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Cech")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(cechBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
    // if MANU teams
                    else if (sth.equals("Ronaldo")) // .... and so on and so forth
                        playerinfo1.setText("" + ronaldoBio);
                        playerinfo1.setEditable(false);
                    else if (sth.equals("Rooney")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(rooneyBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Tevez")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(tevezBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Giggs")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(giggsBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Ferdinand")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(ferdinandBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Brown")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(brownBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                    else if (sth.equals("Sar")) // if the user selects "Arsenal", show Arsenal's Bio
                        playerinfo1.setText(sarBio);
                        playerinfo1.setEditable(false);
                        //t_chosen = sth;
                catch (NullPointerException e)
                // if sth equals 'null', catch the exception and continue the program
        } // end class
    // --------------- p_list_Listener2 - listener for playerList2 ------------------
        class p_list_Listener2 implements ItemListener
            java.awt.List playerslist;
            public p_list_Listener2(java.awt.List playerslist)
                this.playerslist = playerslist;
            public void itemStateChanged(ItemEvent evt)
                String sth = playerslist.getSelectedItem();
    // ----------- PLAYER BIO'S ------------                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

    Ok. Here's my code at last. It comprises of three classes, each creating three different frames:
    Class 1:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Vector;
    class class1
        public static void main(String[] param)
            Frame f = new TestFrame("test");
            f.setSize(600, 450);
            f.setVisible(true); // the first window is shown
    class TestFrame extends Frame
        public TestFrame(String title)
            super(title);
            setLayout(new FlowLayout());
            Button a = new Button("Click Me");
            add(a);
            a.addActionListener(new ButtonListener());
            addWindowListener(new WindowCloser());
        class ButtonListener implements ActionListener
            public void actionPerformed(ActionEvent evt)
                class2 c_instance = new class2();
                c_instance.mainfalse();
    Class 2:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.util.Vector;
    import javax.swing.BoxLayout;
    public class class2
        Vector teams;
        Vector Arsenal = new Vector(4);
            Player Adebayor = new Striker();
            Player Walcott = new Striker();
            Player Fabregas = new Midfielder();
            Player Denilson = new Midfielder();
            Player Gallas = new Defender();
            Player Eboue = new Defender();
            Player Lehmann = new Goalkeeper();
            // ONLY CREATING ONE TEAM FOR THE PURPOSE OF THE SIMPLIFIED PROGRAM
        public void mainfalse()
            Frame m_frame = new mainframe("class3", teams);
            m_frame.setSize(1200, 700);
            m_frame.setVisible(true);
        class mainframe extends Frame
            Vector teams;
            public mainframe(String title, Vector teams)
                super(title);
                this.teams = teams;
                setLayout(new FlowLayout());
                Arsenal.addElement(Adebayor);
                Arsenal.addElement(Walcott);
                Arsenal.addElement(Fabregas);
                Arsenal.addElement(Denilson);           
                Arsenal.addElement(Gallas);
                Arsenal.addElement(Eboue);           
                Arsenal.addElement(Lehmann);    
                teams.addElement(Arsenal);
    // --------------- add START GAME button ----------------           
                Button c = new Button("Start Game");
                add(c);
                c.addActionListener(new startgameListener(teams));
    // --------------- WINDOW CLOSER LISTENER ----------------
                addWindowListener(new WindowCloser());           
        class startgameListener implements ActionListener
            Vector teams;
            public startgameListener(Vector t1)
                this.teams = t1;
            public void actionPerformed(ActionEvent evt)
                class3 c_instance1 = new class3();
                c_instance1.gVector(teams);
    }*... and Class 3:*
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Vector;
    public class class3
        Vector teams;
        public void gVector(Vector t1)
            this.teams = t1;
            Frame main = new mainframe("Main Window", teams);
            main.setSize(1400, 900);
            main.setVisible(true);
        class mainframe extends Frame
            public mainframe(String title, Vector t1)
                super(title);
                setLayout(new FlowLayout());
                addWindowListener(new WindowCloser());
                Vector teams = t1;
                JOptionPane.showMessageDialog(null, "Hello and WELCOME to The FIRST, annual StickMan Footy!");
                if (teams.contains(Arsenal))
                    int t = teams.indexOf(Arsenal);
                    Vector Arsenal = (Vector) teams.elementAt(t);
                // getName() is a method declared in the Player class
                // the Player class is the superclass of the Striker class
    /*            if (teams.contains(Adebayor))
                And my error message after trying to compile Class 2, is "cannot find symbol - variable Arsenal".
    ........... help.
    Shax

  • Needs help.....Please about using different classes

    I don't know how to use differenet classes.
    Please tell me how to write class to suit Start. This stuff me up. Please .... help me
    <<My program>>
    //Start
    public class Start
    {  private Artist[] Artists;
    private Record[] records;
    private Person[] Manager;
    private TextMenu makeMenu = new TextMenu();
    public static void main(String[] args)
         Start studio = new Start();
    studio.menu();
    public Start()
    {  //Person.Manager(ManagerName,HouseNumber,StreetNumber,PhoneNumber)
         Manager = new Person[1];
         Manager[0] = new Person("Yangfan",88,"Young ST",11118888);
         //Artist(GroupID,ArtistName,HouseNumber,StreetNumber,PhoneNumber)
         Artists = new Artist[5];
    Artists[0] = new Artist(1,"Backstreet Boys",58,"Music ST",99998888);
    Artists[1] = new Artist(2,"Santana",68,"Music ST",99998899);
    Artists[2] = new Artist(3,"Macy Gray",78,"Music ST",55558888);
    Artists[3] = new Artist(4,"Ricky Martin",88,"Music AVE",77778888);
    Artists[4] = new Artist(5,"Did Rock",55,"Music Road",66667777);
    //Record(RecordingID,RecordName,Artist,StartTime,FinishTime,RecordingDate,GuestArtist1,GuestArtist2)
    records = new Record[6];
    records[0] = new Record(1,"I want it that way",Artists[0],11,12,"05/08/2001",Artists[1],Artists[3]);
    records[1] = new Record(2,"Smooth",Artists[1],11,12,"05/08/2001",Artists[1],"");
    records[2] = new Record(3,"Do something",Artists[2],11,"05/08/2001",Artists[3],"");
    records[3] = new Record(4,"Livin La Vida Loca",Artists[3],11,12,"05/08/2001",Artists[1],Artists[3]);
    records[4] = new Record(5,"Bawitdaba",Artists[4],11,13,"05/08/2001",Artists[1],"");
    records[5] = new Record(6,"The one",Artists[0],11,14,"05/08/2001",Artists[1],"");
    public void menu()
    {  String[] choices = {">>>List Manager Details",">>>List All Artist Names",">>>List An Artist Telephone-Number",">>>Show Details For One Recording",">>>Add A New Recording",">>>List The Recording Costs For All Artists",">>>List Artist's Reocording",">>>Exit Program"};
    while (true)
    {  switch (makeMenu.getChoice(choices))
    {  case 1: showAllArtists();
    break;
    case 2: showAllRecords();
    break;
    case 3: System.exit(0);
    break;
    case 4: System.exit(0);
    break;
    case 5: System.exit(0);
    break;
    case 6: System.exit(0);
    break;
    case 7: System.exit(0);
    break;
    case 8: System.exit(0);
    break;
    default:
    public void showAllArtists()
    {  int numArtists = Artists.length;
    for(int i = 0; i < numArtists; i++)
    {  Artists[i].displayArtistDetails();
    public void showAllRecords()
    {  for (int i = 0; i < records.length; i++)
    {  System.out.println();
    records.printRecordDetails();
    <<Assignment>>
    Due - midnight, Wednesday August 22nd
    This assignment will test your knowledge of Java programming using classes, encapsulation and javadoc.
    The base requirements
    Write a complete Java class to manage a Digital Recording Studio. The studio wants to keep a list of all Artists that use the studio and also wishes to keep track of all Recordings that have been made. An important function of the program is to calculate the time spent making a recording and charge the Artist for the time used.
    You must create at least the following classes, Start, Studio, Person, Artist, Recording, Address. You may create other classes if needed as well
    Start will contain main(), create one instance of a Studio and execute a Menu of commands to test your code. Studio should contain a studio name, an array of Artist and an array of Recording plus the studio manager (a Person). Each Artist should contain the name of the group and an Address. Each Person will have a name and a home address. Each recording will have a Title (usually song title), an Artist (only one), and a list of guestArtist (they are Artist�s but will not receive royalties) the number of the CD the recording is stored on (numbers are numerical and recordings are saved on CD-R), plus the recording start and finish times for the recording session (suggest you use Java Date class � refer to the API). An Address will contain, house number (integers only), a street name and a telephone number. There is no need to store city and country.
    To enter a set of data for testing your program � main() should call a method in the Start class that will fill in a set of values by creating objects and filling in values by calling methods in each class. This is the ONLY method allowed to be longer than 1 page long � normally we would read the data from a file but there are no O-O principles that can be learnt with simply filling in data values. It is suggested to create say at least 4 Artist�s and 6 Recordings (at least one with 1 guest Artist and one with 2 guestArtist�s)
    A menu for testing your program should be provided (it is suggested to put the Menu into a separate class as you need at least 3 menus). While other commands are possible, only the following ones will receive marks.
    Menu commands needed are
    List the Managers name, address and telephone number
    List all Artist Names
    List an Artist telephone number (a sub menu showing valid Artist�s is required)
    Show all details for one Recording ( sub menu of valid Recordings will be needed and remember there can be more than one guestArtist)
    Add a new Recording, user will need to be prompted for all details.
    List the recording costs for all Artists � show each Artist on a separate line with their name and total amount, charge for using the studio is $1000 per hour or part thereof, example for a 1 hour and 10 minute recording the Artist will be billed for 2 hours.
    List all the Recording�s one Artist has worked on (sub menu of Artists needed), the list should show whether they were the Artist or a guestArtist
    Exit program
    Use fixed sizes for arrays, suggest 20 is suitable for all arrays. Java can handle dynamic data structures (where the number of elements can grow or shrink), but that is beyond a first assignment.
    Do NOT make ANY methods static - this defeats the Object Oriented approach and will result in ZERO marks for the entire assignment.
    Data MUST be encapsulated, this means that all the data relating to an object are to be stored INSIDE an object. None of the data detail is to be globally available within your program - hence do not store Artist names in either Studio or Recordings � just store a reference instead. Do NOT create ID numbers for Artists, you should use References instead � for many students this will be the hardest part as you have to use Objects, not program in a C style to solve the problem. Note that if there are any non-private data in classes then zero will given for marks for encapsulation.
    Good programming style is expected (see web page or lecture notes). In particular, you must use javadoc to generate a set of html pages for your classes. Make sure you use the special javadoc style comments in your source code. Marks will be granted for both using javadoc and also for including sensible javadoc comments on each class and each public method.
    What to Hand In
    Read the turnin page, basically the .java files, a readme.txt to tell the marker which file the program starts from plus the javadoc (html) files. Do NOT send .class files (if you do send these we will delete them and recompile your program), do NOT compress with gtar, tar, zip or use any other tool on your files. Turnin automatically compresses all your files into a single archive for us to mark.
    The simplest way to turnin all your files is to place all files in one directory then just use the *.* wildcard to turn in all files within that one directory.
    You must turnin all files that are not part of Java 1.3. In particular, you are allowed (actually encouraged) to use EasyIn or SavitchIn but should include the one you use in the files you submit. It is STRONGLY suggested that you copy all the files into another directory, test it works there by compiling and executing then turnin files from that directory. A common problem is students adding comments at the last minute then not testing if it still compiles. The assignment will be marked as submitted � no asking later for leniency because you added comments at the last minute and failed to check if it still worked.
    If the tutors are unable to compile your submission, they will mark the source code but you will lose all the execution marks. Sorry, but it is your responsibility to test then hand in all files.
    Comments
    For CS807 students, this program should be fairly easy if it was to be programmed in C (you would use several struct). The real art here is to change over to programming objects. Data is contained in an object and is not global. This idea is essential to using Java effectively and is termed encapsulation. Instead of using function(data), you use objectName.method( ). Effectively you switch the data and functions around, the data has a method (function) attached to it, not the other way around as in C (where you have a function and send data to it).
    While there will be some marks for execution, the majority of the marks will be given for how well you write your code (including comments and documentation) and for how well you used O-O principles. Programs written in a C style with most of the code in one class or using static will receive ZERO marks regardless of how well they work.
    You are responsible for checking your turnin by reading the messages turnin responds with. Failure to read these messages will not be an acceptable excuse for submitting an incorrect assignment. About 2% of assignments sent to turnin are unreadable (usually empty) and obtain 0.
    Late submissions
    Late submissions will only be accepted with valid reasons for being late. All requests for assignment extensions must be made via email to the lecturer. Replies for acceptance or refusal will made by email. Instant replies are unrealistic (there is usually a flood of queries into my mail box around assignment due dates) and the best advice is to ask at least 4 days in advance so that you will have a reasonable chance of getting a timely reply and allow yourself enough time to submit something on time if the extension is not granted.
    ALL late submissions will be marked LAST and will NOT be sent to tutors for marking until all other assignments have been marked. As an example, if you submit late and your assignment is not yet marked by the time assignment 2 is due then it will be pushed to the end of the marking pile as the assignments that were submitted on time for assignment 2 will take priority.
    If you make a second submission after the submission date, only the first submission will be marked. We will not mark assignments twice! You can update your submission BEFORE the submission date if you need to - this will just overwrite the first submission. The latest time for a late submission is 5pm on the Wednesday after the due date. This is because, either a solution will be handed out at that lecture or details of the assignment will be discussed at the lecture. I cannot accept any assignment submissions after that time for any reason at all including medical or other valid reasons. For those who are given permission to be later than the maximum submission time � a different assignment will be handed out. Remember, if you decide to submit late you are VERY UNLIKELY to receive feedback on your assignments during semester.
    Assignments will be removed from turnin and archived elsewhere then forwarded to tutors for marking on the morning after the assignment is due. A different tutor will mark each of your assignments � do not expect the tutor you see at the tutorials to be your marker.
    Marks will be returned via email to your computer science yallara account � ideally within 2 weeks. I will send marks out when I receive them so do not send email asking where your marks are just because a friend has theirs. If you want your email forwarded to an external account, then place a valid .forward file into your yallara account. The Help Desk on level 10 can assist you in setting this up if you do not know how to do it.

    I have seen other people who have blatantly asked for
    other people to do their homework for them, but you
    are the first person I've seen to actually cut and
    paste the entire assignment as it was handed to you.
    Amazing.
    Well, unlike some of the people you're talking about, it seems like zyangfan did at least take a stab at it himself, and does have a question that is somewhat more sepcific that "please do this homework for me."
    Zyangfan,
    marendoj is right, though. Posting the entire assignment is kind of tacky. If you want to post some of it to show us what you're trying to do, please trim it down to the essential points. We don't need to see all the instructor's policies and such.
    Anyway, let me see if I understand what you're asking. You said that you know how to write the code, but only by putting it all in one class, is that right? What part about using separate classes do you not understand? Do you not know how to make code in one class aware that the other class exists? Do you not know how code in class A can call a method in class B?
    Please be a bit more specifice about what you don't understand. And at least try using multiple classes, then when you can't figure out why something doesn't work, explain what you did, and what you think should have happened, and what did happen instead.
    To get you started on the basics (and this should have been covered in your course), you write the code for two classes just like for one class. That is, for class A, you create a file A.java and compile it to A.class. For class B, you create a file B.java and compile it to B.class. Given how rudimentary you question is, we'll skip packages for now. Just put all your class files in the same directory, and don't declare packages in the .java files.
    To call a method in class B from code that's in class A, you'll need an object of class B. You instantiate a B, and then call its methods.
    public class B {
      int count;
      public B() { // constructor
      public void increment() {
        count++;
    public class A {
      public static void main(String args[]) {
        B b = new B();
        b.increment();
    }Is this what you were asking?

  • Using APEX_MAIL from within a procedure invoked from DBMS_JOB

    I have done a lot of googling and wasted a couple of days getting nowhere and would appreciate some help. But I do know that in order to use APEX_MAIL from within a DBMS_JOB that I should
    "In order to call the APEX_MAIL package from outside the context of an Application Express application, you must call apex_util.set_security_group_id as in the following example:
    for c1 in (
    select workspace_id
    from apex_applications
    where application_id = p_app_id )
    loop
    apex_util.set_security_group_id(p_security_group_id =>
    c1.workspace_id);
    end loop;
    I have created a procedure that includes the above (look towards the end)
    create or replace procedure VACANCIES_MAILOUT
    (p_application_nbr number,
    p_page_nbr number,
    p_sender varchar2)
    AS
    Purpose: Email all people registerd in MAILMAN [email protected]
    with details of any new vacancies that started listing today.
    Exception
    when no_data_found
    then null;
    when others then raise;
    l_body CLOB;
    l_body_html CLOB;
    l_vacancy_desc VARCHAR2(350);
    to_headline varchar2(200);
    to_org varchar2(100);
    l_vacancies_desc varchar2(2000);
    to_workspace_id number(22);
    CURSOR vacancies_data IS
    select DISTINCT v.headline to_headline,
    ou.org_name to_org
    from VACANCIES v,
    Org_UNITS ou
    where
    ou.org_numb = v.Org_Numb
    and v.public_email_sent_date is Null
    Order by ou.org_name, v.headline;
    BEGIN
    BEGIN
    FOR vacancies_rec in vacancies_data
    -- build a list of vacancies
    loop
    BEGIN
    l_vacancy_desc := '<br><b>' ||
    vacancies_rec.to_org || '<br>' ||
    vacancies_rec.to_headline || '</b><br>';
    -- l_vacancy_desc :=
    -- vacancies_rec.to_org || ' - ' ||
    -- vacancies_rec.to_headline ;
    l_vacancies_desc := l_vacancies_desc || l_vacancy_desc;
    END;
    END LOOP;
    END;
    l_body := 'To view the content of this message, please use an HTML enabled mail client.'||utl_tcp.crlf;
    l_body_html :=
    '<html>
    <head>
    <style type="text/css">
    body{font-family:  Verdana, Arial, sans-serif;
                                   font-size:11pt;
                                   margin:30px;
                                   background-color:white;}
    span.sig{font-style:italic;
    font-weight:bold;
    color:#811919;}
    </style>
    </head>
    <body>'||utl_tcp.crlf;
    l_body_html := l_body_html || l_vacancies_desc
    || '<p>-----------------------------------------------------------------------------------------------------------------</strong></p>'
    ||utl_tcp.crlf
    || '<p>The above new vacancies have been posted on the <strong>Jobs At Murdoch</strong> website.</p>'
    ||utl_tcp.crlf
    ||'<p>For futher information about these vacancies, please select the following link</p>'
    ||utl_tcp.crlf
    ||'<p> Jobs At Murdoch </p>'
    ||utl_tcp.crlf
    ||'<p></p>'
    ||utl_tcp.crlf;
    l_body_html := l_body_html
    ||' Regards
    '||utl_tcp.crlf
    ||' <span class="sig">Office of Human Resources</span>
    '||utl_tcp.crlf;
    for c1 in (
    select workspace_id
    from apex_applications
    where application_id = 1901)
    loop
    apex_util.set_security_group_id(p_security_group_id => c1.workspace_id);
    end loop;
    apex_mail.send(
    p_to => '[email protected]',
    p_from => '[email protected]',
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => 'Jobs At Murdoch - new vacancy(s) listed');
    update VACANCIES
    set public_email_sent_date = trunc(sysdate,'DDD')
    where public_email_sent_date is null;
    commit;
    END;
    but still get the error
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    ORACLE_HOME = /oracle
    System name: Linux
    Node name: node
    Release: 2.6.18-194.17.1.el5
    Version: #1 SMP Mon Sep 20 07:12:06 EDT 2010
    Machine: x86_64
    Instance name: instance1
    Redo thread mounted by this instance: 1
    Oracle process number: 25
    Unix process pid: 5092, image: (J000)
    *** 2011-07-12 09:45:03.637
    *** SESSION ID:(125.50849) 2011-07-12 09:45:03.637
    *** CLIENT ID:() 2011-07-12 09:45:03.637
    *** SERVICE NAME:(SYS$USERS) 2011-07-12 09:45:03.637
    *** MODULE NAME:() 2011-07-12 09:45:03.637
    *** ACTION NAME:() 2011-07-12 09:45:03.637
    ORA-12012: error on auto execute of job 19039
    ORA-20001: This procedure must be invoked from within an application session.
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 290
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 325
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 367
    ORA-06512: at "HRSMENU_TEST.VACANCIES_MAILOUT", line 94
    ORA-06512: at line 1
    Can someone please tell me what what stupid thing I am doing wrong? The procedure worked when invokded from SQL Workshop but fails in a DBMS_JOB.
    much thanks Peter

    I think that might help...
    http://www.easyapex.com/index.php?p=502
    Thanks to EasyApex..
    LK

  • Internal class type 023 cannot be used in class maintenance

    Dear PP gurus,
    I am creating class from  t code CL01 and  while entering class type 023         , i am getting a error message
    "Internal class type 023 cannot be used in class maintenance" . when i pressed F4 , in the list 023 is not present.
    In the develpopment client , when i do the same  023 , it allows be to create class
    pls help me wher i am missing or?
    Regards

    Hello All,
    I am facing a similar problem.
    I have checked the following customization "SPRO --> Cross Application component -->Classification system --> Class --> Maintain Object type and class,
    Here select the MARA table click on the object and check class type 023 is assigned or not."
    Class type 023 is not assigned there. When i try to add a new entry I get the following error message
    "Specify the key within the work area".
    I referred to the following note :OSS Note 1066606, but that is concerned with AFS component.
    Kindly provide me a solution as soon as possible.
    Regards,
    Julia

  • Please give me the information when to use inner classes in applications

    HI,
    please give me when to use the innerclasses

    > HI,
    please give me when to use the innerclasses
    Use them when you want to create a class within another class.
    Now gimme all 'er Dukes!!!

  • Java Inner classes within the Threading paradigm

    Hi all.
    Im familiar with static nested classes, method local classes, inner classes and anonymous classes.
    But what I am a little perplexed by, is when exactly to use inner classes or static nested classes? (forgetting anonymous classes and method local classes).
    I read this article (http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html) and the first point makes for a good argument, but why nest the class? Why not define it as an external class?
    Also you typically find nested classes within the Threading paradigm, but why?
    I typically would create a top level class (non nested) that would implement the Runnable interface, override run() and then
    use this class when constructing a new Thread.
    Any clarification would be greatly received.
    Thanks and Happy Friday.

    Boeing-737 wrote:
    I read this article (http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html) and the first point makes for a good argument, but why nest the class? Why not define it as an external class?
    I was going to provide some reasons, but when I read the article I found they were already there. Following the DRY principle I'm going to let the article speak for itself.
    Also you typically find nested classes within the Threading paradigm, but why?No, I don't. If that's where you typically find them then you haven't had a varied experience.
    I typically would create a top level class (non nested) that would implement the Runnable interface, override run() and then
    use this class when constructing a new Thread.So carry on doing that, if it works for you.

  • AS3 air project.. nested button in a movie clip .. trying to use a class script

    I have been tring to have a button in a nested movie clip move the timeline along using a class script attached to the nested movie. I can get the buttons to work on the main timeline with another similar class script, but when I have a button within a nested movie and attach similar code to the movie, it doesn't seem to want to work. This is the class code attached to the nested clip.... I guess can an active listener be called if the button isn't yet being visible yet, and should this be done on the Main class script page for the main timeline? Any help would be great!! Thanks
    package  {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        public class Animation extends MovieClip {
            public function Animation() {
                gotoAndStop(1);
                negBackground_btn.addEventListener(MouseEvent.MOUSE_UP, buttonPressedNegBackground);
            private function buttonPressedNegBackground(e:MouseEvent):void {
                negBackground_btn.visible = false;
                gotoAndStop("negChar");

    Hi,
    Your question is bit confusing, try to explain it. According to what I unsrestand you should use the particular movieClip name with the code to make it happen properly.
    Like :
    (movieClip_Instance).gotoAndStop("negChar");

  • When is it best to use Local Classes..?

    Hi All,
           We all know that a global class creation is very helpful wherein the class can be reused by multiple programs.In contrast when is it best to use a local class within the program...?
    Can anyone please share the sample scenarios where we need to make use of a local class...?
    Cheers
    Nishanth

    Hi Nishanth,
    First of all, there will be a few cases when creating a local class in your program is mandatory. For example,
    if you're using an ALV Grid on your screen using the OO Approach, then you <b>must</b> declare a class locally in
    your program if you want to handle the events. You cannot use a subroutine in this case.
    Secondly, if you are looking for an explanation that is more introductory in nature, then the ABAP Programming
    help has got some good documentation. Here are the links which explain the concepts with an example as a
    transition from function groups to classes -
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Regards,
    Anand Mandalika.

  • How to use TableSorter class with DefaultTableModel

    Hi Friends
    Please tell me how to use TableSorter Class which is in the Java. Tutorials with DefaultTableModel.
    i saw in a thread there it was given that we have to pass the DefaultTableModel to the TableSorter Class.
    I tried to use like that. But i am getting Error Like Exception occurred during event dispatching:
    I am posting the part of Code where i use the DefaultTableModel
         private void displayavailablity(String selectedAuthor)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT BId,BName,BAuthorName,BAuthorandPublisher,BCat FROM Books where BAuthorandPublisher='" +selectedAuthor+"'");     
                        ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"NUMBER","BOOK NAME","AUTHOR","CODE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        TableSorter sorter = new TableSorter((DefaultTableModel)table.getModel());
                        rs.close();
                   catch(SQLException ex)
                        System.out.println("ERROR IS HERE");
                        ex.printStackTrace();
         }Please help me on this issue Otherwise Please give me some Sample coding to implement this sorting. with DefaultTableModel
    Thank you for your service
    Cheers
    Jofin

    I don't know about any TableSorter class, but I suppose you mean javax.swing.table.TableRowSorter.
    The TableRowSorter is to be attached to the JTable, not to the data model. Here's a cut'n'paste from the last time I used it:
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
    myTable.setRowSorter(sorter);
    And heres from the JDK1.6 documentation:
    TableModel myModel = createMyTableModel();
    JTable table = new JTable(myModel);
    table.setRowSorter(new TableRowSorter(myModel));
    Check out http://java.sun.com/javase/6/docs/api/javax/swing/table/TableRowSorter.html. I find it to be good documentation.

Maybe you are looking for

  • Embedding video in CS4

    How do you embed video in Dreamweaver?

  • Creating a PDF from a plugin

    I'm developing a plugin for the Mac which will need to create a PDF of the image. The PDF generation methods in Cocoa require an NSView to operate against. My question is how do I dynamically create a view using the image data passed to the plugin? O

  • No sound on A305 series laptop

    For some reason the express card was missing from my laptop and I didn't realize it until I inspected the laptop.  Ever since it didn't have the card I have not been getting any sound at all despite verifying that it had the correct sound drivers.  A

  • Parse Error

    Real strange, I'm using a PC at work and I can import a .mov file in AE CS3 but I can't import a jpeg file error parse message how do I fix the issue. Jim

  • How to transform a photography to this kind of painting/drawing. (examples attached)

    Hi, I would like to transform photographies into one specific kind of paint/draw. I understand theres allot of filters already available and i also downloaded some actions i found, none gave me the result i want, below theres an example of a photo i