Need Help with some code

Hello, thanks for helping:
my problem is that I am creating a "before" and "after" situation between strings. (What a string was before.. and now what it is)
so here's the sample I created. Basically a display issue. If you run it you'll know the problem.
Thanks again for helping.
   import javax.swing.*;
   import java.awt.*;
   import java.awt.event.*;
    public class JScrollExample extends JFrame
      JPanel mainpanel = new JPanel();
      JTextArea text = new JTextArea();
      JScrollPane scroll = new JScrollPane(text);
      String[] before, after, other;
      int sda, indexMaxLength;
      int[] ja;
      StringBuilder[] sb;
      String[] name;
       public JScrollExample()
         getContentPane().add(mainpanel, BorderLayout.NORTH);
         setTitle("JScrollExample");
         text.setColumns(100);
         text.setRows(30);
         mainpanel.add(scroll);
         before = new String[]
               "asdf-asdfasdfasdf-asdf", "asdf-asdfasdfasdf-asdffdsaasdf",
               "asdf-asdffdsaasdffdssasdfasdf-asdf", "AVDSDFDSasdf-asdfasdfasdf-asdf",
               "asdsdfsdfsdfsdfsdsdfsdf-asddsffasdsdfsdfasdfvfdvdfvfd-asdf"
         after = new String[]
               "jkloolkj-iriod-3342", "jsdfsdolkj-iriod-3342", "jkloolkj-fdsfiriod-3342",
               "jkloolkj-idsfsfsfsdfsdfiod-3sdfds342", "ASXkloolkj-iriod-3342MBW"
         other = new String[]
               "AAAAAAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
               "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "AAAAAAAAA", "AAAAAAAAAAAAA"
         indexMaxLength = 0;
         sb = new StringBuilder[before.length];
         ja = new int[before.length];
         name = new String[before.length];
         for(int j = 0; j < before.length; j++)
            if(before[j].length() > before[indexMaxLength].length())
               indexMaxLength = j;
         sda = before[indexMaxLength].length();
         for(int i = 0; i < before.length; i++)
            ja[i] = ((sda - before.length()) + 25);
for(int j = 0; j < ja.length; j++)
sb[j] = new StringBuilder("");
for(int g = 0; g < ja[j]; g++)
sb[j].append(" -");
text.append("I'm trying to make it look nice and neat," +
               "and have each line have same amount of '-' " + "I tried doing it " +
               "and this is what I got. Basically what i'm doing is finding " +
               "the longest string, subtracting each string's \nlength with the " +
               " longest one, then adding 25, to get an equal value, then using " +
               "that value to put that many '-' in between before and after. But " +
               "because every character has a different size, it doesn't work\n " +
               "unless all the characters are the same\n\n");
for(int i = 0; i < before.length; i++)
String y = (after[i]);
text.append(before[i] + sb[i].toString() + "> " + y + "\n");
indexMaxLength = 0;
sb = new StringBuilder[before.length];
ja = new int[before.length];
for(int j = 0; j < other.length; j++)
if(other[j].length() > other[indexMaxLength].length())
indexMaxLength = j;
sda = other[indexMaxLength].length();
for(int i = 0; i < other.length; i++)
ja[i] = ((sda - other[i].length()) + 25);
for(int j = 0; j < ja.length; j++)
sb[j] = new StringBuilder("");
for(int g = 0; g < ja[j]; g++)
sb[j].append(" -");
text.append("\n\nWHAT I WANT IS THIS: \n\n");
for(int i = 0; i < other.length; i++)
String y = (after[i]);
text.append(other[i] + sb[i].toString() + "> " + y + "\n");
public static void main (String[] args)
JFrame.setDefaultLookAndFeelDecorated(true);
JScrollExample frame = new JScrollExample();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);          
frame.setVisible(true);
frame.pack();

what methods do you think I should use?I think you should use the monospaced font.
I went to the font metrics page, and I understand what it does.Well, then you should realize that you can't be guaranteed that your column will line up if you attempt to use the FontMetrics class. All the FontMetrics class can tell you is the width of a String.
You can calculate the width of your longest String and then calculate the width of 25 " -" to get the total width before the second colum. Lets assume this width is 500. Now lets also assume that each " -" string is 10 pixels.
If we have "i" as the only text and its width is 3 pixels, then how do you calculate a multiple of " -" which will total to 500 pixels?
Similiarly if you have a "W" as the text and its width is 7 pixels you will never be able to add characters that will total to 500 pixesl.
So if you need "- - - - >" between column 1 and column 2 the easiest solution is to use a monospaced font.
If on the other hand you only care about column two lining up in the same postion each time, then you may be able to use tabs in a JTextPane as you can easily control the placement of text for each tab. This posting will give you an idea:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=585006

