From: Jean Louis <bugs@gnu.support>
To: "Quiliro Ordóñez" <quiliro@riseup.net>
Cc: Renato Pontefice <renato.pontefice@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: One thing each 3 days but maximum 10
Date: Mon, 31 Oct 2022 20:56:08 +0300 [thread overview]
Message-ID: <Y2AMOAvugwtAcue5@protected.localdomain> (raw)
In-Reply-To: <be4ad339ddfe4f495f92fd922fa667f4@riseup.net>
* Quiliro Ordóñez <quiliro@riseup.net> [2022-10-31 13:03]:
> El 2022-10-30 23:57, Jean Louis escribió:
> > * Renato Pontefice <renato.pontefice@gmail.com> [2022-10-30 19:11]:
> >> I have to take a pill each 3 days, but for max 10 times.
> >> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> >> I nean to show how many pill I have already take?
> >
> > Use PostgreSQL to give you schedule:
> >
> > #+BEGIN_SRC sql :engine postgresql :results value raw
> > SELECT '** TODO Take pill again
> > SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3
> > day'::interval)::date || E'>\n'
> > AS "* My treatement";
> > #+END_SRC
> Isn't it much easier to copy the first one and change the day, instead
> of going through the learning curve of database administration? Of
> course that, if you have a bazooka, you can even write a love letter
> with it. But would it be right tool?
Any useful tool external to any text file that may help you in work
and life, is the right tool. Use anything you find useful.
To correct you, this is not "database administration", it is using
PostgreSQL like programming language. If there would be ready Emacs
Lisp function, I would mention it, but I do not know any.
This belowe is pretty much intuitive:
SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval);
SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval);
generate_series
------------------------
2022-10-28 00:00:00+03
2022-10-31 00:00:00+03
2022-11-03 00:00:00+03
2022-11-06 00:00:00+03
2022-11-09 00:00:00+03
2022-11-12 00:00:00+03
2022-11-15 00:00:00+03
2022-11-18 00:00:00+03
2022-11-21 00:00:00+03
2022-11-24 00:00:00+03
And you can have it display it with date only:
SELECT generate_series('2022-10-28', '2022-11-26', '3 day'::interval)::date;
generate_series
-----------------
2022-10-28
2022-10-31
2022-11-03
2022-11-06
2022-11-09
2022-11-12
2022-11-15
2022-11-18
2022-11-21
2022-11-24
And you may concatenate it how you wish:
SELECT 'This is my day: ' || generate_series('2022-10-28', '2022-11-26', '3 day'::interval)::date;
This is my day: 2022-10-28
This is my day: 2022-10-31
This is my day: 2022-11-03
This is my day: 2022-11-06
This is my day: 2022-11-09
This is my day: 2022-11-12
This is my day: 2022-11-15
This is my day: 2022-11-18
This is my day: 2022-11-21
This is my day: 2022-11-24
And there are complex intervals, readable to human:
SELECT 'This is my day: ' || generate_series('2022-10-28', '2022-10-29', '1 hour 2 minutes'::interval);
This is my day: 2022-10-28 00:00:00+03
This is my day: 2022-10-28 01:02:00+03
This is my day: 2022-10-28 02:04:00+03
This is my day: 2022-10-28 03:06:00+03
This is my day: 2022-10-28 04:08:00+03
This is my day: 2022-10-28 05:10:00+03
This is my day: 2022-10-28 06:12:00+03
This is my day: 2022-10-28 07:14:00+03
This is my day: 2022-10-28 08:16:00+03
This is my day: 2022-10-28 09:18:00+03
This is my day: 2022-10-28 10:20:00+03
This is my day: 2022-10-28 11:22:00+03
This is my day: 2022-10-28 12:24:00+03
This is my day: 2022-10-28 13:26:00+03
This is my day: 2022-10-28 14:28:00+03
This is my day: 2022-10-28 15:30:00+03
This is my day: 2022-10-28 16:32:00+03
This is my day: 2022-10-28 17:34:00+03
This is my day: 2022-10-28 18:36:00+03
This is my day: 2022-10-28 19:38:00+03
This is my day: 2022-10-28 20:40:00+03
This is my day: 2022-10-28 21:42:00+03
This is my day: 2022-10-28 22:44:00+03
This is my day: 2022-10-28 23:46:00+03
Now after learning about the flexibility and power of that function,
you may think of using intervals for anything you wish.
Within Org, you may embed it how you wish and want, including, you
may produce tables with that function.
Org's function `org-clone-subtree-with-time-shift' I find really
handy, but I also find it hard coded, it is only for subtree.
And I personally can rely on it as Org has too many bugs and is
constantly developed. We have just found that "hours" are missing,
which speaks of design planning quality level.
Why would one exclude seconds? Just because author of function does
not use seconds, that is why author excluded seconds, and minutes, and
hours in the original function.
Do I want to use a function which possibly contains errors? There are
too many human errors when dealing with time, unspoken of programming
errors.
My choice is to use what I consider stable, and which is more
flexible.
As Org may be dynamically modified by external tool, then I will use
any kind of tool.
My Org file are mostly on the file system, there are maybe 300 files,
and only 38 in the database. But then I use in the database too much
of Markdown, and way much more of the text type.
And any kind of the markup I want to use embeddable external
tools. This is because it is useful.
Personally I do not want to remain hard coded to Org type only, as it
limits my work, my output, my PDF and HTML files, there are too many
problems involved.
To embed any external output into anything, I use templating system. RCD Template Interpolation System for Emacs:
https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html
Then I can use any kind of programming language and embed it in text
or any kind of
markuptypes_name | count
-------------------------------------------+-------
Default (Text) | 42517
Markdown (Discount Markdown) | 4303
Asciidoctor | 264
Markdown (Pandoc, espresso) | 54
Markdown (Discount) with Table of Content | 45
Org | 38
txt2tags | 7
Enriched | 4
Org Heading | 2
PostgreSQL | 2
Kotl | 1
HTML | 1
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
prev parent reply other threads:[~2022-11-01 8:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 16:08 One thing each 3 days but maximum 10 Renato Pontefice
2022-10-31 4:26 ` Ihor Radchenko
2022-10-31 4:57 ` Jean Louis
2022-10-31 5:16 ` Ihor Radchenko
2022-10-31 6:08 ` Jean Louis
2022-10-31 6:27 ` Ihor Radchenko
2022-10-31 17:14 ` Jean Louis
2022-11-01 8:40 ` Ihor Radchenko
2022-10-31 10:01 ` Quiliro Ordóñez
2022-10-31 17:56 ` Jean Louis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2AMOAvugwtAcue5@protected.localdomain \
--to=bugs@gnu.support \
--cc=emacs-orgmode@gnu.org \
--cc=quiliro@riseup.net \
--cc=renato.pontefice@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).