How do i run two threads with different sleep times?

How do i run two threads with different sleep times?
Ive got thread A and thread B, they both update a jpanel.
They both start when i press the start button.
However thread A updates every 250ms and thread B updates every 1000ms. i cant just run them both at 250ms becuase this will mess it up.
So for every four runs of thread A i want thread b to only be run once
Does anyone know how to do this?
Thanks, Ant...

ok, ive done it but now i cant stop it!
ive added buttons to start and stop, the start button works but the stop button doesnt. why doesnt "t.stop();" work?
    public void run() {
        while(t == Thread.currentThread()) {
            System.out.println("No " + t.getName());
            if (t.getName().equals("1")){
                try {
                    t.sleep(1000); // in milliseconds
                } catch (InterruptedException e) {}
            } else{
                try {
                    t.sleep(250); // in milliseconds
                } catch (InterruptedException e) {}
    }

Similar Messages

  • Run two VIs at the same time

    Hello!
    I want to know how i can run two VIs at the same time.
    I mean that i want to run a second VI ( N.2) while another VI (N.1) is in
    execution without suspend it (N.1)
    If anyone has suggestions, please help me!
    Thank you very much.
    roby.

    If you say "run a vi", I assume that you have the VI open in LabVIEW, then press the run button. (Some of the earlier answers taks about programmatically calling VIs, which I don't think is the focus of your question)
    You can run as many VIs as you want at the same time. Simply press the run button of the second VI and they will both run.
    Of course you should ensure that they don't use the same resources (e.g. DAQ device, or listen on the same TCP port, etc.) In these cases, the second VI might fail. (Also if the second VI is a subVI of the first VI, you won't be able to run it seperately, because it will be already running.)
    LabVIEW Champion . Do more with less code and in less time .

  • How can I setup an .indd with two columns with different threads so that I can export to epub?

    Hi all. Sorry, english is not my native language. I´ve made an .indd: each page has two columns with different threads (is a bilingual text). When I export this .indd to .epub only appears one column from a thread following the next thread. What can i do to fix this? My indesign is CS6
    Thank you

    There are fixed format EPUB files as can be used for children's books, etc. where there are a lot of illustrations. However, those are very work-intensive to produce. I've never worked on one.
    Anne-Marie Concepcion did a Lynda.com video on producing one.
    Rorohiko produces a product called ePubCrawler which can help in produced fixed format EPUB files:
    Fixed Layout EPUB Assistant In InDesign: ePubCrawler | Rorohiko ...

  • I have two users with different music on each itunes and i can only use one library, how do i use both for one iTouch?

    i have two users with different music on each itunes and i can only use one library, how do i use both for one iTouch?

    Chris, I believe this link may have the information you're looking for. Welcome to discussions!
    http://docs.info.apple.com/article.html?artnum=300432

  • How do I sync two ipods with two different IDs on the same computer?

    How do I sync two ipods with two different IDs on the same computer?

    Simply connect them.  One computer with one iTunes can manage multiple devices.  They're tracked by S/N but you might wish to assign them unique names so that you can track them yourself.
    The only minor issue is app updating and purchases while on the computer.  It's necessary to log out and back in to the "correct" ID.  Much easier to do these things from the iPods.

  • HT204053 I have two iphones with different numbers that I use my apple ID for purchases, etc.  How do I get my second iphone setup on icloud?  I would like to use the features of icloud for both of my iphones.  Thank you

    I have two iphones with different phone numbers that I use.  I have one of them set up on icloud now, but do not know how to set up my second device on icloud.  Both of my iphones use my same Apple ID for purchases, etc.  Is there a simple way to add a device to my icloud account?  Thank you in advance for any help someone may be able to give me.

    To move one of the phones to a different iCloud account (if that's what you want to do), go to Settings>iCloud and turn all synced data to Off.  When prompted, choose to keep the data on your iPhone.  After everything is off, scroll to the bottom and tap Delete Account.  This will delete the account from the phone but not from iCloud so the other phone will not be effected.  Then set up a new iCloud account with a different Apple ID and turn iCloud syncing in Settings>iCloud back to On.  When prompted, choose Merge.  This will upload the data to the new iCloud account.
    You will then have to go to icloud.com and sign into each iCloud account separately and delete any unwanted data that you don't want on the phone syncing with each account.

  • I have 2? How do I sync selected photos from my IPad to my IMac w/o losing all photos on my IPad and getting the phoos o my IMac. ou see I have two IMacs with different sets of photos. Also want to convert all Apple works docs to pages docs on my IMac.

    I have 2? How do I sync selected photos from my IPad to my IMac w/o losing all photos on my IPad which will be replaced with the photos on my IMac.You see I have two IMacs with different sets of photos. Also want to convert all Apple works docs to pages docs on my IMac. Is there and app available to do the former. many thanks. b

    The iPad and related software is designed to sync with only one computer. I suggest transferring the photos from one of your iMacs to the other so that all photos are on one Mac. Same for all other files you want to sync over.
    To get those AppleWorks files to the iPad you'll have to determine if Pages will open them. If it will then use the file sharing feature of iTunes to copy them to Pages on your pad.
    If Pages will not open the AppleWorks files directly you'll have to save them in some format that Pages will read. These include but may not be limited to Pages and Word formats.

  • How to run two files with same url-  urgent

    hi,
    i created two servlet page and both are working very fine.but at same time i only able to run one file with same url. Is possible to run two or more file at same time with same url name..
    if you r not understanding what i want to ask then, i have two file names under helloWeb directory
    1) helloWorld.java(servletname s1, url /man)
    2) helloWeb.java (servletname s2,url /man)
    to run - http://localhost:7001/helloWeb/man - it runs very first file which is added to deployment module.
    so i want to know how i can run both file with same url, for this what i have to pass on my address bar.
    plz help me i m wating
    <b></b>

    Hi,
    We can give same url mapping to both Servlets but we can access the servlet which is entered first in web.xml because whenever we send a request to the webserver then webserver look at the elements in web.xml file one by one.
    When it finds the corresponding url mapping then immediately sends the response to the client.The same url mapping for the next element will be ignored.
    I think there is no possibility to access both servlets with same url.
    Regards
    Anilkumar kari

  • How to compare two rows from two table with different data

    how to compare two rows from two table with different data
    e.g.
    Table 1
    ID   DESC
    1     aaa
    2     bbb
    3     ccc
    Table 2
    ID   DESC
    1     aaa
    2     xxx
    3     ccc
    Result
    2

    Create
    table tab1(ID
    int ,DE char(10))
    Create
    table tab2(ID
    int ,DE char(10))
    Insert
    into tab1 Values
    (1,'aaa')
    Insert
    into tab1  Values
    (2,'bbb')
    Insert
    into tab1 Values(3,'ccc')
    Insert
    into tab1 Values(4,'dfe')
    Insert
    into tab2 Values
    (1,'aaa')
    Insert
    into tab2  Values
    (2,'xx')
    Insert
    into tab2 Values(3,'ccc')
    Insert
    into tab2 Values(6,'wdr')
    SELECT 
    tab1.ID,tab2.ID
    As T2 from tab1
    FULL
    join tab2 on tab1.ID
    = tab2.ID  
    WHERE
    BINARY_CHECKSUM(tab1.ID,tab1.DE)
    <> BINARY_CHECKSUM(tab2.ID,tab2.DE)
    OR tab1.ID
    IS NULL
    OR 
    tab2.ID IS
    NULL
    ID column considered as a primary Key
    Apart from different record,Above query populate missing record in both tables.
    Result Set
    ID ID 
    2  2
    4 NULL
    NULL 6
    ganeshk

  • How to combine two applications with different workspaces in APEX

    Hi,
    Can anyone help out in merging two applications with different workspaces in APEX 3.2 ?
    Thanks in advance,

    Hello Satya,
    >> I am Satya …
    Please take one more step to help us and update your forum handle to something friendlier than user123… Thanks.
    >> Can anyone help out in merging two applications with different workspaces in APEX 3.2 ?
    This is not a trivial task.
    You didn’t mentioned if both workspaces sharing the same APEX instance, or they are on two different instances (machines). I believe the latter is a pre-condition to a success.
    First you need to remember that importing an APEX component, like a single page, is possible only to the same application that it was exported from. This is still valid if you have the same workspace on two separate APEX instances – one is an import of the other (which makes it an identical copy). Still, the application ID must be the same, or you’ll get the following error: “This page was exported from a different application or from an application in different workspace. Page cannot be installed in this application.”
    You can’t simply manipulating the export file, if the two workspaces are sharing the same APEX instance, as all workspaces on the same instance shares the same APEX metadata files, and you’ll receive a “unique constraint violated” error messages. That means you can’t import one application into the workspace of the other, even if you are using a different application ID.
    As far as I can see, the only viable way of doing an application merge is to have two identical workspaces, on two separate APEX instances. The two applications should share the same application ID, although this parameter can be changed in the import file. You should export the page in one application – on the first instance – and import it into the other application – on the second instance.
    You should also make sure that the exported page ID doesn’t exist on the target application, otherwise it will be replaced by the new imported page. Also, if the imported page include references to shared components that are not defined on the second application, it might also pose a problem.
    As I said, this is not trivial. The benefits are mostly depend on the amount and complexity of the pages you want to merge. If they are not many, and simple, you should consider just re-creating them on the target application. If they are very complex, the merge might fail anyway.
    Regards,
    Arie.
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • How do i link itunes between two computers with different Apple ID's

    how do I link itunes between two computers with different Apple ID

    You need to set up two user accounts on the mac.  System Preferences>Users & Groups.  Then each user can set up apple IDs for itunes and icloud any way they want.

  • How to join two columns between two tables with different column names

    Hi
    How i can join 2 columns with different names between the 2 tables.
    Can any one please give solution for this.
    Thanks
    Manu

    Hi,
    basic understanding of joins:
    If you want to join 2 tables there should be matching column w.r.t. data and it's data type. You need not to have same column names in both the tables...
    so, find those columns which has got same values..

  • How to run two thread parallel y on two cores of dual-core ??

    I want to run two threads on two cores ???
    is there any package which support parallel computing??
    can we do this by using java.util.concurrency pakage??
    Thanks you
    please Reply.....

    vikram_p wrote:
    I want to run two threads on two cores ???ok
    Threads are automatically spread over the available cores, as the OS sees fit.
    is there any package which support parallel computing??Java does so without any external libraries.
    can we do this by using java.util.concurrency pakage??yes
    One question mark per question is plenty, thank you.

  • How can I run the report for different input values at the same time?

    Reports version: Report Builder 6.0.8.13.1
    Oracle version: Oracle8i Enterprise Edition Release 8.1.7.0.0
    I want to run the same report for different input parameter values and spool each o/p to different file and ftp to a server. For this, as a first step, I am spooling different input values in to a file, reading those values through a loop and calling the report for that input values. Each report run/execution is taking 15 minutes. Total report execution is taking approximately 4 hours (assuming 16 different input values) to complete. So I have to wait 4 hours to see ALL outputs.
    I would like to run the report parallel for ALL the input values and I should be able to see the ALL outputs with in 15 or 16 minutes.
    In my shell script, I added & symbol at the end of the report call to start/run the job in the background. Due to this the control passed to the next step after the report call. At this place I have an ftp command to send the output file to a different server and it is giving error some thing like “o/p file is not available/created yet". This is due to the fact that report writer is NOT yet completely started/initiated or it is NOT completed the spooling.
    How can I run the report at the same time for all the input values and save the time?
    Thanks in advance.
    Kishore.

    Increase the number of server engines running right now it seems there is only one engine running ,increase it to 4 or 6
    and then atleast 4 or 6 reports will run simultaneously.
    For FTPing the output add to your sript to check whether it is locked and if not then only try to ftp .
    Also for more better functionality read the document (chapter 15 ) for 10g reports for its new fuinctionality.
    http://download.oracle.com/docs/cd/B14099_17/bi.1012/b14048/toc.htm
    Thanks
    Subodh

  • Can I backup two devices (with different documents) to one iCloud account?  For example: iPad and iPhone, not everything is synced between the two, but I would like to backup each (seperately in the cloud), is this possible?

    Hello Apple Community,
    Can I backup two devices (with different documents) to one iCloud account? 
    For example: iPad Air and iPhone 5, not everything is synced between the two, but I would like to backup each (seperately in the cloud).  Is this possible?
    This way when I change from an old ipad to a new, I can restore with the ipad backup, and when I change from an old iphone to a new, I can restore from the
    iphone backup.
    Thank you in advance!

    Terminology check here. Do you really mean a "CD"?  There's a difference in Cloud behavior between content from a physical CD you ripped (which only has Cloud content if you have iTunes Match) and an "album" you bought from the iTunes Store.
    Read references for Home Sharing.
    iTunes: How to share music and video - http://support.apple.com/kb/HT2688 - about Music Sharing and Home Sharing
    Home Sharing Support page - http://www.apple.com/support/homesharing/
    iOS: Setting up Home Sharing on your device - http://support.apple.com/kb/ht4557 - "With Home Sharing in iOS 4.3 or later, you can stream your entire iTunes library over your home Wi-Fi network from your Mac or PC right to your iPhone, iPad, or iPod touch."
    The above can get pretty complicated.  You are probably best off by syncing both devices to a single library and/or updating the libraries on both computers to have the same content.

Maybe you are looking for

  • Urgent!!!  Issue in using GOS(Generic Object Services)

    Hello Friends, I have created a GOS Business object and i am using this to attach documents at the selection screen of my programs. The implementation is successfull and working fine. When i execute my program, i can see the GOS Toolbar, i am able to

  • An unknown error occurs when trying to use daq express VI's

    When I try to open the daq express VI in labVIEW 8.2 (it doesn't matter which one), the program tries to "initialize" like its supposed to, but then it says that NI Assistant host encountered an error and needs to close, then gives a message saying "

  • Can I close my MBA while running an external monitor?

    I'd like to drive a 27" external monitor, using a bluetooth mouse and keyboard. Can I do this and close the laptop? Macbook Air or Macbook Pro? Thanks for any help.

  • MIURA File on desktop

    Hi All, I unplugged a windows external drive my Macbook Air without ejecting it and ever since then a file or drive named MIURA appears on the desktop everytime I turn the machine on. I can eject this file or put it in the trash can but it keeps comi

  • Apache PW Authentication & Leopard

    i have an apache site running on my G%. i had password authentication working fine under Panther and Tiger. just upgraded to Leopard and it seems not to be working. it's as though none of the httpd.conf edits (that i see are still there) are not taki