Similar Messages

  • Need help with some code ... Searching a tree and inserting data

    I'm trying to write code for the addIterative method below.
    My problem is that I also need to search the list or node to see if the word exists.
    The method add(word,line,position,iterative) validates the parameters; and, in order to update the tree and/or any relevant linked-list, calls either the incomplete method addIterative(word,line,position) or the incomplete method addRecursive(word,line,position). Note the following: if the word is not contained currently in the tree, then all of the (word,line,position) triplet needs to be added to the data structure; otherwise, only the (line,position) pair needs to be added to the data structure. The result must be the same regardless of the algorithmic strategy employed.
    any suggestions would be greatly appreciated, new to java, and very lost.
    regards,
    Jimmy
    * Write a description of class Tree091 here.
    * @author (your name)
    * @version (a version number or a date)
    class Tree091 /*(i.e., WordTree)*/
    { private char[] word=null;
    private List091 list=null;
    private Tree091 precursor=null; /*(i.e., leftSubTree)*/
    private Tree091 successor=null; /*(i.e., rightSubTree)*/
    public Tree091(char[] word,
    List091 list,
    Tree091 precursor, /*(i.e., lexicographically < word)*/
    Tree091 successor) /*(i.e., lexicographically > word)*/
    { if (word==null) return;
    if (word.length<1) return;
    if (list==null) return;
    this.word=word;
    this.list=list;
    this.precursor=precursor;
    this.successor=successor;
    public void add(char[] word,
    int line,
    int position,
    boolean iterative)
    { if (word==null) return;
    if (word.length<1) return;
    if (line<0) return;
    if (position<0) return;
    if (iterative)
    this.addIterative(word,line,position);
    else
    this.addRecursive(word,line,position);
    private void addIterative(char[] word,
    int line,
    int position)
    /* something goes here*/
    private void addRecursive(char[] word,
    int line,
    int position)
    /* something goes here*/
    private int compare(char[] array1,
    char[] array2)
    { if (array1==null) return -2;
    if (array2==null) return -2;
    int length1=array1.length;
    if (length1==0) return -2;
    int length2=array2.length;
    if (length2==0) return -2;
    int minLength=length1<length2?length1:length2;
    for (int i=0; i<minLength; i++)
    { if (array1[i]<array2) return -1;
    if (array1[i]>array2[i]) return 1;
    return length1==length2 ? 0 : length1<length2 ? -1 : 1;
    public boolean contained(char[] word)
    { int compare=compare(this.word,word);
    if (compare==1&&this.precursor!=null)
    return this.precursor.contained(word);
    if (compare==0) return true;
    if (compare==-1&&this.successor!=null)
    return this.successor.contained(word);
    return false;
    public int listNodeCount(boolean iterative)
    /* something goes here*/
    return 24;
    public int maximumWordLength(int currentLength)
    /* something goes here*/
    return 25;
    public String toString()
    { String string="";
    if (this.precursor!=null) string+=this.precursor;
    string+="\""+(new String(this.word))+"\""+this.list;
    if (this.successor!=null) string+=this.successor;
    return string;
    public int treeNodeCount()
    /* something goes here*/
    return 26;
    public String wordArray(int length)
    /* something goes here*/
    return "hey hey wordarray";

    hey,
    ok, wow, that was intense, my brain hurts!!!!
    And now I've got to go do a graduate program test, argh!!!
    A problem I keep getting is trying to figure out what my lecturer is doing in the start of the Tree091 class,
    that is, I can see that he is constructing the list and tree but it appears that he is doing it all at the same time, and I'm getting confused with what actually gets inserted into the list, and do we insert the word, line and position, or just the line and position?
    Also, I didnt use a 'while loop', I'm not sure how, but I found a 'for loop' in the text book, what do you think of it? Is it ok for now?
    And I'm getting an error at this line:
    Tree091 ins = new Tree091(char[] word); // getting error '.class' expected here
    any ideas?
    heres what I've got so far:
    private void addIterative(Comparable char[] word,int line, int position){
    // Insert char[] word into the this BST     
         int direction = 0;     
         Tree091 parent = null, curr = root;
         for (;;) {     
              if (curr == null) {
                   Tree091 ins = new Tree091(char[] word); // getting error '.class' expected here
                   // word found so we call insertList method
                   insertList091(line, position, List091 precursor);
                   if (root) == null)
                        root = ins;
                   else if (direction < 0)     
                        parent.left = ins;
                   else // direction > 0
                        parent.right = ins;
                   return;
              direction = elem.compareTo(curr.element);
              if (direction == 0)
                   return;
              parent = curr;
              if (direction < 0)
                   curr = curr.left;
              else // direction > 0
                   curr = curr.right;
    }And heres an attempt at the insertList method
    private void insertList(char[] word, int line, int position, List091 precursor){
    // Insert line and position at a given point in this List091, either after the node
    // precursor, or before the first node if precursor is null
    // Looking at assignment question we may need a double linked list
         List091 ins = new List091 (char[] word, line, position, null);
         if precursor == null) { //insert before first node (if any).
              ins.successor = first;
              first = ins;
         } else {
              ins.successor = precursor.successor;
              precursor.successor = ins;
    }How far off am I Joachim?
    cheers,
    Jimmy
    ps. heres the tree091 class again:
    class Tree091 /*(i.e., WordTree)*/
    { private char[] word=null;
      private List091 list=null;
      private Tree091 precursor=null; /*(i.e., leftSubTree)*/
      private Tree091 successor=null; /*(i.e., rightSubTree)*/
      public Tree091(char[] word,
                     List091 list,
                     Tree091 precursor, /*(i.e., lexicographically < word)*/
                     Tree091 successor) /*(i.e., lexicographically > word)*/
      { if (word==null) return;
        if (word.length<1) return;
        if (list==null) return;
        this.word=word;
        this.list=list;
        this.precursor=precursor;
        this.successor=successor;
      public void add(char[] word,
                      int line,
                      int position,
                      boolean iterative)
      { if (word==null) return;
        if (word.length<1) return;
        if (line<0) return;
        if (position<0) return;
        if (iterative)
          this.addIterative(word,line,position);
        else
          this.addRecursive(word,line,position);
      private void addIterative(char[] word,
                                int line,
                                int position)
        /* students to complete */
      private void addRecursive(char[] word,
                                int line,
                                int position)
         /* students to complete */
      private int compare(char[] array1,
                          char[] array2)
      { if (array1==null) return -2;
        if (array2==null) return -2;
        int length1=array1.length;
        if (length1==0) return -2;
        int length2=array2.length;
        if (length2==0) return -2;
        int minLength=length1<length2?length1:length2;
        for (int i=0; i<minLength; i++)
        { if (array1<array2[i]) return -1;
    if (array1[i]>array2[i]) return 1;
    return length1==length2 ? 0 : length1<length2 ? -1 : 1;
    public boolean contained(char[] word)
    { int compare=compare(this.word,word);
    if (compare==1&&this.precursor!=null)
    return this.precursor.contained(word);
    if (compare==0) return true;
    if (compare==-1&&this.successor!=null)
    return this.successor.contained(word);
    return false;
    public int listNodeCount(boolean iterative)
    /* students to complete */
    public int maximumWordLength(int currentLength)
    /* students to complete */
    public String toString()
    { String string="";
    if (this.precursor!=null) string+=this.precursor;
    string+="\""+(new String(this.word))+"\""+this.list;
    if (this.successor!=null) string+=this.successor;
    return string;
    public int treeNodeCount()
    /* students to complete */
    public String wordArray(int length)
    /* students to complete */
    Edited by: allergy01 on Apr 25, 2009 9:19 PM
    Edited by: allergy01 on Apr 25, 2009 9:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • I need help with my code..

    hi guys. as the subject says I need help with my code
    the Q for my code is :
    write a program that reads a positive integer x and calculates and prints a floating point number y if :
    y = 1 ? 1/2 + 1/3 - ? + 1/x
    and this is my code
       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 2; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             int m;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             do
                m = (int) Math.pow( -1, n)/i;
                System.out.println(m);
                   n++;
                   i++;
             while ( m >= 1/x );
          } // end method main
       } // end class Sh7q2 when I compile it there is no error
    but in the run it tells me to enter a positive integer
    suppose i entered 5
    then the result is 1...
    can anyone tell me what's wrong with my code

       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 1; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             double m;
             int a = 1;
             double sum = 0;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             for ( i = 1; a <= x; i++)
                m =  Math.pow( -1, n+1)/i;
                sum  = sum + m;
                n++;
                a++;
             System.out.print("y = " + sum);
          } // end method main
       } // end class Sh7q2is it right :S

  • Need help with WMI code that will send output to db

    'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
    and talks to our server. I also want the code to:
    * check the users computer and find all installed patches
    * the date the patches were installed
    * the serial number of the users computer
    * the computer name, os version, last boot up time, and mac address
    and then have all this output to a database file. At the command prompt I've tried:
    wmic qfe get description, hotfixid
    This does return the patch information I'm looking for, but how do I combine that line of code with:
    wmic os get version, csname, serialnumber, lastbootuptime
    and
    wmic nicconfig get macaddress
    and then get all this to output to a database file?

    Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
    found lots of good information. I also found a good command that will print information to a text file.
    Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
    I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
    updates enable, that's because we are not allowed to.   
    This is my code so far. 
    #if you want the computer name, use this command
    get-content env:computername
    $computer = get-content env:computername
    #list of installed patches
    Get-Hotfix -ComputerName $computer#create a text file listing this information
    Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
    I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
    SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
    way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)?

  • I need Help with Some CSS

    I am in the process of making a new template for my site.
    I can't really provide any code and here's why, I need help finding the code that I need to change. The new template is actually being designed here.
    If you scroll over the home link you will find a sub-menu pops up, if you scroll over the menu items they get bigger and come 'at" you, if you hover over sub-2 and then hover over sub-3 you will notice there is a wild transition effect, I need to know how to get rid of those, it is a different CSS code from another template link to my site. I can't find out how, if somebody could please help me out it would be wonderful. Thank you a whole bunch in advance.

    Your menu moves for a couple of reasons first, you have a border in the hover, which is going to move all of the text.  You can get rid of the border in the hover or add a border of the same size/style in the active.
    The second reason it appears you have some paddng in the hover that moves the text.
    Find those and you can solve the issue.
    Gary

  • Need help with error code 150:30

    need help with finding out what error code 150:30 is and how to fix it

    See the following:
    Error 150:30 - Error "Licensing has stopped working" | Mac OS :
    http://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html

  • I need help with some simple code! Please read!

    hi everyone.
    I'm having problems with a piece of code, and i'd be extremely greatful if somebody could give me a hand with it. I'm totally new to java and have to make a program for my university degree, but i'm finding it extremely difficult, mainly due to my total lack of apptitude for this type of thing. I know this is easy stuff, but the books I have are no use so any help would be greatly appreciated.
    I have to write a program which uses two class files. I want one with the code to produce a simple button, and one to invoke it several times at different locations. I decided to write the program as one class file at first, and thought i'd be able to split it up at later. The program works fine when it is one class file. My book said that to split the two classes up, all i needed to do was change the second class to public, although this seems to not work at all. I'm at my wits end on this, and if anyone could correct my code I'd be eternally greatful.
    Here is the first class... (sorry about the lack of indentation)
    >>>>>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20);
    >>>>>>>
    This is the second class....
    >>>>>>>
    public class PhoneButton {
    private Button butt;
    public PhoneButton(int a, int b, int c){
    setLayout(null);
    butt = new Button();
    butt.setBounds(a,b,20,20);
    add(butt);
    >>>>>>>>
    My compiler generates errors relating to Button, but i can't do anything to please it.
    Also, could anyone give me some pointers on how to add a different number or symbol to each button. That is what I added int c for, but i couldn't get it to work.
    Cheers in advance.
    Michael Morgan

    I found that there are 5 error in your code.
    1. You should import the "java.awt" package to the PhoneButton.java
    2. The PhoneButton is not a kind of Component. You cannot not add it to the Phone class
    3. the myButton = new PhoneButton(20, 20) does not provide enough parameters to create PhoneButton
    4. You cannot add a Button to a PhoneButton. Becaue the PhoneButton is not a kind of Container
    Fixed code:
    import java.awt.*;
    public class PhoneButton extends Button {
    public PhoneButton(int a, int b, int c){
         setBounds(a, b, 20, 20);
         setLabel(String.valueOf(c));
    ===========================================
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20, 1);
    ======================
    Visual Paradigm for UML - Full Features UML CASE tool
    http://www.visual-paradigm.com/

  • Noob needs help with this code...

    Hi,
    I found this code in a nice tutorial and I wanna make slight
    adjustments to the code.
    Unfortunately my Action Script skills are very limited... ;)
    This is the code for a 'sliding menue', depending on which
    button u pressed it will 'slide' to the appropriate picture.
    Here's the code:
    var currentPosition:Number = large_pics.pic1._x;
    var startFlag:Boolean = false;
    menuSlide = function (input:MovieClip) {
    if (startFlag == false) {
    startFlag = true;
    var finalDestination:Number = input._x;
    var distanceMoved:Number = 0;
    var distanceToMove:Number =
    Math.abs(finalDestination-currentPosition);
    var finalSpeed:Number = .2;
    var currentSpeed:Number = 0;
    var dir:Number = 1;
    if (currentPosition<=finalDestination) {
    dir = -1;
    } else if (currentPosition>finalDestination) {
    dir = 1;
    this.onEnterFrame = function() {
    currentSpeed =
    Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
    distanceMoved += currentSpeed;
    large_pics._x += dir*currentSpeed;
    if (Math.abs(distanceMoved-distanceToMove)<=1) {
    large_pics._x =
    mask_pics._x-currentPosition+dir*distanceToMove;
    currentPosition = input._x;
    startFlag = false;
    delete this.onEnterFrame;
    b1.onRelease = function() {
    menuSlide(large_pics.pic1);
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    b3.onRelease = function() {
    menuSlide(large_pics.pic3);
    b4.onRelease = function() {
    menuSlide(large_pics.pic4);
    I need to adjust five things in this code...
    (1) I want this menue to slide vertically not horizontally.
    I changed the 'x' values in the code to 'y' which I thought
    would make it move vertically, but it doesn't work...
    (2) Is it possible that, whatever the distance is, the
    "sliding" time is always 2.2 sec ?
    (3) I need to implement code that after the final position is
    reached, the timeline jumps to a certain movieclip to a certain
    label - depending on what button was pressed of course...
    I tried to implement this code for button number two...
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    --> sliding still works but it doesn't jump to the
    appropriate label...
    (4) I wanna add 'Next' & 'Previous' buttons to the slide
    show - what would be the code in this case scenario ?
    My first thought was something like that Flash checks which
    'pic' movieclip it is showing right now (pic1, pic2, pic3 etc.) and
    depending on what button u pressed u go to the y value of movieclip
    'picX + 1' (Next button) or 'picX - 1' (Previous button)...
    Is that possible ?
    (5) After implementing the Next & Previous buttons I need
    to make sure that when it reached the last pic movieclip it will
    not go further on the y value - because there is no more pic
    movieclip.
    Options are to either slide back to movieclip 'pic1' or
    simply do nothing any more on the next button...
    I know this is probably Kindergarten for you, but I have only
    slight ideas how to do this and no code knowledge to back it up...
    haha
    Thanx a lot for your help in advance !
    Always a pleasure to learn from u guys... ;)
    Mike

    Hi,
    I made some progress with the code thanx to the help of
    Simon, but there are still 2 things that need to be addressed...
    (1) I want the sliding time always to be 2.2 sec...
    here's my approach to it - just a theory but it might work:
    we need a speed that changes dynamically depending on the
    distance we have to travel...
    I don't know if that applies for Action Scrip but I recall
    from 6th grade, that...
    speed = distance / time
    --> we got the time (which is always 2.2 sec)
    --> we got the disctance
    (currentposition-finaldestination)
    --> this should automatically change the speed to the
    appropriate value
    Unfortunately I have no clue how the action script would look
    like (like I said my action script skills are very limited)...
    (2) Also, one other thing I need that is not implemented yet,
    is that when the final destination is reached it jumps to a certain
    label inside a certain movieclip - every time different for each
    button pressed - something like:
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    that statement just doesn't work when I put it right under
    the function for each button...
    Thanx again for taking the time !!!
    Mike

  • Beginner needs help with simple code.

    I just statrted learnind java, and I need some help with this simple program. For some reason everytime I enter my Farenheit value, the Celsius conversion returns as 0.0. Would really appreciate the help. Thanks.
    Here's the code:
    public class TempConverter
    public static void main(String[] args)
    double F = Double.parseDouble(args[0]);
    System.out.println("Temperature in Farenheit is: " + F);
    double C = 5 / 9;
    C *= (F - 32);
    System.out.println("Temperature in Celsius is: " + C);
    }

    double C = 5 / 9This considers "5" and "9" to be integers and does an integer division, discarding the remainder. The result of that division is 0. Trydouble C = 5.0/9.0;

  • Need help with HTML5 code

    What is wrong with this code?  It does not play. It should play in Windows-7 and XP with IE8.
    Also, on the screen there is a large white area where the <video> code is.  Why?
    How do I get rid of it?
    Thanks.
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>video testing</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <body>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download mp4 </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download">http:// www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download webm </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download ogg </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download flv </a> button to start video.</p>
    <video width="480" height="270" controls="controls">
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.mp4"  type='video/mp4; codecs="vp8, vorbis"' />
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.webm" type='video/webm; codecs="avc1.42E01E, mp4a.40.2"' />
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12dB.ogg" type="video/ogv; codecs=&quot;theora, vorbis&quot;" />
    <object data="id=player1" width="480" height="270">
        <param name="classid" value="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" />
        <param name="movie" value="player.swf" />
        <param name="flashvars" value="UX-CT-Tour-Short-1024d12db.flv & autostart=true" />
        <param name="allowfullscreen" value="false" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="allowscriptaccess" value="always" />
    <embed flashvars="file=UX-CT-Tour-Short-1024d12db.flv & autostart=true" id="player1" src="player.swf"
    allowfullscreen="true" allowscriptaccess="always" width="480" height="270" />
    </object>
    </video>
    <p>here is some more text</p>
    </body>
    </html>

    Data load? Did it pass a syntax check?
    Anyway, maybe this will help:
    DATA: create_date              TYPE sy-datum,
          update_date              TYPE sy-datum,
          number_of_days_closed(4) TYPE c,
          alert_close_flag(1)      TYPE c,
          result                   LIKE number_of_days_closed.
    IF alert_close_flag EQ 'Y'.
      number_of_days_closed = update_date - create_date .
    ELSE.
      CLEAR number_of_days_closed.
    ENDIF.
    result = number_of_days_closed.
    Rob

  • [8i] Need help with some workday calculations

    At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
    Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
    But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
    Note: I'm working with Oracle 8i

    OK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
    CREATE TABLE caln
    (     clndr_dt     DATE          NOT NULL
    ,     clndr_yr     NUMBER
    ,     shop_day     NUMBER
    ,     shop_dt          DATE
    ,     shop_wk          NUMBER
    ,     shop_yr          NUMBER
    ,     shop_days     NUMBER
    ,     clndr_days     NUMBER
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
    INSERT INTO     caln
    VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
    INSERT INTO     caln
    VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
    INSERT INTO     caln
    VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
    INSERT INTO     caln
    VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
    INSERT INTO     caln
    VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
    INSERT INTO     caln
    VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
    INSERT INTO     caln
    VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
    INSERT INTO     caln
    VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
    INSERT INTO     caln
    VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
    INSERT INTO     caln
    VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
    INSERT INTO     caln
    VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
    INSERT INTO     caln
    VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
    INSERT INTO     caln
    VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
    INSERT INTO     caln
    VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
    INSERT INTO     caln
    VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
    INSERT INTO     caln
    VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
    INSERT INTO     caln
    VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
    INSERT INTO     caln
    VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
    INSERT INTO     caln
    VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
    INSERT INTO     caln
    VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
    INSERT INTO     caln
    VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
    INSERT INTO     caln
    VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
    INSERT INTO     caln
    VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
    INSERT INTO     caln
    VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
    INSERT INTO     caln
    VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
    INSERT INTO     caln
    VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
    INSERT INTO     caln
    VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
    INSERT INTO     caln
    VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
    INSERT INTO     caln
    VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
    INSERT INTO     caln
    VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
    INSERT INTO     caln
    VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
    INSERT INTO     caln
    VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
    INSERT INTO     caln
    VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
    INSERT INTO     caln
    VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
    INSERT INTO     caln
    VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
    INSERT INTO     caln
    VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
    INSERT INTO     caln
    VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
    INSERT INTO     caln
    VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
    INSERT INTO     caln
    VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
    INSERT INTO     caln
    VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
    INSERT INTO     caln
    VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
    INSERT INTO     caln
    VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
    INSERT INTO     caln
    VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
    INSERT INTO     caln
    VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
    INSERT INTO     caln
    VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
    INSERT INTO     caln
    VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
    INSERT INTO     caln
    VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
    INSERT INTO     caln
    VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
    INSERT INTO     caln
    VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
    INSERT INTO     caln
    VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
    INSERT INTO     caln
    VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
    CREATE TABLE ords
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     ord_stat     VARCHAR2(2)
    ,     ord_qty          NUMBER
    ,     part_nbr     VARCHAR2(5)
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
    INSERT INTO     ords
    VALUES (1,1,'CL',10,'PART1');
    INSERT INTO     ords
    VALUES (1,2,'CL',5,'PART1');
    INSERT INTO     ords
    VALUES (25,1,'CL',15,'PART2');
    INSERT INTO     ords
    VALUES (14,1,'OP',12,'PART3');
    INSERT INTO     ords
    VALUES (33,1,'CL',25,'PART1');
    INSERT INTO     ords
    VALUES (33,2,'CL',15,'PART1');
    INSERT INTO     ords
    VALUES (33,3,'OP',10,'PART1');
    INSERT INTO     ords
    VALUES (7,1,'PL',18,'PART2');
    INSERT INTO     ords
    VALUES (96,1,'PL',10,'PART3');
    INSERT INTO     ords
    VALUES (31,1,'CL',20,'PART2');
    CREATE TABLE oops
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     op_nbr          VARCHAR2(4)     NOT NULL
    ,     mach_id          VARCHAR2(4)
    ,     oper_stat     VARCHAR2(2)
    ,     plan_start_dt     DATE
    ,     plsu          NUMBER
    ,     plrn          NUMBER
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
    -- NOTE:
    -- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
    -- in more than two operations (though in reality more would be there) since they should be
    -- ignored in the final result anyway
    INSERT INTO     oops
    VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
    INSERT INTO     oops
    VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
    INSERT INTO     oops
    VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
    INSERT INTO     oops
    VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
    INSERT INTO     oops
    VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    CREATE TABLE mach
    (     mach_id          VARCHAR2(4)     NOT NULL
    ,     desc_short     VARCHAR2(9)     
    ,     group          VARCHAR2(7)
         CONSTRAINT ords_pk PRIMARY KEY (mach_id)
    INSERT INTO     mach
    VALUES     ('123A','desc here','GROUPH1');
    INSERT INTO     mach
    VALUES     ('259B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('110C','desc here','GROUPJ1');
    INSERT INTO     mach
    VALUES     ('050C','desc here','GROUPK2');
    INSERT INTO     mach
    VALUES     ('220B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('150G','desc here','GROUPL1');
    INSERT INTO     mach
    VALUES     ('250G','desc here','GROUPL2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');

  • I need help with some character replacement

    I have a package that calls another package to determine if there are any of 4 values (&,<,>,") and I want to replace the value in the package with the proper value for HTML. If I can get the & figured out I can handle the rest, I just need help getting past this part. I consider myself a novice at PL/SQL so any input is welcome. The package body gives me this message on compile:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    if
    I'm stuck on how to do the actual replace within the package. The code for the replace block is below: using a package and procedure in the package body. I'm using TOAD 9.x on 10gR2.
    I have a feeling the the assignment of the := is having a problem but I'm not sure. This is all part of a larger chunk of code I've written to dynamically create audit triggers (before and after) for my data tables and it writes out to the audit in xml on a row by row basis. The XML insert is failing on on the 4 special characters that need to be converted to their HTML proper use.
    CREATE OR REPLACE package pkg_audit_xml
    as
    procedure change_illegal_char
    (p_new_val in varchar2,
    p_old_val in varchar2,
    p_has_changed in out boolean);
    end;                    
    CREATE OR REPLACE package body pkg_audit_xml
    as
    procedure change_illegal_char
    (p_new_val in varchar2,
    p_old_val in varchar2,
    p_has_changed in out boolean)
    is
    v_temp clob;
    begin
    if ( nvl(p_new_val, ' ') <> nvl(p_old_val, ' ') ) then
    p_has_changed := true;
    p_old_val := replace(p_old_val,'&','&amp;');
    p_new_val := replace(p_new_val,'&','&amp;');
    end if;
    end;
    end pkg_audit_xml;
    /

    SQL> create or replace procedure aa_test(a_old_val IN varchar2) as
      2  begin
      3   a_old_val := substr(a_old_val,1,4);
      4   dbms_output.put_line(a_old_val);
      5  end;
      6  /
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE AA_TEST:
    LINE/COL ERROR
    3/2      PL/SQL: Statement ignored
    3/2      PLS-00363: expression 'A_OLD_VAL' cannot be used as an assignment
             target

  • Need help with my code

    Hi,
    I'm trying to make a driver for an instrument with NAT9914 chipset and I'm having some problems. Sometimes, my Read lost the first character and my Write always get stuck waiting for BO after sending the first character.
    Can somebody points me out what is wrong?
    Here is my code:
    * Initialization
    // enable 9914 chip reset state
    GPIBout(&(hDev->pIo->w.auxcr, 0x1c);
    // disable all interrupts
    GPIBout(&(hDev->pIo->w.imr0, 0);
    GPIBout(&(hDev->pIo->w.imr1, 0);
    // clear status registers by reading
    GPIBin(&(hDev->pIo->r.isr0);
    GPIBin(&(hDev->pIo->r.isr1);
    // set GPIB address;
    GPIBout(&(hDev->pIo->w.adr,(25 & 0x1f));
    // speed is 4Mhz
    GPIBout(&(hDev->pIo->w.accr), 0x0100 );
    // Set T1 Delay to vstdl
    GPIBout(&(hDev->pIo->w.auxcr), 0x97 );
    // release 9914 chip reset state
    GPIBout(&(hDev->pIo->w.auxcr), 0x00);
    * Read
    // Wait to be Active Listener
    while( !((GPIBin(&(hDev->pIo->r.adsr)) & HR_LAPS)) );
    // set and get eos
    ibeos(hDev, (REOS << 8) | '\n');
    eos = bdGetEOS();
    // reading loop
    while(1)
    // send RHDF
    GPIBout(&(hDev->pIo->w.auxcr),AUX_RHDF);
    // wait for BI or stop on end
    while(!((isreg1 = GPIBin(&(hDev->pIo->r.isr0)) & HR_BI) && !(isreg1 & HR_END ) && NotTimedOut());
    // No BI
    if( (isreg1 & HR_END) || TimedOut() )
    break;
    // read byte
    bin[j++] = GPIBin(&(hDev->pIo->r.dir);
    // read last character
    bin[j] = GPIBin(&(hDev->pIo->r.dir));
    // make string readable
    if((eosmodes & REOS) && (bin[j] == eos ))
    bin[j] = '\0';
    else
    bin[j+1] = '\0';
    * Write
    // Wait to be Active Talker
    while( !((GPIBin(&(hDev->pIo->r.adsr)) & HR_TPAS)) );
    // writting loop
    while(i{
    // write byte to register
    GPIBout(&(hDev->pIo->w.cdor), buf[i++]);
    // wait for BO or ERR
    while( !((GPIBin(&(hDev->pIo->r.isr0)) & HR_BO))
    || !((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR)) )
    // if error, stop
    if((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR))
    break;
    // if no error, send EOI with last byte
    if(!((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR)))
    GPIBout(&(hDev->pIo->w.auxcr ), 0x08 );
    GPIBout(&(hDev->pIo->w.cdor), buf[i]);
    Thanks,
    Michael

    Try visiting the NI web site for Registry Level programming. It contains Manuals, Notes, Examples and KB entries that should help with your application:
    ni.com>>Technical Support>>GPIB>>GPIB Register Level Programming

  • Need help with some JS installing Bumpbox 2.0

    I am trying to add a lightbox effect to a pdf on my website, I found a Javascript plugin at http://www.artviper.net/bumpbox-demo/index.html that looks like it should do the trick, but I am having trouble getting it to work.
    To narrow down the problem I created a test.html file that I stuck in the root directory of the folder I downloaded from their site (so I am working locally off my desktop at this point)
    My code is as follows... I feel like I am missing something super obvious, does anyone see it? (do I need to define the .bump class in the css file?)
    Thank you in advance for the much needed help!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    <body>
          <a href="http://www.artviper.net/test.pdf" class="bump" rel="800-350">PDF File &raquo;</a><br />
    <script type="text/javascript" src="js/mootools.js"></script>
    <script type="text/javascript" src="js/bumpbox-2.0.1.js"></script>
    <script type="text/javascript"> doBump( '.bump',750, 500, '111', '900', '0.8', 5, 1 ,'333', 15,'000', 4,
                     Fx.Transitions.Bounce.EaseOut,
                     Fx.Transitions.Bounce.EaseOut,
                     'images/demo_bg_bumpbox.png',
                     'top left',
                     'repeat-x' ); </script>
    </body>
    </html>

    These paths won't work because they point to files on your local hard drive.
    <script type="text/javascript" src="file:///Macintosh HD/Users/Robert/Downloads/bumpbox Folder copy/js/mootools.js"></script>
    <script type="text/javascript" src="file:///Macintosh HD/Users/Robert/Downloads/bumpbox Folder copy/js/bumpbox-2.0.1.js"></script>
    Are you working within a properly defined local site?
    Did you save those javascript files to the js folder in your local site root?
    Correct path to scripts for this test page should look like this:
    <script type="text/javascript" src="../js/mootools.js"></script>
    <script type="text/javascript" src="../js/bumpbox-2.0.1.js"></script>
    PS.  Do not add spaces to folder or file names.  It can create problems for web files.
    Nancy O.

Maybe you are looking for

  • Problems syncing new google calendar delegates to iPhone 3

    I got a iPhone 3 a few months ago and had no problem setting up calendar so that all of my google calendar delegates are visible in both iCal and on my iPhone. I haven't had any problems with getting events to update on all of my calendars regardless

  • Connection request timed out - problem

    Hi, our errorlog confirms there are regular "Connection request timed out" errors in our web-application (asp.net with odp 9.2.0.4). Now we did a standard ODP installation, so i don't know how all the Pooling parameters are set up initially. But i fo

  • My B750 wont boot up!!!!!

    I can just bought this laptop and I can get everything to work, press F2 and all that but this stupid laptop wont work! I hear that little sound thingi, like after the windows sign comes up and it saying powering up, but it never shows my icon to cli

  • Is it possible to create views with parameters ?

    Hi, As MS-Access, is it possible to create views with parameters ? Ms-Access syntax : parameters [a] text; select * from table where code = [a] If yes, can you give samples ? Regards Pascal

  • Deleted files still using up disk space

    Long story. Transferred 30Gb of mpegs from my wife's laptop to mine via firewire target disk mode on wife's machine. Logged off to disconnect and when I unplugged, got the disk wasn't ejected error. I thought it was. I had deleted the 30G from my wif