emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One thing each 3 days but maximum 10


From: Jean Louis
Subject: Re: One thing each 3 days but maximum 10
Date: Mon, 31 Oct 2022 20:56:08 +0300
User-agent: Mutt/2.2.7+37 (a90f69b) (2022-09-02)

* 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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]