AirTime / Threads and resulting problems

Hi,
i ve written something like a proprietary webservice to authenticate a user. So consider this code:
        MyHTTPRequest request = new PlayerRequest("authenticateLogin");
        request.addParameter("login", playername);
        request.addParameter("password", password);
        request.execute();
        if (!request.isError()) {
            Player[] playerArray = (Player[]) request.createObjectsFromHTTP();
            player = playerArray[0];
        } else {
            player = null;
        }execute() fires a new Thread and does the HTTP stuff. Now the Emulator shows the AIRTIME yes/no Screen. It locks because isError() contains a join(), this is because isError() must wait for the HTTP connection to finish to see what happened.
When i leave out the join() in the isError() method, i can answer the yes/no screen, but then my isError() gets a NullPointer, because the request is not finished.
So i have a situation, where i cant go on in my code before the HTTPRequest is ended, but i must be able to answer the yes/no screen.
I tried several things like a loop in the code above which asks if the thread from PlayerRequest is still running but as soon i do something like this, i got my deadlock on yes/no screen again.
Any suggestions?

thats exactly the problem why you have to use Threads. The main thread has first to be finished, before the networking thread can be started. By using join() you make the use of Threads obselete since this must be processed sequentially (because the main thread waits for the networking thread, in your implementation). Finally, for this what you want to do using threads is senseless, but they are mandatory for MIDP 2.0.
Okay, now for the solution ;)
You have to initiate the processing of the result from your networking thread. That means the main thread finishes and does nothing (or displays a gauge or sth). After the networking, the networking thread calls something like "processResult()" and thus gives the control back to the main thread. This is the principle of using threads: that they can work asynchronously and (more or less) independent from another.
hth
Kay

