Canvas...somewhere to start???

Can anyone recommend a good place to start in working out how to use the canvas class and graphics.
There seem to be no simple examples on the net from my googling. All I want is a simple example of a canvas with a line drawn on it, nothing fancy, just somewhere easy to start!!!
Cheers for any help
Alex

Don't use a canvas, draw in a JPanel...
public class MyCanvas extends JPanel {
  public void paint(Graphics g) {
    super.paint(g);
    drawSomething(g);
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    drawSomething(g);
  private drawSomething(Graphics g) {
    // draws a line from (10,10) to (50,50)
    g.setColor(Color.red);
    g.drawLine(10,10,50,50);
// Make a JFrame and instantiate a MyCanvas object. Set the preferred size of your canvas object to at least(100,100). Put the MyCanvas object in your JFrame's content pane. You'll see a small red line.

Similar Messages

  • Adding Image to Canvas Won't Start at 0 (but img.y says 0)

    I am going nuts! I have a canvas which I am trying to add a background image to. I am not setting the Y position, but after I add it to the canvas it always starts about 40 px down. If I trace the Y position it still says 0, even after a timer. I have tried to move it to the parent canvas and got the same results.
    What is going on?

    If the image y is indicating 0, then chances are whatever object contains the image is offset somehow.

  • Firefox just updated and now when I try to look at the pictures that have been downloaded it starts loading a welcome site, but never finishes. I do not know what is going on.

    I have some pictures that were downloaded from some emails. I was on AOL thru Firefox, when there was an upgrade. Allowed the upgrade & restarted. When I went back thru Firefox onto Yahoo.com to my mail site and then opened pictures it started going to somewhere that starts with: http://us.mc1801.mail.yahoo.com/mc/welcome?.partner
    It just keeps circling a green arrow like it is trying to load but nothing happens. I have tried several restarts and it does the same thing. As I type this the green arrow is still working. Do I need to call AOL support or what? Thanks Alice

    hello cornea1, try to disable "encrypted connection scanning" within kaspersky's settings > additional > network.

  • Compiz: How to start all windows maximized?

    Hi all,
    I'd like to start all windows maximized on my netbook running compiz. There is a an option in "Window Management/Window Rules/Matches". Putting a value of "class=" in the box will set all windows maximized but cannot be un-maximized.
    Is there an option somewhere to start all applications maximized but allow to un-maximized them later on?
    Thanks!

    Not aware of a plugin but try this - https://aur.archlinux.org/packages.php?ID=22071

  • How to sequence canvasses, SVGForms, SVGSplashScreens

    I have made a program, that "walks" , through a few input phases. Purely sequentially:
    1: the splash, that times out after 2 seconds and at DISMISS_COMMAND steps to a
    2: Canvas, that processes exactly 3 keyPressed events and then automatically jumps to
    3: an SVGForm that asks for two values via a set of SVGRadioButtons and an SVGSpinner. Pressing Command.EXIT makes the program exit, Command.OK makes the program then jump to
    4: a canvas that keeps running "forever", until a certain key is pressed. (event KeyPressed) Then the Canvas stops and the program exits.
    So the program is controlled by regular commands and by keyPressed events.
    My question is, what the best, or "best practice" way is to connect these phases.
    1: in the commandAction of the main MIDlet ? This processes the DISMISS_COMMAND , EXIT command and OK command mentioned., but not the keyPressed events of phase 4 or the automatic jump from phase 2.
    in other words: is it "good practice" to use commandAction to handle all program control ? The DISMISS_COMMAND would then cause Canvas (2) to start, which would, on ending, create and start the SVGForm which would again have the same commandListener as the splash. Sort of recursion ?
    2: or in the startApp with some if-constructions and state variables or whatever?

    Erik_that_s_me wrote:
    I have made a program, that "walks" , through a few input phases...given that you describe the problem in terms of phases (states), [state pattern|http://en.wikipedia.org/wiki/State_pattern|explanation] naturally comes to mind.
    My question is, what the best, or "best practice" way is to connect these phases.
    1: in the commandAction of the main MIDlet ?Above, you mean something like having single CommandListener "shared" between different screens?
    My experience with stuff like that was rather negative: "personal" listeners (one per screen) were easier to code and maintain. If you find a way that does not use shared listener, I'd recommend to go for it.
    2: or in the startApp with some if-constructions and state variables or whatever?hm for stuff like that I would try to design a dedicated object to manage state, variables and transitions

  • Need help displaying image on canvas  :((

    can anybody help me with my coding. my problem is, i cannot display an image on my canvas. plz..someone help me to solve my problem..
    Here's my coding...
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.util.*;
    public class ImageMidletServlet
        Display display = null;
        //Form f = null;
        String url = "http://localhost:8080/banner/hp0.gif";
        String url2 = "http://localhost:8080/banner/rotateNumber";      
        //String url = "http://localhost:8080/banner/banner";
        Command backCommand = new Command("Back", Command.BACK, 0);
        Command submitCommand = new Command("Submit", Command.OK, 2);
        Command exitCommand = new Command("Exit", Command.STOP, 3);
        private Test test;  
        private StringItem stringItem2;
        private TextField txtField;
        private Timer tm;          // Timer
        private load load;       // Task
        private int id = 0;
        Image img = null;
        //String id;
        public ImageMidletServlet(Display display)
            this.display=display;  
            loadimage();
        public void loadimage()
            tm = new Timer();
            load = new load();
            tm.schedule(load,0,6000);
         class Test extends Canvas implements Runnable, CommandListener
            private Canvas canvas;
            public Test(Canvas canvas)
                this.canvas=canvas;
                setCommandListener(this);
            public void start()
                Thread t = new Thread(this);
                t.start();
            public void run ()
                DataInputStream is = null;
                DataInputStream is2 = null;
                StringBuffer sb = new StringBuffer();
                Image img= null;
                TextBox txtBox = null;
                StringBuffer b = new StringBuffer();
                HttpConnection c2 = null;
                OutputStream os = null;           
                ++ id;
                try
                    c2 = (HttpConnection)Connector.open(url2+ "?bannerid="+id);
                    os = c2.openOutputStream();
                    os.write(("bannerid="+id).getBytes());              
                    os.flush();
                    //HttpConnection c = (HttpConnection) Connector.open(url+ "?bannerid="+id);
                    HttpConnection c = (HttpConnection) Connector.open(url);
                    int len = (int)c.getLength();
                    if (len > 0)
                        is = c.openDataInputStream();
                        byte[] data = new byte[len];
                        is.readFully(data);
                        is2 = c2.openDataInputStream();
                        int ch;
                        while ((ch = is2.read()) != -1) {
                        b.append((char) ch);
                        System.out.print((char)ch);
                        try {
                        //img = Image.createImage(data, 0, len);
                        img = Image.createImage("/images/splash.png");
                        Graphics graphics = img.getGraphics();                   
                        catch (Exception e)
                        if(img==null)
                        System.out.print("no image");
                        else {System.out.print("got image");}
                    else
                        showAlert("length is null");;
                    is.close();
                    c.close();
                    c2.close();
                   // repaint();
                catch (Exception e)
                    e.printStackTrace();
                    showAlert(e.getMessage());
            /* Display Error On screen*/
            private void showAlert(String err)
                Alert a = new Alert("");
                a.setString(err);
                a.setTimeout(Alert.FOREVER);
                display.setCurrent(a);
             public void commandAction(Command c, Displayable d)
            if (c == exitCommand)
                //destroyApp(true);
                //notifyDestroyed();
            else if (c == backCommand)
                //display.setCurrent(f);
            else if (c == submitCommand)
                /*test  = new Test(this);
                test.start();*/
             protected void paint(Graphics graphics)
             if (img != null)
                graphics.setColor(0x000000);  
                graphics.drawImage(img, 0, 0, Graphics.TOP | Graphics.HCENTER);
             else
             {System.out.print("no drawing");}
        class load extends TimerTask
        private Test canvas;
           public final void run()
          this.canvas = canvas;
          test  = new Test(canvas);
          //test();
          test.start();
    }

    Hi
    I would do like this: take the code that draws the image an put it into a separate class (which will extend the Canvas class) which will take as a parameter to its constructor either an array of bytes or an Image object (it's up to you) and call this class after you have downloaded all the bytes from the input stream. I presume that you get the "no drawing" message..
    Mihai

  • Starting new threads from a servlet

    Hi
    I read somewhere that starting new threads from a servlet is not supported in the future releases of J2EE .
    Any one aware of this.
    I have a listener program started as a new thread from the init method of a servlet which is set to load on startup.
    I have to think about another way to do this if this is not suppported in the future releases
    any comments

    Dr clap
    Actually I was getting some warning messages in my websphere server console when I tried to make JDBC connections from the thread I opened in the servlet.
    Everthing works fine but with the warning messages,
    Then someone from IBM answered me in one of the forums quote
    Cause: These messages are being produced due to an
    "unsupported" environment. When application is
    spinning its own threads from an EJB, spinning a
    thread and accessing a database is not supported (per
    the J2EE specification). One exception to this rule is
    if a Servlet is spinning its own threads and accessing
    a database. The J2EE specification is not clear on
    this, so WebSphere Application Server 5.0 must allow
    for it at this time. IBM is working with Sun to
    clarify this in the specification, so eventually (i.e.
    J2EE 1.4) spun threads from a Servlet accessing a
    database outside of a transaction will not be
    supported either.
    Since we don't want to promote the usage of these
    "naked" threads accessing databases, we are producing
    the warning messages. Although they may be filling up
    the logs, we feel that these are necessary to warn the
    user that they are doing something not in-line with
    the intended usage. Customer should consider changing
    their application to comply with the
    J2EE specification.
    """

  • Help me to make my game working as Applet

    here is the working code
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.IOException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class Arkanoid extends Canvas implements Runnable
       public BufferStrategy buforowanie;
       public BufferedImage statek, kulka, tlo, klocek;
       Thread thread;
       public int x = 100, y, x_kulki = 500, y_kulki = 580;
       public int lewo_prawo = (int)(10 * Math.random()), gora_dol = -3, x_klocka = 0, y_klocka = 0;
       public Window win;
       Graphics g;
       public boolean[][] jest_czy_nie;
       public Rectangle[][] klocki;
       public Rectangle[][] klocki_gora;
       public Rectangle[][] klocki_dol;
       public Rectangle[][] klocki_lewo;
       public Rectangle[][] klocki_prawo;
       public boolean czy_zbite = false;
       public int szybkosc = 5;
       public Arkanoid()
          statek = loadImage("statek.gif");
          kulka = loadImage("kulka.gif");  
          tlo = loadImage("8.jpg");
          klocek = loadImage("klocek.gif");
          start();     
          requestFocus();
          jest_czy_nie = new boolean[10][10];
          klocki = new Rectangle[10][10];
          klocki_gora = new Rectangle[10][10];
          klocki_dol = new Rectangle[10][10];
          klocki_lewo = new Rectangle[10][10];
          klocki_prawo = new Rectangle[10][10];
          for (int i = 0; i < 10; i++)
                   for (int j = 0; j < 10; j++)
                     jest_czy_nie[i][j] = true;
                     klocki_gora[i][j] = zwroc_wsp_gory(klocek, 100 * i, 20 * j);
                     klocki_dol[i][j] = zwroc_wsp_dolu(klocek, 100 * i, 20 * j);
                     klocki_lewo[i][j] = zwroc_wsp_lewa(klocek, 100 * i, 20 * j);
                     klocki_prawo[i][j] = zwroc_wsp_prawa(klocek, 100 * i, 20 * j);
       public BufferedImage loadImage(String sciezka)
            URL url = null;
            try
               url = getClass().getClassLoader().getResource(sciezka);
               return ImageIO.read(url);
            catch (Exception e)
                 System.out.println("w pizdeczke");
                 System.exit(0);
                return null;
       public Rectangle zwroc_wsp(BufferedImage obrazek, int x, int y)
          int a, b;
          BufferedImage image;
          a = x;
          b = y;
          image = obrazek;
          return new Rectangle(a, b, image.getWidth(), image.getHeight());
       public Rectangle zwroc_wsp_gory(BufferedImage obrazek, int x, int y)
          int a, b;
          BufferedImage image;
          a = x;
          b = y;
          image = obrazek;
          return new Rectangle(a, b, 100, 3);
       public Rectangle zwroc_wsp_dolu(BufferedImage obrazek, int x, int y)
          int a, b;
          BufferedImage image;
          a = x;
          b = y;
          image = obrazek;
          return new Rectangle(a, b + 17, 100, 3);
       public Rectangle zwroc_wsp_lewa(BufferedImage obrazek, int x, int y)
          int a, b;
          BufferedImage image;
          a = x;
          b = y;
          image = obrazek;
          return new Rectangle(a, b + 3 , 3, 14);
       public Rectangle zwroc_wsp_prawa(BufferedImage obrazek, int x, int y)
          int a, b;
          BufferedImage image;
          a = x;
          b = y;
          image = obrazek;
          return new Rectangle(a + 97, b + 3 , 3, 14);
       public void run()
          Graphics g = buforowanie.getDrawGraphics();
          g.drawImage(tlo , 0, 0, 1000, 700, 0, 0, 1000, 700, this);
          int i = -1;
          int j = -1;
          Graphics2D g2 = (Graphics2D)g;
          for (i = 0; i < 10; i++)
               for (j = 0; j < 10; j++) 
               if (jest_czy_nie[i][j] == true)
               g.drawImage(klocek, 100*i, 20 * j, 100, 20, null);
               j = 0;
          while (true)
           if (x > 880) x = 880;
           g.drawImage(tlo , 0, 600, 1000, 620,  0, 600, 1000, 620, this);
           g.drawImage(tlo , x_kulki, y_kulki, x_kulki + 20, y_kulki + 20,  x_kulki, y_kulki , x_kulki + 20, y_kulki + 20, this);
           x_kulki = x_kulki + lewo_prawo;
           y_kulki = y_kulki + gora_dol;
           if (x_kulki < 0) lewo_prawo = -lewo_prawo;
           if (x_kulki > 1000) lewo_prawo = -lewo_prawo;
           if (y_kulki < 0) gora_dol = - gora_dol;
           if (y_kulki > 700) System.exit(0);
           g.drawImage(statek , x, 600, this);
           g.drawImage(kulka , x_kulki, y_kulki, this);
           Rectangle statek_wsp = zwroc_wsp(statek, x, 600);
           Rectangle kulka_wsp = zwroc_wsp(kulka, x_kulki, y_kulki);
           if (statek_wsp.intersects(kulka_wsp))
                gora_dol = - gora_dol;
                lewo_prawo = (int)(((x_kulki - x) - 50)/10);
           for (i = 0; i < 10; i++)
               for (j = 0; j < 10; j++)
                  if (kulka_wsp.intersects(klocki_lewo[i][j]) && (jest_czy_nie[i][j] == true) && (czy_zbite == false))
                       g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,  100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                       lewo_prawo = - lewo_prawo;
                       jest_czy_nie[i][j] = false;
                       System.out.println("lewo");     
                       czy_zbite = true;
                   else
                   if (kulka_wsp.intersects(klocki_prawo[i][j]) && (jest_czy_nie[i][j] == true)&& (czy_zbite == false))
                        g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,  100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                        lewo_prawo = - lewo_prawo;
                          jest_czy_nie[i][j] = false;
                          System.out.println("prawo");      
                          czy_zbite = true;
                   else
                   if (kulka_wsp.intersects(klocki_dol[i][j]) && (jest_czy_nie[i][j] == true)&& (czy_zbite == false))
                        g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,  100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                           gora_dol = - gora_dol;
                          jest_czy_nie[i][j] = false;
                          System.out.println("dol");
                       czy_zbite = true;
                   else   
                   if (kulka_wsp.intersects(klocki_gora[i][j]) && (jest_czy_nie[i][j] == true)&& (czy_zbite == false))
                       g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,  100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                         gora_dol = - gora_dol;
                        jest_czy_nie[i][j] = false;
                       System.out.println("gora");     
                       czy_zbite = true;
               j = 0;
           czy_zbite = false;
           buforowanie.show();
          try
              Thread.sleep(szybkosc);
          catch (InterruptedException e)
              System.out.println("interrupt");
       public void start()
          thread = new Thread(this);
         thread.start(); 
       public void stop()
         thread.stop(); 
       /*public static void main(String[] args)
           Arkanoid panel = new Arkanoid();
            Frame frame = new Frame();
               //frame.setUndecorated(true);
            GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice device = environment.getDefaultScreenDevice(); 
            GraphicsConfiguration configuration = device.getDefaultConfiguration();
            device.setFullScreenWindow(frame);
            Graphics g = device.getFullScreenWindow().getGraphics();
               frame.setSize(1000,700);
            frame.add(panel);
            frame.setVisible(true);
           panel.createBufferStrategy(2);
           panel.buforowanie = panel.getBufferStrategy();
           Klawisze s&#322;uchacz_klawiszy = new Klawisze(panel);
           frame.addKeyListener(s&#322;uchacz_klawiszy);
           Mysz s&#322;uchacz_myszy = new Mysz(panel);
           panel.addMouseMotionListener(s&#322;uchacz_myszy);
           Cursor invisibleCursor = Toolkit.getDefaultToolkit().createCustomCursor(Toolkit.getDefaultToolkit().getImage(""), new Point(0, 0), "invisible");
               panel.setCursor(invisibleCursor);
    }and here the applet
    import java.awt.*;
    import javax.swing.*;
    public class Applet extends JApplet
      public void init()
           Arkanoid panel = new Arkanoid();
           Container pow = getContentPane();
           pow.add(panel);
           panel.setSize(1000,700);
          panel.createBufferStrategy(2);
          panel.buforowanie = panel.getBufferStrategy();
          Klawisze s&#322;uchacz_klawiszy = new Klawisze(panel);
          panel.addKeyListener(s&#322;uchacz_klawiszy);
          Mysz s&#322;uchacz_myszy = new Mysz(panel);
          panel.addMouseMotionListener(s&#322;uchacz_myszy);
          Cursor invisibleCursor = Toolkit.getDefaultToolkit().createCustomCursor(Toolkit.getDefaultToolkit().getImage(""), new Point(0, 0), "invisible");
             panel.setCursor(invisibleCursor);
    }the game is working well so i decided to share it and put it somewhere in the internet
    there are also 2 mouse and key listener classes respectively but as far as iam convinced they dont affect the problem i am getting at all
    here is the exception thats thrown while i try to run that
    Exception in thread "Thread-3" java.lang.NullPointerException
         at Arkanoid.run(Arkanoid.java:133)
         at java.lang.Thread.run(Unknown Source)
    line 133 refers to this : at Arkanoid.run(Arkanoid.java:133)
    thanks in advance, Lukasz
    null
    null

    The use of thread.stop() is not recommended. You can find out why by looking the method up
    in the Thread class api. It includes a link into the guide for more details.
    //  <applet code="A2" width="1000" height="700"></applet>
    //  use: >appletviewer A2.java
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.IOException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    public class A2 extends Applet
        A2Canvas canvas;
        public void init()
            canvas = new A2Canvas();
            setLayout(new BorderLayout());
            add(canvas);
        public void start()
            canvas.start();
        public void stop()
            canvas.stop();
        public static void main(String[] args)
            Applet applet = new A2();
            Frame frame = new Frame();
            frame.addWindowListener(closer);
            frame.add(applet);
            frame.setSize(1000,700);
            applet.init();
            frame.setVisible(true);
            applet.start();
        private static WindowListener closer = new WindowAdapter()
            public void windowClosing(WindowEvent e)
                System.exit(0);
    class A2Canvas extends Canvas implements Runnable
        public BufferStrategy buforowanie;
        public BufferedImage statek, kulka, tlo, klocek;
        Thread thread;
        public int
            x = 100,
            y,
            x_kulki = 500,
            y_kulki = 580;
        public int
            lewo_prawo = (int)(10 * Math.random()),
            gora_dol = -3,
            x_klocka = 0,
            y_klocka = 0;
        public boolean[][] jest_czy_nie;
        public Rectangle[][] klocki;
        public Rectangle[][] klocki_gora;
        public Rectangle[][] klocki_dol;
        public Rectangle[][] klocki_lewo;
        public Rectangle[][] klocki_prawo;
        public boolean czy_zbite = false;
        public int szybkosc = 100;
        public A2Canvas()
            statek = loadImage("statek.gif");
            kulka = loadImage("kulka.gif");  
            tlo = loadImage("8.jpg");
            klocek = loadImage("klocek.gif");
            // In your original (posted) application:
            // Calling start (here) before construction is complete
            // results in a NullPointerException in the run method
            // because buforowanie is initialized in the main method
            // after construction, ie, after this class instance has
            // been created. For success, move this call to the end
            // of your main method, ie, panel.start().
    //        start();
            // Not recommended, see api for explanation.
    //        requestFocus();
            // This is recommended instead, see api.
            requestFocusInWindow();
            // Arrange for this to be focusable.
            setFocusable(true);
            jest_czy_nie = new boolean[10][10];
            klocki = new Rectangle[10][10];
            klocki_gora = new Rectangle[10][10];
            klocki_dol = new Rectangle[10][10];
            klocki_lewo = new Rectangle[10][10];
            klocki_prawo = new Rectangle[10][10];
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++)
                    jest_czy_nie[i][j] = true;
                    klocki_gora[i][j] = zwroc_wsp_gory(klocek, 100 * i, 20 * j);
                    klocki_dol[i][j] = zwroc_wsp_dolu(klocek, 100 * i, 20 * j);
                    klocki_lewo[i][j] = zwroc_wsp_lewa(klocek, 100 * i, 20 * j);
                    klocki_prawo[i][j] = zwroc_wsp_prawa(klocek, 100 * i, 20 * j);
        public BufferedImage loadImage(String sciezka)
            URL url = null;
            try
                url = getClass().getClassLoader().getResource(sciezka);
                return ImageIO.read(url);
            catch (Exception e)
                System.out.println("w pizdeczke " + sciezka);
                System.exit(0);
                return null;
        public Rectangle zwroc_wsp(BufferedImage obrazek, int x, int y)
            int a, b;
            BufferedImage image;
            a = x;
            b = y;
            image = obrazek;
            return new Rectangle(a, b, image.getWidth(), image.getHeight());
        public Rectangle zwroc_wsp_gory(BufferedImage obrazek, int x, int y)
            int a, b;
            BufferedImage image;
            a = x;
            b = y;
            image = obrazek;
            return new Rectangle(a, b, 100, 3);
        public Rectangle zwroc_wsp_dolu(BufferedImage obrazek, int x, int y)
            int a, b;
            BufferedImage image;
            a = x;
            b = y;
            image = obrazek;
            return new Rectangle(a, b + 17, 100, 3);
        public Rectangle zwroc_wsp_lewa(BufferedImage obrazek, int x, int y)
            int a, b;
            BufferedImage image;
            a = x;
            b = y;
            image = obrazek;
            return new Rectangle(a, b + 3 , 3, 14);
        public Rectangle zwroc_wsp_prawa(BufferedImage obrazek, int x, int y)
            int a, b;
            BufferedImage image;
            a = x;
            b = y;
            image = obrazek;
            return new Rectangle(a + 97, b + 3 , 3, 14);
        public void run()
            Graphics g = buforowanie.getDrawGraphics();
            g.drawImage(tlo , 0, 0, 1000, 700, 0, 0, 1000, 700, this);
            int i = -1;
            int j = -1;
            Graphics2D g2 = (Graphics2D)g;
            for (i = 0; i < 10; i++)
                for (j = 0; j < 10; j++) 
                    if (jest_czy_nie[i][j] == true)
                        g.drawImage(klocek, 100*i, 20 * j, 100, 20, null);
                j = 0;
            while (true)
                if (x > 880) x = 880;
                g.drawImage(tlo , 0, 600, 1000, 620,  0, 600, 1000, 620, this);
                g.drawImage(tlo , x_kulki, y_kulki, x_kulki + 20, y_kulki + 20,
                            x_kulki, y_kulki , x_kulki + 20, y_kulki + 20, this);
                x_kulki = x_kulki + lewo_prawo;
                y_kulki = y_kulki + gora_dol;
                if (x_kulki < 0) lewo_prawo = -lewo_prawo;
                if (x_kulki > 1000) lewo_prawo = -lewo_prawo;
                if (y_kulki < 0) gora_dol = - gora_dol;
                if (y_kulki > 700) System.exit(0);
                g.drawImage(statek , x, 600, this);
                g.drawImage(kulka , x_kulki, y_kulki, this);
                Rectangle statek_wsp = zwroc_wsp(statek, x, 600);
                Rectangle kulka_wsp = zwroc_wsp(kulka, x_kulki, y_kulki);
                if (statek_wsp.intersects(kulka_wsp))
                    gora_dol= - gora_dol;
                    lewo_prawo = (int)(((x_kulki - x) - 50)/10);
                for (i = 0; i < 10; i++)
                    for (j = 0; j < 10; j++)
                        if (kulka_wsp.intersects(klocki_lewo[i][j]) &&
                                jest_czy_nie[i][j] && !czy_zbite)
                            g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,
                                        100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                            lewo_prawo = - lewo_prawo;
                            jest_czy_nie[i][j] = false;
                            System.out.println("lewo");     
                            czy_zbite = true;
                        else if (kulka_wsp.intersects(klocki_prawo[i][j]) &&
                                jest_czy_nie[i][j] && !czy_zbite)
                            g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,
                                        100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                            lewo_prawo = - lewo_prawo;
                            jest_czy_nie[i][j] = false;
                            System.out.println("prawo");      
                            czy_zbite = true;
                        else if (kulka_wsp.intersects(klocki_dol[i][j]) &&
                                jest_czy_nie[i][j] && !czy_zbite)
                            g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,
                                        100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                            gora_dol = - gora_dol;
                            jest_czy_nie[i][j] = false;
                            System.out.println("dol");
                            czy_zbite = true;
                        else if (kulka_wsp.intersects(klocki_gora[i][j]) &&
                                jest_czy_nie[i][j] && !czy_zbite)
                            g.drawImage(tlo , 100 * i, 20 * j, 100 * i + 100, 20 * j + 20,
                                        100 * i, 20 * j, 100 * i + 100, 20 * j + 20, this);
                            gora_dol = - gora_dol;
                            jest_czy_nie[i][j] = false;
                            System.out.println("gora");     
                            czy_zbite = true;
                    j = 0;
                czy_zbite = false;
                buforowanie.show();
                try
                    Thread.sleep(szybkosc);
                catch (InterruptedException e)
                    System.out.println("interrupt");
                    break;  // We need to exit this loop now.
        public void start()
            if(buforowanie == null)
                createBufferStrategy(2);
                buforowanie = getBufferStrategy();
            thread = new Thread(this);
            thread.start(); 
        public void stop()
            thread.interrupt(); 
            thread = null;
    }

  • Overclocking the i7, a beginners guide

    To give credit where credit is due: This was not written by myself. I have only edited parts of it.
    I found this on the internet, but it was such a great article, that I wanted to draw your attention to it. Credits go to Chad. Thanks for all the effort you put into this.
    What is overclocking?
    Overclocking is a process of making various components in a computer to go faster than their stock speeds. So if you buy a processor (lets say an i7-920 2.66 GHz) and make it go faster (lets say 3.6 GHz), that can be deemed as overclocking.
    HALT! Do not proceed any further until you have read this:
    Dell, Gateway, eMachine, etc... do not overclock very well, so proceed at your own risk. You break it, it is your fault.
    A little bit more of some explanation:
    This guide is intended to explain how to overclock and its uses. It was made for those who have computers (moreover, motherboards and other components) that support overclocking. If you bought a brand of computer like Dell, Sony, Gateway, HP, eMachine, or any other crappy PC (not saying all of them are) that comes for a store like Walmart, Best Buy, or Circuit City, then this guide does not pertain to you. Even though it is possible to overclock these systems with software, it is not recommended nor advised. This guide is meant for anyone who has a motherboard made by ASUS, GIGABYTE, Abit, DFI, (sometimes Intel), or any other well known brand known for their boards and overclocking abilities. But be forewarned, not all boards made by these companies are made to overclock. Check and see if yours does before going any farther than this final line.
    Note: There are ways to bypass hardware overclocking via software, but it is not recommended and can make your PC unstable, even rendering it unable to stay stable till the system is returned to normal. Overclocking software is made for boards that supports overclocking so that changes can be made without having to restart.
    Further notes:
    -Motherboards not designed for overclocking will not go as far in overclocking, become unstable sooner, and heat far quicker.
    -Computers with boards that do not support overclocking do not have adequate cooling.
    Why would you want to overclock if it could be damaging?
    Simple, to get more out of what you payed for. Overclocking is similar to going and upgrade a car's engine by boring out its piston chambers and adding better fuel injection, air intake, transmission, etc..., but there is always a risk in doing so. But it all boils down to one thing: performance. It is hard to fry your system if you are careful and know what you are getting yourself into. If you are careful about what you do, then it is rather hard to do any kind of permanent damage to your system by pushing it to its sheer limits.
    As with any kind of performance enhancement, there is a level of risk involved. The first and foremost danger is heat. Heat will degrade and damage your components beyond repair if left unchecked and will most definitely lower your system's life span. When you overclock, you are making your computer do more work than it is used to, thus it is going to generate more heat, so having a good cooling system is essential. If you do not have sufficient cooling, then your system could and will overheat. Overheat by itself cannot kill your computer though, the only way for that to happen is to repeatedly overheat it time and time again past the recommended temperatures. YOU SHOULD ALWAYS TRY TO STAY AT OR BELOW YOUR CPU's MAX RATED TEMPERATURE! If you go above this, you can risk harming your CPU. Do so at your own risk. Run your CPU at 5-10C above its max temp for short periods only and ONLY for benchmarking purposes only. DO NOT DO IT FOR LONG TERM!
    And as luck would have it, you do not have to be overly worried about your system overheat as there will be signs before you system becomes a fried potato. Random crashes are probably the most common sign. Overheat is easily prevented by the use of thermal sensors which can tell you how hot your system is getting. If you see temperatures that you think is too high, then either run at a lower speed, or get better cooling, which I will cover later on.
    The other danger of overclocking is voltage. Too much, and you can significantly shorten your components' lifespan. A small boost will not do much, but if you plan on a rather hefty overclock, you may want to be aware that it will decrease the lifespan of your computer's components. But this is usually not an issue since most people who will overclock do not use their components for more than 4-5 years and there is a good chance your components will not fail before 4-5 years regardless of the voltages running through it. Most processors are designed to last in upwards of ten years. So most of the time, loosing a few of those years is worth the performance gained for overclocking.
    Disclaimer for my own protection:
    WARNING!!! READ THIS DAMN WARNING!!! I DO NOT WANT TO HEAR YOU WHINE YOU BROKE YOUR COMPUTER SO READ THIS WARNING!!!!!!
    Overclocking can really mess things up, and it wares down your hardware and its life-expectancy. In other words, the more you overclock, the shorter your computer will live (like how an F1 car's engine must be replaced after every other race). If you attempt to overclock, then I am not responsible for any damage or destroyed hardware when using this guide. Follow at your own risk.
    Overclocking
    This guide is meant for beginners and not for people looking to squeeze out every last bit from their processor. That’s when things become extremely motherboard specific. The goal of this guide is to try to make overclocking the core i7 an easy and enjoyable experience. Overclocking your core i7 is a must; if you don’t you’re a chump. This guide will focus more on core i7 920s, but ideas will probably carry over into EE and higher end chips with locked multipliers.
    Recommended hardware:
    1. A good cooler (Do not use stock if you plan to go past around 3.5. You will run your processor way too hot) (Noctua, ThermalRight Ultra Extreme or Megahalem are my preferred ones but read around.
    2. DDR3 1600+ - You can get away with 1333 but with ram being as cheap as it is, why not.
    3. Pretty much any x58 board (although some are better than others, read some reviews).
    4. A good PSU with an EPS(8 pin) plug.
    5. Paper, Pencil, and Patience – Write things down so you can remember your successes and failures. There is not much to play with in terms of the i7, but keeping track of what you tried can eliminate any frustrating experiences and also allow you to go back to a known stable settings.
    Recommended software for stability testing:
    1. Prime95.
    http://www.mersenne.org/freesoft/
    2. Memtest86+ http://www.memtest.org/
    3. Realtemp http://www.techpowerup.com/realtemp/
    4. CPUZ - http://www.cpuid.com
    Many people have personal favorites but the above are what I use.
    Not all I7s are created equal:
    1. So you read on a thread that someone hit 4 ghz on a C0 stepping processor with only 1.28 vcore and you’re wondering if yours will do the same. It’s doubtful, but who knows. It may take you up to 1.4 volts at least with a C0. That’s life; if you're unhappy, sell it and buy a D0.
    2. Not all i7s have the same quality IMC (Integrated Memory Controller). Some are more temperamental than others and will refuse to run your ram at its rated speed without a huge raise of qpi/uncore (VTT). This is not common and often it can be a sign of the quality of the ram.
    3. For the most part, D0's overclock higher and at lower voltages than C0 chips, due to refinements in the fabrication process. Late C0 chips benefitted from the same refinements, and random other batches hit 4.0 ghz at really low volts. I have been told that some D0's do not hit 4.0, but most will do so at a lower voltage than most C0's. A D0 is a more desirable chip, but it's not a must and this guide is still useful to owners of C0's.
    4. Toms Hardware article about speed vs power consumption is flawed and based on one really terrible C0 that needed 1.5 vcore to hit 4ghz. Is a D0 at 1.2v at 4 ghz going to consume more power than a C0 at 3.6 and 1.32 volts? No. The D0 will use less. Power consumption at any given voltage will increase about 3-11 watts (avg 5 for every 100 mhz you increase). Something brough to my attention recently though is that this may differ because some chips are leakier than others. A D0 is by no means a guarantee that it will consume less power.
    5. If you want to reach higher clocks, you may need a better motherboard, cooler, chip or whatever. This guide is not for advanced overclockers.
    Key Terms and Settings Quick Guide:
    BCLK – Base Clock - This clock controls your memory speed, QPI speed, and core speed based on whatever multiples for those settings you have. It's the most important part of overclocking the Core i7. It's stock setting is 133
    Uncore – This is basically the speed of everything which isn't your core (i.e. L3 cache, IMC, etc). It should be 2x your memory speed but allows for multipliers higher than 2x as well. Stability will be greatest at 2x.
    QPI – Quickpath interconnect - It's basically the intel equivalent of AMD's hypertransport. It's how the CPU and the X58 chipset communicate. It has multipliers of 18x, 22x, and 24x. The 920 should be left at 18x creating a 9:8 ratio between the uncore and the memory multiplier assuming you use the 8x ratio, which some claim offers the greatest stability. Although people have been able to run it at all sorts of ratios.
    Memory - Memory is calculated based on either a 6x, 8x, 10x, 12x, or 14x of your base clock. I recommend 6x and 8x. Depending on your mobo bios it may be called ratio or multiplier.
    Ram Timings – This guide will only deal with the first four and the command rate. There are other guides regarding these. You can use XMP (intel's memory profile system) to have these values plugged in but it may set your QPI/uncore voltage automatically to 1.35 which may be more than you need (although it will be stable).
    Turbo mode – This enables the 21x multiplier on the chip. Most boards allow you to do this with eist disabled, but some boards require it enabled. See if a newer bios lets you change things.
    CPU Multiplier – On the 920 the range is from 12x – 21x (22x on one core when at stock speeds). It has been found that the 19x and 21x multipliers are more stable than the 20x.
    Vcore – Voltage of your cpu. See below for tweaking instructions.
    PLL – phase-locked loop – Just use the settings recommended below (1.8 – 1.88 is within specification).
    QPI/Uncore (VTT) – This voltage is the VTT although it does play a role in feeding the IMC with voltage enough to overclock your ram, the L3 cache and a number of other things (Specification is that it should be less than 1.35 but when taking droop into account you can go higher, probably 1.4 is safe. Some ram modules have XMP profiles which call for higher QPI so some will argue that this is safe. I'm not going to argue one way or the other.)
    Vdimm – Your ram voltage (Specification says 1.65 max but 1.66 is fine and so is a bit higher depending on your QPI/uncore voltage).
    Important to do before you overclock:
    EIST – Enhanced intel speedstep technology - It's a power saving tech that should be disabled while testing overclocking stability. This should be disabled while finding your OC, but can be enabled after you are stable (Disable if you have stability issues).
    C1E – Another intel power saving technology. Disable while overclocking, enable afterwards.
    Anything Spread Spectrum – Disable it.
    PCIE frequency – Always at 100, but see FAQ questions below.
    LLC - Load Line Calibration - This gets rid of vdroop when enabled and can help stabilize overclocks. It breaks intel spec, but it is highly recommended to enable it, since it will reduce the needed vcore for a stable OC. The argument for vdroop is that it's a standard and reduces voltage spikes. I have not been able to find anyone who's done any damage by enabling LLC and thus disabling vdroop. In an old anandtech review from 2007 they found that it increased power consumption on an X38 asus board; a newer xbitlabs article using X58 found that it actually decreased with more threads or was otherwise the same. This guide pretty much assumes you use it, but like anything else you are taking the risk. Then again, on my board, enabling it doesn't give you any red letter warning like when you maybe tap your vdimm above 1.65.
    All other settings leave at auto unless needed for stability.
    Initial steps:
    If you've played around with any settings before reset your bios to its stock options. There's probably no need to reset your CMOS, but it can't hurt; if you don't know how to reset your CMOS then I suggest you learn to do so. It's unlikely that you will have to as most modern motherboards will usually have some sort of protection against bad overclocks and automatically allow you to reset the bios upon a bad boot.
    Once your bios is at its stock configuration disable EIST, turbo mode, C1, and any other power saving options that may interfere with an overclock as well as any spread spectrum settings. Now, boot into windows (If you want to use the 21x multiplier then go right ahead and set it as long as you can do so without enabling EIST). Open up cpuz, load up prime and see where the voltage goes. This is your approximate vid for stock. The chip may very well run under this voltage, but this is the vid that the bios is seeing.
    From here we have a number of different methods we can try. I always change my BCLK in my bios settings so that anything set to auto will adjust itself if need be, although you are free to use whatever windows based tools you want although beware of any problems they may cause you.
    You should always set your memory to 8x or 6x depending on what you have and your uncore to 2x the memory. Leave the QPI at the lowest setting.
    Set windows not to restart on a bsod (You want to know what the error was): 
    Windows XP and Vista Directions, but it is the same for Win7.
    Method #1: Optimizing for max performance per watt.
    This method takes by far the most amount of time but for many its worth it in terms of its power efficiency.
    Begin by going into the bios and changing your voltage to your vid and setting QPI/uncore (VTT) to 1.25 (I have raised this due to concerns about droop at 1.2) and vdimm to 1.65 (Most boards can't do this; 1.66 is safe, ignore your spaz bios warnings; you are not going to explode anything, although if you do, it's not my fault. Set it to 1.64 if it helps you sleep easier. I recommend at this point to be working with either the 21x multiplier if possible in order to keep your ram as much out of the equation as possible. 20X has known problems and 19x will land you with high ram speeds quicker which will require raises in the QPI/uncore voltage sooner.
    Open up real temp and run Prime 95 with 8 threads and check stability for an hour at least (The more the better. I recommend overnight just to make sure all is good). Record your settings on a piece of paper or email them to yourself. Make sure to have Realtemp open in order to watch your temperatures. Temperatures should not exceed 80-85 during Prime. During normal use for extended periods, they should never see these kinds of temperatures. I like to keep mine below 70 for normal usage.
    After its stable go into the bios and increase the BCLK by 10 and repeat the process. Find the max BCLK for your stock vid (or any voltage, if you'd like by lowering by smaller amounts when you find an unstable clock. This will help you know what you can run at any given voltage.
    See below for known Prime 95 errors and how they relate to your settings (also some settings to try for stability). Once you get to the clocks you want, I recommend running Prime for at least 16-24 hours. I have in fact had errors in the 14th hour so it's good to know that you're truly stable.
    See also below for optimizing your ram settings.
    Method #2: Quick and dirty method for 4ghz aka screw efficiency
    Set your ioh and ich to 1.2, your vdimm to 1.65, your cpu pll to 1.88, and your QPI/uncore to 1.35.
    For D0 users set your vcore to 1.275 and for C0/C1 users set your vcore to 1.4 and BCLK to 190/191 or 210/211 and multiplier to 21 and 19 respectively. Check for Prime stability. D0's should be fine, but C0/C1 still may not make it, at this point your temps may be too high if you're not on water, so I suggest you start working backward in order to hit a much lower vcore or use method 3.
    Method #3: Quick and dirty vcore boosting.
    Set your ioh and ich to 1.2, your vdimm to 1.65, your cpu pll to 1.88, and your QPI/uncore to 1.35. Set BCLK to 190/191 or 210/211 and multiplier to 21 and 19 respectively.
    The D0 chip usually hits 4.0 in the vcore range of 1.175 and 1.25. Try those voltages until you find whats right for your chip.
    The C0/C1 is a much more difficult beast with a much larger range of 1.27 to around 1.4 and up to 1.5 (Do not attempt on air unless you live somewhere really, really cold). Some may not hit 4ghz at all.
    This method is more difficult as some chips may not boot until you give them the proper vcore
    How to use Prime95 to test stability:
    Open up Prime95 and Realtemp to check your idles and loads. Set Prime95 to whatever priority you'd like. I prefer 4 or 7 so that realtemp still updates but some people prefer 10 and will run without a temperature monitor. Either is fine, but I'm always paranoid that my cooler will somehow become unlatched spontaneously. Set windows not to restart on bluescreen by setting [insert settings here] so that you can catch the error (although windows will record it somewhere). Start a mixed torture test and let it run for however long, depending on if you're only doing a temporary stability test in order to raise (about 1 hour) or a true stability test (16-24 hours). Once you've passed Prime95 you can run any other stability test that you want.
    Prime 95 Errors:
    Freeze: Increase the vcore
    Other errors can indicate instability with the chip if they are during small fft (increase vcore by .125) or instability with ram large ftt (Try raising the ioh and/or running memtest).
    BSOD code 101: Increase the vcore. I recommend increasing by +.025 if you get a bsod
    BSOD code 124: Increasese or decrease the QPI/uncore by .25. Depending on where you are in your stability tests you'll probably need to increase it. 1.375 is the max I'm comfortable with although people say 1.4+ is safe. This is for you to determine and research. Don't do anything you're not comfortable with. Intel says do not go above 1.35 so 1.375 with droop and loss is safe and not too far outside specification.
    It is important to note that sometimes QPI can be too high and that might cause this code. That's why it's not a good idea to just set things to 1.35 and hope for the best. If you find that increasing QPI/uncore voltage is not increasing stability, try decreasing it. Just remember of course, to keep track of your settings. I recommend not increasing, unless you have to (Don't be arbitrary about it).
    D0 exclusive BSOD weird 2 letter/number codes: Treat this as a 101 and increase vcore by +.025. Update: It seems that these error codes can crop up for other reasons. Depending on where you are in the process you should take a look at your other voltages. I realize this is vague, but you may need to experiment.
    If any worker fails, especially during small fft then it's cpu voltage. Bump it once or twice. If it fails during large fft then its probably memory error you can try running memtest/upping ioh. I would try running small fft at that point for a good amount of time and make sure its not the cpu voltage. If it passes 8-12 hours of small fft then work on making it pass large fft. Just remember to keep track of your settings. That's not to say that a large fft error won't be the result of cpu voltage, it's just not what I would try. Be methodical. If something allows Prime to run significantly longer then keep it. Significant depends where you are in the process. If your workers fail as soon as you start and a setting change gets you through a test then I'd say its good. If you get crashes during the 8th hour, and the setting change only gets you another 5 minutes in the 8th hour, it's probably just random and not the setting.
    Testing Memory Stability with memtest 86+:
    Personally, I do not run memtest until I actually encounter what could be memory errors( I assume things work until proven otherwise). Begin by setting your ram timings in the bios and setting your QPI/uncore to 1.35 and your vdimm to 1.64-1.66. Do not oc your cpu. Just run your ram at its rated spec to make sure that the ram is stable and not defective. You can also check it again with an oc'ed cpu as well. If it's unstable try raising the ioh to 1.20 or higher. If you are still getting errors try each dimm one at a time and see if you need to RMA (A pain in the *** but necessary).
    Optimizing ram with memtest86+:
    Assuming your ram is stable you can either overclock, lower voltage, tighten timings, or all of the above.
    1. Lowering voltage. Run memtest86 for 20 minutes, if you get errors, stay where you are. Otherwise lower the vdimm by .02 and repeat until you get an error within 20 minutes. Then run it overnight.
    2. Overclocking. You may be able to run your ram faster than you thought. Loosen the timings(make them higher) and then increase BCLK. You can optimize your voltage with the above number one. Depending on the ram, you may be able to overclock quite a bit or not at all. Running your ram at anything above 1066 is in fact overclocking the IMC.
    3. Tightening timings. Timings should be decreased as such. Assuming you begin with 9-9-9 your next step should be 9-9-8 then 9-8-8 then 8-8-8. You can also try 8-9-8 but this is going to depend on your memory. You may need to raise voltages to tighten the timings.
    The usefulness of overclocking your ram is limited. See the useful links sections below to see how certain ram settings will impact your real life performance.
    Frequently asked questions:
    Q: I can't raise my BCLK over some number. How do I fix it? What's the deal?
    A: Not all chips and motherboards are made the same. You can try playing around with voltage amplitude, pll, skew or pcie (pcie is probably best not raised as it can cause damage). This is a question that is better asked on a thread dedicated to a specific board. You may end up being out of luck.
    Q: What are safe voltages?
    A: According to Intel or common knowledge the following are the safe air temperatures:
    Vcore: ~1.4
    QPI/uncore (VTT): 1.35
    PLL: 1.88
    Vdimm:~1.65 (Some will say that you are safe within .5 of your QPI/uncore allowing for a max of 1.85 on vdimm. See the link to the xtreme systems forum below on this subject for a long thread).
    IOH: Less than 1.3
    ICH: Less than 1.3
    Q: My chip is too hot before I can reach 4 ghz. What can I do?
    A: Disable hyperthreading or buy a better cooler (Noctua, TRUE or Megahalems recommended).
    Q: But don't I want hyperthreading?
    A: It's certainly nice to have a feature you paid for, but it sometimes decreases performance and it definitely causes a lot of heat. It's up to you.
    Q: How do I go past 4ghz?
    A: Same way as you got there in the first place. Just keep increasing BCLK. Past this point though it's up to you to do some research on your own.
    Q: What is this multiplier throttling I've heard about?
    A: Some boards will throttle down the 21x multiplier if the wattage becomes too high. The culprits without public fixes are the Asus P6T Deluxe and vanilla (The Deluxe v1 has a bios available on the xtremesystems forum which can be crossflashed onto the v2 which will fix this problem) It really only becomes a problem at high voltages with high frequencies. Other boards have ways of disabling it.
    Q: Why would I want to optimize my voltages?
    A: Save money on power bills and leave more wattage for other devices.
    Q: My chip was stable for X amount of time and now it's not?
    A: Have you added any hardware? How are your temperatures? High voltages and high temps can cause decay and make the chip require more voltage for an overclock. It may also be that your PSU is starting to go or maybe your motherboard is. Do your best to troubleshoot this.
    Q: My temperatures seem really high? Is X degrees ok?
    A: A better question is whether or not you are ok with X degrees. How long do you plan to won this chip? What are your ambients? If your house is 40 degrees centigrade, don't expect your chip to drop below that unless you are using extreme cooling (also try to move somewhere cooler cause that's really hot or get some AC, are you trying to cook yourself?). A cpu well taken care of can last over a decade when run within spec. How long do you really think you're going to keep this chip? A rule of thumb I go by is never push a part that I can't afford to replace if I break it (I do this anyway, but its a good rule nonetheless). Your temps will always get higher than normal when stress testing so do some normal stuff to see if your temperatures are acceptable. Try backing down a bit if you are unhappy.
    Q: I heard this will work or this needs to be this way?
    A: Try it. This is a general guide, not a set of hard and fast rules.
    Q: My computer restarted while priming; how do I find out the error?
    A: If you haven't already, disable bsod restarts in windows. Sometimes, though, it decides to restart anyway.
    Open Computer Management by right-clicking the Computer icon on the start menu (or on the Desktop if you have it enabled) and select Manage. Navigate to the Event Viewer. Note: If you did not disable UAC then you will be prompted to consent to the action you're about to perform. Click Continue. Note: You can also open the Event Viewer by typing Event Viewer in the Search box and pressing Enter, or typing eventvwr.msc in the Run command.
    Also check the results.txt in your Prime95 folder for a log of when it ultimately crashed and what it was doing at the time.
    Q: Whats the deal with PCIE frequency? Can it help break my BCLK wall?
    A: Yes, but I advise caution. Raising this too much can damage things running on the pcie bus or cause them to not work. I would not raise it personally more than a few mhz. You are probably safe at 103, but I take no responsibility of course.
    Voltages/settings you can try to use to increase stability:
    PLL: 1.88
    IOH: 1.2+
    ICH: 1.2
    CPU voltage amplitude: +800mv
    CPU Skew: +300ps
    Command rate: change from 1n to 2n
    You should really check in on your specific board as not all boards have the same settings. Be methodical in testing settings since you want to know whether something helped or hurt by itself before you combine.
    Useful Links:
    http://www.overclock.net/intel-cpus/538439-guide-overclocking-core-i7-920-4-a.html
    Intel Info on the i7
    QPI/Uncore voltage (XS) (Do not take this as gospel try to stay in spec unless you feel like really pushing things)
    Info on multiplier throttling (XS)
    Memory Scaling on the Core I7

    My i7 rig is with a socket 1156 board, an Asus P7P55D mobo, and an 860 CPU. I know the Corsair DDR3 memory @ its stock 1.65v simply doesn't run at 1600mhz like it says on its box - 1333mhz seems to be its stability wall.
    I upgraded my Q6600 and Asus P5B deluxe rig because so many people said to never consider overclocking on an editing rig. Was that over-cautious advice?

  • JInternalFrame drawing problem.

    Hi gurus
    Please could you help with a java problem that I cant find an answer to over the net:
    I have a JDesktop which contains multiple JInternalFrames. On one JInternalFrame i have attached a JPanel on which to draw on. I have multiple threads (simple ball shapes) that need to be drawn onto the JPanel and have left it up to the indivual threads to draw themselves (as opposed to using paintComponent in the JPanel class). The drawing on the JInternalFrame works perfectly fine.
    The problem arises when the other JInternalFrames are placed on top of each other - the balls are drawn over the top most JInternalFrame. What am i doing wrong? I have attached snippets of the code:
    public class Desktop extends JFrame implements ActionListener
              public Desktop()
                        setTitle("Agent's world");
                        setSize(w,h);
                        setDefaultCloseOperation(EXIT_ON_CLOSE);
                        JDesktopPane desktop = new JDesktopPane();
                        setContentPane(desktop);
                        /************* Agent *************/
                        JInternalFrame agents = new JInternalFrame("Agents War", true, false, true, false);                    
                        agents.reshape(0,0,(int)((w/3)*2),h);
                        Container contentPane = agents.getContentPane();
                        canvas = new AgentPanel(agents);
                        contentPane.add(canvas);
                        /************* Button *************/
                        JPanel buttonPanel = new JPanel();
                        ButtonGroup buttonGroup = new ButtonGroup();
                        JButton start = new JButton("START");
                        start.addActionListener(this);
                        buttonPanel.add(start);
                        contentPane.add(buttonPanel, "North");
                        agents.setVisible(true);
                        desktop.add(agents);
                        //sets focus to other frames within the desktop
                        try
                                  agents.setSelected(true);
                        catch(PropertyVetoException e)
                                  //attempt to refocus was vetoed by a frame
              /** Method to listen for event actions, i.e. button clicks **/
         public void actionPerformed(ActionEvent event)
                   //passes through 'this' to allow access to the getList method
                   Agents agent = new Agents(canvas, this);
                   agent.start();
    public class Agents extends Thread
              public Agents(AgentPanel panel, Desktop desktop)
                        panel =_panel;
                        desktop = _desktop;
                        setDaemon(true);
    /** Moves the agent from a spefic position to a new position **/
              public void move()
                        Graphics g = panel.getGraphics();
                        Graphics2D g2 = (Graphics2D)g;
                        try
                                  //set XOR mode
                                  g.setXORMode(panel.getBackground());
                                  //draw over old
                                  Ellipse2D.Double ballOld = new Ellipse2D.Double(i , j, length, length);
                                  g2.fill(ballOld);     
                                  i++;
                                  j++;
                                  if(flag == true)
                                            //draw new
                                            Ellipse2D.Double ballNew = new Ellipse2D.Double(i , j, length, length);
                                            g2.fill(ballNew);
                                            g2.setPaintMode();
                        finally
                                  g.dispose();
              /** Activates the Thread **/
              public void run()
                   int i = 0;
                   while(!interrupted() && i<100)
                        try
                                       for(i = 0 ; i <100 ; i++)
                                                 //draw ball in old position                                             move();          
                                                 sleep(100);                              
                             catch(InterruptedException e)
    public class AgentPanel extends JPanel
              /** local copy of internal frame */
              private JInternalFrame frame;
              public AgentPanel(JInternalFrame _frame)
                        frame = _frame;
                        setSize(frame.getWidth(), frame.getHeight());
                        setBackground(Color.white);          
              public void paintComponent(Graphics g)
                        super.paintComponent(g);
    Thank you in advance.
    Ravs

    I have the same problem. Seems to be a bug. See:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=231037
    Bummer.

  • ITunes won't recognize media on external hard drive

    Hello Everyone....
    So I have a 17" Macbook Pro, that was recently repaired under Future Shop's PSP that I purchased. They wiped it completely clean, so I essentially have a brand new computer again.
    Luckily, I put almost all of my data and media onto my external hard drive before it went in. I have been operating with my iTunes media stored on an external drive for some time now with success.
    Now that my computer is completely new, I did all the available updates, and then went to link my library to my iTunes, as it's "new again". It doesn't have my library attached anymore. I think I forgot to save the actual library files that I'm now reading about, and instead just saved the actual mp4 files. To be honest I didn't know there were library files and actual media files, seems weird...
    I've changed my preferences back to the external drive folder where my media is located, and I've clicked "consolidate files" and nothing happens.
    I've tried to hit the "scan for media" button that pops up when you have a wiped or new computer and nothing has happened.
    I tried to physically click and drag everything from my external drive into my iTunes, and the little "processing xyz..." popped up with the blue and white striped progress bar, however when I woke up this morning nothing had happened. I'm not sure how that developed.
    I can't seem to find anything on the internet to assist with this particular issue. I have all my media stored properly in the iTunes media folder but no actual "library" file. I guess I didn't realize they existed!
    Any ideas? I am losing my mind. This mac is my second and has been in for repairs twice, and has given me nothing but problems. I am aware this "problem" is my own dumb fault but I feel like it should be much easier to recognize your existing media when it's right there in front of you.

    Preferences does not scan for media, it only changes the storage location for new additions.  The files have to be added to the library.  It sounds like you tried this in one of your attempts but it did not work (I don't know why it didn't unless there is some detail I missed).
    Where do you want your library?  On the external or internal?
    If the internal, start iTunes.  Drag your media files to the "Automatically Add To iTunes folder.  iTunes 9: Understanding the "Automatically Add to iTunes" folder. - http://support.apple.com/kb/HT3832  Or use the "Add" menu item to add files to iTunes, or drag them to the iTuens library in the sidepanel.
    If somewhere else, start iTunes while holding down the option/alt key, select a library location.  Add as above.
    What are the iTunes library files? - http://support.apple.com/kb/HT1660
    More on iTunes library files and what they do - http://en.wikipedia.org/wiki/ITunes#Media_management
    What are all those iTunes files? - http://www.macworld.com/article/139974/2009/04/itunes_files.html
    Where are my iTunes files located? - http://support.apple.com/kb/ht1391

  • A Request for help from me again! Yay!

    hi guys! I was working on implementing threads for the directions of the unit. When i press forward once...nothing happens, but when i press twice it gives me this HUGE list of errors. I dont have a clue. Again, any help would be appreciated.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class NBoard extends JFrame implements KeyListener{
         int selection = 0;
         boolean selectionmade = false;
         final int WIDTH = 600;
         final int HEIGHT = 600;
         Image Viz =Toolkit.getDefaultToolkit().getImage(JOptionPane.showInputDialog("What character do you want?")+".gif");
         int XC = 50;
         int YC = 50;
         Thread moving = new Move();
         Unit Host = new Unit();
         public NBoard(){
              this.setSize(WIDTH,HEIGHT);
              selection = Integer.parseInt(JOptionPane.showInputDialog("What level design do you want?"));
              if(selection > 0){
                   selectionmade = true;
              addKeyListener(this);
              this.setVisible(true);
         public static void main(String args[]){
              new NBoard();
         public void paint(Graphics g){
              if(selectionmade == true){
                   if(selection == 1){
                        g.setColor(Color.white);
                        g.fillRect(0,0,WIDTH,HEIGHT);
                        g.setColor(Color.black);
                        g.drawLine(WIDTH/2,0,WIDTH/2,HEIGHT);
                   if(selection == 2){
                        g.setColor(Color.white);
                        g.fillRect(0,0,WIDTH,HEIGHT);
                        g.setColor(Color.black);
                        g.drawLine(WIDTH/2,0,WIDTH/2,HEIGHT);
                        for(int ctr = 1; ctr < 6; ++ctr){
                             g.drawRect(WIDTH/4 ,ctr * 100, 20, 20);
                             g.drawRect((WIDTH / 3) * 2 ,ctr * 100, 20, 20);
                   if(selection == 3){
                        g.setColor(Color.white);
                        g.fillRect(0,0,WIDTH,HEIGHT);
                        g.setColor(Color.black);
                        g.drawLine((WIDTH/2) - 90,0,(WIDTH/2) + 90,HEIGHT);
                   g.drawImage(Viz,XC,YC,this);
              public void keyPressed(KeyEvent e){                              //The Problem Areas
                   if(e.getKeyChar() == 'w'){
                        moving.start();                                             //Starting the thread to move up
                   else if(e.getKeyChar() == 's'){
                        YC = YC + 2;
                   else if(e.getKeyChar() == 'a'){
                        XC = XC - 2;
                   else if(e.getKeyChar() == 'd'){
                        XC = XC + 2;
                   System.out.println(e.getKeyChar());
                   repaint();
         public void keyReleased(KeyEvent e){                              //The Problem Areas
              if(e.getKeyChar() == 'w'){
                   moving.interrupt();                                             //Trying to interrupt the thread once the key is released
         public void keyTyped(KeyEvent e){}
    class Move extends Thread{                                                  //The Problem Areas
         public void run(){                                                       //The Thread
              Unit.XC = Unit.XC - 2;
              try{
                   Thread.sleep(1000);
              catch (Exception e){}
    class Unit{                                                                      //The Object which will hold all of the information about each unit
         static int XC = 30;
         static int YC = 30;
    } By the way, here is my order of events, so you can look forward to seeing requests for help for them (hopefully not).
    Threads: Moving the guy around
    Threads: Making him shoot a ball at the mouses position
    Network: Allow others to join/play game (This is gonna be HUGE probably), while host decides on game type.
    Thanks for all the help so far!

    Where does moving ever get started? Why does Move extend Thread instead of implementing Runnable? (Implementing runnable is preferred and often the correct way to do it and it is in this case)
    But regardless there shoud be a moving.start() somewhere or start of the Thread that has the Runnable target Move.... I don't think I see one. Unless I missed it.
    so...itll work if i change the setup to Runnable?

  • How to convert an array collection instance to a complex object for interaction with webservice

    Hi there,
    I have a stubborn problem that I am trying to work out the best way to solve the problem.  I am interacting with a WebService via HTTPService calling a method called find(String name) and this returns me a List of ComplexObjects that contain general string and int params and also lists of other Complex Objects.  Now using the code:
    ArrayCollection newOriginalResultsArray = new ArrayCollection(event.result as Array)
    flex converts my complex objects results to an arraycollection so that I can use it in datagrids etc.  Now up until this part is all good.  My problem is when getting a single instance from the results list, updating it by moving data around in a new datagrid for example - I want to interact with the webservice again to do an create/update.  This is where I am having problems - because these webservice methods require the complex object as a parameter - I am struggling to understand how I can convert the array collection instance back to my complex object without iterating over it and casting it back (maybe this is the only way - but I am hoping not).
    I am hoping that there is a simple solution that I am missing and that there is some smart cookie out there that could provide me with an answer - or at least somewhere to start looking. I guess if I have no other alternative - maybe I need to get the people who built the service to change it to accept an array - and let them do the conversion.
    Any help would be greatly appreciated.
    Bert

    Hi Bert,
    According to my knowledge you can use describeType(Object) method which will return an XML... That XML will contain Properties and values just iterate through the XML and create a new Object..   Probably u can use this method...
    public function getObject(reqObj:Object,obj:Object,instanceName:String,name:String=null,index:int=-1):Obj ect
                if(!reqObj)
                    reqObj = new Object();
                var classInfo:XML = describeType(obj);
                var className:String = instanceName;
                if(name!=null)
                    className=name+"."+className;
                if(index!=-1)
                    className=className+"["+index+"]";
                for each (var v:XML in classInfo..accessor)
                    var attributeName:String=v.@name;
                    var value:* = obj[attributeName]
                    var type:String = v.@type;
                    if(!value)
                        reqObj[className+"."+attributeName] = value; 
                    else if(type == "mx.collections::ArrayCollection")
                        for(var i:int=0;i<value.length;i++)
                            var temp:Object=value.getItemAt(i);
                            getReqObject(reqObj,temp,attributeName,className,i);
                    else if(type == "String" || type == "Number" || type == "int" || type == "Boolean")
                        reqObj[ className+"."+attributeName] = value; 
                    else if (type == "Object")
                        for (var p:String in value)
                            reqObj[ className+"."+attributeName+"."+p] = value[p];
                    else
                        getReqObject(reqObj,value,attributeName,className);
                return reqObj;
    Thanks,
    Pradeep

  • Is it possible to export as HTML5?

    Firstly, my apologies, i'm in no way a flash expert and this will probably make the majority of you cringe. I am fine at the design side of things, however when it comes to the coding etc I haven't the foggiest.
    Basically I have created flash banners for my website to be displayed on various ad networks. These are designed in flash and exported as .swf which is fine. Obviously the majority of mobiles however don't display this but would display html5 or gif? Want to try and really stay away from gifs if possible. I have noticed on Flash CC there is a canvas at the start called html canvas?! Is this something that basically makes your banner in html5 or am i really jumping the gun on this one?
    If no to all of the above, where or what would you suggest I used to create HTML5 banners?
    Thanks so much in advance, Tom

    Yes, if you create a new HTML5 Canvas document or convert an ActionScript document to one, it will publish for HTML and Canvas. You will need to use JavaScript in place of ActionScript for Canvas but all the workflow and tooling is identical across document types.

  • Problem GameCanvas for Nokia 6260!!!!

    Hi,
    I tested some applications that extends the GameCanvas, when I tested on simulator J2ME Wireless Toolkit it hasn't problem when I download the application on phone (Nokia 6260) the program show screen and it work ok but when i try go out the application send the two errors
    "Buffer closed java.lang.RunTimeException
    0 java.lang.NullPointerException"
    It's possible that phone not support the class javax.microedition.lcdui.game.GameCanvas? or what's the problem?
    Help me please,
    Thanks
    P.S Below put the code, maybe this way is easer.
    // A simple example of a game canvas that displays
    // a scrolling star field. The UP and DOWN keys
    // speed up or slow down the rate of scrolling.
    public class StarField extends GameCanvas implements Runnable{
         private static final int SLEEP_INCREMENT = 10;
         private static final int SLEEP_INITIAL = 150;
         private static final int SLEEP_MAX = 300;
         private Graphics graphics;
         private Random random;
         private int sleepTime = SLEEP_INITIAL;
         private volatile Thread thread;
         private Command salir = null;
         public StarField(){
              super( true );
              graphics = getGraphics();
              graphics.setColor( 0, 0, 0 );
              graphics.fillRect( 0, 0, getWidth(), getHeight() );
         // When the game canvas is hidden, stop the thread.
         protected void hideNotify(){
              thread = null;
         // The game loop.
         public void run(){
              int w = getWidth();
              int h = getHeight() - 1;
              while( thread == Thread.currentThread() ){
                   // Increment or decrement the scrolling interval
                   // based on key presses
                   int state = getKeyStates();
                   if( ( state & DOWN_PRESSED ) != 0 ){
                        sleepTime += SLEEP_INCREMENT;
                        if( sleepTime > SLEEP_MAX )
                             sleepTime = SLEEP_MAX;
                   } else if( ( state & UP_PRESSED ) != 0 ){
                        sleepTime -= SLEEP_INCREMENT;
                        if( sleepTime < 0 ) sleepTime = 0;
                   // Repaint the screen by first scrolling the
                   // existing starfield down one and painting in
                   // new stars...
                   graphics.copyArea( 0, 0, w, h, 0, 1,
                   Graphics.TOP | Graphics.LEFT );
                   graphics.setColor( 0, 0, 0 );
                   graphics.drawLine( 0, 0, w, 1 );
                   graphics.setColor( 255, 255, 255 );
                   for( int i = 0; i < w; ++i ){
                        int test = Math.abs( random.nextInt() ) % 10;
                        if( test < 4 ){
                             graphics.drawLine( i, 0, i, 0 );
                   flushGraphics();
                   // Now wait...
                   try {
                        Thread.currentThread().sleep( sleepTime );
                   catch( InterruptedException e ){
         // When the canvas is shown, start a thread to
         // run the game loop.
         protected void showNotify(){
              random = new Random();
              thread = new Thread( this );
              thread.start();
    Thanks, see you

    do you have a memory card in your phone? Try freeing up your phones memo by deleting text,images and videos
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

Maybe you are looking for