Need help with threads?.. please check my approach!!

Hello frnds,
I am trying to write a program.. who monitors my external tool.. please check my way of doing it.. as whenever i write programs having thread.. i end up goosy.. :(
first let me tell.. what I want from program.. I have to start an external tool.. on separate thread.. (as it takes some time).. then it takes some arguments(3 arguments).. from file.. so i read the file.. and have to run tool.. continously.. until there are arguments left.. in file.. or.. user has stopped it by pressing STOP button..
I have to put a marker in file too.. so that.. if program started again.. file is read from marker postion.. !!
Hope I make clear.. what am trying to do!!
My approach is like..
1. Have two buttons.. START and STOP on Frame..
START--> pressed
2. check marker("$" sign.. placed in beginning of file during start).. on file..
     read File from marker.. got 3 arg.. pass it to tool.. and run it.. (on separate thread).. put marker.. (for next reading)
     Step 2.. continously..
3. STOP--> pressed
     until last thread.. stops.. keep running the tool.. and when last thread stops.. stop reading any more arguments..
Question is:
1. Should i read file again and again.. ?.. or read it once after "$" sign.. store data in array.. and once stopped pressed.. read file again.. and put marker ("$" sign) at last read line..
2. how should i know when my thread has stopped.. so I start tool again??.. am totally confused.. !!
please modify my approach.. if u find anything odd..
Thanks a lot in advance
gervini

Hello,
I have no experience with threads or with having more than run "program" in a single java file. All my java files have the same structure. This master.java looks something like this:
---master.java---------------------------------------------------
import java.sql.*;
import...
public class Master {
public static void main(String args []) throws SQLException, IOException {
//create connection pool here
while (true) { // start loop here (each loop takes about five minutes)
// set values of variables
// select a slave process to run (from a list of slave programs)
execute selected slave program
// check for loop exit value
} // end while loop
System.out.println("Program Complete");
} catch (Exception e) {
System.out.println("Error: " + e);
} finally {
if (rSet1 != null)
try { rSet1.close(); } catch( SQLException ignore ) { /* ignored */ }
connection.close();
-------end master.java--------------------------------------------------------
This master.java program will run continuously for days or weeks, each time through the loop starting another slave process which runs for five minutes to up to an hour, which means there may be ten to twenty of these slave processes running simultaneously.
I believe threads is the best way to do this, but I don't know where to locate these slave programs: either inside the master.java program or separate slave.java files? I will need help with either method.
Your help is greatly appreciated. Thank you.
Logan

Similar Messages

  • I have need help with something Please respond Quickly :)

    I have need help with something Please respond Quickly  ok so i have the linksys wrt54g Version 2.2 and i upgraded the firmware to V4.21.4 from this site http://homesupport.cisco.com/en-us/wireless/lbc/WRT54G and i clicked V2.2 for the router. So after i upgraded i lost internet ability i can't use the internet so i had to downgrade back to V4.21.1 but i want the things that newer update sloves. Please Help. Everything thing says DNS error? aka Modem.
    $$Cgibbons$$

    Ya i tried that i tried restoring and redoing everything when i downgrade back to .1 it works fine though?
    $$Cgibbons$$

  • Need help with Fancybox please

    Hola
    I need some help with Fancybox.
    I bought this template and it came without facybox, so I thought
    that this will be a great help to learn some about jQuerry, but I'm lost
    Why is NOT working on my page?
    I just cannot figure this out.
    Can you please check my page?
    http://tummytime.biz/pages/portfolio_fancy.html
    I got Windows 8, Dreamweaver CC
    Thanks a lot.

    There are a couple things that could be causing a couple browsers' collective heads to implode.
    Remove the <! right before your </head> tag...
    </script>
    <!
    </head>
    <body>
    You have two calls to the fancybox css file, you only need one.
    Aside from that I'm not seeing any code problems jump out at me.
    EDIT: Ah, didn't scroll far enough. You have more than one reference to the jquery library. Typically, only one is needed and two or more will cause them all to fail. Usually, you can use the "latest" link and cover all your bases.
    If you aren't using those referenced scripts at the bottom of your page, delete them.

  • Need Help With Home Please

    If anyone here is good with Java, I need serious help with my homework, please give me your instant messenger screen name and we can chat, thanks alot!!
    Angela

    I don't understand how people get themselves into
    these situations as school, if you don't want to learn
    it don't sign up for the class.....You never got yourself into this situation.... I think everyone has on occassion.
    My very first "serious" university program was to solve a second order, non-linear differential equation using the Runge-Kutta method. This is NOT the easy way to learn a computer language and I have to admit I did take "shortcuts" using more experienced people than me.
    That was before the web though...
    God am I really that old?

  • I need help with this please

    javax.servlet.ServletException
    at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:595)
    at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:537)
    at jsp.addservice._jspService(addservice.jsp:515)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:847)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:229)
    at mil.usmc.m4l.servlets.M4LServlet.forward(M4LServlet.java:34)
    at mil.usmc.m4l.servlets.EditService.doGet(EditService.java:120)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at mil.usmc.m4l.filters.M4LCMSFilter.doFilter(M4LCMSFilter.java:150)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:673)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Edited by: user11237193 on Apr 27, 2010 10:58 AM
    I am getting error and I ned help with it Thank you for your help.

    I'd enter the dell service tags in here to find out what OS the pc was designed for.
    http://www.dell.com/support/contents/us/en/19/Category/Product-Support/Self-support-Knowledgebase/locate-service-tag?~ck=mn
     For windows I'd ask over here.
    http://answers.microsoft.com/en-us/windows
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • HT3702 need help with purchase please!!!

    My husband mistakenly hit the purchase button las night for an apple app and now it has been taken out of our account, but was deleted off the phone as soon has he realized that he hit the purchase button how do we get a refund please we need HELP!!!

    All sales are final
    You can try contacting itunes and asking for an exception

  • Need help with debugging PLEASE

    Hi,
    I'm new to Java and was given an assignment to debug a program. I am completely lost and really havent gone over most of the stuff that is in this program. I would greatly appreciate any help with this that I can get.
    Here is my code:
    import java.util.*;
    import javax.swing.*;
    public class IndexHitFrequency
    private final int NUMBER_OF_SIMULATIONS = 1000;
    private int indexHit[] = new int [10];
    public IndexHitFrequency()
    Random generator = new Random(); // for generating random number
    int array[] = {6, 2, 4, 8, 5, 0, 1, 7, 3, 9 };
    //convert to ArrayList and sort it
    List list = new ArrayList(Arrays.asList(array));
    for (int i = 0; i < NUMBER_OF_SIMULATIONS; i++)
    //generate random number
    int randomNumber = generator.nextInt(array.length);
    // get index hit
    int index = Collections.binarySearch(list, randomNumber) ;
    // save index hit to array
    if(index > -1)
    indexHit[index]++;
    }//end for
    String output = "Index\tFrequency\t\n";
    //append the frequency of index hit to output
    for (int i = 0; i < indexHit.length; i++)
    output += i + "\t" + indexHit[i] + "\t\n";
    //display result
    JTextArea outputArea = new JTextArea();
    outputArea.setText(output);
    JOptionPane.showMessageDialog(null, outputArea, "Search random number 1000 times" ,
    JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    }// end constructor
    public static void main (String [] args)
    new IndexHitFrequency();
    } // end class IndexHitFrequency
    I get these errors after trying to compile:
    "IndexHitFrequency.java": Error #: 300 : method asList(int[]) not found in class java.util.Arrays at line 17, column 40
    "IndexHitFrequency.java": Error #: 300 : method binarySearch(java.util.List, int) not found in class java.util.Collections at line 24, column 34

    C:\Java\Tutorial\rem>javac IndexHitFrequency.java
    IndexHitFrequency.java:15: asList(java.lang.Object[]) in java.util.Arrays cannot
    be applied to (int[])
    List list = new ArrayList(Arrays.asList(array));
                                    ^
    IndexHitFrequency.java:22: cannot find symbol
    symbol  : method binarySearch(java.util.List,int)
    location: class java.util.Collections
    int index = Collections.binarySearch(list, randomNumber) ;
                           ^
    2 errors
    C:\Java\Tutorial\rem>Copied source and compiled in DOS window ( XP's cmd.exe) and got these error messages...
    I think these error are more clear than the ones you posted, so this should help you resolve the problem...
    - MaxxDmg...
    - ' He who never sleeps... '

  • I need help with hyperlink PLEASE!!!!!!!

    I hope somebody can help me with this question. I create some
    button in flash 8. My web page is divided in three frames( using
    the frame tag), two rows and the second row has two colums. My
    question is how can i make one of my buttons to open a new web page
    but in a different frame. The button is in column number 1 of row 2
    and when the user click this button i want that this new page open
    in column number 2 of row 2. How can ia do that? please help
    me

    valla23 wrote:
    > I hope somebody can help me with this question. I create
    some button in flash
    > 8. My web page is divided in three frames( using the
    frame tag), two rows and
    > the second row has two colums. My question is how can i
    make one of my buttons
    > to open a new web page but in a different frame. The
    button is in column number
    > 1 of row 2 and when the user click this button i want
    that this new page open
    > in column number 2 of row 2. How can ia do that? please
    help me
    Always best to google before posting, especially if you
    urgent to meet deadline.
    Forum archives:
    http://groups.google.com/advanced_group_search?q=group:macromedia.flash.*&hl=en&lr=&ie=UTF -8
    Search "flash in frames"
    the very second result, so happen to be from me, exhaling
    exactly how to set it up.
    http://groups.google.com/group/macromedia.flash/browse_thread/thread/6b0047b0a65be8a0/9f8f c0765bf2297e?lnk=st&q=&rnum=2&hl=en#9f8fc0765bf2297e
    Personally posted that couple of hundreds of times in past 8
    years.
    Please try to utilize the search before posting so we don't
    need to hammer same
    topic over and over and over and over and over .....again...
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Need help with Program Please!

    // Name: John Weir 02/03/2006
    Please read the comments as they will explain what help I need.
    All help greatly appreciated! Am new to working with GUI.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class FeverDiagnosis extends JFrame
         // diagnoisis constants
         private final String MENIGITIS = "menigitis";
         private final String DIGESTIVE_TRACT_INFECTION = "digestive tract infection";
         private final String PNEUMONIA_OR_AIRWAYS_INFECTION  ="pneumonia or airways infection";
         private final String VIRAL_INFECTION = "viral infection";
         private final String THROAT_INFECTION = "throat infection";
         private final String KIDNEY_INFECTION = "kidney infection";
         private final String URINARY_INFECTION = "urinary tract infection";
         private final String SUNSTROKE_OR_HEAT_EXHAUSTION = "sunstroke or heat exhaustion";
         // symptom constants
         private final String FEVER = "fever";
         private final String COUGHING = "coughing";
         private final String HEADACHE = "headache";
         private final String BREATHING_WITH_DIFFICULTY = "shortness of breath, wheezing, or coughing up phlegm";
         private final String ACHING_BONES_JOINTS = "aching bones or joints";
         private final String RASH = "rash";
         private final String SORE_THROAT = "sore throat";
         private final String BACK_PAIN_AND_CHILLS_AND_FEVER = "back pain just above the waist with chills and fever";
         private final String URINARY_DIFFICULTY = "pain urinating or are urinating more often";
         private final String TOO_MUCH_SUN = "sun overexposure due to spending the day in the sun or in hot conditions";
         public final String VOMITING_OR_DIARRHEA = "vomitting spell or diarrhea";
         private final String MENIGITIS_POSSIBILITIES =
                          "pain when bending your head forward,\n"
                        + "    nausea or vomiting, eye ache from \n"
                        + "    bright lights, drowsiness or confusion";
         // GUI varibles
         private JTextArea textArea;
         private JFrame theFrame;
         private JLabel stuff2;
         private JButton b1;
         private JButton b2;
         // instance variable
         private String symptoms = "";
         private Scanner cin = new Scanner (System.in);
         char response;
         String input;
         public FeverDiagnosis()
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame theFrame = new JFrame("John Weir");
              theFrame.setSize(650, 400);
              Dimension frameSize = theFrame.getSize();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              theFrame.setLocation((screenSize.width - frameSize.width)/2,(screenSize.height - frameSize.height)/2);
              theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container contentPane = theFrame.getContentPane();
              theFrame.getContentPane().setLayout(new FlowLayout());
              JLabel stuff2 = new JLabel("Test");
              textArea = new JTextArea(12,50);
              textArea.setEditable(true);
              textArea.setBackground(Color.black);
              textArea.setForeground(Color.green);
              textArea.setFont(new Font("Serif", Font.ITALIC, 16));
              textArea.setLineWrap(true);
              textArea.setWrapStyleWord(true);
              b1 = new JButton("Yes");
              b2 = new JButton("No");
              contentPane.add(stuff2);
              contentPane.add(new JScrollPane(textArea));
              contentPane.add(b1);
              b1.setEnabled(true);
              contentPane.add(b2);
              b2.setEnabled(true);
              ActionListener l = new ActionListener()
                public void actionPerformed(ActionEvent e)
                   if((e.getSource() == b1))
                   //   HELP NEEDED
                   //   NEED BUTTON TO PASS
                   //   STRING VALUE "Y" TO
                   //   METHOD: have(String s)
                   input.equals("y");
                   else
                   if((e.getSource() == b2))
              b1.addActionListener(l);
              b2.addActionListener(l);
              theFrame.setVisible(true);
              theRules();
    public void theRules()
         displayNote();
         if (! have(FEVER) )
              displayUnsure();
         else
         if(are(COUGHING))
              if( are(BREATHING_WITH_DIFFICULTY))
                   addSymptom( PNEUMONIA_OR_AIRWAYS_INFECTION );
                   displayDiagnosis(PNEUMONIA_OR_AIRWAYS_INFECTION);
              }else
              if(have(HEADACHE))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(ACHING_BONES_JOINTS))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(RASH))
                   displayUnsure();
              }else
              if(have(SORE_THROAT))
                   addSymptom( THROAT_INFECTION );
                   displayDiagnosis(THROAT_INFECTION);
              }else
              if(have(BACK_PAIN_AND_CHILLS_AND_FEVER))
                   addSymptom( KIDNEY_INFECTION );
                   displayDiagnosis(KIDNEY_INFECTION);
              }else
              if(have(URINARY_DIFFICULTY))
                   addSymptom( URINARY_INFECTION );
                   displayDiagnosis(URINARY_INFECTION);
              }else
              if(have(TOO_MUCH_SUN))
                   addSymptom( SUNSTROKE_OR_HEAT_EXHAUSTION );
                   displayDiagnosis(SUNSTROKE_OR_HEAT_EXHAUSTION);
              }else
                   displayUnsure();
              else
              if(have(HEADACHE))
                   addSymptom(VIRAL_INFECTION);
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(are(MENIGITIS_POSSIBILITIES))
                   addSymptom( MENIGITIS );
                   displayDiagnosis(MENIGITIS);
              }else
              if(are(VOMITING_OR_DIARRHEA))
                   addSymptom( DIGESTIVE_TRACT_INFECTION );
                   displayDiagnosis(DIGESTIVE_TRACT_INFECTION);
              }else
              displayUnsure();
         public void displayNote()
              textArea.append("\n\n"
                   + "Fever Diagnostic Tool\n"
                   + "---------------------\n\n"
                   + "Please note that this program performs no true diagnostic activity.\n"
                   + "No decisions should be made based upon the tool's analysis. If users\n"
                   + "have a fever, they should contact their doctor.\n\n");
         public boolean have(String s)
              // prompt and extract
              textArea.append("Do you have you " + s + " (y, n): " + "\n");
              // NEED BUTTON TO PASS STRING  FROM ActionPerformed
              // AND HAVE IT RETURNED AS A CHAR RESPONCE!
              input = cin.nextLine();
              response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         private boolean are(String s)
              textArea.append("Are you " + s + " (y, n): " + "\n");
              input = cin.nextLine();
              char response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         public void addSymptom(String s)
              symptoms += "*   " + s + "\n";
         public void displayDiagnosis(String diagnosis)
              textArea.setText("");
              textArea.append("\nSymptoms:\n" + symptoms + "\n" + "Diagnosis"
                   + "\n   Possibilities include " + diagnosis  + "\n");
              textArea.append("\n");
              //System.exit(0);
         public void displayUnsure()
              textArea.append("\nInsufficient information to make a diagnosis" + "\n");
              textArea.append("\n");
              //System.exit(0);
         public static void main(String[] args)
              new FeverDiagnosis();
    }

    If you're looking to use a JTextArea as a console you can use these two classes
    you are free to use and modify these classes but please do not change the package or take credit for it as your own work.
    TextAreaReader.java
    =================
    * Created on Jul 7, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.awt.TextArea;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.TextEvent;
    import java.awt.event.TextListener;
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.Reader;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    public class TextAreaReader extends Reader implements KeyListener {
         JTextArea mJArea;
         TextArea mAWTArea;
         Object mKeyLock = new Object();
         Object mLineLock = new Object();
         String mLastLine;
         int mLastKeyCode = 1;
         public TextAreaReader(JTextArea area) {
              super();
              mJArea = area;
              mJArea.addKeyListener(this);
         public TextAreaReader(TextArea area) {
              super();
              mAWTArea = area;
              mAWTArea.addKeyListener(this);
         public void keyPressed(KeyEvent ke) {
              mLastKeyCode = ke.getKeyCode();
              synchronized(mKeyLock) {
                   mKeyLock.notifyAll();
              if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
                   if (mJArea != null) {
                        String txt = mJArea.getText();
                        int idx = txt.lastIndexOf('\n', mJArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mJArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
                   else {
                        String txt = mAWTArea.getText();
                        int idx = txt.lastIndexOf('\n', mAWTArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mAWTArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
         public void keyReleased(KeyEvent ke) {
         public void keyTyped(KeyEvent ke) {
         public int read(char[] arg0, int arg1, int arg2) throws IOException {
              throw new IOException("Not supported");
         public String readLine() {
              synchronized(mLineLock) {
                   try {
                        mLineLock.wait();
                   catch (InterruptedException ex) {
              return mLastLine;
         public int read() {
              synchronized(mKeyLock) {
                   try {
                        mKeyLock.wait();
                   catch (InterruptedException ex) {
              return mLastKeyCode;
         public void close() throws IOException {
              // TODO Auto-generated method stub
         public static void main(String args[]) {
              JFrame f = new JFrame("TextAreaInput Test");
              JTextArea area = new JTextArea();
              final TextAreaReader tar = new TextAreaReader(area);
              f.add(area);
              Runnable r1 = new Runnable() {
                   public void run() {
                        while (true) {
                             int code = tar.read();
                             System.out.println("read: " + code);
              Runnable r2 = new Runnable() {
                   public void run() {
                        while (true) {
                             String line = tar.readLine();
                             System.out.println("read line: " + line);
              Thread t1 = new Thread(r1);
              Thread t2 = new Thread(r2);
              t1.start();
              t2.start();
              f.setBounds(100, 100, 200, 200);
              f.setVisible(true);
         public InputStream toInputStream() {
              return new MyInputStream();
         private class MyInputStream extends InputStream {
              public int read() {
                   return TextAreaReader.this.read();
    ==================
    TextAreaOutputStream
    ==================
    * Created on Mar 13, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.swing.JTextArea;
    import javax.swing.text.JTextComponent;
    public class TextAreaOutputStream extends OutputStream {
         public static final int DEFAULT_BUFFER_SIZE = 1;
         JTextArea mText;
         byte mBuf[];
         int mLocation;
         public TextAreaOutputStream(JTextArea component) {
              this(component, DEFAULT_BUFFER_SIZE);
         public TextAreaOutputStream(JTextArea component, int bufferSize) {
              mText = component;
              if (bufferSize < 1) bufferSize = 1;
              mBuf = new byte[bufferSize];
              mLocation = 0;
         @Override
         public void write(int arg0) throws IOException {
              //System.err.println("arg = "  + (char) arg0);
              mBuf[mLocation++] = (byte)arg0;
              if (mLocation == mBuf.length) {
                   flush();
         public void flush() {
              mText.append(new String(mBuf, 0, mLocation));
              mLocation = 0;
              try {
                   Thread.sleep(1);
              catch (Exception ex) {}
    }

  • New to itunes and need help with library please

    some of my albums have various artists. i cant get them to show up as 1 album it shows as an album for every song. can anyone help me please?
    another problem i am having is my album artwork does not show up when I insert a cd to rip. I am also having trouble with the itunes suddenly getting all garbled up so i cant even see the screen untill I close itunes and open it back up. grrrr!! i sold my Zune to get this ipod touch and am wondering if I have made a mistake.
    thanks for any help you can give me
    Carri

    according to you we are on the same page here. When you rip a regular cd into itunes, it does not have the album artwork engrained into the song file. This is just an example, Say you ripped a Metallica cd into itunes such as "Master of Puppets." The song on the album "Disposable Heroes" will not have the album artwork with it.
    You need to get an apple account, just go to the itunes store and sign up. After you do that you can click on one of the songs from the album you ripped. Right click it, and go to the choice "get album artwork". itunes will automatically modify the artwork for all the songs on that album. That is it. I may have a post later on your other problems. Ask me if you don't fully understand what i said.

  • Need help with dates  please-urgent

    Hi folks, please help me with this if you can.
    I run a weekly job, and need to have my java code create and use 2 dates to capture data for the whole week.
    begin_date mm/dd/yyyy (String) to be 7 days prior to current date
    end_date mm/dd/yyyy (String) to be the currecnt date
    Note: please take into account the cases where the CURRENT_DATE is the first week of the month. As a result the 7 days prior will fall into the previous month. i.e if end_date="06/04/2003" then the begin_date will be "05/29/2003 Thanks a bunch

    http://java.sun.com/j2se/1.4.1/docs/api/index.html
    See the Calendar and DateFormat classes.

  • Need Help with Printer Please

    I am a new MAC user. So please, if you have a solution for me, speak slowly. (LOL)
    I have the new G5. Bought the Epson printer to go with it. It's the CX4200.
    I loaded the software for it. But can't get it to print. It seems the computer won't or can't find it in their list of printers.
    Ok, so I go to a Word Doc., for example. And select print. The window says that I need to select a printer. I hit the arrow down button and there's my printer listed. So I choose that, but still won't print. Seems I have to go down to another line in the same box and find the printer in this long list. There are many Epsons listed but not mine, which is the CX4200.
    And darn-it, tech support on the phone is closed at 6pm!!!??? I sure hope to see a reply soon. I really need to print something tonight.
    Thanks for any help you can provide.
    My personal e-mail is
    [email protected]
    Thanks!
    Cary
    PS: This process asked me to choose an OS for my G5. I have no idea what my OS is. All's I know is I have a G5. Gosh, I feel soooo dumb!

    What have you done so far?
    I suggest you connect it via a usb  cable first.  Once you get the printer working, move to wifi.  You will have to use an existing printer usb cable or purchase a cable.  Be sure to get the correct cable.  Ask for help.
    The warrenty indicates there is phone support.  Give HP a call.
    Warranty
    One-year limited hardware warranty; 24-hour, 7 days a week phone support
    Robert

  • I need help with animation, PLEASE help!

    I am trying to create pacman animation by using a series of filled arcs that I create by coding in java. I know how to create the arcs, but I don't know how to use them to create animation. In other words I don't know how to put them in sequence to create animation.
    I have searched the web, and all I find is animation that use a series of GIF or JPEG images.
    can you please help me or point me to the right direction.
    by the way, which of these two animation would run faster? The one that uses GIF images, or the one that would use shapes created in java?
    Thanx

    Perhaps you could do this two ways
    One way, (im not sure if this will work), is to create a .gif file that is already animated. An open mouth animated to a closed mouth. But i don't know if Java will accept this.
    The second way would be to create a Thread. And to create however many images you want to display the open to closed mouth. Then continuously change the image so it appears the mouth is opening and closing.
    Put in a delay so it doens't go too fast, and there ya have it.
    Public void run()
    int i =0;
    while(true)
    myThread.sleep(10);
    image = difImage;
    }something like that. Might used a bufferedImage and make just use subImage to pull off each picture you need to change.

  • Need help with Signature on Checks using SAP SCRIPT

    Hi,
    I am looking for some help on how to get the Printer Resident Singature on to the Check using SAP Script. We have a HP Laser 8150 Priter in which the Chip Contains the Signature ( Printer Resident Singaure ) and currentlly the ORACLE application is able to print this signature on the checks. Right now we are in Migration to SAP and we are trying to get this Signature to print on the Check using SAP Script.
    Please help us.

    There are many ways to do this, the simplest way to print the signature is using HEX ENDHEX command.
    1. Print the Printer font list from the printer configuration menu, Find the signature in the font list, next to it there'll be esacape sequence in ASCII and Hex format.
    2. Add the following command in the window of the signature:
    /: HEX TYPE PCL
    /= Enter the Hex escape sequence(begins with 1B) from first step
    /: ENDHEX
    Regards
    Sridhar

  • Creating breakout game. Need help with thread starting.

    Howdy. As the title says, I've got an assignment to make a breakout game. So far it's going alright, but I've run into a rather large snag...I can't get it to animate :P I've got my main applet, then I created a class heirarchy for the paddle, ball, and brick objects. For this question, lets just focus on the ball object.
    This is my applet code so far (it is not even close to being done, so don't laugh :P )
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    * Class BreakoutApplet - Plays a simple game of Breakout.
    * @author Kris Nelson
    * @version November 10, 2004
    public class BreakoutApplet extends JApplet implements Runnable
        protected Brick brick; // creates an object of class brick
        protected Ball ball; // creates an object of class ball
        protected Paddle paddle; // creates an object of class paddle
        protected boolean running; // tells the program whether or not the thread is running
        protected ArrayList brickArray = new ArrayList(); // stores all the bricks in the game
        protected Thread timer; // the thread which controls the animation for the applet
        * Called by the browser or applet viewer to inform this JApplet that it
        * has been loaded into the system. It is always called before the first
        * time that the start method is called.
        public void init()
            // this is a workaround for a security conflict with some browsers
            // including some versions of Netscape & Internet Explorer which do
            // not allow access to the AWT system event queue which JApplets do
            // on startup to check access. May not be necessary with your browser.
            JRootPane rootPane = this.getRootPane();   
            rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
            createBricks(); // creates the games array of bricks
            ball = new Ball(400, 400, 2, 2); // sets the values for the ball
            paddle = new Paddle(300, 660, 2); // sets the values for the paddle
            // !!!!!!! have tried placing ball.start() here
        * Paint method for applet.
        * @param  g   the Graphics object for this applet
        public void paint(Graphics g)
            // draws the background, border, and all the games objects
            g.setColor(Color.lightGray); // sets the drawing color to light gray
            g.fillRect(0, 0, 600, 700); // displays the game screens background
            displayBorder(g); // displays the game screens border
            displayBricks(g); // displays the array of bricks
            ball.display(g); // displays the ball
            paddle.display(g); // displays the paddle
        * Creates the games array of bricks
        public void createBricks()
            int colorNumber = 1; // starts the color of the bricks at orange
            double yPosition = 100; // starts the bricks y screen position at 100
            for(int i = 0; i < 4; i++)
                double xPosition = 12; // starts the bricks x screen position at 12
                for(int j = 0; j < 8; j++)
                    if(colorNumber == 0)
                        colorNumber = 1; // sets the color of the bricks to orange
                    else
                        colorNumber = 0; // sets the color of the bricks to green
                    brickArray.add(brick = new Brick(xPosition, yPosition, colorNumber)); // adds a brick to the current container in the brick array
                    xPosition = xPosition + brick.getWidth(); // move the bricks x screen position to the next column
                yPosition = yPosition + brick.getHeight(); // moves the bricks y screen position to the next row
                if(colorNumber == 0)
                    colorNumber = 1; // sets the color of the bricks to orange
                else
                    colorNumber = 0; // sets the color of the bricks to green
        * Displays the game screens border
        * @param  g   the Graphics object for this applet
        public void displayBorder(Graphics g)
            g.setColor(Color.black); // sets the drawing color to black
            g.fillRect(0, 0, 600, 24); // draws a border on the top of the screen
            g.fillRect(0, 0, 12, 700); // draws a border on the left of the screen
            g.fillRect(588, 0, 12, 700); // draws a border on the right of the screen
        * Displays the array of bricks on the screen
        * @param  g   the Graphics object for this applet
        public void displayBricks(Graphics g)
            Brick currentBrick; // holds the brick data from the current ArrayList container
            for(int i = 0; i < 32; i++)
                currentBrick = (Brick)(brickArray.get(i)); // grabs the brick data from the current ArrayList container
                currentBrick.display(g); // displays the current brick
        * Called by the browser or applet viewer to inform this JApplet that it
        * should start its execution. It is called after the init method and
        * each time the JApplet is revisited in a Web page.
         public void start()
             if(timer == null)
                 timer = new Thread(this); // creates a new object of type Thread
                 timer.start(); // starts the new thread
                 running = true; // tells the program that the new thread is running
        * Runs the code that controls the animation
        public void run()
            do{
                repaint(); // redraws the screen
                try{
                    timer.sleep(100); // puts the thread to sleep for 100 milliseconds
                } catch(InterruptedException e) {running = false;}
                // !!!!!!! have tried placing ball.start() here
            } while(running);
            timer = null; // destroys the timer thread
        * Called by the browser or applet viewer to inform this JApplet that
        * it should stop its execution. It is called when the Web page that
        * contains this JApplet has been replaced by another page, and also
        * just before the JApplet is to be destroyed.
        public void stop()
            running = false; // tells the program that the thread is now done
    }These are the bits of code for my class heirarchy, just to (hopefully) make it easier to follow.
    import java.awt.*;
    * The parent class of all the games objects.
    * @author Kris Nelson
    * @version November 9, 2004
    public class Sprite
        protected double screenX, screenY; // stores the x and y location of the object
        * Constructor for objects of class Sprite
        * @param  xPosition   the initial x screen position
        * @param  yPosition   the initial y screen position
        public Sprite(double xPosition, double yPosition)
            screenX = xPosition; // sets the initial x screen position
            screenY = yPosition; // sets the initial y screen position
        * Sets new x and y screen locations for an object
        * @param  newX   the new x screen location
        * @param  newY   the new y screen location
        public void setScreenXY(double newX, double newY)
            screenX = newX; // sets the new x screen location
            screenY = newY; // sets the new y screen location
        * Sends back the current x screen location
        * @return     the current x screen location
        public double getScreenX()
            return screenX; // returns the current x screen location
        * Sends back the current y screen location
        * @return     the current y screen location
        public double getScreenY()
            return screenY; // returns the current y screen location
    import java.awt.*;
    * Parent class of any game object that moves.
    * @author Kris Nelson
    * @version November 9, 2004
    public class MovingSprite extends Sprite implements Runnable
         protected double speedX, speedY; // stores the speed of an object in the x and y directions
         protected Thread timer; // the thread which controls animation for all moving objects
         protected boolean running; // tells the program whether or not the thread is running
         * Constructor for objects of class MovingSprite
         * @param  xPosition   the initial x screen position
         * @param  yPosition   the initial y screen position
         * @param  xSpeedValue   the speed in the x direction
         * @param  ySpeedValue   the speed in the y direction
         public MovingSprite(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
              super(xPosition, yPosition); // passes the initial screen positions to Sprite
              speedX = xSpeedValue; // sets the speed in the x direction
              speedY = ySpeedValue; // sets the speed in the y direction
         * Sends back the speed in the x direction
         * @return     the speed in the x direction
         public double getSpeedX()
             return speedX; // returns the speed in the x direction
         * Sends back the speed in the y direction
         * @return     the speed in the y direction
         public double getSpeedY()
             return speedY; // returns the speed in the y direction
         * Starts the thread in order to start animation
         public void start()
             if(timer == null)
                 timer = new Thread(this); // creates a new object of type Thread
                 timer.start(); // starts the new thread
                 running = true; // tells the program that the new thread is running
         * Empty since the child objects have their own run methods
         public void run()
         * Stops the thread from running
         public void stop()
             running = false; // tells the program that the thread is now done
    import java.awt.*;
    * Creates a single ball who's purpose is to bounce around and destroy the bricks.
    * @author Kris Nelson
    * @version November 10, 2004
    public class Ball extends MovingSprite
        protected static final double BALL_WIDTH = 15; // sets the width of the ball
        protected static final double BALL_HEIGHT = 15; // sets the height of the ball
        * Constructor for objects of class Ball
        * @param  xPosition   the initial x screen position
        * @param  yPosition   the initial y screen position
        * @param  xSpeedValue   the speed in the x direction
        * @param  ySpeedValue   the speed in the y direction
        public Ball(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
            super(xPosition, yPosition, xSpeedValue, ySpeedValue); // passes the initial screen positions and ball speeds to MovingSprite
            // !!!!!!!! have tried placing timer.start() here
        * Displays a ball onto the screen
        * @param  g   the Graphics object for this applet
        public void display(Graphics g)
            g.setColor(Color.blue); // sets the balls color
            g.fillOval((int)(screenX), (int)(screenY), (int)(BALL_WIDTH), (int)(BALL_HEIGHT)); // displays the ball
        * Runs the code that controls the balls animation
        public void run()
            do{
                try{
                    timer.sleep(100); // puts the thread to sleep for 100 milliseconds
                } catch(InterruptedException e) {running = false;}
                screenX = screenX + speedX;
                screenY = screenY + speedY;  // this is VERY SIMPLE BALL MOVEMENT FOR TESTING PURPOSES, WILL BE CHANGED LATER
            } while(running);
    }Sorry if that was too much code. I'm just trying to make this easier to follow.
    I placed a // !!!!!!!!!!!!! comment in the places where I have tried starting the ball thread.
    So basically, everything is running fine, except that I'm not at all sure of where to start the ball Thread, and thus can't start anything moving. If someone could tell me where I should be starting the thread, I would REALLY appriciate it. Thank you :D
    - Kris

    Some advice.
    1. the start method on the ball should be called from the start method on the applet and should in turn call the start method on the sprite's thread.
    2. the run method of the Moveable sprite should have been declare abstract
    3. don't implement borders manually. There's a java.awt.Border class for that.
    4. probably, you don't want to have the game invoke each sprite by name; just make a big list of all the sprites and invoke all of them every time
    5. do you really need provision for a non-circular ball? this isn't rugby.
    6. I don't think you ever had a threading problem, just a display problem.
    7. Don't write comments like this:     ball.display(g); // displays the ballHere's my (even more simplified version):import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    * Class BreakoutApplet - Plays a simple game of Breakout.
    * @author Kris Nelson, modified by Michael Lorton
    * @version November 10, 2004
    public class BreakoutApplet extends JApplet implements Runnable {  
        protected Ball ball;
        protected Paddle paddle;
        public boolean running; // tells the program whether or not the thread is running
        protected Thread timer; // the thread which controls the animation for the applet
        public void init() {
            // this is a workaround for a security conflict with some browsers
            // including some versions of Netscape & Internet Explorer which do
            // not allow access to the AWT system event queue which JApplets do
            // on startup to check access. May not be necessary with your browser.
            getRootPane().putClientProperty("defeatSystemEventQueueCheck",
                                            Boolean.TRUE);
             ball = new Ball(this, GAMEWIDTH / 2, GAMEHEIGHT / 2, 5, 5);
        public final static int GAMEWIDTH = 600;
        public final static int GAMEHEIGHT = 400;
        public void paint(Graphics g) {
            g.setColor(Color.lightGray);
            g.fillRect(0, 0,
                       GAMEWIDTH, GAMEHEIGHT);
            ball.display(g); // displays the ball
        * Called by the browser or applet viewer to inform this JApplet that it
        * should start its execution. It is called after the init method and
        * each time the JApplet is revisited in a Web page.
        public void start() {
            if(timer == null) {
                timer = new Thread(this); // creates a new object of type Thread
                timer.start(); // starts the new thread
                running = true; // tells the program that the new thread is running
            ball.start();
        * Runs the code that controls the animation
        public void run() {
            do{
                repaint(); // redraws the screen
                try{
                    Thread.sleep(100);
                } catch(InterruptedException e) {running = false;}
            } while(running);
        public void stop() {
            running = false;
    abstract class Sprite {
        protected double screenX, screenY; // stores the x and y location of the object
        protected final BreakoutApplet parent;
        * Constructor for objects of class Sprite
        * @param  xPosition   the initial x screen position
        * @param  yPosition   the initial y screen position
        public Sprite(BreakoutApplet parent, double xPosition, double yPosition) {
            this.parent = parent;
            screenX = xPosition; // sets the initial x screen position
            screenY = yPosition; // sets the initial y screen position
        * Sets new x and y screen locations for an object
        * @param  newX   the new x screen location
        * @param  newY   the new y screen location
        public void setScreenXY(double newX, double newY) {
            screenX = newX; // sets the new x screen location
            screenY = newY; // sets the new y screen location
        * Sends back the current x screen location
        * @return     the current x screen location
        public double getScreenX() {
            return screenX; // returns the current x screen location
        * Sends back the current y screen location
        * @return     the current y screen location
        public double getScreenY() {
            return screenY; // returns the current y screen location
        abstract public void display(Graphics g);
    * Parent class of any game object that moves.
    * @author Kris Nelson
    * @version November 9, 2004
    abstract class MovingSprite extends Sprite implements Runnable {
        protected double speedX, speedY; // stores the speed of an object in the x and y directions
        protected Thread timer; // the thread which controls animation for all moving objects
        protected boolean running; // tells the program whether or not the thread is running
        * Constructor for objects of class MovingSprite
        * @param  xPosition   the initial x screen position
        * @param  yPosition   the initial y screen position
        * @param  xSpeedValue   the speed in the x direction
        * @param  ySpeedValue   the speed in the y direction
        public MovingSprite(BreakoutApplet parent,
                            double xPosition, double yPosition,
                            double xSpeedValue, double ySpeedValue) {
            super(parent, xPosition, yPosition);
            speedX = xSpeedValue; // sets the speed in the x direction
            speedY = ySpeedValue; // sets the speed in the y direction
        * Starts the thread in order to start animation
        public void start() {
            if(timer == null) {
                timer = new Thread(this); // creates a new object of type Thread
                timer.start(); // starts the new thread
                running = true; // tells the program that the new thread is running
        * Runs the code that controls the balls animation
        public void run() {
            while (parent.running) {
                try{
                    Thread.sleep(100);
                } catch(InterruptedException e) {
                    System.err.println(e);
                step();
        abstract protected void step();
    * Creates a single ball whose purpose is to bounce around and destroy the bricks.
    * @author Kris Nelson
    * @version November 10, 2004
    class Ball extends MovingSprite {
        protected static final int BALL_DIAMETER = 15;
        * Constructor for objects of class Ball
        * @param  xPosition   the initial x screen position
        * @param  yPosition   the initial y screen position
        * @param  xSpeedValue   the speed in the x direction
        * @param  ySpeedValue   the speed in the y direction
        public Ball(BreakoutApplet parent,
                    double xPosition, double yPosition,
                    double xSpeedValue, double ySpeedValue) {
            super(parent, xPosition, yPosition, xSpeedValue, ySpeedValue);
        * Displays a ball onto the screen
        * @param  g   the Graphics object for this applet
        public void display(Graphics g) {
            g.setColor(Color.blue);
            g.fillOval((int)(screenX),
                       (int)(screenY),
                       BALL_DIAMETER, BALL_DIAMETER);
        protected void step() {
                screenX = screenX + speedX;
                if (screenX < 0) {
                    screenX = -screenX;
                    speedX = -speedX;
                else if ((screenX + BALL_DIAMETER)> BreakoutApplet.GAMEWIDTH) {
                    screenX = 2*(BreakoutApplet.GAMEWIDTH  - BALL_DIAMETER) - screenX;
                    speedX = -speedX;
                screenY = screenY + speedY;
                if (screenY < 0) {
                    screenY = -screenY;
                    speedY = -speedY;
                else if ((screenY  + BALL_DIAMETER) > BreakoutApplet.GAMEHEIGHT) {
                    screenY = 2*(BreakoutApplet.GAMEHEIGHT - BALL_DIAMETER) - screenY;
                    speedY = -speedY;
    }

Maybe you are looking for

  • Pavilion elite m9350f crashes

    May computer has started crashing with either re-booting or BSOD's. I am running the system with Vist 64 bit, all original hardware (I have not changed out anything) : AMD Phenom 9850 Quad-core processor 2.50 GHz 6GB RAM  Nvidia GeForce 9800GT I have

  • Multiple VLANs over 1300 series bridges

    Hi I am looking to connect a small external building to a main campus building by wireless bridge. The building i want to connect currently has two vlans, can the 1300 series bridges carry multiple vlans over the wireless bridge link? If so can anyon

  • Regarding Ranges : to search for a patter which starts with 0 and any no: 0

    HI, My requirement is to use ranges on LIFNR to select data from EKKO. Here, I need to give 000123 for a vendor 123. ie, I need to prefix zeros. The problem is I cannot use any pattern here.. like if I give 12*, the conversion exit will give a dump.

  • Updating rows of multiple tables

    This should be very simple..I'm missing out on something...I just want to update a row in each of the tables taking values from a master array..I spent a lot of time on this just bot able to get this right... the funny thing is it updates the table 1

  • This is not working. How do I get a refund? Order ADO14028493

    This did not work for me or the IT person helping me. How do I get a refund? I wish I would have read the reviews prior to ordering, but unfortunately, I trusted the Adobe name:-( Order # is ADO14028493.