Similar Messages

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • Problem with threads and ProgressMonitor

    Dear Friends:
    I have a little problem with a thread and a ProgressMonitor. I have a long time process that runs in a thread (the thread is in an separate class). The thread has a ProgressMonitor that works fine and shows the tasks progress.
    But I need deactivate the main class(the main class is the user interface) until the thread ends.
    I use something like this:
    LongTask myTask=new LongTask();
    myTask.start();
    myTask.join();
    Now, the main class waits for the task to end, but the progress monitor don`t works fine: it shows only the dialog but not the progress bar.
    What's wrong?

    Is the dialog a modal dialog? This can block other UI updates.
    In general, you should make sure that it isn't modal, and that your workThread has a fairly low priority so that the UI can do its updating

  • Having a problem with threads and using locks

    I was hoping someone could give me some hits on getting my code to run properly. The problem I am having is I think my locks and unlocks are not working properly. Plus, for some reason I always get the same output, which is:
    Withdrawal Threads         Deposit Threads            Balance
    Thread 2 attempts $29 Withdrawal - Blocked - Insufficient Funds
    Thread 4 attempts $45 Withdrawal - Blocked - Insufficient Funds
    Thread 6 attempts $34 Withdrawal - Blocked - Insufficient Funds
    Thread 7 attempts $40 Withdrawal - Blocked - Insufficient Funds
                                    Thread 1 deposits $187          $187
                                    Thread 3 deposits $169          $356
                                    Thread 5 deposits $61           $417
    Press any key to continue...If someone can see the error I made and doesn't mind explaining it to me, so I can learn from it, I would appreciate that very much.
    /************Assign2_Main.java************/
    import java.util.concurrent.*;
    public class Assign2_Main
    {//start Assign2_Main
        public static void main(String[] args)
        {//start main
               // create ExecutorService to manage threads
               ExecutorService threadExecutor = Executors.newCachedThreadPool();
            Account account = new SynchronizedThreads();
            Deposit deposit1 = new Deposit(account, "Thread 1");
            Deposit deposit2 = new Deposit(account, "Thread 3");
            Deposit deposit3 = new Deposit(account, "Thread 5");
            Withdrawal withdrawal1 = new Withdrawal(account, "Thread 2");
            Withdrawal withdrawal2 = new Withdrawal(account, "Thread 4");
            Withdrawal withdrawal3 = new Withdrawal(account, "Thread 6");
            Withdrawal withdrawal4 = new Withdrawal(account, "Thread 7");
            System.out.println("Withdrawal Threads\t\tDeposit Threads\t\t\tBalance");
            System.out.println("------------------\t\t---------------\t\t\t-------\n");
            try
                threadExecutor.execute(withdrawal1);       
                threadExecutor.execute(deposit1);     
                threadExecutor.execute(withdrawal2);  
                threadExecutor.execute(deposit2);    
                threadExecutor.execute(withdrawal3);
                threadExecutor.execute(deposit3);       
                threadExecutor.execute(withdrawal4);
            catch ( Exception e )
                 e.printStackTrace();
                //shutdown worker threads
               threadExecutor.shutdown();
        }//end main
    }//end Assign2_Main/******************Withdrawal.java****************************/
    public class Withdrawal implements Runnable
    {//start  class Withdrawal
          *constructor
        public Withdrawal(Account money, String n)
             account = money;
             name = n;
        public void run()
        {//start ruin
             int newNum = 0;
                newNum = account.getBalance(name); 
               Thread.yield();
        }//end run
        private Account account;
        private String name;
    }//end  class Withdrawal/*******************Deposit.java***************/
    import java.util.Random;
    public class Deposit implements Runnable
    {//start class Deposit
          *constructor
        public Deposit(Account money, String n)
             account = money;
             name = n;
        public void run()
        {//start run
                try
                     Thread.sleep(100);
                   account.setBalance(random.nextInt(200), name);
                }// end try
                catch (InterruptedException e)
                  e.printStackTrace();
       }//end run
       private Account account;
       private Random random = new Random();
       private String name;
    }//end class Deposit/********************Account.java*****************/
    *Account interface specifies methods called by Producer and Consumer.
    public interface Account
         //place sum into Account
         public void setBalance(int sum, String name);
         //return  value of Account
            public int getBalance(String name);         
    } /**************SynchronizedThreads.java****************/
    import java.util.concurrent.locks.*;
    import java.util.Random;
    public class SynchronizedThreads implements Account
    {//start SynchronizedThreads
          *place money into buffer
        public void setBalance(int amount, String name)
        {//start setBalance
             // lock object
             myLock.lock();           
            sum += amount;
            System.out.println("\t\t\t\t" + name + " deposits $" + amount +"\t\t$"+ sum+"\n");       
               //threads are singnaled to wakeup
            MakeWD.signalAll();
              // unlock object                                                
            myLock.unlock();
           }//end setBalance
            *gets the balance from buffer
           public int getBalance(String name)
        {//start getBalance
             int NewSum = random.nextInt(50);
             //lock object
            myLock.lock();
            try
                 if(sum > NewSum)
                     //takes NewSum away from the account
                     sum -= NewSum;
                        System.out.println(name + " withdraws $" + NewSum +"\t\t\t\t\t\t$"+ sum+"\n");
                else
                     System.out.println(name +  " attempts $" + NewSum + " Withdrawal - Blocked - Insufficient Funds\n");                 
                     //not enough funds so thread waits
                        MakeWD.await();         
                //threads are singnaled to wakeup
                MakeD.signalAll();     
                }//end try
            catch (InterruptedException e)
                   e.printStackTrace();
            finally
                 //unlock object
                 myLock.unlock();
            return NewSum;     
         }//end getBalance
         private Random random = new Random();  
         private Lock myLock = new ReentrantLock();
         private Condition MakeD = myLock.newCondition();
         private Condition MakeWD = myLock.newCondition();
         private int sum = 0;
    }//end SynchronizedThreads

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • Problem with Thread and InputStream

    Hi,
    I am having a problem with threads and InputStreams. I have a class which
    extends Thread. I have created and started four instances of this class. But
    only one instance finishes its' work. When I check the state of other three
    threads their state remains Runnable.
    What I want to do is to open four InputStreams which are running in four
    threads, which reads from the same url.
    This is what I have written in my thread class's run method,
    public void run()
         URL url = new URL("http://localhost/test/myFile.exe");
    URLConnection conn = url.openConnection();
    InputStream istream = conn.getInputStream();
    System.out.println("input stream taken");
    If I close the input stream at the end of the run method, then other threads
    also works fine. But I do not want to close it becuase I have to read data
    from it later.
    The file(myFile.exe) I am trying to read is about 35 MB in size.
    When I try to read a file which is about 10 KB all the threads work well.
    Plz teach me how to solve this problem.
    I am using JDK 1.5 and Win XP home edition.
    Thanks in advance,
    Chamal.

    I dunno if we should be doing such things as this code does, but it works fine for me. All threads get completed.
    public class ThreadURL implements Runnable
        /* (non-Javadoc)
         * @see java.lang.Runnable#run()
        public void run()
            try
                URL url = new URL("http://localhost:7777/java/install/");
                URLConnection conn = url.openConnection();
                InputStream istream = conn.getInputStream();
                System.out.println("input stream taken by "+Thread.currentThread().getName());
                istream.close();
                System.out.println("input stream closed by "+Thread.currentThread().getName());
            catch (MalformedURLException e)
                System.out.println(e);
                //TODO Handle exception.
            catch (IOException e)
                System.out.println(e);
                //TODO Handle exception.
        public static void main(String[] args)
            ThreadURL u = new ThreadURL();
            Thread t = new Thread(u,"1");
            Thread t1 = new Thread(u,"2");
            Thread t2 = new Thread(u,"3");
            Thread t3 = new Thread(u,"4");
            t.start();
            t1.start();
            t2.start();
            t3.start();
    }And this is the o/p i got
    input stream taken by 2
    input stream closed by 2
    input stream taken by 4
    input stream closed by 4
    input stream taken by 3
    input stream closed by 3
    input stream taken by 1
    input stream closed by 1
    can u paste your whole code ?
    ram.

  • Little bit of thread and little bit of instant messenger design problem

    OK! i have a small problem here, i am planning on making a instant messenger server and client, not compatible with any out there(as of yet) and not using any stansard protocols out there, just something i made on my own. ok now the problem i am trying to figure out is....i have a "Messaging Server" as the name suggests it sends messages from one client to the other, how it is setup is, client connects to this server, the server accepts and creates a new thread for this client and adds a message listener to this client handler thread. as and when the server creates this thread for the client, it puts it in a vector which is keeping track of every client connected to this server. so now when the client sends a message to another client, basically it goes through this server, the thread upon receiving this message, fires a method of the listener. this method takes the message, finds out who it is going to(therefore the userid) and seaches the threads vector to find the appropriate thread and then just creats another striped down message out of the received message and calls a method in that thread to send this newly created message and hence the message should be sent.(i am speculating, i still have not created this)
    so the problem ia m logically facing is...at what point of time who is taking the load, what i mean by that is, when the thread receives the message, ofcourse it is this thread which is working is taking the load, but when the listener fucntion is fired which thread is handlign the call is it the client handler thread which fired the method or the messaging server thread which creates these threads?? now once that is solved, who(which thread) is doing the work when i call the fucntion in the other thread which i found aftre searching the vector. i mean i am thinking like this cuz i am not much in sink with the way threads work. i am also trying to figure out this to find out the load the server or the threads will be having.
    algo example:
    class messageServer
         vector currentWorkingThreads;
         messageListener listener;
         main()
              listener = new messageListener(); //should it be here or the other place i am mentioning below
              while(true)
                   clientHandler = socket.accept();
                   listener = new messageListener(); //should it be here or the other place i am mentioning above
                   //create a thread and add this thread object to the vector
                   thread.addLisenter(listener);
    class messageServerThread
         string userid;
         messageListener lis;
         run()
              object obj = in.readObject();
              lis.sendMessage(obj);
         sendMessage(obj)
              out.writeObject(obj);
              out.flush;
    class messageListener
         sendMessage(msSendMessage msg)
              //find the appropriate user thread
              loop(currentWorkingThread.next())
                   messageServerThread msgThread = (messageServerThread)currentWorkingThread.element();
                   if(msg.userid == msgThread.userid)
                        msReceiveMessage rcvMsg = msg.strip(); //dosent matter what this does, it just strips the unwanted info and returns the type msReceiveMessage
                        msgThread.sendMessage(rcvMsg);
    and if this is something out of the line, or not a good way of doing it, can someone help me with the design it would be gr8.
    thanx a lot
    -Ankur
    help would be greatly appreciated.
    [email protected]

    other, how it is setup is, client connects to this
    server, the server accepts and creates a new thread
    for this client and adds a message listener to this
    client handler thread. as and when the server creates
    this thread for the client, it puts it in a vector
    which is keeping track of every client connected to
    this server.ok so far.
    so now when the client sends a message to
    another client, basically it goes through this server,
    the thread upon receiving this message, fires a method
    of the listener. this method takes the message, finds
    out who it is going to(therefore the userid) and
    seaches the threads vector to find the appropriate
    thread and then just creats another striped down
    message out of the received message and calls a method
    in that thread to send this newly created message andhere you seem to confuse the thread instance and the thread of execution. the thread invoking this method is still the event handling thread (i.e. the receiver thread of the socket). you do not need threads for delivering - this can be done by the receiving sockets' event handling threads. disadvantage: if processing of the message takes significant time then the socket is blocked and cannot process another message.
    solution: put the message in an event queue which is processed by one or more threads. (see my example i e-mailed you)
    robert
    hence the message should be sent.(i am speculating, i
    still have not created this)
    so the problem ia m logically facing is...at what
    point of time who is taking the load, what i mean by
    that is, when the thread receives the message,
    ofcourse it is this thread which is working is taking
    the load, but when the listener fucntion is fired
    which thread is handlign the call is it the client
    handler thread which fired the method or the messaging
    server thread which creates these threads?? now once
    that is solved, who(which thread) is doing the work
    when i call the fucntion in the other thread which i
    found aftre searching the vector. i mean i am thinking
    like this cuz i am not much in sink with the way
    threads work. i am also trying to figure out this to
    find out the load the server or the threads will be
    having.
    algo example:
    class messageServer
    vector currentWorkingThreads;
    messageListener listener;
    main()
    listener = new messageListener(); //should it be
    e here or the other place i am mentioning below
    while(true)
    clientHandler = socket.accept();
    listener = new messageListener(); //should it be
    be here or the other place i am mentioning above
    //create a thread and add this thread object to the
    he vector
    thread.addLisenter(listener);
    class messageServerThread
    string userid;
    messageListener lis;
    run()
    object obj = in.readObject();
    lis.sendMessage(obj);
    sendMessage(obj)
    out.writeObject(obj);
    out.flush;
    class messageListener
    sendMessage(msSendMessage msg)
    //find the appropriate user thread
    loop(currentWorkingThread.next())
    messageServerThread msgThread =
    =
    (messageServerThread)currentWorkingThread.element();
    if(msg.userid == msgThread.userid)
    msReceiveMessage rcvMsg = msg.strip(); //dosent
    ent matter what this does, it just strips the unwanted
    info and returns the type msReceiveMessage
    msgThread.sendMessage(rcvMsg);
    and if this is something out of the line, or not a
    good way of doing it, can someone help me with the
    design it would be gr8.
    thanx a lot
    -Ankur
    help would be greatly appreciated.
    [email protected]

  • Objects, Threads and Problems.

    Hi, im having an issue with multiple objects and multiple threads.
    Essentially, i have three different class, and ideally would like only one object of each. The problem is that i need to access each one from the other two, so i have to create a new object in each one. I tried using runnable, but then you can only put in 1 thread, and im going to be running a lot more.
    Can anyone help?
    thanks.

    Essentially, i have three different class, and
    ideally would like only one object of each. The
    problem is that i need to access each one from the
    other two, That sounds like a bad design, but ok.
    so i have to create a new object in each
    one. Why? This way you end up with an infinate amount of objects. Just keep references to each other.
    I tried using runnable, but then you can only
    put in 1 thread, and im going to be running a lot
    more.I don't understand how this is related?

  • Remote and IR Problem

    A rather odd and annoying problem has recently been occuring on my MBP. A couple days ago my remote (after working without fail for over a year now) suddenly stopped working. Yesterday night and this morning it started working again but after a while it stopped again. I've read dozens of support articles which haven't really helped because there seems to be another problem.
    Most articles have stated that there is an option to disable the IR receiver in the "security" window under system preferences. When the IR and remote are not working this option disappears but when they are working the option is present. I have also tried replacing the battery without any result.
    I am now thinking that it might have something to do with heat buildup because it is mainly occuring after the laptop has been on for about a half hour, so I am going to try to borrow someone's fan.
    If anyone has any suggestions to solve this I would appreciate it if you could help. Thanks!
    MacBook Pro 1.83 GHz   Mac OS X (10.4.9)  

    check out this thread. Seems to be the same problem.
    http://discussions.apple.com/thread.jspa?messageID=4701905&#4701905

  • Timeline - Cannot Move Tracks and Display Problem

    I've created about a ten-minute timeline that I'd really prefer not to toss out because a lot of work went into creating parts of it and getting the timing right with the music, etc. When I first open the project in Premiere Elements, everything seems okay - my timeline plays with all transitions and I can scroll around in the timeline. However, I appear to have done something where whenever I click and drag to try to move a track, the timeline goes insane. I get a circle with a line through it for a cursor and a blank tooltip window, whether I try to drag the track horizontally or vertically. After that, while the timeline will still play, the timeline itself gets all wonky in its display, almost as if the video isn't refreshing on it. (It's kind of like the timeline has crashed.) I attached a screenshot of what it looks like. Whenever I move my cursor to the edge of the timeline, the timeline scrolls in that direction.
    I'm running Premiere Elements 7 Educational Version on  a Core 2 Duo laptop with 3GB RAM, an Intel 965 graphics chip (latest Intel drivers are installed), and Vista Business 32-bit. The clips are from a standard DV cam (not HD), and there are some PNG format stills and MP3 sounds mixed in there as well. There are three active A/V tracks. I think that's all the relevant information, but ask me if you need more.
    Can anyone tell me what I've done and/or how to fix this?

    Good morning every one!
    The bad news: As expected the problem does still occur. The good news: I was able to track it down to one clip in the timeline.
    To save others time, I will described what I have evaluated quite detailed in the following paragraphs...
    As it seemed to me that deactivating the Windows indexing service made the usage of PrE more stable I thought that maybe file locks would cause the trouble. So I verified this by opening the project in PrE, writing and executing a small Java application that puts an exclusive file lock on one of the files from the project and tried to move the according clip in the timeline. It worked without any problems and the known symptoms did not occur. So we can put aside the file locks.
    Afterwards I tried to reproduce the problem by playing around with the scene that caused problems last week. I tried by moving around the video clips and the problem did not occur. Then I remembered my statement I have made earlier, that the problems seemed to occur as I started to work with titles and music clips -- and bingo: I have three music clips in my "soundtrack" track and one of them seems to cause the whole trouble. After I have clicked on this specific music clip, the problem occurs and it is no longer possible to move anything in the timeline and the strange behaviour regarding the automatic scrolling when the cursor is at the left/right etch is activated.
    It was easily reproducable: Restart PrE, open my project, move a video clip to verify that moving clips works, click on the specific music clip and the problem occurs. I have tried this several times and each time the problem occured. When I clicked on one of my other two music clips everything was fine -- same for the video clips I tried. So in my case it seems to be this single clip.
    OK, what's specific regarding this clip: All my music files are placed on a share on my Windows home server (in contrast to the video footage which is located on the local HD). So I moved the "dangerous" music file to the local HD, changed the path to the file with a text editor directly in the PrE project file (which is a simple XML file) and started up PrE again. I verified that PrE takes the file from the local HD (server was down), but the problem did still occur. So it is not a network issue.
    The next specific thing is, that this music file is the only file in my project which is a .wma-file -- the others are .mp3-files. So I did three things:
    At first I downloaded the project file provided by SQFreak2 in this thread and checked whether he is also using .wma-files. The result: He does not use them.
    As the second thing I again changed my project file in the text editor: I changed the path of the music clip to some other .mp3-file. Afterwards I opened up PrE with that project file, used the playback to verify that the other music file is referenced by the clip instead of the original wma-file and then tried to move the clip -- again the symptoms occured.
    As the last step I created a new project, added the "problematic" wma-file, placed it on the "soundtrack" track and afterwards tried to move it. The result: No problems at all.
    So it neither seems to be a generic problem with wma-files nor does it seem to be a file-specific problem at all.
    Lets summarize the things from above: File locks do not cause any trouble. In my project a single audio clip seems to cause the problem. The problem seems to be caused by the clip and not the file referenced by the clip (no matter whether local or server based, wma or mp3, the problem occurs in every case).
    What I have learned? Well, I am not sure. But in the meanwhile I am quite sure, that it hasn't to do anything with hardware and drivers, but that we are dealing with a bug in PrE that occurs in specific project cirumstances.
    This morning I have got some additional ideas I would like to try to track the problem down (e.g. the problematic clip has a transition for a fade out in the end [when I did this I didn't knew, that a fade out could be easily achieved in the clip's properties] -- I will try to remove this one and look what will happen).
    P.S.: In one of my earlier posts I stated the assumption that the problem occurs as soon as I move the mouse cursor over the vertical scroll bar of the timeline -- but this is definitely not the case.

  • Threads and progressbar

    hello all,
    I am trying to display a window with an indeterminate progress bar while I am searching through files looking for a particular file. The problem is that when I display the window, the outline of it appears, but never fully displays.......what I attempted to do, was make the window implement runnable. Inside of the run method, I set a JProgressbar to indeterminate and set the window to visible. Right before the code that searches for the file, I created a new thread and gave it an instance of my window class, then called the start method of the thread.
    ex
    class window extends JFrame implements runnable{
    JProgressbar bar = new......
    public void run(){
    bar.setIndeterminate(true);
    this.setVisible(true);
    inside of the main class(which itself is a JFrame)
    Thread temp;
    window mywindow = new window()
    temp = new Thread(mywindow);
    temp.start();
    //searching code here
    mywindow.dispose();
    anybody have any suggestions why the window doesn't display???
    Thanks

    Have you tried it without making the Progress window a thread? Just try opening the window and them starting the search. If that fails, try making the search a separate thread. I would avoid making the window a thread. The swing classes have their own threads running in the background. One thing I found that helps keep windows from freezing is when you have to fire a long process resulting from an actionPerformed event you can do this without writing a lot of code:
    //normal
    actionPerformed(ActionEvent e)
       doSomething();
    //allows window to refresh
    actionPerformed(ActionEvent e)
        new Thread() {
           public void run() {
                doSomething();
        }.start();
    }

  • KT3 Ultra2 R and VGA problem

    I wonder if I could please get some ideas as regard this rather odd problem which I am encountering. This problem occurs when while the pc is 'shut down' if I disconnect the power supply ie switch off power by way of the switch on the psu. When I switch power back on again and boot, the pc begins its booting sequence it begins to launch windows and then it stops and a little red square (with a bit of green) appears in the top left hand corner of the screen. Now this problem does not occur if I shut down the pc normally (but don't cut off power supply). I have several partitions on my HDD and they are all affect at the same time. The end result is that I boot into safe mode I look at the refresh rate which is set to 'unknown' change it to 'adapter default' then reboot but upon reboot I get windows displaying screen at 640x480 with standard vga colours. I check in device manager under 'display adapters' what driver it's showing and it's the driver which I last loaded ie the correct one. I cannot change screen resolution , bit colour and the refresh rate only allows for 2 options, either 'optimal' or 'adapter default'. In order to get back to where I was, I have to remove and re-install my VGA driver and then everyting is back to normal (until I switch off power again at psu then back to square one). I have spoken to the manufacturers of the graphics card and they say that if the card works ok when I shut down pc normally and restart then cannot be the card. I described my problem in greater detail to MSI support and they said either VGA or O/S.
    In essence I wanted to isolate the problem to, is it 'hardware or 'software'.
    I would be grateful if anyone can shed some light.
    KT3 Ultra2 R   (5.5   not the right one but the cpu clock speed is correct at post)
    XP 2600+ 333 T'Bred
    Crucial 512 Mb PC 2700
    Leadted Ti 4400 128 MB Vivo (det 44.03)
    Creative Audigy
    Enermax 432W
    Windows 98SE (via 4-1 v 4.34)
    Seagate 60Gb 7200rpm   I am running the HDDs as independant drives on the
    Seagate 40Gb 7200rpm   Raid controller ie one on IDE3 & one on IDE4

    Odd as it might seem I have to follow the proceedure listed below if I want to switch off power altogether to work on my pc.
    1. Cold boot system with 166FSB and let O/S install
    2. Reboot enter Bios and reduce FSB to 133 make sure to set memory speed as HCLK and let O/S load
    3. Shut down and switch off power supply
    4. Reconnect power and boot system. Enter bios set FSB to 166 (the mem speed will be HCLK)
    5. System continues to boot and loads O/S
    From that point on, cold boots (without cutting power supply) are not problematic as once the 166FSB is 'registered' everything works ok (at every cold boot). So anytime I wanna work on my pc I guess I have to do the above 5 steps. They seem to work but need to try it out a few more times before I am confident that this process will always work.
    I am sure you agree that this is one strange mother of a problem.
    I suppose the only 2 things left are a total O/S reload or trying another 333 cpu because I have tried everything else.  I guess I will have to live with it.
    I have also cut some additional front vents so that front fan draws more air in and it appears to have dropped my idle Temp to 40.5C on CPU (running at clock 2083Mhz).
    As as said earlier in my post my system ran perfectly with XP2000+ and 512Mb PC2100. I merely upgraded the CPU to XP2600 and mem to PC2700 and it has thrown up this very odd problem. And to boot (if you will pardon the expression) when I first installed new CPU and memory it booted first time at 166FSB. osnavi, in case you upgrade your CPU to a XP2600 and you get this weird problem at least you can come back to to this thread and find this workaround.
    I wonder if anyone can fathom out why this is happening.......If not as I said I can live with it.
    wonkanoby, I will try the link to the memtest. That is the only thing I have not tested so will give that a try.
    -MSI KT3 Ultra2 Raid
    -AMD XP2600+ 333 T'Bred
    -Evercool CUD 725 Cooler
    -2x256 Mb PC 2700 Crucial
    -Leadtek Ti4400 128Mb Vivo
    -Creative Audigy
    -LiteOn DVD 16x
    -Liteon CDR48125w
    -HP CDR 9710i
    -Seagate Barracuda IV 60Gb (I am running the HDDs on the raid
    -Seagate Barracuda IV 40GB controller as 2 independant drives)
    -2 Case fan
    -Enermax 431W

  • Audio (and other) problems noted with Keynote version 4.0.1

    Since installing Keynote 4 and the 4.0.1 update, I have noted the following situations and/or problems:
    1) When doing a "save-as" the filename is appended with the suffix ".key" but when I subsequently "save" this file, the suffix disappears. The file seems to open and operate OK nonetheless, but this puzzles and somewhat concerns me that someday Keynote may not recognize the file. This happens whenever I "save" a slideshow after I have made any changes to it.
    2) When playing back a "soundtrack," the audio "glitches" frequently at slide transitions: this occurs repeatedly on my G5 desktop system but not on my MacBook Pro-17. The "glitches" always seem to occur at the same places in the track - which, of course, is also at the same slide transitions. (This problem has spawned several similar questions and threads in this forum.)
    3) Related to #2 above, the "glitches" also interrupt or corrupt the "recording" of that soundtrack, so that the synchronization is off when the slideshow is played back.
    4) If I want to have an audio track play under a series of slides, the only way I have found to accomplish this is to create a separate slideshow with the audio track running as a "soundtrack" and "record" the Builds and Transitions in sync with the audio. If I want to incorporate several of these shows together, I can create a "master" slideshow and Hyperlink each segment to the next. HOWEVER...
    5) When I "record" a "soundtrack" and "synchronize" the Builds and Transitions within the slideshow, everything plays back properly in sync ONLY when the slideshow is played as a stand-alone presentation (i.e. a cold start from the desktop). If I initiate playback of the slideshow via a Hyperlink from another presentation, the soundtrack plays but NONE of the synchronization works at all.
    6) The only way I have found to have an audio track "fade-in" or "fade-out" is to use off-line editing software to record these fades prior to importing the tracks into Keynote. The "Start Audio" Build function is simply a hard "cut" in, and the end of the track is a hard "cut" out.
    These problems are consistent and repeatable facts. Whether they are "bugs" in the software or "design shortcomings" is uncertain. Nonethtless ...
    At the risk of offending the moderators of this forum, I feel compelled to comment that these problems render the audio operations of Keynote less than satisfactory and should be addressed as soon as possible with another update to this visually stunning but audio-challenged application.

    Well Ron S, I re-confirmed why I prefer not to look to tech support for support.
    It seems to me that support's main function is to deflect any critical comments and push the blame back to the user.
    Frankly, I have better things to do with my time and money than try to help a multi-billion dollar enterprise learn about itself.
    So, for the benefit of you and the nearly 400 who have followed this thread, I offer you my latest and probably last attempt to have Apple acknowledge in some small way that "Houston, we have a problem".
    I expect this reply will result in this thread being yanked as well, since I'm expressing negative thoughts about Apple's product and wishing they would do better, which is a non-technical gasp of utter frustration and disappointment. Note that "product" is singular, defining Keynote. My other Apple products serve me loyally and superbly, which is why my huge disappointment with Keynote.
    So here is my correspondence with Tech Support. I've removed names except mine.
    I think it speaks for itself. They have notes from my conversations with them that I have current Apple computers, including a MacBookPro, not an old PowerBook, nevertheless, they have told me that the problem is mine because the fabulous hyper-performing Keynote software is choking my poor old machine (paraphrased muchly).:
    Hi (support),
    That's disappointing news, especially since this test was done on 3 machines: an old G4 400, a 2.0G Dual G5 and an Intel core duo MacBookPro which yielded identical results.
    It is not a hardware issue.
    I do not accept a brush-off that it is my hardware that is causing Keynote to be problematic.
    I will assume that Apple is not interested in addressing these issues in public and that Keynote is substandard software that is in need of re-authoring.
    Sorry to be so blunt, but Apple has set this tone with Keynote, and used its considerable reputation as a leading a/v technology innovator to imply that Keynote will deliver the excellence we Mac users have come to expect.
    I have been a loyal mac user since the SE series and have enjoyed success with the machines and software offered by Apple, and depend on them for my livelihood. I'm currently using FC Studio6 and know that Apple is capable of maintaining its high standards.
    However, Keynote fails to do that, instead behaving like a product that was invented in a teenager's basement and is in beta. I realize that it's not designed as a FCP level product, but it fails at the basic tasks that you advertise it will complete.
    A version 4 product should work as advertised. Keynote certainly does not.
    I'm deeply saddened that Apple seems to have become an iPod entertainment company, interested mainly in profits from entertainment rather than serious useful technology.
    On 2007-Oct-19, at 10:14 AM, (tech support) wrote:
    Hello Sir,
    Unfortunately, this does look like it's mostly a case of some of the new Keynote features slowing down the performance on the PowerBook.
    At this point, there isn't much else we can do in the way of troubleshooting.
    If you are not satisfied with the performance on the PowerBook, using the previous version of Keynote is probably his best option at this point.
    We will continue to research this issue, but at this point it's unlikely I'll be able to find additional suggestions for improving performance, as it looks like it is is reproducible and limited to older models.
    On Oct 16, 2007, at 11:27 PM, Ron Tucker wrote:
    Hi (support),
    Thanks for your recent followup calls. I'm directing a video shoot so am a bit preoccupied.
    Here are the tests I mentioned.
    These are as simple as it gets, and I think highlights the synchronization problem with Keynote.
    Test 1 is straightforward, and demonstrates that a single unedited recorded audio track will maintain mouse click synchronization.
    Test 2 is the same file, but with audio modifications applied to each slide in succession.
    This demonstrates a dramatic synchronization slippage.
    The visuals occur before the click (and audio) markers. Keynote seems to be create delay in audio at each "record and replace" point. This accumulates as the audio is revised in successive slides.
    These tests demonstrate that there is a fundamental flaw in how Keynote handles audio in its most basic application.
    This does not address the slim toolset available, such as lack of insert capability and other basic audio tools, which is a separate design issue, and I suppose subject to "request for enhancement" feedback.
    I've reluctantly abandoned Keynote for my project work at present until these basic issues are addressed and it can be demonstrated that Keynote can successfully execute its feature set.
    <TuckerKeynoteTest.zip>
    Message was edited by: Ron Tucker1

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • I am making code to try to make a game and my problem is that my code......

    I am making code to try to make a game and my problem is that my code
    will not let it change the hit everytime so im getting the first guy to hit 1 then next hits 8 and so on and always repeats.
    Another problem is that I would like it to attack with out me telling it how much times to attack. I am using Object oriented programming.
    Here is the code for my objects:
    import java.lang.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.Random;
    import static java.lang.Math.*;
    import java.awt.*;
    import java.awt.color.*;
    class rockCrab {
         //Wounding formula
         double sL = 70;                                   // my Strength Level
         double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
         double aB = 0;                                 // equipment stats
         double eS = (sL * bP) + 3;                         // effective strength
         double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
         //Attack formula
         double aL = 50;                                   // my Attack Level
         double eD = 1;                                   // enemy's Defence
         double eA = aL / eD;                              // effective Attack
         double eB = 0;                                   // equipment bonus'
         double bA = ((eA/10) * (eB/10));                    // base attack
         //The hit formula
         double fA = random() * bA;
         double fH = random() * bD;
         double done = rint(fH - fA);
         //health formula
         double health = floor(10 + sL/10 * aL/10);
         rockCrab() {
         void attack() {
              health = floor(10 + sL/10 * aL/10);
              double done = rint(fH - fA);
              fA = random() * bA;
              fH = random() * bD;
              done = rint(fH - fA);
              System.out.println("Rockcrab hit" +done);
    import java.lang.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.Random;
    import static java.lang.Math.*;
    import java.awt.*;
    import java.awt.color.*;
    class self {
         //Wounding formula
         double sL = 1;                                   // my Strength Level
         double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
         double aB = 0;                                 // equipment stats
         double eS = (sL * bP) + 3;                         // effective strength
         double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
         //Attack formula
         double aL = 1;                                   // my Attack Level
         double eD = 1;                                   // enemy's Defence
         double eA = aL / eD;                              // effective Attack
         double eB = 0;                                   // equipment bonus'
         double bA = ((eA/10) * (eB/10));                    // base attack
         //The hit formula
         double fA = random() * bA;
         double fH = random() * bD;
         double done = rint(fH - fA);
         //health formula
         double health = floor(10 + sL/10 * aL/10);
         self() {
         void attack() {
              health = floor(10 + sL/10 * aL/10);
              fA = random() * bA;
              fH = random() * bD;
              done = rint(fH - fA);
              System.out.println("You hit" +done);
    }Here is the main code that writes what the objects do:
    class fight {
         public static void main(String[] args) {
              self instance1 = new self();
              rockCrab instance2 = new rockCrab();
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
              instance2.health = instance2.health - instance1.done;
              System.out.println("You hit: " +instance1.done);
              System.out.println("rockCrabs health: " + instance2.health);
              instance1.health = instance1.health - instance2.done;
              System.out.println("RockCrab hit: " +instance2.done);
              System.out.println("rockCrabs health: " + instance1.health);
    }when the code is run it says something like this:
    you hit 1
    RockCrabs health is 9
    RockCrab hit 7
    your health is 38
    you hit 1
    RockCrabs health is 8
    RockCrab hit 7
    your health is 31
    you hit 1
    RockCrabs health is 7
    RockCrab hit 7
    your health is 24
    you hit 1
    RockCrabs health is 6
    RockCrab hit 7
    your health is 17
    my point is whatever some one hits it always repeats that
    my expected output would have to be something like
    you hit 1
    RockCrabs health is 9
    RockCrab hit 9
    your health is 37
    you hit 3
    RockCrabs health is 6
    RockCrab hit 4
    your health is 33
    you hit 2
    RockCrabs health is 4
    RockCrab hit 7
    your health is 26
    you hit 3
    RockCrabs health is 1
    RockCrab hit 6
    your health is 20
    Edited by: rade134 on Jun 4, 2009 10:58 AM

    [_Crosspost_|http://forums.sun.com/thread.jspa?threadID=5390217] I'm locking.

  • Java threads and WinLogon processes taking CPU!

    We are seeing a strange problem. We have a multi-threaded java application
    that is deployed on a Microsoft Windows 2000 server (SP4) with Citrix
    Metaframe XP (Feature release 2). When this application starts, we start to see
    multiple WINLOGON.EXE processes (20 plus) each taking up 1-2% of CPU -
    this raises the CPU usage on the server significantly, impacting performance.
    We have tested with JDK 1.3, 1.4, and 1.5 and see the same issues. If we
    run the java application in a single thread, we dont see the same issue.
    Has any one seen this problem before? Any suggestion on how this can be resolved?
    Thanks in advance!

    Thanks for your replies. This is a Citrix environment where there are 50 plus
    users logged in and there are 50 plus instances of Winlogon.exe always
    running. Most of the time the cpu usage of these processes is 0.
    We tried a multi-threaded program that lists files in a directory every few
    seconds. There are 40 plus servers in the farm that we are deploying this
    application on. We are seeing this problem on only some of the servers.
    If we run a single thread from main(), we dont see the issue. But if we spawn
    10 threads doing the scans periodically, we notice that as soon as all the threads
    start, the WinLogons appear to start to take up CPU. When we stop the java
    program, the WinLogon processes drop in CPU usage.
    Is it possible that Java and WinLogon share some dlls that could be triggering
    the WinLogon processes off?
    We have tried running the single thread and multi-threaded programs around
    same time and the correlation with the winlogons is clearly visible. If we add
    sleep() soon after we start a thread, the winlogons seem to kick in later.

Maybe you are looking for

  • How can I list path of all muisc NOT stored in iTunes Muisc Folder?

    Hi I'm trying to help out a friend (using a Vista PC) with this... Is there a utility which will list the file path of all the music files in the iTunes Library _which are not in_ the iTunes Music Folder? We have discovered that there are many many t

  • Not able to create new repository

    H, While creating the new repository under Virtaul Content Repository, i am getting follwing error. Please help The Repository class: com.documentum.beaspi.webcache.WebCacheRepository is not a valid implementation. Please check your classpath. I have

  • Transfering to new PC - want to keep the settings & boolmark

    Transferring to a new computer. How do I find and copy the existing settings & bookmarks to the new m/c? Thanks for your help

  • MotionX Drive App

    My iPhone App Store won't recognize my "MotionX Drive" app as the most current version...recurrently tells me to update...in the Update screen, however, the app is updated/purchased and the "Open" button is visible...anyone else seen this problem, an

  • Confused with picture count. Can somebody explain?

    I am thinking about getting the new 5s and wanted to see how much storage I will need. When I view "Camera Roll" the picture count is 304. When I view the photo count through Settings..General..About... the photo count is 617. Why are these numbers s