Stop timer programatically

I know how to programmatically set the start date/time for the timer to start executing...
But how does one set the end time so that the TimerTask would gracefully stop executing..
This is the scenario:
I want to post data to a servlet at a 5 minute interval and I want to do this only from 8 am to 5 pm everyday.
I know that I need 2 TimerTasks. TimerTask1 and TimerTask2
TimerTask1 is to execute scheduleAtFixedRate() every 5 minutes. And TimerTask2 needs to execute every 8 am.
How do I tell TimerTask1 to stop posting data to the servlet when the time reaches 5 pm?
Pls help. Thanks.

put it in a tread that spawns at 8:00 am and then the spawned thread can check time every XX minutes. When it's 5pm stop the tread and dispose it appropriately.

Similar Messages

  • How do I find and clear all ticked Stop Times in music tracks?

    I have lots of music tracks which have the Stop Time ticked under the Options tab in Get Info. I don't know why they are ticked as I didn't do it, but now I want to clear them all as it causes tunes to stop abruptly in playback. I've looked for a script that would do this, but no luck. If there's no available script, perhaps if I could at least find all of the songs with Stop Time ticked, that would be a start. Does anyone either know of a way to clear all ticked Stop Times, or at least create a playlist of all songs with Stop Time ticked? If anyone knows why Stop Time gets ticked for some songs and not others, that would also be useful information. Thanks in advance.

    barney97,
    Maybe this script in can be of help:
    tell application "iTunes"
    if selection is not {} then
    set sel to selection
    repeat with this_track in selection
    try
    set finish of this_track to 1000
    end try
    end repeat
    display dialog "Done!" buttons {"Thanks"} default button 1 giving up after 5
    end if
    end tell
    Replace the "1000" with the number of seconds of your longest track, compile and run the script. The script tries to set the Stop Time to 1000 seconds. If your tracks are shorter in duration, the Stop times just will be cleared.
    Run Script Editor (in ./Applications/Applescript) and copy the script (grey block above) to it.
    Click the 'Compile' button and save it as a script in ./Library/iTunes/Scripts.
    It will then appear in the Script menu in iTunes.
    Next, select all tracks in your Music Library (Command-A) and run the script.
    It's not a very elegant solution, but it works.
    If anyone knows why Stop Time gets ticked for some songs and not others, that would also be useful information.
    I can't tell you that. I've never experienced a phenomenon like that.
    Maybe some iTunes related Widget or iTunes supporting application is responsible for that.
    Hope this helps.
    M
    17' iMac 800 MHz, 768 MB RAM, 200 GB HD, DL burner   Mac OS X (10.4.9)   iTunes 7.2

  • I do not have the 'Advanced' tab on the menu bar. I am trying to change ringtone on my iphone 4s. Have done the following: Right cick on song, entered the start and stop times, but unable to proceed as need 'Advanced' tab in order to change to option.

    I do not have the 'Advanced' tab on the menu bar. I am trying to change ringtone on my iphone 4s. Have done the following: Right cick on song, entered the start and stop times, but unable to proceed as need 'Advanced' tab in order to change to option.

    You don't need to upgrade your software.  But if you're struggling with Spry, IMO you should cut your losses and switch to something better for the longrun.
    If you have a budget to work with, I highly recommend Project Seven's Pop-Menu Magic 3.  It's easy to use in DW CS4, 5, 6 or CC.  More importantly, it's bullet proof and works in all devices. 
    Pop-Menu  Magic3 by PVII (commercial DW extension)
    http://www.projectseven.com/products/menusystems/pmm3/index.htm
    If you don't have a budget to work with, you can roll your own menus with jQuery plugins.  A bit more effort on your part, but they perform better than Spry.
    jQuery Superfish
    http://users.tpg.com.au/j_birch/plugins/superfish/
    jQuery MegaMenu2
    DEMO:
    http://www.geektantra.com/projects/jquery-megamenu-2/
    DOWNLOAD:
    http://code.google.com/p/jquery-megamenu/
    Nancy O.

  • Stop times not working in latest update

    I updated my iTunes a few days ago. Today I discovered that my stop and start times I had placed on some of my tunes have been reset to the original times. I can adjust them (the changes show in the Info panel) but that does not affect playback: the songs continue on past the stop time indicated.
    MacBook Pro   Mac OS X (10.4.6)  

    so it seems both "start time" and "stop time" should be checked for the song (on the info-options tab), as should "remember playback position."

  • How do I stop Time Machine from backing up Aperture thumbnails?

    Hi,
    My 2TB backup drive recently became full, and I became curious as to what was filling it up. I wrote a perl script to analyze the Time Machine backups, and I noticed that over 50% of my backup was filled with AP.Thumbnails and AP.Minis from the Aperture project directory. In particular, the AP.Thumbnails files in the backup consumed 737 GB of disk space!
    The problem with the thumbnails files is that they are a single file that contains all of the thumbnails for all of the 40,000 photos I have in Aperture and it is now 20gb in size. Every time I add a new file to Aperture, the thumbnail file changes, and I get a new 20gb of data added to my backup. I add photos often which means that most of my backups have 20gb of Aperture files (which are easy to rebuild and don't need to be backed up).
    I decided to try and stop Time Machine from backing up these files, and there seems to be no way of doing so (without telling Time Machine to skip backing up my entire Aperture project which I don't want to do). In Finder, you can do a "show package contents", but the Time Machine GUI doesn't allow this.
    I tried to tell Time Machine to exclude the files via the GUI, but Time Machine sees the Aperture Library as a single package and won't let me exclude individual files from within the package.
    I googled around, and found the attribute that Time Machine puts on files to exclude them from the backup. I used xattr to set the attributes:
    xattr -w com.apple.metadata:comapple_backupexcludeItem com.apple.backupd <filename>
    I also used this command on the iPhoto thumbnail files.
    I used spotlight to find all of the files with this attribute using this command:
    sudo mdfind "comapple_backupexcludeItem = 'com.apple.backupd'"
    This command returned the iPhoto files, but did not return the Aperture files.
    However, if I run "xattr" on the Aperture files, the attribute does exist!
    During my next time machine backup, the iPhoto files were skipped as I wanted them to be, but the Aperture thumbnails were backed up again
    I thought that maybe time machine was looking at the aperture package as an atomic unit, but iPhoto is stored as a package as well, and the attributes worked there on files inside the package.
    Does anyone have any idea why time machine is still backing up these files? Is there any way I can get around this?
    It seems to me to be an incredible oversight on Apple's part since both tools are Apple. The thumbnails files are very expensive to backup, and they are not necessary for backup since the are easy to rebuild from the original photos which are also backed up.
    Thanks,
    Ron

    Shadow99999 wrote:
    Hi,
    My 2TB backup drive recently became full, and I became curious as to what was filling it up. I wrote a perl script to analyze the Time Machine backups,
    No need to write your own script for that. there are a couple of already made nice GUI tools for this - TimeTracker http://www.charlessoft.com/ and BackupLoupe http://soma-zone.com/BackupLoupe/
    and I noticed that over 50% of my backup was filled with AP.Thumbnails and AP.Minis from the Aperture project directory. In particular, the AP.Thumbnails files in the backup consumed 737 GB of disk space!
    The problem with the thumbnails files is that they are a single file that contains all of the thumbnails for all of the 40,000 photos I have in Aperture and it is now 20gb in size. Every time I add a new file to Aperture, the thumbnail file changes, and I get a new 20gb of data added to my backup. I add photos often which means that most of my backups have 20gb of Aperture files (which are easy to rebuild and don't need to be backed up).
    I decided to try and stop Time Machine from backing up these files, and there seems to be no way of doing so (without telling Time Machine to skip backing up my entire Aperture project which I don't want to do). In Finder, you can do a "show package contents", but the Time Machine GUI doesn't allow this.
    I tried to tell Time Machine to exclude the files via the GUI, but Time Machine sees the Aperture Library as a single package and won't let me exclude individual files from within the package.
    I don't have aperture but I think most people exclude the whole thing from TM backups and back it up separately. but if you want to exclude a subfolder in a package that's easy too. just select the package in finder, control-click on it and select "show package contents". in the resulting finder window drill to the folder you want to exclude and drag it to the TM exclusion list in TM system preferences->options.
    I googled around, and found the attribute that Time Machine puts on files to exclude them from the backup. I used xattr to set the attributes:
    xattr -w com.apple.metadata:comapple_backupexcludeItem com.apple.backupd <filename>
    I was not aware of this method for excluding stuff from TM backups. could you provide a link to where you found this?
    I also used this command on the iPhoto thumbnail files.
    I used spotlight to find all of the files with this attribute using this command:
    sudo mdfind "comapple_backupexcludeItem = 'com.apple.backupd'"
    This command returned the iPhoto files, but did not return the Aperture files.
    that's because Spotlight never looks inside packages unless you start a search inside a package directly. iphoto seems to be the only exception. I don't know how it's done.

  • In Month View, showing start and stop times for appointments

    Hi, I want to show both the start and stop times for all appointments in my iCal Month view and have not been able to figure out how to do that. Any suggestions? - Dave

    I would also like to know how to do this if possible. I want to print month-view schedules with start and end times for events. Thought I'd bump this up to see if anyone has any ideas.

  • Can't change stop time on song

    Hi all.
    I have a song recently purchased on iTunes that won't let me change the stop time. The actual play time for the song is 3:21, but it stops and goes to the next song, in iTunes, after 3:08. I am not having any problems with the stop time with the same song on my iPhone 4. I know how to chage the stop time of a song; I've done it many times before. But when I go to the options tab on the song, select the stop time check box, and change the time, then click OK, it beeps at me and the stop time goes back to 3:08.
    Please help!

    Can you confirm that you're -
    1 - selecting, then right-clicking a track
    2 - selecting Get Info in the context menu and then going to the Options tab
    3 - then using the mouse arrow to position the cursor in the Stop Time field
    4 - and then changing the entry in that field.
    If so, at what point does the problem occur?

  • Printing event start and stop times

    In month view, is there any way to have both the start and stop times for an event show when you print the calendar so you can see the duration of an event - thanks.

    You might be able to use this script to reset the start/stop times to zero.  Try with a small selection and see if it works for you.
    http://dougscripts.com/itunes/scripts/ss.php?sp=batchtrimtime

  • Why doesn't the stop time option work in videos in itunes?

    I downloaded some music videos into iTunes and some have intor's or crdeits that I wanted to cut out.  I tried using the "Get Info" and changing the start and stop times there.  It will change the start times, but will still play through to the end of the video instead of stopping at the time I had indicated.  When I go back and check, the stop time box is still checked and marked where I want it ... any suggestions?  I just upgraded the iTunes software, thinking maybe that was it, but still a no go.

    It work now.
    I just downloaded OSX 10.9.3 and iTunes 11.2 and one or both of them has fixed the problem.  (Been broken for years).  Have fun

  • How do I change the start/stop time for multiple songs not just one song at a time?

    How do I chnage the start/stop time for multiple songs not just one song at a time?

    I don't think you can in iTunes.
    Multiple editing in Get Info does not offer an option to change start/stop times.

  • My ipod nano 7th gen. won't save the changes I make to a song's start and stop time. How do I fix this?

    So I have a few songs that I don't like the intro to or the end of it that I had cut to where I wanted on my previous ipod. When I try to do the ame thing with this one with the start and stop time, it will work for awhile and then randomly start and stop where it had originally. I have done it like 4 times now for some songs and I can't seem to get it to stick. Suggestions?

    If you use the Sync feature in iTunes, then it needs to be done to the song in your Music Library, then synced with the iPod.  If you do not use the Sync feature and are performing the changes to the song on your iPod specifically, then the setting may be getting overwritten when you drag the song that's already on the iPod back onto the iPod.  It will overwrite all local settings for the song on the iPod with the settings in your library. 
    Try performing the changes to the song in your music library, and then dragging it back over to your ipod (or Sync your iPod if you use that feature).  This will make sure that the setting are consistent in both your library and iPod in-case you were to ever overwrite the song once more.

  • ITunes ignores the "stop time" for music videos since 10.6.7 osx update.  Tried with iTunes 10.2.1, 10.2.2, 10.3.  Only way to make it work is to back out to 10.6.6 (time consuming).  Has nobody else noticed this?

    Only a problem with music videos. Normal audio tracks work fine.  Introduced with 10.6.7.  10.6.8 failed to fix it.
    Set the "stop time" of a music video to 10 seconds shorter than the full length and iTunes will still play it to the end.  Very annoying, especially if there's a bunch of noise at the end of a song.

    More info: After I upgraded to 10.6.7, I first noticed the problem.  Downgraded to 10.6.6 and it worked again.  Upgraded to 10.6.8 when it was released to see if this had the issue fixed - but it didn't, iTunes failed to stop on time again (only music videos).
    Just downgraded to 10.6.6 and it still doesn't work!!!  Now I'm really screwed and confused.  HELP!

  • If I have manually set "Start Time" and "Stop Time" for songs, and my hard drive is backed up in Time Machine, when files/songs are transferred on new hard drive, will my "Start Time" "Stop Time" options be there?

    My Macbook Pro will be going in for reimaging and my hard drive will be wiped, I want to know if all my iTunes preferences will be copied if I have backed them up on Time Machine. Specifically, if I have set certain "Start Time" and "Stop Time" for my songs, and I copy my iTunes library, will these "Start Time" and "Stop Time" options remain or will I have to manually set them one by one once again? I need a reply ASAP! Thanks so much!

    As far as I'm aware the start & stop times are stored in the library database, not the media files. If you backup/restore/transfer the whole library then the settings are included. If you create a complete copy of your iTunes folder on another drive you can connect to that copy by holding down option/alt as you start iTunes so you can check that everything is working properly before you send the Macbook away.
    tt2

  • How to Stop Time Machine before Disk is Full

    In the System Preferences, Time Machine will keep weekly backups "until your backup disk is full". I also use the backup disk for other storage purposes, so is there a way to stop Time Machine perhaps when the disk is 90% full or has 10 gigs left?
    Does anyone know a command line trick or option to adjust this setting to backup "until your backup disk is nearly full"? I'd prefer a way to limit Time Machine from taking over the entire disk.

    OK then - Create a file A on the disk that represents 10% of the disk space. When the disk fills you can then remove the file A and deal with disk full conditions as you wish.
    You can create a file easily in terminal.app. Use the mkfile command.
    Let's say you disk with Volume name "Big" is 300 GB in size.
    In Terminal enter
    cd /Volumes/Big
    mkfile 30g TempFile
    This will create a 30 GB file with a pathname of /Volumes/Big/TempFile
    This is somewhat of a kludge but it's simple.

  • ITunes won't let me edit stop time on a particular song, will let me edit stop time on other songs

    Recently I was given a bunch of digital music on hard drive.  One of the songs on the hard drive has a time of around 8 minutes and a file size of around 11 mb.  The song plays perfectly fine if I preview it off of the hard drive.  When the song is imported into iTunes the time drops to 8 seconds but the file remains the same size as before.  I've tried to edit the stop time of the song to reflect what it should be but will not apply the changes that I've made.  I've been able to edit the stop/start times of other songs from the same import.  Any ideas as to how to deal with this?

    I didn't have precisely this issue, but one similar.  What fixed it (and I don't know why I tried it) was to have iTunes convert the song (from m4a to mp3 in my case), and iTunes corrected the time.
    Good luck
    srb

Maybe you are looking for