Need someone to chek my code n tell me if the asserts work. Please!!

Hi , its importante that someone could help me on my code.
the code is the greatest common divisor ( Maximo divisor comum)
Well , the code is all right but i can't run it with the asserts , im using Eclipse 3.1 , the level of compilation is 1.3 .
It says that ignores de asserts but when i compile it gives me error on assert expression.
I would like to someone could test this code in another JAva editor like XEmacs or JBuilder ,anything that works with asserts and accept them.
Someone working with linux could test this too?
Just wanna see if the assertions are right , because i can't run the program with them in the eclipse. :S
Its importante, help me please.
Code:
import pt.iscte.io.*;
public class gCommonDivisor {
public static void main(String[] args){
      assert 0 < n : n;     //  <--  THERE THEY ARE  : (
      assert 0 < d : d;  // n is the numerator and d is the denomi.
System.out.println("Insira valor do numerador: ");
          int n = Teclado.intLido();
          System.out.println("Insira valor do denominador: ");
          int d = Teclado.intLido();
          int r = mdc( n, d); // modulo para o maximo divisor comum
          int den = denominador(r , d); // modulo para denominador simplificado
          int num = numerador(r, n); // modulo para numerador simplificado
          // Output do Maximo divisor comum e da frac�ao reduzida
          System.out.println("Maximo divisor comum entre "+ n +" e "+ d +" � "+ r);
          System.out.print("Frac��o reduzida de "+ n +"/"+ d +" = "+ num +"/"+ den);
           * @pre V.
           * @post gcd = maximo divisor comum
          static int mdc(int n, int d){
          int gcd = 1;
          int k =1;
          while (k <= n && k <= d) {
               if (n % k == 0 && d % k == 0)
                    gcd =k;
               k++;
               return gcd;
          // numerador simplificado
          static int numerador(int r , int n ) {
          int numerador = n / r;
          return numerador;
          // denominador simplificado
          static int denominador(int r , int d ) {
          int denominador = d / r;
          return denominador;
} Thank you so much .
Please help me!
Sorry about the language of the code. but dont worry about it, the code works fine without those two asserts after the main.
kind regards,
Josh

wow i forgot to say that u just need to change the
expression to read the input from the console.
U dont have the iscte_io.jar
change int n = Teclado.intLido();
and int m = Teclado.intLido();
cuz u don't have the Teclado( Keyboard) i had to import pt.iscte.io.Teclado;
to read the input given by the user.
thks

Similar Messages

  • Can someone post apple script code to tell Safari to refresh every 5 min?

    Can someone post apple script code to tell Safari to refresh every 5 min?
    thanx in advance!

    save the script as an application and checkmark the "Stay Open" box
    -- start script
    on idle
    tell application "Safari"
    activate
    set doc_url to URL of document 1
    open location doc_url
    end tell
    return 15 --<change the number 15 to the number of seconds you want between each refresh
    end idle
    -- end script
    <br>
    Mac OS X (10.4.7)

  • Someone tell me why it isnt working, please!

    i just need someone to say "put whatsamajigger here and it'll all be okay"
    so if someone could tell me what whatsamajigger is and where it goes i'll be soo greatfull!
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.* ;
    * Class EmailFront
    * @author (James Boulton)
    * @version (1.0)
    public class EmailFront extends JApplet implements ActionListener
    File file = new File("text.txt");
    PrintStream print = new PrintStream( file );
    JLabel FirstNameLabel = new JLabel("First Name");
    JLabel LastNameLabel = new JLabel("Last Name");
    JLabel EmailLabel = new JLabel("Email Address");
    JLabel image;
    JLabel image2;
    JTextField FirstNameText = new JTextField( 10 );
    JTextField LastNameText = new JTextField( 10 );
    JTextField EmailAddressText = new JTextField( 15 );
    JPanel panel1 = new JPanel();
    JPanel panel2 = new JPanel();
    JPanel panel3 = new JPanel();
    JPanel panel4 = new JPanel();
    JPanel panel5 = new JPanel();
    JPanel container = new JPanel();
    JButton Enterbutton = new JButton("Enter Details");
    ImageIcon myimage2;
    ImageIcon myimage;
    Font font;
    public void init() {
    try {
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    public void run() {
    createGUI();
    } catch (Exception e) {
    System.err.println("createGUI didn't successfully complete");
    private void createGUI() {
    getContentPane().setLayout( new BorderLayout());
    container.setLayout(new BoxLayout( container, BoxLayout.Y_AXIS ));
    panel1.setLayout(new BoxLayout( panel1, BoxLayout.Y_AXIS ));
    font = new Font("Copperplate Gothic Light",Font.PLAIN, 11);
    myimage = new ImageIcon (Toolkit.getDefaultToolkit().getImage("background.jpg"));
    myimage2 = new ImageIcon (Toolkit.getDefaultToolkit().getImage("background2.jpg"));
    FirstNameLabel.setForeground(Color.WHITE);
    FirstNameLabel.setFont(font);
    LastNameLabel.setForeground(Color.WHITE);
    LastNameLabel.setFont(font);
    EmailLabel.setForeground(Color.WHITE);
    EmailLabel.setFont(font);
    image = new JLabel(myimage);
    image2 = new JLabel(myimage2);
    panel1.add(image2);
    panel2.add(FirstNameLabel); panel2.add(FirstNameText);
    panel3.add(LastNameLabel); panel3.add(LastNameText);
    panel4.add(EmailLabel); panel4.add(EmailAddressText);
    panel5.add(Enterbutton);
    container.add(panel2);container.add(panel3);container.add(panel4);container.add(panel5);
    getContentPane().add(image, BorderLayout.NORTH);
    getContentPane().add(panel1, BorderLayout.EAST);
    getContentPane().add(container, BorderLayout.CENTER);
    setBackground (Color.black);
    container.setBackground( Color.black );
    panel1.setBackground( Color.black );
    image.setBackground( Color.black );
    panel2.setBackground( Color.black );
    panel3.setBackground( Color.black );
    panel4.setBackground( Color.black );
    panel5.setBackground( Color.black );
    Enterbutton.addActionListener( this );
    public void actionPerformed( ActionEvent evt)
    String newFN = FirstNameText.getText();
    String newLN = LastNameText.getText();
    String newEA = EmailAddressText.getText();
    print.println( newFN );
    print.println( newLN );
    print.println( newEA );
    public void start()
    public void stop()
    public void destroy()
    public String getAppletInfo()
    return "Title: \nAuthor: \nA simple applet example description. ";
    public String[][] getParameterInfo()
    String paramInfo[][] = {
    {"firstParameter", "1-10", "description of first parameter"},
    {"status", "boolean", "description of second parameter"},
    {"images", "url", "description of third parameter"}
    return paramInfo;
    and dont worry about all of the last bits, it still compiles, i can sort them out later, for now i just want to get the writing to a txt document done, and yes, i do have a txt document in the file.

    i've just never attempted a applet beforeSo why are you attempting one now? Did somebody tell you to do that, or did you just read one of those godawful books that start out by telling you how to write applets but never bother to tell you why you should write an applet?
    No, none of that is your fault. You've written applications before and they worked fine? Stick with writing applications. The only reason to write an applet is so you can provide users of your website with a component that has more capabilities than HTML and Javascript.

  • I need someone to review my program and tell me why it won't work

    I can't get this to work. It's a program that generates a set of random numbers, stores them as a .txt file then a second program imports that data and sorts it in descending order and displays the average and median of the data. If this is too messy and there is a better way to post these programs please tell me and I will repost. Sorry about the messyness but here you go:
    It's two separate .java files.
    RandMarks.java:
    import java.io.*;
    public class RandMarks
    public static void main (String [] args) throws IOException
    int randomNum;
    PrintWriter fileOut = new PrintWriter (new FileWriter ("marks.txt"));
    for (int i = 1; i <= 25; i++)
    randomNum = (int) (Math.random () * 60 + 40);
    fileOut.println (randomNum);
    fileOut.close ();
    IcsMarkbook.java:
    import java.io.*;
    public class IcsMarkbook
    public static void main (String [] args) throws IOException
    BufferedReader readFile = new BufferedReader (new FileReader ("marks.txt"));
    int inMarks [] = new int [25];
    int avgMark, medMark;
    int totalMarks = 0;
    for (int i = 0; i < 100; i++)
    inMarks = Integer.parseInt (readFile.readLine ());
    bubbleSort (inMarks);
    for (int p = 0; p < inMarks.length; p++)
    System.out.println ("#" + p + " - " + inMarks [p]);
    totalMarks = totalMarks + inMarks [p];
    avgMark = totalMarks / inMarks.length;
    System.out.println ("The average is " + avgMark);
    medMark = inMarks [13]
    public static void bubbleSort (int array [])
    for (int pass = 0; pass < array.length - 1; pass++)
    for (int element = 0; element < array.length - 1; element++)
    if (array [element] > array [element + 1])
    swap (array, element, element + 1);
    //Swap method
    public static void swap (int array2 [], int first, int second)
    int hold;
    hold = array2 [first];
    array2 [first] = array2 [second];
    array2 [second] = hold;

    RandMarks.java:
    import java.io.*;
    public class RandMarks
         public static void main (String [] args) throws IOException
              int randomNum;
              PrintWriter fileOut = new PrintWriter (new FileWriter ("marks.txt"));
              for (int i = 1; i <= 25; i++)
                   randomNum = (int) (Math.random () * 60 + 40);
                   fileOut.println (randomNum);
              fileOut.close ();
    }IcsMarkbook.java:
    import java.io.*;
    public class IcsMarkbook
         public static void main (String [] args) throws IOException
              BufferedReader readFile = new BufferedReader (new FileReader ("marks.txt"));
              int inMarks [] = new int [25];
              int avgMark, medMark;
              int totalMarks = 0;
              for (int i = 0; i < 100; i++)
                   inMarks = Integer.parseInt (readFile.readLine ());
              bubbleSort (inMarks);
              for (int p = 0; p < inMarks.length; p++)
                   System.out.println ("#" + p + " - " + inMarks [p]);
                   totalMarks = totalMarks + inMarks [p];
              avgMark = totalMarks / inMarks.length;
              System.out.println ("The average is " + avgMark);
              medMark = inMarks [13]
         public static void bubbleSort (int array [])
              for (int pass = 0; pass < array.length - 1; pass++)
                   for (int element = 0; element < array.length - 1; element++)
                        if (array [element] > array [element + 1])
                             swap (array, element, element + 1);
         //Swap method
         public static void swap (int array2 [], int first, int second)
              int hold;
              hold = array2 [first];
              array2 [first] = array2 [second];
              array2 [second] = hold;
    }The message that I got was:
    Exception in thread "main" jaja.lang.NumberFormatException: null
            at java.lang.Integer.parseInt(Integer.java:415)
            at java.lang.Integer.parseInt(Integer.java:497)
            at IcsMarkbook.main(IcsMarkbook.java:13)
    I have gone over the program multiple times and cannot figure out what's wrong.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Could someone look at my code, I can't see the error myself

    Hi,
    I have been working on a small game, and have been able to make most of it run.
    However, every now and again when i try to start it, it loads the frame and graphics, but don't start the game loop.
    I think i have been starring at it too long, because i can't see WHY?
    Here is the code, i assume its something connected to the boolean "waitingForKeyPress"
    Sorry about the commentss being in danish, but its a quite simple program, so im sure it makes sense.
    public class EagleFlight extends Canvas {
         private static final long serialVersionUID = 1L;
         //Strategybuffer til page flipping, samt grafiske variable.
         private BufferStrategy strategy = null;
         //private BufferedImage backbuffer = null;     
         private ImageEntity background = null;     
         //private Graphics2D g;     
         //private BufferedImage expl;
         private BufferedImage[] explosion2;     
         private boolean gameRunning = true;
         //Lister over entiteter i spillet.
         private ArrayList<Entity> entities = new ArrayList<Entity>();
         private ArrayList<ShipEntity> shipAnimation = new ArrayList<ShipEntity>();
         //Lister over entiteter der evt skal fjernes i gameLoop.
         private ArrayList<Entity> removeList = new ArrayList<Entity>();
         private ArrayList<Entity> removeAsteroid = new ArrayList<Entity>();
         //Variable til spillerens skib.
         private ShipEntity ship, shipL, shipR, eagleM;
         private double moveSpeed = 300;
         private long lastFire = 0;
         private long firingInterval = 500;
         private String message = "";
         //Booleans til keyInput og spilkontrol.
         private boolean waitingForKeyPress = true;
         private boolean leftPressed = false;
         private boolean rightPressed = false;
         private boolean firePressed = false;
         private boolean isThrusting = false;
         private Boolean shipHit = false;
         private Boolean animation = false;
         //Klasser der bruges i spillet.
         private FXSound fxSound = null;
         private Music music;     
         int score =0;
         private int astroidCount = 0;
         //Variable til ekspoltionsanimation.
         private int v = 0, x = 0, y = 0, eksp = 0;
         //Opretter JFrame og tilf&#65533;jer JPanel.
         public EagleFlight(){
              JFrame container = new JFrame("Eagle Flight 1999");                    
              JPanel panel = (JPanel) container.getContentPane();
              panel.setPreferredSize(new Dimension(800,600));
              panel.setLayout(null);
              //Tilf&#65533;jer EagleFlight canvas til JPanel
              setBounds(0,0,800,600);
              panel.add(this);
              //S&#65533;ttes til true, s&#65533; for&#65533;get graphics har ansvaret.
              setIgnoreRepaint(true);
              //Pakker og synligg&#65533;r vinduet.
              container.pack();
              container.setResizable(false);
              container.setVisible(true);
              // Tilf&#65533;jer windows close funktion
              container.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              // Tilf&#65533;jer keyListener og inputhandler.
              addKeyListener(new KeyInputHandler());
              //S&#65533;tter fokus til dette vindue-
              requestFocus();
              // Laver buffering strategy til accelerated graphics
              createBufferStrategy(2);
              strategy = getBufferStrategy();
              // Tilf&#65533;jer midlertidigt Entities, s&#65533; startsk&#65533;rmen ikke er tom.
              initEntities();
         }//End of EagleFlight().
         //Nulstiller variable og lister.
         private void startGame() {
              entities.clear();
              initEntities();          
              shipHit = false;          
              leftPressed = false;
              rightPressed = false;
              firePressed = false;
              gameRunning = true;
              music = new Music();
              music.start();
              waitingForKeyPress = false;
         }//end of startgame().
         private void initEntities() {
              //Laver 3 skibe til thrusteranimationen.
              ship = new sprite.ShipEntity(this,"eagle.png",370,430);
              shipL = new sprite.ShipEntity(this,"eagle1.png",370,430);
              shipR = new sprite.ShipEntity(this,"eagle2.png",370,430);
              shipAnimation.add(ship);
              shipAnimation.add(shipL);
              shipAnimation.add(shipR);
              //Opretter baggrundsbillede.
              new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
              background = new ImageEntity("stars.png",0,0);
              //Klarg&#65533;r special effect lyd.
              fxSound = new FXSound();
              //Opretter eksplotionsanimation
              explosion2 = new ExplotionImages().explosion();
              //Laver en pokkers bunke asteroider og placerer dem "over" JPanel, s&#65533; de falder naturligt.
              for (int row=0;row<6;row++) {
                   for (int x=0;x<10;x++) {
                        Entity astroid = new sprite.Astroid(this,"asteroid1.png",20+(x*120),(-2800)+row*400);
                        entities.add(astroid);                                   
                        astroidCount++;
              for (int row=0;row<6;row++) {
                   for (int x=0;x<10;x++) {
                        Entity astroid = new sprite.Astroid(this,"asteroid4.png",20+(x*120),(-3800)+row*400);
                        entities.add(astroid);                                   
                        astroidCount++;
              for (int row=0;row<6;row++) {
                   for (int x=0;x<10;x++) {
                        Entity astroid = new sprite.Astroid(this,"asteroid2.png",20+(x*120),(-4800)+row*400);
                        entities.add(astroid);                                   
                        astroidCount++;
              for (int row=0;row<6;row++) {
                   for (int x=0;x<10;x++) {
                        Entity astroid = new sprite.Astroid(this,"asteroid3.png",20+(x*120),(-5800)+row*400);
                        entities.add(astroid);                                   
                        astroidCount++;
         }//end of initEntities()
         //Fjerner de entities der ikke bruges mere.
         //@param entiteten der skal fjernes.
         public void removeEntity(Entity entity)
              removeList.add(entity);               
         }//end of removeEntity().
         //Tilf&#65533;jer ramte asteroider til remove listen.
         //@param entiteten der skal tilf&#65533;jes.
         public void removeAsteroid(Entity doomed){
              removeAsteroid.add(doomed);
         }//End of removeAsteroid().
         //Udf&#65533;res n&#65533;r spilleren d&#65533;r.
         public void notifyDeath() {
              message = "All your base are belong to us!";
              shipHit = true;
              removeAsteroid.add(eagleM);
              shipAnimation.clear();          
         }//End of notifyDeath().
         //Fors&#65533;ger at affyre v&#65533;ben, hvis reload er ok og skibet ikke er ramt.
         public void tryToFire() {
              // check that we have waiting long enough to fire
              if (System.currentTimeMillis() - lastFire < firingInterval) {
                   return;
              if (!shipHit){
                   lastFire = System.currentTimeMillis();
                   ShotEntity shot = new sprite.ShotEntity(this,"shot.gif",ship.getX()+23,ship.getY()-15);
                   entities.add(shot);
                   fxSound.fxSound1();
         }//End of tryToFire().
         //Metode til at vinde spillet.
         public void notifyAlienKilled() {
              astroidCount--;
              score++;
              fxSound.fxSound3();
              if (astroidCount == 0) {
         }//End of notifyAlienKilled()
         public void gameLoop() {
              long lastLoopTime = System.currentTimeMillis();
              long timeInGame = 0;
              // I dette loop udf&#65533;res spillets grafik og logik.
              while (gameRunning) {
                   // Beregner tid for hvor meget de enkelte grafiske enheder skal flyttes
                   long delta = System.currentTimeMillis() - lastLoopTime;
                   lastLoopTime = System.currentTimeMillis();
                   timeInGame = (timeInGame + System.currentTimeMillis()/100000);
                   // Skaffer den grafiske acceleration.
                   // Tegner baggrunden.
                   Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
                   background.draw(g);
                   //Cykler rundt mellem asteroider og flytter dem.
                   if (!waitingForKeyPress) {
                        for (int i=0;i<entities.size();i++) {
                             Entity entity = (Entity) entities.get(i);
                             entity.move(delta);
                        //Bev&#65533;ger de 3 skibe i sync.
                        for (int e=0;e<shipAnimation.size();e++) {
                             ShipEntity fakeeaglemove = (ShipEntity) shipAnimation.get(e);
                             fakeeaglemove.move(delta);
                   // Cykler rundt mellem entities og tegner dem.          
                   for (int i=0;i<entities.size();i++) {
                        Entity entity = (Entity) entities.get(i);
                        entity.draw(g);
                   //Tegner det skib der er i brug.
                   for (int e=0;e<shipAnimation.size();e++)
                        eagleM = (ShipEntity) shipAnimation.get(e);
                        if (leftPressed)
                        {eagleM = shipL;
                        if (rightPressed)
                        {eagleM = shipR;
                        else if ((!leftPressed) && (!rightPressed))
                        {eagleM = ship;
                        eagleM.draw(g);
                   //Brute force detection p&#65533; skibet og asteroider.               
                   try {
                        for (int c = 0; c < entities.size(); c++) {
                             for (int m = 0; m < shipAnimation.size(); m++) {
                                  Entity me = (Entity) shipAnimation.get(m);
                                  Entity him = (Entity) entities.get(c);
                                  if (me.collidesWith(him)) {
                                       //removeAlien.add(him);
                                       me.collidedWith(him);
                                       him.collidedWith(me);
                   } catch (Exception e) {
                   //Brute force detection p&#65533; skud og asteroider.
                   try {
                        for (int p = 0; p < entities.size(); p++) {
                             for (int s = p + 1; s < entities.size(); s++) {
                                  Entity me = (Entity) entities.get(p);
                                  Entity him = (Entity) entities.get(s);
                                  if (me.collidesWith(him)) {
                                       me.collidedWith(him);
                                       him.collidedWith(me);
                   } catch (Exception e) {
                   //Explotion animation.
                   for (int i=0;i<removeAsteroid.size();i++) {
                        Entity entity = (Entity) removeAsteroid.get(i);
                        explosion(entity);                                   
                   if (animation){
                        int sequence[] = { 0,1,2,3,4,5,5,4,3,2,1,0};                    
                        eksp = sequence[v];
                        g.drawImage(explosion2[eksp], x-100,y-100, null);
                   //Afslutter spillet hvis spillerens skib er ramt.
                   if (eksp == 0 || v == 12){     
                        if (shipHit){
                             animation = false;
                             waitingForKeyPress = true;
                             music.stop();                                        
                             if(isThrusting){
                                  fxSound.StopThruster();
                        animation = false;
                        v = 0;
                        eksp = 0;
                   v++;//Opdaterer image nummer for eksplotionsanimation til n&#65533;ste genneml&#65533;b.
                   // Fjerner entities der ikke er med mere.
                   entities.removeAll(removeList);
                   entities.removeAll(removeAsteroid);
                   //Nulstiller removelisterne
                   removeList.clear();                              
                   removeAsteroid.clear();
                   // Mens der ventes p&#65533; keyinput vises dette.
                   if (waitingForKeyPress) {
                        g.setColor(Color.white);
                        g.drawString(message,(800-g.getFontMetrics().stringWidth(message))/2,250);
                        g.drawString("Insert coin",(800-g.getFontMetrics().stringWidth("Insert coin"))/2,300);
                        timeInGame = 0;
                   g.setColor(Color.white);               
                   g.drawString("Score: "+score,720,595);
                   g.drawString("Time in Flight: "+timeInGame/1000000000+" Secs",5,595);
                   // Graphics ryttes op og bufferen flippes.
                   g.dispose();
                   strategy.show();
                   // Nulstiller skibets bev&#65533;gelse.
                   ship.setHorizontalMovement(0);
                   shipL.setHorizontalMovement(0);
                   shipR.setHorizontalMovement(0);
                   //Tilpasser skibets horizontale bev&#65533;gelseshastighed til input.
                   if ((leftPressed) && (!rightPressed))
                        ship.setHorizontalMovement(-moveSpeed);
                        shipL.setHorizontalMovement(-moveSpeed);
                        shipR.setHorizontalMovement(-moveSpeed);
                   else if ((rightPressed) && (!leftPressed))
                        ship.setHorizontalMovement(moveSpeed);
                        shipL.setHorizontalMovement(moveSpeed);
                        shipR.setHorizontalMovement(moveSpeed);//animationtest ship changed to eagle
                   //Affyrings sekvens
                   if (firePressed)
                        tryToFire();
                   // Lille pause til andre ting.
                   try { Thread.sleep(10); } catch (Exception m) {}
         }//End of gameLoop
         //Metode til kontrol af thrusterlyden.
         private void thrusterSound(){
              if (!isThrusting){
                   fxSound.fxSound2();               
                   isThrusting = true;
         }//End of thrusterSound
         //Metode til at inds&#65533;tte eksplotion p&#65533; den rette plads.
         //@param den ramte entitet.
         private void explosion(Entity entity){
              x = entity.getX();
              y = entity.getY();
              animation = true;
         }//End of explosion
         //Inner class der klarer input fra keybard.
         private class KeyInputHandler extends KeyAdapter {
              //S&#65533;tter t&#65533;ller til 1, s&#65533; wait for input virker.
              private int pressCount = 1;
              //@param den trykkede tast.
              public void keyPressed(KeyEvent e) {
                   // Ser f&#65533;rst om der ventes p&#65533; input til start.
                   if (waitingForKeyPress) {
                        return;
                   //Er spillet igang udf&#65533;res input
                   if (e.getKeyCode() == KeyEvent.VK_LEFT) {
                        leftPressed = true;                         
                        thrusterSound();
                   if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
                        rightPressed = true;
                        thrusterSound();
                   if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                        firePressed = true;
              } //End of keyPressed
              //Stopper handlingen fra input
              //@param den trykkede tast.
              public void keyReleased(KeyEvent e) {
                   // if we're waiting for an "any key" typed then we don't
                   // want to do anything with just a "released"
                   if (waitingForKeyPress) {
                        return;
                   if (e.getKeyCode() == KeyEvent.VK_LEFT) {
                        leftPressed = false;
                        fxSound.StopThruster();
                        isThrusting = false;
                   if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
                        rightPressed = false;
                        fxSound.StopThruster();
                        isThrusting = false;
                   if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                        firePressed = false;
              }//End of keyReleased
              //Metode til at starte spillet med any key.
              //@param den trykkede tast.
              public void keyTyped(KeyEvent e) {
                   if (waitingForKeyPress) {
                        if (pressCount == 1) {
                             // Starter spillet.
                             waitingForKeyPress = false;
                             startGame();
                             //pressCount = 0;
                        } else {
                             pressCount++;
                   // Tilf&#65533;jer esc key til at afslutte spillet.
                   if (e.getKeyChar() == 27) {
                        System.exit(0);
         }//End of KeyTyped.
         public static void main(String args[])
              EagleFlight ef = new EagleFlight();          
              ef.gameLoop();
         }//End of main.
    }//End of class EagleFlight.

    Mondariz wrote:
    It was a copy/paste job from Eclipse, not suer why it formatted like this. You need to add code tags.
    [edit: do what Darryl says... as opposed to my crap version that did not format properly either]
    As far as the tracing goes. It shouldn't be taking hours. Start by putting them in where your program starts and move on.

  • HT201304 All I need to know is how do I find out my IPod's Touchs restriction codes ? Anybody help me the legal way please?

    I / we have two Ipod touches and I have forgotten the restriction password. I all I need to do is update it so my daughter can install an app she wants. never need it before been to tight to shell out money's for games .

    You will need to Restore your Device...
    https://discussions.apple.com/message/16804924#16804924

  • I need someone to assist me with setting my dsl to the proper speed of 10mb from current at 7.1

    I am getting very frustrated with customer service being unable to resolve setting my dsl speed to the max available on my line which is 10 mb a second according to dsl tech support. I am getting to the point that I am going to cancel my service if this situation does not get resolved. I am currently only set in the system to a speed of 7.1mb and this speed was what I was getting with my dry loop dsl. I had to add a phone line and a double bundle in order to get the faster speed of 10mb a second. I need help right away to resolve this issue. No one at billing or technical support has been able to fix this issue with multiple calls and transfers from one department to another. 
    Thank You
    Brian

    Step one: Visit http://www.giganews.com/line_info.html and post up the Traceroute the page shows, if you wish. Be aware that your non-bogan public IP Address will show up.  It might shown up as the final hop (bottom-most line of the trace)  might contain a hop with your IP address in it. Either remove that line or show only the first two octets. What I'm looking for is a line that mentions "ERX" in it's name towards the end. If for some reason the trace does not complete (two lines full of Stars), keep the trace route intact.
    For example this what I saw when I was using Verizon
        news.giganews.com
        traceroute to 71.242.*.* (71.242.*.*), 30 hops max, 60 byte packets
        1 gw1-g-vlan201.dca.giganews.com (216.196.98.4) 13 ms 13 ms 13 ms
        2 ash-bb1-link.telia.net (213.248.70.241) 39 ms 7 ms 7 ms
        3 TenGigE0-2-0-0.GW1.IAD8.ALTER.NET (63.125.125.41) 4 ms 4 ms GigabitEthernet2-0-0.GW8.IAD8.ALTER.NET (63.65.76.189) 4 ms
        4 so-7-1-0-0.PHIL-CORE-RTR1.verizon-gni.net (130.81.20.137) 6 ms 6 ms 6 ms
        5 P3-0-0.PHIL-DSL-RTR11.verizon-gni.net (130.81.13.170) 6 ms 6 ms 6 ms
        6 static-71-242-*-*.phlapa.east.verizon.net (71.242.*.*) 32 ms 32 ms 33 ms
    Step two: Can you provide the Transceiver Statistics from your modem?
    #3 If you don't know how to get that info:
    a) What is the brand and model of your modem?
    b) If you have a RJ-45 WAN port router connected to it: What is the brand and model of the RJ-45 WAN port router?
    #4 If you have a RJ-45 WAN port router connected to the modem, even if you know how to get the Transceiver Statistics from the modem: What is the brand and model of the RJ-45 WAN port router?
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • HT5675 i need java 1.6 to get ,m,inecraft but it wont ever work please help?

    i need java 1.6 to get minecraft but it wont ever work someone please help me!

    Hello,
    What version of Mac OS X are you running on your iBook?
    Also check what version of java is currently installed by doing the following,
    Open Terminal, type in java -version then press Enter.  Then retrieve the current java version, in this example being 1.6.0_24

  • Can anyone tell me why this doesnt' work please

    Be gentle :o)
    I am trying out this printing in version 1.4 I am wanting to print out the contents of a text file
    Below is the code but it does nothing
    It compiles but doesn't function??
    HELP
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class PrintFile {
         public static void main(String args[]) {
              PrintFile pf = new PrintFile();
         public PrintFile() {
              /* Construct the print request specification.
              * The print data is Postscript which will be
              * supplied as a stream. The media size
              * required is A4, and 1 copy are to be printed
              DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST;
              PrintRequestAttributeSet aset =
                   new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              aset.add(new Copies(1));
              aset.add(Sides.TWO_SIDED_LONG_EDGE);
              aset.add(Finishings.STAPLE);
              /* locate a print service that can handle it */
              PrintService[] pservices =
                   PrintServiceLookup.lookupPrintServices(flavor, aset);
              if (pservices.length > 0) {
                   System.out.println("selected printer " + pservices[0].getName());
                   /* create a print job for the chosen service */
              DocPrintJob pj = pservices[0].createPrintJob();
                   try {
                        * Create a Doc object to hold the print data.
                        * Since the data is postscript located in a disk file,
                        * an input stream needs to be obtained
                        * BasicDoc is a useful implementation that will if requested
                        * close the stream when printing is completed.
                        FileInputStream fis = new FileInputStream("EventFile.txt");
                        Doc doc = new SimpleDoc(fis, flavor, null);
                        /* print the doc as specified */
                        pj.print(doc, aset);
                        * Do not explicitly call System.exit() when print returns.
                        * Printing can be asynchronous so may be executing in a
                        * separate thread.
                        * If you want to explicitly exit the VM, use a print job
                        * listener to be notified when it is safe to do so.
                   } catch (IOException ie) {
                        System.err.println(ie);
                   } catch (PrintException e) {
                        System.err.println(e);
    }

    I too find the same problem not locating all the print services, then i use defualt print service and it works, another error i was getting that of invalid flavor so i then get all the doc flavor supported by my printer and use AUTOSENSE. Following is the code that u can test:
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class PrintText1 {
         public static void main(String[] args) {
              System.out.println("Print Text");
              PrintText1 ps = new PrintText1();
         public PrintText1() {
              /* Construct the print request specification.
              * The print data is Postscript which will be
              * supplied as a stream. The media size
              * required is A4, and 2 copies are to be printed
              System.out.println(0);
              DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
              PrintRequestAttributeSet aset =
                   new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              aset.add(new Copies(1));
              aset.add(Sides.ONE_SIDED);
              //aset.add(Finishings.STAPLE);
              /* locate a print service that can handle it */
              System.out.println(1);
              PrintService defpservices = PrintServiceLookup.lookupDefaultPrintService();
              System.out.println("Default Printer " + defpservices.getName());
              /* create a print job for the chosen service */
              DocPrintJob pj = defpservices.createPrintJob();
              System.out.println(2);
              try {
                   * Create a Doc object to hold the print data.
                   * Since the data is postscript located in a disk file,
                   * an input stream needs to be obtained
                   * BasicDoc is a useful implementation that will if requested
                   * close the stream when printing is completed.
                   FileInputStream fis = new FileInputStream("file.txt");
                        Doc doc = new SimpleDoc(fis, flavor, null);
                        System.out.println(3);
                        /* print the doc as specified */
                        pj.print(doc, aset);
                        * Do not explicitly call System.exit() when print returns.
                        * Printing can be asynchronous so may be executing in a
                        * separate thread.
                        * If you want to explicitly exit the VM, use a print job
                        * listener to be notified when it is safe to do so.
              } catch (IOException ie) {
                   System.err.println("IOException " + ie);
              } catch (PrintException e) {
                   System.err.println("PrinterException " + e);
    Try this code it will work for you to print the text file.
    Now my problem is i am trying to print the html file and its printing the html file including all the html tags, can anybody help how can i be able to print only that area that viewable to user in the internet explorer and not all the html tags:
    Following is my code which i had written using servlet:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.util.Properties;
    import java.net.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class printServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException
              // Set the mime type
              response.setContentType("text/html");
              // Create a PrintWriter Object
              PrintWriter out = response.getWriter();
              /* Construct the print request specification.
              * The print data is HTMl which will be
              * supplied as a stream. The media size
              * required is A4, and 1 copies are to be printed
              System.out.println(0);
              //DocFlavor htmlFlavor = DocFlavor.URL.TEXT_HTML_US_ASCII;
              DocFlavor htmlFlavor = new DocFlavor("application/octet-stream", "java.net.URL");
              PrintRequestAttributeSet aset =
                   new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              aset.add(new Copies(1));
              aset.add(Sides.ONE_SIDED);
              /* locate a print service that can handle it */
              System.out.println(1);
              //PrintService[] pservices =
                   //PrintServiceLookup.lookupPrintServices(htmlFlavor, aset);
              PrintService pservices = PrintServiceLookup.lookupDefaultPrintService();
                   //System.out.println("Printer Length " + pservices.length);
                   //PrintService service = pservices[0];
              System.out.println("selected printer " + pservices.getName());
              DocFlavor[] sdf = pservices.getSupportedDocFlavors();
              System.out.println("Supported DocFlavors are: ");
              for( int r = 0; r < sdf.length; r++ )
                   System.out.println(sdf[r].toString());
              /* create a print job for the chosen service */
              String urlString = "http://localhost:8080/printengine/jsp/hello.html";
              URL url = new URL(urlString);
              DocPrintJob pj = pservices.createPrintJob();
              Doc doc = new SimpleDoc(url, htmlFlavor, null);
              out.println("<html><body>" + doc + "</body></html>");
              System.out.println(3);
              /* print the doc as specified */
              try
                   pj.print(doc, aset);
                   System.out.println(4);
                   * Do not explicitly call System.exit() when print returns.
                   * Printing can be asynchronous so may be executing in a
                   * separate thread.
                   * If you want to explicitly exit the VM, use a print job
                   * listener to be notified when it is safe to do so.
                   out.println("<html><body>Printing Successful</body></html>");
              catch (PrintException e)
                   System.err.println("PrinterException " + e);
    Please help me out

  • I cannot share photos with anyone ,for i select someone i get error code 400.

    I cannot share photoss with anyone for when ii try to select someone i get a error code 400.

    Version  9
    "domnic.rj23" <[email protected]> wrote:
    domnic.rj23 http://forums.adobe.com/people/domnic.rj23 created the discussion
    "Re: I cannot share photos with anyone ,for i select someone i get error code 400."
    To view the discussion, visit: http://forums.adobe.com/message/5781697#5781697

  • Need to Create New Commodity Codes....Please Help.

    Hi All Experts,
    I need to create new Commodity Codes for DE - Germany. The code numbers with the descriptiones I got from the Business user, there are 5 new codes.
    I need to know how to create these commodity codes and what I have to maintain for the fields like -
    Description:
    Specific unit of measure:
    Sec unit of measure:
    Additional Info:
    Min. Oil Product:
    It is highly appriciable if you all can please suggest me the complete process for this. 
    Please help me ASAP. Thanks to you all in advance.
    Best Regards....
    Somraj.

    90308930 u2013 Measuring fixture
    Description
    Electronic instruments and appliances fo
    r measuring or checking electrical quant
    ities, without recording device, n.e.s.
    n.e.s.  
    Spec.unit of measure
    KG   Kilogram
    Additional info
    2    Dispatch / Export
    85423910 u2013 Amplifier
    Comm./imp. code no.   85423910
    Description
    Electronic integrated circuits in the fo
    rm of multichip integrated circuits cons
    isting of two or more interconnected mon
    olithic integrated circuits as specified
    in note 8 (b) (3) to chapter 85 (excl.
    such as processors, controllers,
    controllers, memories and amplifiers)
    Spec.unit of measure
    KG   Kilogram
    Additional info
    2    Dispatch / Export
    85339000 u2013 Resistor
    Description
    Parts of electrical resistors, incl. rhe
    ostats and potentiometers, n.e.s.
    Spec.unit of measure
    KG   Kilogram
    Additional info
    2    Dispatch / Export
    Not idea, as I can't find these on my system
    82032000 u2013 Tool, gripper
    85044082 - Rectifier
    Try following link, I believe that can be helpful to you.
    - +_Customs-Tariff-Number_+
    Regards
    JP

  • I need to re activate CS 4 Creative suite, normally I got a challenge code by telephone, and the software worked. Now it's impossible to speak someone by telephone, how can I activate my software on my new mac? I need a challenge code because it is an upg

    I need to re activate CS 4 Creative suite, normally I got a challenge code by telephone, and the software worked. Now it's impossible to speak someone by telephone, how can I activate my software on my new mac? I need a challenge code because it is an upgrade version.

    Try serial number and activation chat support (non-CC)
    http://helpx.adobe.com/x-productkb/global/service1.html ( http://adobe.ly/1aYjbSC )

  • Do you need to use Actionscript 3 code in Flash player 9 and above?

    Can anyone tell me if I need to use Actionscript 3 code instead of Actionscript 2 code in the following situation:
    I am running a swf file which is contained in a browser window (all files are contained on a CD and I have a 'trust' file set up to let them play properly).  Up until now, I have been using the following Actionscript 2 code to close the browser window (the Actionscript 2 code is on an 'Exit' button within the swf):
    on (release) {
    getURL("javascript:window.close()");
    This Actionscript 2 code has always worked and still works in Flash player 8 and lower.  However, it does nothing when played using Flash player 9.  Can anyone tell me if Flash player 9 won't recognize Actionscript 2 code?  Is it essential to use ONLY Actionscript 3 code if you are using Flash player 9?
    I am having the same problem when I try to launch another html page containing a swf (popped up from the swf contained in the main html window).  I have the following code on the button to launch the popup html window.  It always worked, but suddenly no longer works with Flash player 9.  Here is the code I am using:
    on (release) {
                getURL("javascript:launchWin2('webpage2.html');");
    I have all the necessary background code to launch 'webpage2.html'.  It works everywhere except in Flash player 9.  Can anyone tell me if it is essential to use Actionscript 3 code ONLY on these buttons in Flash player 9?  I am pretty new to Actionscript 3, so any help with syntax would be appreciated. 
    Please note that I don't want to use the projector.
    Thanks!

    You can use both AS2 and AS3 based applications in both Flash 9 and 10.
    As for the issues you describe - perhaps Flash General Forum is a better bet:
    http://forums.adobe.com/community/flash/flash_general

  • Hi, can someone please tell me why the spell check in pages doesn't work. I went to preferences and enabled this auto spell checker and have set the language to british english. But still it doesn't work while it works perfectly in TextEdit.

    Hi, can someone please tell me why the spell check in pages doesn't work. I went to preferences and enabled this auto spell checker and have set the language to british english. But still it doesn't work while it works perfectly in TextEdit.

    Inspector > Text > More > Language
    Only applies to selected text, like making it a particular font.
    It is not a setting that sticks. If you continue to paste in text from elsewhere particularly the Internet it will have a different or None language set to it. You need to select it and make it B.E.
    Peter

  • Need help in framing ABAP code

    Hi,
    Can someone help me frame code for the below logic
    In start routine, if records that have a common record for PO 0OI_EBELN in ITROMML ODS and 0AC_DOC_NO on ITROFIL ODS , then the entire PO record details will be deleted from ITROMML ODS . Therefore  0AC_DOC_NO details from ITROFIL ODS will be filled in ITROCMH ODS and ITROCMD ODS.
    Logic is like : Using the Material Document Number ITRMATDOC, line item ITRMTDCLI and fiscal year 0FISCYEAR as key - open POs (0OI_EBELN) from ITROMML ODS are checked with invoices 0AC_DOC_NO in ITROFIL ODS and if the respective keys match, then the entire record is deleted from ITROMML ODS and only invoiced records are brought into the second level ODS ITROCMH and ITROCMD
    Here,
    ITROMML and ITROFIL are first level ODS
    ITROCMH and ITROCMD are second level ODS
    I need to write the start routine in between these two levels in BI.7

    any suggestions please?

Maybe you are looking for

  • Size of Add Image Sequence in Compressor is too small?

    Hello all, i tried to import an image sequence into Compressor (20 Tiff files sequentially numbered with 1920x1080 aspect ratio) so i can export it to Apple ProRes. I want to do this through compressor so as to be able to use the batch option in the

  • How to include a delete functionality to web reports of BW

    Hello Experts, How can we delete the views which are saved by endusers in a web report. I hope  there should be a possibility of adding a "button" to the report which gives the user the functionality of deleting a view. Please let me know <removed by

  • Update supplier bank details for already paid invoice

    Hello, I have an invoice which has already been paid as part of the payments process. The problem is that the supplier bank information was not setup properly (the last one was end dated) and as a result, looking at the ap_invoices_all table, you wil

  • Regarding Tab key Navigation in a page

    Hi, I have a requirement regarding the tab key navigation on a page. Suppose the focus is on the last field of a page, on clicking the tab key i should go to the first field in the page not the url. i tried using tab index, but the problem is that af

  • Minutes Online Bug?

    So I don't think I want this fixed, because it makes me look good, but according to my profile I've been online for 7591668 minutes.  As impressive as this might seem, I can honestly say I have not been online 24/7 for over 14 years.  Does anyone els