complex habit scheduling in orgmode - emacs

There are a few complex habits/tasks that I wish orgmode to handle, and I'm not quite sure how to program them:
A habit that has to be done twice a day, between certain hours (E.g. 8-9 and 18-19).
A habit that has to be done over the weekend (Between Thursday-Saturday).
A task that occurs every 6 months, twice a day between certain hours, for a duration of 21 days total.
Can someone help with adding the right SCHEDULE?

Weekend only habit:
SCHEDULED: <2013-12-13 Fri ++1w/2d>
This will cause it to repeat every Friday (regardless of when completed), and will be late if delayed by more than 2 days after the next notification.
Twice a day habit:
This will most likely have to be created as two separate habits, one for the first timeframe and one for the second.
Bi-annual:
Most likely requires two TODO's as well to allow for the two timeframes. I'm not sure if there's any real way of doing so without using complex diary SEXPs which you would have to create every 6 months (or update the SEXP to match the next 6 month span). Org TODOs/Habits don't usually include an 'end-date' when they repeat.

Related

Scheduling a job to run every Nth week and specific week days starting on specific date with Quartz (Scala)

In continuation of:
What is the most reliable way to schedule a job with cron scheduler is Quartz that repeats every N days starting from a specific date
&
Absolutely unexplainable results for cron based scheduler in Quartz
There is another question regarding possibilities of scheduling with quartz. And the difference between the two above and this one and the fact that I am trying to execute more than a single job for the target period (e.g. Mon, Fri every 4th week)
Let's assume that a user needs to execute a task every 4th week on Wednesday & Friday starting from a specific date.
Of course, I can setup a cron scheduler that will look something like this:
0 0 12 ? 1/4 WED,FRI *
But we are beck to the same problem as described in the linked posts. What this cron expression really mean, is execute the job on Wednesday & Friday of every 4th week of the month.
Another option is to use, calendar interval schedule builder (the perfectly resolves the problem for as long as there is only one day of the week that needs to be considered); however, it does not allow to specify days of a week, but simply calculates the true 4 weeks worth of time based on the start date.
How, if possible, to schedule a job with Quartz, that will be executed every 4th (or any Nth week) on more than a single day of the week? Is it possible to achieve it without multiple triggers?
Thanks,
So, after long digging around, it seems like the only way to solve it with existing Quartz tools is to manage this type of scheduling with more that one trigger (one for every weekday).
Hopefully that helps somebody.

Multiple tasks in a week

How do I specify a task in org-mode as needing to be done 3 times a week without being specific about which day of the week it is?
Org-mode documentation for repeated tasks suggests the use of y/m/d/h intervals, but I didn't find the syntax for specifying an event n times per interval.
You can define your TODO as a habit in org:
The TODO may also have minimum and maximum ranges specified by
using the syntax `.+2d/3d', which says that you want to do the
task at least every three days, but at most every two days.
Maybe this would serve your purpose?

iCalendar recurrence rule for event that occurs every two years in multiple months on first weekend day

Is it possible to specify an event to occur on the 1st weekend day of multiple months every 2 years in a single RRULE? Using February and September as a test case, my first thought was:
FREQ=YEARLY;DTSTART=20140320T070000Z;INTERVAL=2;BYSETPOS=1;BYMONTH=2,9;BYDAY=SA,SU
but BYSETPOS reduces the set down to February only. I thought changing the freq to monthly would do the trick after I posted here, but applying an interval of 2 for every other year messes things up because the interval is applied to a monthly freq instead of a yearly freq.
I made this a new question because I did not include interval in my original question.
I think splitting this into multiple rrules would work, but it would greatly increase the complexity of this area of my app so I was hoping for a single rrule with a yearly freq.
Thanks!
FWIW, and since you mention it as a potential workaround, RFC5545 has removed the ability to have multiple RRULE property in a single VEVENT/VTODO (https://www.rfc-editor.org/rfc/rfc5545#section-3.6.1). It was there in RFC2445.
Then, unless someone finds a very elegant and simple solution, you may be left with something that is so convoluted that most clients will barf on it (don't know how interoperability is important to you).
This leaves you with 2 choices I think:
either use 2 different events (maybe linked with a RELATED-TO property)
or, if you can bound the event to a certain number of instances, represent it as a set of RDATE (or RRULE + RDATE, or RRULE + EXDATE, etc...).
Adding BYSETPOS like this may work as you intend:
FREQ=YEARLY;INTERVAL=2;BYMONTH=2,9;BYDAY=+1SA,+1SU;BYSETPOS=1,3
what you could try is to take advantage of the fact that bysetpos allows you to select within the year the selected instances of your rule, then you could limit the number of instances to the first week of the month (by setting the days of the month to the first 6 ones) to avoid the cases where month have more or less weeks, which then allows you to select the first and third instance in your year.
Which then gives:
DTSTART:20140320T060000Z
FREQ=YEARLY;INTERVAL=2;WKST=MO;BYSETPOS=1,3;BYMONTH=2,9;BYMONTHDAY=1,2,3,4,5,6,7;BYDAY=SA,SU
which will be:
Sat 2014/Sept/6
Sat 2016/Feb/6
Sat 2016/Sep/3
...
Sun 2024/Sep/1
this was verified with dateutil-python and http://jkbr.github.io/,

Change the hour when org-mode is starting new day

I use org-mode to clock my work and sometimes I work past midnight for few hours.
So, for example, I clocked time starting 03.06.2013 10pm and ending 04.06.2013 2am.
And org-mode is dividing it at 0am, starting new day. But it would be more convinient for me if that time 0am-2am was recorded for 03.06.2013 instead of 04.06.2013.
So I want to be able to specify at what time (say, 4am) org-mode is deciding the new day has started.
I can use a workaround by shifting timezone for the emacs process, but then I need to keep in mind that all recorded time is shifted... Not very convinient.
See the variable org-extend-today-until, a variable defined in org.el.
Documentation:
The hour when your day really ends. Must be an integer.
This has influence for the following applications:
When switching the agenda to "today". It it is still earlier than
the time given here, the day recognized as TODAY is actually yesterday.
When a date is read from the user and it is still before the time given
here, the current date and time will be assumed to be yesterday, 23:59.
Also, timestamps inserted in capture templates follow this rule.

Recurring dates on dates that do not exist

When giving the option for something to reoccur every certain amount of time how should I treat times that don't reoccur on every interval?
For example what should happen to birthday reminders for February 29th? Or if I have a monthly appointment on the 31st what should happen on months that do not have a 31st day?
What do you believe the reasonable user would expect and be least surprised by?
My first reaction to this question would be to give the user the option of what to do if it falls on that date (go to next day, skip the day, etc.).
But to directly answer your question, I believe the reasonable user would be least surprised by the occurrence falling on the day before the "skipped" day.
I'd think you would be able to flag dates like this pretty easily. The only dates I can think of are the 29th, 30th, and 31st of a month, or February 29th.
When the user opts to be reminded of one of these dates monthly (or annually for Feb. 29), you can prompt them for an alternate date for those months.
Additionally, you could have an option to be notified "on the last day of each month."
Ideally, prompt when creating the reminder.
If you are stuck with it, I would pull them forward. That's the least harmful choice. You don't always want the least surprise, minimizing the harm of making the wrong choice is also important.