How to run a scheduled task at specific times? - windows-phone-7.1

I need to run a scheduled task every day at 9 a.m. and 6 p.m. How can I do this? I looked into PeriodicTask but it runs once every 30 mins. How do I achieve this task?

You can't. However, you can check if the time is close to 9am/6pm when the Scheduled Task is running every 30 minutes. The furthest off you'll get is 29 minutes.
Consider using a Reminder instead.

you can use the scheduled notification of Alarm in windows phone os7.1.
check here:http://msdn.microsoft.com/en-us/library/hh202946(v=VS.92).aspx

Related

How to prevent edge cases or delay for a deadline of a scheduled task?

Suppose I have an event scheduled in the future with start_date, end_date (inclusive), timezone, and status. The dates are wall-time since users are from all of the places with different timezones. There will be incoming transactions and I'd like to check the validity of these transactions against the status of the task.
If the status of the task is active then it's still valid. What I'm planning to do is to setup a cron job (or ActiveJob in Rails) to run every 15 minutes to check whether the task has already started or ended according to the user's timezone setting and update the status field.
The problem is that suppose the task's end_date is 15 December and the cron job begins at exactly 16 December 00:00 at which the task should be already expired and the cron job takes approximately 2 minutes to complete the whole database. Then the status will updated to inactive at 16 around December 00:02. If there is a transaction coming in at 16 December 00:01 and then the application checks the validity against its status which is still active but in fact it's already past the deadline.
Any ideas how to combat this problem?
By the way, although the application itself is not really serious and can afford some mismatches, I'm still worried about the data intregrity when querying since there will be some datapoints missing out of the valid date range.
Cron won't work since it creates the problem you describe, but with activejob you can tell it the exact date and time to run https://edgeguides.rubyonrails.org/active_job_basics.html#enqueue-the-job
By the way, if something depends on a date, why don't you actually check that date instead of the "status" column?

PC wakes up automatically only for a few minutes(I need more time)

I set up Jenkins to run some jobs(It runs 10 minutes) at night. In that time PC is already went sleep. Thats why i set up Task Scheduler:
Triggered every days. Actions cmd.exe/c"exit". This think wake up PC only for two minutes, but i need 10(and more in the future). Do you mind helping me solve this problem?

Run job once at 8 PM and stop at 6 AM in Quartz.net

How can i schedule job to run once at 8:00 PM Every Day and force it to stop at 6:00 AM in next day?
Setup trigger to run job every day at 8PM. If you prefer cron expressions, you can use cronmaker UI for expression generation.
As #derloopkat mentioned, Configuring Quartz.Net to stop a job from executing, if it is taking longer than specified time span shows approach how to stop job using IInterruptableJob interface. Moreover, cause you know exact time, when job should be stoped (6AM), you may not to use separate thread for Interrupt() method, but create another simple job that do interruption at 6AM by trigger.

Want to schedule a task on every 2 hours from 8am to 12pm on heroku through scheduler add on

I want to create a task that run on every 2 hours from morning 8 to midnight. I have created task and tested locally , when i made a job through scheduler it just gives me three times daily , hourly and every 10 min. How can i customize it.
You'll have to upgrade the Heroku Scheduler Add-On to make more precise settings. With the free dyno you can only choose between these 3.
The only way to achieve this would make these cron jobs from the framework itself. With a gem like https://github.com/jmettraux/rufus-scheduler

Managing timezones for different users

I have a website where I have many users coming from different countries. Users can schedule a task based on their timezone. Now there is a cron running on the server after every min, the cron executes a script which checks if there are any scheduled task of any user and if so it does the needful.
Since my server is based in the US, the script executed by the cron considers the timezone of the US. What do I have to do in my script that will execute the user's task based on user's timezone instead of server's timezone?
Thanks in advance for any ideas
Lookup the user's timezone.
Compute the current time in the user's timezone.
For each job, look up the last time it was run and compute the next time it should run.
For any job whose next run time is now or in the past, run that job and update the record of the last time each job was run.
I did something similar on the iPhone a few months ago.
My solution was to capture the time as a string. So if the user selected 8am, I would just capture 08:00 and their time zone e.g. Europe/London.
Every 5 minutes or so on my server, I could then convert this 08:00 into the current UTC time based on the timezone. If this time was "present", I would carry about a check on the user's transport status and issue alerts.
To help me with the TimeZones, I used NodaTime. http://noda-time.blogspot.co.uk/

Resources