Does this code look right

<?php
$name=$_POST['name'];
$email=$_POST['email'];
$location=$_POST['location'];
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());
mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$location')");
Print "Your information has been successfully added to the database.";
?>

What colors? You mean in code view?
Actually your last line should be this -
print ("Your information has been successfully added to the database.");
Other than that, the code and its coloring are correct as far as I can tell.

Similar Messages

  • Programming project: does this code look clean enough to turn in?

    Hi, i was just wanting to know people's opinion on the format of my classes below, i haven't done much java programming and I just want to make sure that this program is easily understood. I will not be able to respond, because I have to wake up in 3 hours for school. So thanks in advance, I will be reading this tomorrow, to see your suggestions, thank you.
    here is the scholar class, it is the class that i made to create a scholar(student object) that will be applying for a scholarship and the grades are entered in the ScholarTester class.
    I could've done things differently and easier but the professor strictly called for it to be exactly as he stated. I came up with a better, less tedious way, but i couldn't use it. My way was to create a method to randomly generate grades and values to determine the major, but my prof. saw it and made me implement everything in ScholarTester. Also neither of the students will receive the scholarship, that will be determined in project 2 my professor said.
    package project1;
    import java.util.*;
    * @author Kevin
    public class Scholar implements Comparable {
        // private variables
        private String fullName;
        private double gradePointAverage;
        private int essayScore;
        private int creditHours;
        private boolean scienceMajor;
        private double totalScore;
           // constructor for a Scholar object
            public Scholar(String myFullName, double myGradePointAverage, int myEssayScore,
                           int myCreditHours, boolean isScienceMajor){
                    this.fullName = myFullName;
                    this.gradePointAverage = myGradePointAverage;
                    this.essayScore = myEssayScore;
                    this.creditHours = myCreditHours;
                    this.scienceMajor = isScienceMajor;
            // returns a Scholar object's fullname
            public String getFullName(){
                return fullName;
            // returns a Scholar object's gpa
            public double getGradePointAverage(){
                return gradePointAverage;
            // returns a Scholar object's essay score
            public int getEssayScore(){
                return essayScore;
            /// returns a Scholar object's credit hours
            public int getCreditHours(){
                return creditHours;
            // retruns if a Scholar object is a science major or not
            public boolean getScienceMajor(){
                return scienceMajor;
            // sets a Scholar object's full name
            public String setFullName(String lastName, String firstName){
               fullName = lastName + ", " + firstName;
               return fullName;
            // sets a Scholar object's gpa
            public double setGradePointAverage(double a){
                gradePointAverage = a;
                return gradePointAverage;
            // sets a Scholar object's gpa
            public int setEssayScore(int a){
                essayScore = a;
                return essayScore;
            // sets a Scholar object's credit hours
            public int setCreditHours(int a){
                creditHours = a;
                return creditHours;
            // sets a Scholar's major to a science major or not a science major
            public boolean setScienceMajor(boolean a){
                scienceMajor = a;
                return scienceMajor;
            // calculates a Scholar object's score
            public double getScore(){
                totalScore = (gradePointAverage*5) + essayScore;
                if (scienceMajor == true)
                    totalScore += .5;
                if (creditHours >= 60 && creditHours <90)
                    totalScore += .5;
                else if (creditHours >= 90)
                    totalScore += .75;
                return totalScore;
            // compares two scholar objects.
            public int compareTo(Object obj){
                Scholar otherObj = (Scholar)obj;
                double result = getScore() - otherObj.getScore();
                if (result > 0)
                    return 1;
                else if (result < 0)
                    return -1;
                return 0;
            // returns the highest scoring of two Scholar objects
            public static Scholar max(Scholar s1, Scholar s2){
                if (s1.getScore() > s2.getScore())
                    System.out.println(s1.getFullName() + " scored higher than " +
                                       s2.getFullName() + ".\n");
                else
                   System.out.println(s2.getFullName() + " scored higher than " +
                                       s1.getFullName() + ".\n");
                return null;
            // returns the highest of 3 student objects
            public static Scholar max(Scholar s1, Scholar s2, Scholar s3){
                if (s1.getScore() > s2.getScore() && s1.getScore() > s3.getScore())
                    System.out.println(s1.getFullName() + " scored the highest" +
                            " out of all three students.");
                else if (s2.getScore() > s1.getScore() && s2.getScore() > s3.getScore())
                    System.out.println(s2.getFullName() + " scored the highest" +
                            " out of all three students.");
                else if (s3.getScore() > s2.getScore() && s3.getScore() > s1.getScore())
                    System.out.println(s3.getFullName() + " scored the highest" +
                            " out of the three students.");
                return null;
            // toString method for a Scholar object
            public String toString(){
                return  "Student name: " + fullName + " -" + " Grade Point Average: "
                        + gradePointAverage  + ". " + "Essay Score: " + essayScore + "."
                        + " Credit Hours: " + creditHours + ". "  +  " Science major: "
                        + scienceMajor + ".";
    }here's the ScholarTester class:
    package project1;
    import java.util.*;
    * This program creates Scholar objects that are applying for a scholarship
    * @author Kevin
    public class ScholarTester {
    public static void main(String [] args){
    System.out.println("This program was written by Kevin Brown. \n");
    System.out.println("--------Part 1--------\n");
    // attributes for a scholar object named abraham
    double abrahamGpa;
    int abrahamEssayScore;
    int abrahamCreditHours;
    int scienceMajorValueAbraham;
    boolean abrahamIsScienceMajor;
        // random numbers used for each scholar object.
        Random doubleGpa = new Random();
        Random intGpa = new Random();
        Random essayScore = new Random();
        Random creditHours = new Random();
        Random scienceMajor = new Random();
            // randomly creates abraham's statistics
            abrahamGpa = doubleGpa.nextDouble() + intGpa.nextInt(4);
            abrahamEssayScore = essayScore.nextInt(6);
            abrahamCreditHours = creditHours.nextInt(121);
            scienceMajorValueAbraham = scienceMajor.nextInt(2);
                if (scienceMajorValueAbraham == 0)
                 abrahamIsScienceMajor = true;
                else
                 abrahamIsScienceMajor = false;
    Scholar abraham = new Scholar("Lincoln, Abraham", abrahamGpa,
                                      abrahamEssayScore, abrahamCreditHours,
                                      abrahamIsScienceMajor);
    System.out.println(abraham);
    double georgeGpa;
    int georgeEssayScore;
    int georgeCreditHours;
    int scienceMajorValueGeorge;
    boolean georgeIsScienceMajor;
        // randomly creates george's statistics
        georgeGpa = doubleGpa.nextDouble() + intGpa.nextInt(4);
        georgeEssayScore = essayScore.nextInt(6);
        georgeCreditHours = creditHours.nextInt(131);
        scienceMajorValueGeorge = scienceMajor.nextInt(2);
             if (scienceMajorValueGeorge == 0)
                 georgeIsScienceMajor = true;
             else
                 georgeIsScienceMajor = false;
    // new scholar object is created from the existing attributes
    Scholar george = new Scholar("Bush, George",  georgeGpa, georgeEssayScore,
                                          georgeCreditHours, georgeIsScienceMajor);
    System.out.println(george + "\n");
    System.out.println("--------Part 2--------\n");
    System.out.println(abraham.getFullName() + " scored " + abraham.getScore() + ".");
    System.out.println(george.getFullName() + " scored " + george.getScore() + ".\n");
    System.out.println("--------Part 3--------\n");
    /* comparing george bush and abraham lincoln's scores and printing them out to
             show that the compareTo method is working*/
             System.out.println(abraham.getFullName() + " scored "
                                + abraham.getScore() + ".");
             System.out.println(george.getFullName() + " scored "
                                + george.getScore() + ".\n");
    if(abraham.compareTo(george) == 1)
        System.out.println(abraham.getFullName() + " scored higher than " +
                george.getFullName() + ".\n");
    else
        System.out.println(george.getFullName() + " scored higher than " +
                abraham.getFullName() + ".\n");
    System.out.println("--------Part 4--------\n");
        // prints out scores to show proof that the Scholar.max method is working right.
        System.out.println(abraham.getFullName() + " scored "
                           + abraham.getScore() + ".");
        System.out.println(george.getFullName() + " scored "
                           + george.getScore() + ".\n");
        Scholar.max(abraham, george); // maximum score between abraham and george.
    // variables for a scholar object named thomas.
        double thomasGpa;
        int thomasEssayScore;
        int thomasCreditHours;
        int scienceMajorValueThomas;
        boolean thomasIsScienceMajor;
        // randomly creates thomas' statistics
            thomasGpa = doubleGpa.nextDouble() + intGpa.nextInt(4);
            thomasEssayScore = essayScore.nextInt(6);
            thomasCreditHours = creditHours.nextInt(131);
            scienceMajorValueThomas = scienceMajor.nextInt(2);
                 if (scienceMajorValueThomas == 0)
                     thomasIsScienceMajor = true;
                 else
                 thomasIsScienceMajor = false;
             // new scholar object created from existing attributes
             Scholar thomas = new Scholar("Jefferson, Thomas", thomasGpa, thomasEssayScore,
                                          thomasCreditHours, thomasIsScienceMajor);
             System.out.println("New student added - " + thomas + "\n");
             // returns all 3 students scores to show proof that the Scholar.max method is working right
             System.out.println(thomas.getFullName() + " scored " + thomas.getScore());
             System.out.println(abraham.getFullName() + " scored " + abraham.getScore());
             System.out.println(george.getFullName() + " scored " + george.getScore() + "\n");
             // highest score of all three scholars
             Scholar.max(abraham, george, thomas);
    }Thanks for reading this long and boring project.

    On comments: don't include a comment that just repeats syntax:
    // constructor for a Scholar object
    public Scholar(String myFullName, ...Anyone knowing Java syntax doesn't need that comment and gains nothing
    from its presence, and anyone not knowing Java syntax shouldn't be reading
    a listing.
    On parameter names: a isn't very imaginative or prescriptive. (See next code.)
    On setters returning the argument:
    public int setCreditHours(int creditHours ){
        this.creditHours = creditHours ;
        return creditHours;
    }1. Most people keep it simple and use a void return type.
    2, The next most common convention is to return this:
    public Scholar setCreditHours(int creditHours){
        this.creditHours = creditHours ;
        return this;
    }Then you can chain calls, which is occasionally useful:
    scholar.setCreditHours(4).setEssayScore(2);3. If you insist on returning the argument, note that this is a one-liner:
    public in setCreditHours(int creditHours){
        return this.creditHours = creditHours ;
    }

  • I have just tried to sync my iphone. Error message saying it cannot be synced has popped up quoting error code (-50). I have just removed old iphone backups from itunes but was very careful to not delete the current one. What does this code mean?

    Hi there,
    I have just tried to sync my iphone.
    Worryingly an error message saying it cannot be synced has popped up quoting error code (-50)
    I have just removed old iphone backups from itunes but was very careful to not delete the current one
    What does this code mean?

    http://support.apple.com/kb/TS1583

  • What does " this code must be redeemed in the Australian storefront " mean? And how can I fix it?

    What does " this code must be redeemed in the Australian storefront " mean? And can I fix it?

    All iTunes gifts and gift cards are country-specific, they can only be redeemed and used in their country of issue. Are you in Australia with an Australian billing address on your account ? If you are then try going to the bottom of the Featured tab in the App Store app on your iPad and tap on your account id, tap on 'View Apple ID' on the popup and log into your account, and then select the Country/Region section and select Australia.
    If you are not in Australia then you won't be able to use it.

  • Simple Question: Why does this code not exit properly?

    This code is pretty simple. All I want to do is load and play a sound file in an application, but this code to load the sound file does not exit properly. I know that some resources must be allocated which I need to deallocate in order to shut down the process, but I don't know what to call to do a proper shut-down. Any help would be appreciated.
    -adam
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class PlaySoundTest extends java.applet.Applet
    public static void main( java.lang.String[ ] aryArgs )
    java.net.URL urlSound = null;
    try
    urlSound = new java.net.URL( "file:/" + aryArgs[ 0 ] );
    catch( java.net.MalformedURLException murle )
    murle.printStackTrace( );
    System.exit( 1 );
    java.applet.AudioClip acSound = java.applet.Applet.newAudioClip( urlSound );

    HI , If u'r still looking for the solution, this code is working on my system -
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class PlaySoundTest extends java.applet.Applet
    public static void main( java.lang.String[ ] aryArgs ){
    java.net.URL urlSound = null;
    try{  //rahul
    try
    urlSound = new java.net.URL( "file:" + aryArgs[ 0 ] );
    catch( java.net.MalformedURLException murle )
    murle.printStackTrace( );
    System.exit( 1 );
    urlSound = new java.net.URL( "file:" + aryArgs[ 0 ] );
    java.applet.AudioClip acSound = java.applet.Applet.newAudioClip( urlSound );
    if(acSound != null){
    acSound.play();
    catch( Exception murle )
    {        //rahul
    murle.printStackTrace( );
    System.exit( 1 );
    }//main
    The only change I made was in the URL part - file: instead of file:/ .
    The other was of course to play the soundclip ...... :- ) I got really confused the first time I played it .

  • Does this code effect performance.

    I am doing some code now :) and I did a method like this, however I do not know if it effects performance for the whole application when the method is being called, or weather it is a good coding standard.
    The code in question is the following:
    public void myMethid(){
       class c{
          public c(String s){
              System.out.println(s);
       c myC = new c("Hello");
    }I know this is a stupid example, however would such a think effect performance, or be wrong? ... would it be better to just declare c as an external class?
    regards,
    sim085

    I have seen ppl complaining about cross posts, but what I am going to do here is cross post my answer, which I feel might be helpful in this situation, and considering that it still lies in the grey area:-
    "I smell a very interesting discussion stemming out of it, but your question is as open ended as it could be, what kind of web application and what performance. performance is the most misused word I have come across in a lot of design considerations. It is not one parameter you could measure but a combination of different considerations, which would be as follows:-
    1) Response time
    2) Responsivesness
    3) Latency
    4) Thoroughput
    5) Load
    6) Load sensitivity
    7) Efficiency
    8) capacity
    9) scalabilty
    You might want to look on the web as to what they mean since I am not going to go into that detail. But these attributes are independent of each other, an application with good latency might be poor in scalability or other way around, so it depends as to whats the nature and requirements of the app you are looking at then deciding which way you would want to go. Its not that simple.
    Secondly I would quote Martin Fowler from his book "Patterns of Enterprise Application Architecture":-
    "Too often I have seen designs used or rejected because of performance considerations, which turn out to be bogus once somebody actually does some measurements on the real setup used for the application."
    So please go back to the requirements and try to figure out what you are actually looking for."

  • Please explain what does this code does exactly

    Can any one explain me what does the below code does.
    This is the code written in one of the BADI (ME_PO_PRICING_CUST) .This badi will be triggered when a sales order delivery address is changed and while saving it this will be triggered. Over all what i come to know is they re trigerring a new version in this code. Can anyone explain me what exactly they are doing in this.Thanks...
    METHOD IF_EX_ME_PO_PRICING_CUST~PROCESS_KOMK.
      FIELD-SYMBOLS: <EKKO> TYPE ANY,
                     <PROCSTAT> TYPE MEPROCSTATE,
                     <FRGKE> TYPE FRGKE,
                     <YNAST> TYPE TABLE,
                     <WA_YNAST> TYPE NAST.
      IM_EKKO-PROCSTAT = 02.
    *break-point.
      ASSIGN ('(SAPLMEPO)EKKO') TO <EKKO>.
      ASSIGN ('(SAPLMEPO)YNAST[]') TO <YNAST>.
      IF <EKKO> IS ASSIGNED.
        ASSIGN COMPONENT 'PROCSTAT' OF STRUCTURE <EKKO> TO <PROCSTAT>.
        ASSIGN COMPONENT 'FRGKE' OF STRUCTURE <EKKO> TO <FRGKE>.
        IF <FRGKE> = 'R'.
          <PROCSTAT> = '02'.
        ENDIF.
      ENDIF.
      IF <YNAST> IS ASSIGNED.
        IF <FRGKE> = 'R'.
          LOOP AT <YNAST> ASSIGNING <WA_YNAST>.
            <WA_YNAST>-AKTIV = 'X'.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDMETHOD.

    r_htkl must be a range table. check the declaration part of it.
    p_htkl is a parameter on selection screen i hope.
    so, there are four fields on a range table.(range table are similar to your select options)
    1. SIGN ( I or E  - Inclusive or Exculsive)
    2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)
    3. LOW (value)
    4. HIGH (value)
    so..
    IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
    r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
    r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
    r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
    APPEND r_htkl. " the range table is appended.
    endif.
    so this range table can be used in select statements as :
    select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or
    in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.
    Had it been
    r_htkl-sign='E'.
    then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.
    as exclusive of the option.
    etc.
    hope this is clear.
    AND PLEASE CLOSE THE OTHER THREAD (duplicate)

  • Why does this code not work?

    String answer = new String("");
    in = new BufferedReader(new InputStreamReader( connection.getInputStream ()));
    String test = new String("");
    for (int i = 0 ; i < 1000 ; i++)
    answer = in.readLine();
    if (answer == null)
    System.out.println ("null");
    break;
    else
    test += answer;
    System.out.println ("answer: " + answer);
    System.out.println ("test: " + test);
    Many times, the loop will go through 2 iterations but each time, test is only equal to the first answer. The second, third, fourth etc.time it goes through the loop, it should concatenate the value of answer to the end of the string variable test. So why is it that whenever i run the program that has this code, the loop might lloop many times (let's say 2 time) but the value of test is only the first answer, and not the first answer concatenated with the second answer.

    It worked for me...my code looks like this...i used FileInputStream instead of connection..
    import java.io.*;
    class Forum {
      public static void main(String a[]) throws IOException{
        String answer = new String("");
        BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream("hi.txt")));
        String test = new String("");
        for (int i = 0 ; i < 1000 ; i++)
        answer = in.readLine();
        if (answer == null)
        System.out.println ("null");
        break;
        else
        test += answer;
        System.out.println ("answer: " + answer);
        System.out.println ("test: " + test);
    my hi.txt is like this:
    fasd rea reks krie
    fsdfasd
    asdfasd
    sfasdf
    asdfasd
    The output is
    answer: fasd rea reks krie
    answer: fsdfasd
    answer: asdfasd
    answer: sfasdf
    answer: asdfasd
    null
    test: fasd rea reks kriefsdfasdasdfasdsfasdfasdfasd
    Is this not the way u want???

  • Why does this code fail in command line?

    I am using the "ListDemo" from the java swing tutorial. If I compile it on the command line
    javac ListDemo.java
    It compiles fine. Then when I run it, it says:
    C:\Development\Java\Projects\Projects>java ListDemo
    Exception occurred during event dispatching:
    java.lang.NoSuchMethodError
    at ListDemo.createAndShowGUI(ListDemo.java:196)
    at ListDemo.access$400(ListDemo.java:7)
    at ListDemo$1.run(ListDemo.java:217)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Yet when I load up the same file into Netbeans, it compiles and runs fine! Here is the file:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    /* ListDemo.java is a 1.4 application that requires no other files. */
    public class ListDemo extends JPanel
                          implements ListSelectionListener {
        private JList list;
        private DefaultListModel listModel;
        private static final String hireString = "Hire";
        private static final String fireString = "Fire";
        private JButton fireButton;
        private JTextField employeeName;
        public ListDemo() {
            super(new BorderLayout());
            listModel = new DefaultListModel();
            listModel.addElement("Alan Sommerer");
            listModel.addElement("Alison Huml");
            listModel.addElement("Kathy Walrath");
            listModel.addElement("Lisa Friendly");
            listModel.addElement("Mary Campione");
            listModel.addElement("Sharon Zakhour");
            //Create the list and put it in a scroll pane.
            list = new JList(listModel);
            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            list.setSelectedIndex(0);
            list.addListSelectionListener(this);
            list.setVisibleRowCount(5);
            JScrollPane listScrollPane = new JScrollPane(list);
            JButton hireButton = new JButton(hireString);
            HireListener hireListener = new HireListener(hireButton);
            hireButton.setActionCommand(hireString);
            hireButton.addActionListener(hireListener);
            hireButton.setEnabled(false);
            fireButton = new JButton(fireString);
            fireButton.setActionCommand(fireString);
            fireButton.addActionListener(new FireListener());
            employeeName = new JTextField(10);
            employeeName.addActionListener(hireListener);
            employeeName.getDocument().addDocumentListener(hireListener);
            String name = listModel.getElementAt(
                                  list.getSelectedIndex()).toString();
            //Create a panel that uses BoxLayout.
            JPanel buttonPane = new JPanel();
            buttonPane.setLayout(new BoxLayout(buttonPane,
                                               BoxLayout.LINE_AXIS));
            buttonPane.add(fireButton);
            buttonPane.add(Box.createHorizontalStrut(5));
            buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
            buttonPane.add(Box.createHorizontalStrut(5));
            buttonPane.add(employeeName);
            buttonPane.add(hireButton);
            buttonPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
            add(listScrollPane, BorderLayout.CENTER);
            add(buttonPane, BorderLayout.PAGE_END);
        class FireListener implements ActionListener {
            public void actionPerformed(ActionEvent e) {
                //This method can be called only if
                //there's a valid selection
                //so go ahead and remove whatever's selected.
                int index = list.getSelectedIndex();
                listModel.remove(index);
                int size = listModel.getSize();
                if (size == 0) { //Nobody's left, disable firing.
                    fireButton.setEnabled(false);
                } else { //Select an index.
                    if (index == listModel.getSize()) {
                        //removed item in last position
                        index--;
                    list.setSelectedIndex(index);
                    list.ensureIndexIsVisible(index);
        //This listener is shared by the text field and the hire button.
        class HireListener implements ActionListener, DocumentListener {
            private boolean alreadyEnabled = false;
            private JButton button;
            public HireListener(JButton button) {
                this.button = button;
            //Required by ActionListener.
            public void actionPerformed(ActionEvent e) {
                String name = employeeName.getText();
                //User didn't type in a unique name...
                if (name.equals("") || alreadyInList(name)) {
                    Toolkit.getDefaultToolkit().beep();
                    employeeName.requestFocusInWindow();
                    employeeName.selectAll();
                    return;
                int index = list.getSelectedIndex(); //get selected index
                if (index == -1) { //no selection, so insert at beginning
                    index = 0;
                } else {           //add after the selected item
                    index++;
                listModel.insertElementAt(employeeName.getText(), index);
                //If we just wanted to add to the end, we'd do this:
                //listModel.addElement(employeeName.getText());
                //Reset the text field.
                employeeName.requestFocusInWindow();
                employeeName.setText("");
                //Select the new item and make it visible.
                list.setSelectedIndex(index);
                list.ensureIndexIsVisible(index);
            //This method tests for string equality. You could certainly
            //get more sophisticated about the algorithm.  For example,
            //you might want to ignore white space and capitalization.
            protected boolean alreadyInList(String name) {
                return listModel.contains(name);
            //Required by DocumentListener.
            public void insertUpdate(DocumentEvent e) {
                enableButton();
            //Required by DocumentListener.
            public void removeUpdate(DocumentEvent e) {
                handleEmptyTextField(e);
            //Required by DocumentListener.
            public void changedUpdate(DocumentEvent e) {
                if (!handleEmptyTextField(e)) {
                    enableButton();
            private void enableButton() {
                if (!alreadyEnabled) {
                    button.setEnabled(true);
            private boolean handleEmptyTextField(DocumentEvent e) {
                if (e.getDocument().getLength() <= 0) {
                    button.setEnabled(false);
                    alreadyEnabled = false;
                    return true;
                return false;
        //This method is required by ListSelectionListener.
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                if (list.getSelectedIndex() == -1) {
                //No selection, disable fire button.
                    fireButton.setEnabled(false);
                } else {
                //Selection, enable the fire button.
                    fireButton.setEnabled(true);
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("ListDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new ListDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();

    You are not running this code under JDK 1.4
    The setDefaultLookAndFeelDecorated method requires JDK 1.4 version.

  • This history look right? After Repairing Disk Permissions WARNINGS exist.

    I just repaired disk permissions on my iMac, does the history look OK? Plenty of WARNINGS at the end of the history. I am not too concerned with the ACL stuff.
    Cheers
    Repairing permissions for “Macintosh HD”
    Reading permissions database.
    Reading the permissions database can take several minutes.
    Permissions differ on "Library/StartupItems", should be drwxr-xr-x , they are drwxrwxr-x .
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Library".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Music".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/Japanese.lproj/Public".
    ACL found but not expected on "System/Library/User Template/French.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/French.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/French.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/French.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/French.lproj/Library".
    ACL found but not expected on "System/Library/User Template/French.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/French.lproj/Music".
    ACL found but not expected on "System/Library/User Template/French.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/French.lproj/Public".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Library".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Music".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/Spanish.lproj/Public".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Library".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Music".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/ru.lproj/Public".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Library".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Music".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/zh_CN.lproj/Public".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Sites".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Desktop".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Documents".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Downloads".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Application Support".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Assistants".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/MIDI Drivers".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Plug-Ins/Components".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Plug-Ins/Digidesign".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Plug-Ins/VST".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Plug-Ins".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Sounds/Alerts".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Sounds/Banks".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio/Sounds".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Audio".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/ColorPickers".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Compositions".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Favorites".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/FontCollections".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Fonts".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/iMovie/Plug-ins".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/iMovie/Sound Effects".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/iMovie".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Input Methods".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Internet Plug-Ins".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Keyboard Layouts".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Preferences".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Printers".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Screen Savers".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Sounds".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library/Voices".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Library".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Movies".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Music".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Pictures".
    ACL found but not expected on "System/Library/User Template/zh_TW.lproj/Public".
    Warning: SUID file "System/Library/Filesystems/AppleShare/afpLoad" has been modified and will not be repaired.
    Warning: SUID file "usr/bin/setregion" has been modified and will not be repaired.
    Warning: SUID file "System/Library/PrivateFrameworks/Install.framework/Versions/A/Resources/runner " has been modified and will not be repaired.
    Warning: SUID file "System/Library/Printers/IOMs/LPRIOM.plugin/Contents/MacOS/LPRIOMHelper" has been modified and will not be repaired.
    Group differs on "private/etc/cups", should be 0, group is 26.
    Permissions differ on "private/var/spool/cups/cache/rss", should be drwxr-xr-x , they are drwxrwxr-x .
    Permissions repair complete

    all of these are harmless.
    http://support.apple.com/kb/TS1448?viewlocale=en_US
    reinstalling 10.5.6 combo update might get rid of some of them but isn't really necessary.

  • What does this code do

    hi friends, i came across this code, and i am struck at understanding this code,
    usually loop keyword will be followed by itab, but here there is nothing, same with sort.
        SORT.
      LOOP.
        AT NEW MSEG-WERKS.
    some code
        ENDAT.
        AT NEW MSEG-MATNR.
    some code
          NEW-PAGE.
        ENDAT.
        AT DETAIL.
          WRITE:
          / MSEG-LGORT,
            MSEG-BWART,
            MSEG-MBLNR,
            MSEG-ZEILE.
        ENDAT.
        AT END OF MSEG-MATNR.
          SKIP 1.
          WRITE: 'x y z..'
        ENDAT.
        AT END OF MSEG-WERKS.
          SKIP 1.
         WRITE: 'x y z..'
        ENDAT.
      ENDLOOP.
    an some one please explain me this code, little briefly.
    thank you.

    sorry friends, i forgot to tell that the following piece of code was above this code:
    INSERT
    MSEG-WERKS                             "Plant
    MSEG-MATNR                             "Material
    MSEG-MBLNR                             "Material document
    MSEG-ZEILE                             "Material item
    INTO HEADER.
    INSERT
    LIPS-VBELN                             "Delivery
    LIPS-POSNR                             "Delivery item
    MSEG-LGORT                             "Storage location
    MSEG-BWART                             "Movement type
    MSEG-MENGE                             "Quantity
    MSEG-SHKZG                             "Debit/credit
    MSEG-MEINS                                                  "UoM
    INTO DETAIL.

  • What files does this code need?

    I am trying to use this code from Java Examples In A Nutshell.
    It is a short program that involves reading one and writing to another (I think!) The way I understand things is that there has to be two files for the program to be able to run, from_file & to_file . I have attempted to creat two txt files and saved them as these names in the same folder as the app. The code complies as you would expect, when I try to run it I get Usage: FileCopy <source> <destination> and the app never runs. I suspect I have not created the external files properly. If you can see where I have gone wrong let me know, layman's terms please, Dave.

    When running the compiled "FileCopy.class" with java command you must enter the names of files, i.e.;
    java FileCopy "from_file" "to_file"
    in the command line.
    In this case args[0] is "from_file" and args[1] is "to_file."

  • Why does this code always gotoAndStop at the same frame?

    The symbol "alldoor" contains the following six frames in sequential order: "door1","red_door1","door2","red_door2","door3" and "red_door3".
    var doors:Array =["door1", "door2", "door3"];
    var doorSelector:String = doors[newDoors(0, doors.length - 1)]
    function newDoors (min:Number, max:Number):Number
    var  doorColors:Number = Math.round(Math.random() * (min - max) + max);
    return doorColors;
    alldoor.gotoAndStop(doorSelector);
    alldoor.addEventListener(MouseEvent.CLICK,changeColors );
    function changeColors(e:MouseEvent)
        if (e.currentTarget.currentLabel == doorSelector)
            e.currentTarget.gotoAndStop(currentFrame + 1);
         I am attempting to get this code select one of the frames starting with the string "door" at start up. Then, the door should move to the frame
    directly following it on the timeline when clicked. However, as the code is written, the frame always jumps to the second frame in the symbol,regardless of what the current label is. What should I change?

    either:
    1.  those frames aren't loaded when that code executes or
    2.  you don't have those labels on the timeline that contains that code or
    3.  there is other code executing after your goto changing your frame
    use the trace() function to debug and find which is your problem.

  • Repaint() an applet from a swing applet, why does this code not work?

    below are three files that work as planned except for the call to repaint(). This is envoked when a button is hit in one applet and it should repaint another applet. I opened them up in a html file that simply runs both applets. If you could see why the repaint doesn't work I'd love to know. good luck.
    //speech1
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    //java extension packages
    import javax.swing.*;
    public class speechapp1 extends JApplet implements ActionListener{
    // setting up Buttons and Drop down menus
    char a[];
    Choice choicebutton;
    JLabel resultLabel;
    JTextField result;
    JLabel enterLabel;
    JTextField enter;
    JButton pushButton;
    TreeTest PicW;
    // setting up applets G.U.I
    public void init(){
    // Get content pane and set it's layout to FlowLayout
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // initialise buttons and shit
    a = new char[30];
    choicebutton = new Choice();
    enterLabel = new JLabel("Test");
    enter = new JTextField(30);
    resultLabel= new JLabel("speech label");
    result = new JTextField(30);
    result.setEditable(false);
    // Add items to Choice Button
    choicebutton.addItem("abc");
    choicebutton.addItem("def");
    choicebutton.addItem("ghi");
    choicebutton.addItem("jkl");
    pushButton = new JButton("Click to continue");
    // Add new Tree from file TreeTest.java
    PicW = new TreeTest();
    // Add buttons to container.
    container.add(resultLabel);
    container.add(result);
    container.add(enterLabel);
    System.out.println("");
    container.add(choicebutton);
    System.out.println("");
    container.add(pushButton);
    pushButton.addActionListener(this);
    //choicebutton.addActionListener( this );
    // Set the text in result;
    result.setText("Hello");
    //public void paint(Graphics gg){
    // result.setText("Hello");
    public void actionPerformed(ActionEvent event){
    // continue when action performed on pushButton
    String searchKey = event.getActionCommand();
    System.out.println("");
    if (choicebutton.getSelectedItem().equals("abc"))
    PicW.getPicWeight(1);
    if (choicebutton.getSelectedItem().equals("def"))
    PicW.getPicWeight(2);
    if (choicebutton.getSelectedItem().equals("ghi"))
    PicW.getPicWeight(3);
    if (choicebutton.getSelectedItem().equals("jkl"))
    PicW.getPicWeight(4);
    System.out.println("repainting from actionPerformed method()");
    PicW.repaint();
    import java.applet.Applet;
    import java.awt.*;
    import java.util.*;
    public class TreeTest extends Applet{
    Tree BackgroundImageTree;
    Tree PlayerImageTree;
    Image snow,baby;
    int weight;
    public void getPicWeight(int w){
    weight = w;
    System.out.println("the new weight has been set at: "+weight);
    this.repaint();
    public void init()
    // initialising trees for backgound images and player images
    BackgroundImageTree = new Tree();
    PlayerImageTree = new Tree();
    // initialising images and correcting size of images to correctly fit the screen
    snow = getImage(getDocumentBase(),"snow.gif");
    baby = getImage(getDocumentBase(),"baby.gif");
    // inserting images into correct tree structure
    System.out.println("inserting images into tree: ");
    // inserting background images into tree structure
    BackgroundImageTree.insertImage(1,snow);
    // inserting players into tree structure
    PlayerImageTree.insertImage(1,baby);
    public void paint(Graphics g){
    System.out.println("Searching for selected Image");
    if((BackgroundImageTree.inorderTraversal(1)==null)&&(PlayerImageTree.inorderTraversal(1)==null)){
    System.out.println("There is no tree with the selected value in the trees");
    }else{
    g.drawImage(BackgroundImageTree.inorderTraversal(1),1,3,this);
    //g.drawImage(PlayerImageTree.inorderTraversal(1),55,150,this);
    import java.awt.*;
    import java.applet.Applet;
    class TreeNode {
    TreeNode left;
    Image data;
    TreeNode right;
    int value;
    public TreeNode(int weight,Image picture){
    left = right = null;
    value = weight;
    data = picture;
    public void insert(int v, Image newImage){
    if ( v< value){
    if (left ==null)
    left = new TreeNode(v,newImage);
    else
    left.insert(v,newImage);
    else if (v>value){
    if (right ==null)
    right = new TreeNode(v,newImage);
    else
    right.insert(v, newImage);
    public class Tree{
    private TreeNode root;
    public Tree() {
    root = null;
    public void insertImage(int value, Image newImage){
    if (root == null)
    root = new TreeNode(value,newImage);
    else
    root.insert(value,newImage);
    // in order search of tree.
    public Image inorderTraversal(int n)
    return(inorderHelper(root,n));
    private Image inorderHelper(TreeNode node, int n){
    Image temp = null;
    if (node == null)
    return null;
    if (node.value == n ){
    return(node.data);
    temp = inorderHelper(node.left,n);
    if (temp == null){
    temp = inorderHelper(node.right,n);
    return temp;
    }

    I can fix your problems
    1. You get an error here because you can only invoke the superclass's constructor in the subclass's constructor. It looks like that's what you're trying to do, but you're not doing it right. Constructors don't return any value (actually they do, but it's implied, so you don't need the void that you've got in your code)
    2. I'm not sure, but I think your call to show might be wrong. Move the setsize and setvisible calls to outside of the constructor

  • ADF 10g: What does this code do?

    What is the difference between this and calling createRootApplicationModule() ? I'm looking for some definitive documentation on this.
       FacesContext fc = FacesContext.getCurrentInstance();
                ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
                BindingContext bc = (BindingContext)vb.getValue(fc);
                DCDataControl dc = bc.findDataControl(amName);
                ApplicationModule am = (ApplicationModule)dc.getDataProvider();I understand it (the above code) is no different from picking it from a specific pageDefinition (say where an action binding to a method of that AM is present) or the above -
    both return an AM instance from the data controls within the current FacesContext. But still, any documentation that would relieve this information itch would be much appreciated.
    Also, any thoughts on the 'best practiceness' quotient of doing the above?
    Edited:
    This is posted just to seek clarification - please refer to the whole thread, links provided as references and the developer guide for the recommended approaches.

    posted will grab the one that has been checked out for the page by the binding filter.Here's the thing: this AM, its methods or any of it's constituent VO attributes do NOT have a binding (but could have, since this AM is exposed in the data controls)
    Just note the use of that #{"data"} EL used above (not #{"bindings"} or #{"data.pageDefName"} ).
    In most all cases, you want the same one that has already been checked out - so getting it via the binding context is preferred.Precisely - is there official documentation that confirms that this is a preferred way?
    It is generally pretty rare where you need to createRootApplicationModule,In fact, not at all - except in test code.
    but you might do so in cases where there is not one already checked out for you (for example, if you are interacting with ADF BC from within a servlet).It would be great to have documentation that says it's ok to do so. Otherwise, I strongly think things could be designed better to even avoid doing that.
    Furthermore, it would be even more preferred not to interact with the AM directly in code, but to expose any methods you might want to call via the data control.Method bindings would be 'ideal'. Using the client interface is currently 'ok' (or at least a lesser evil).
    In any new code I wouldn't interact with an AM in UI code - just that there is a whole lot of legacy code which does so. I'm just making sure that the above alternative to createRootApplicationModule is not just equally bad. (i.e. does not require an explicit 'release' call)
    http://blogs.oracle.com/smuenchadf/2009/09/best_practice_example_for_invo.htmlTotally agree with with the above - and yet get hold of an AM instance via its interface the 'right' way in old code that needs it.
    Thanks for the response.

Maybe you are looking for