Re: [dev] organizing programs

2023-05-15 Thread Sebastiano Tronto
Hi,

NRK  wrote:
> Not too bad, and since the source was pretty small, I decided to take a
> glance. Here's some unsolicited review:

Wow, thanks for the code review! Some of the mistakes you spotted are
things I have learnt after writing this code, but many are new to me.
I love learning this kind of stuff!

I have implemented the suggested improvements. I won't reply in detail
to avoid going off topic, except for this:

> http://www.catb.org/~esr/writings/unix-koans/ten-thousand.html

Very wise! I have only resorted to writing this in C rather than in sh
after fighting against string parsing for quite some time. I thought
strftime could save me, and in some way it did.

Best,
Sebastiano



Re: [dev] organizing programs

2023-05-14 Thread NRK
On Sun, May 14, 2023 at 09:55:16PM +0200, Sebastiano Tronto wrote:
> I could not find any tool that was simple enough for my taste, so I
> rolled my own[0].
>
> [0] https://git.tronto.net/sdep

Not too bad, and since the source was pretty small, I decided to take a
glance. Here's some unsolicited review:


9 #define min(X,Y) (Xhttps://c-faq.com/cpp/safemacros.html


11 /*
12  * Maximum number of characters in a line. The rest will be 
truncated.
13  * Change this if you need very long lines.
14  */
15 static const int MAXLEN = 1;

`const` in C doesn't mean "constant expression", and so if you use
`buf[MAXLEN]` you'll get a VLA (compile with -Wvla and you should see warning
about it). Either use a #define or an enum.

https://c-faq.com/ansi/constasconst.html


55 static Options default_op();

`f()` does not do what you might think. A function without an argument list
takes *unspeficied* amount of arguments, not zero arguments (a historical
baggage). These have been obsolete since C99 and newer clang version defaults
to erroring out on it, see: https://wiki.gentoo.org/wiki/Modern_C_porting

Explicitly use `f(void)` instead.


71  next->ev.text = malloc(sizeof(char) * l);

sizeof(char) is *defined* to be always 1. So it's not really doing anything:
https://c-faq.com/malloc/sizeofchar.html


72  strncpy(next->ev.text, text, l);

`strncpy` doesn't nul-terminate in case the soruce is bigger than the dest.
Additionally strncpy will *always* write `n` bytes even if the soruce fits into
the dest. This is rarely the semantic people want and 99% of the time I see
strncpy used it's typically either bugger, misused, or enefficient.

There is no standard "copy and truncate if needed" function. Closest you can
find would be memccpy:

if (memccpy(dest, src, '\0', n) == NULL)
dest[n - 1] = '\0';

You can wrap this in function or roll your own (TIP: if you have your string 
copy
function return a pointer to the nul-byte in dest, then you can use it for
efficient concat: https://www.symas.com/post/the-sad-state-of-c-strings).


216 static char *
217 strtrim(char *t)
218 {
219 char *s;
220 
221 for (s = [strlen(t)-1]; s != t && isspace(*s); *s = '\0', 
s--);
222 for (; *t != '\0' && isspace(*t); t++);

The entire ctype library is badly designed because it only accepts input that's
either EOF or [0, UCHAR_MAX]. From the manpage:

| These functions check whether c, which must have the value of an unsigned char
| or EOF (otherwise the behavior is undefined)

Either cast the argument to `unsigned char` or just roll your own. (Also
keep in mind that `plain char` can be either signed or unsigned
depending on the implementation).

Also the name `strtrim` steps into the namespace reserved by .
You can rename it to `str_trim` to avoid it.


And that's mostly it from a quick glance. Slightly relevant:
http://www.catb.org/~esr/writings/unix-koans/ten-thousand.html

- NRK



Re: [dev] organizing programs

2023-05-14 Thread Sebastiano Tronto
Hello,

LM  wrote:
> I've been looking into todo programs, task schedulers and related
> organizing programs. [...]
> 
> I'd be curious to know what tools other people use on the list to
> handle organizational jobs such as time and task scheduling, todo
> lists, habit tracking, displaying/printing calendars, etc.  [...]

For TODO lists I have always used plain text files, either a single file
or a directory with multiple files when things got out of hand. I have
read about using mail inboxes as todo-list, I'd like to try once; but
for now it is just an entry in my TODO.txt (seriously).

The only thing I was missing from plain text files were notifications /
reminders for time-sensitive stuff. I could not find any tool that was
simple enough for my taste, so I rolled my own[0]. It is a C program that
reads line formatted as "[date] [text]" from stdin and prints out those
whose date matches the current minute to stdout. I have a script running
every 60 seconds that feeds a file with my task list to this program and
pipes the output to herbe[1] (or to notify-send). I have some shortcuts
to add pre-formatted entries to my tasks file, but usually I just edit
it with vi.

For calendar I just use cal(1) in a pop-up terminal[2][3].

Best,
Sebastiano

[0] https://git.tronto.net/sdep
[1] https://github.com/dudik/herbe
[2] https://git.tronto.net/scripts/file/popup-cal12.html
[3] https://git.tronto.net/scripts/file/popup-cal3.html



Re: [dev] organizing programs

2023-05-13 Thread Hiltjo Posthuma
On Sat, May 13, 2023 at 11:26:15PM +0200, Viktor Grigorov wrote:

> Pen and paper work best for me when it comes to tasks.

I like it, when you attach it to a balloon you can even sync it to the clouds!

> 
> May 13, 2023, 23:01 by s.je...@gmail.com:
> 
> > Heyhey!
> >
> > Страхиња Радић  wrote:
> >
> >> On 23/05/12 02:11PM, LM wrote:
> >> > I'd be curious to know what tools other people use on the list to
> >> > handle organizational jobs such as time and task scheduling, todo
> >> > lists, habit tracking, displaying/printing calendars, etc.  Any
> >> > recommendations?  If you use more than one application, which programs
> >> > work together or chain well?  Thanks.
> >>
> >> http://codemadness.org/todo-application.html
> >>
> >
> > Just chiming in with that years ago I was trying out taskwarrior as
> > well but after neglecting this system for years I have simply used a
> > ~/TODO.txt file at work.
> >
> > I always order the items in there according to priority and delete the
> > items I have finished using vim. This system has worked very well for
> > me and I haven't seen a need to change it yet. Your mileage may vary!
> >
> > Cheers,
> > Silvan
> >
> 
> 

-- 
Kind regards,
Hiltjo



Re: [dev] organizing programs

2023-05-13 Thread Viktor Grigorov
I use a a a timer zsh script that has a timer/countdown and alarm options, the 
former of which can easily serve as a pomodo technique utility.
There was a todo dash script using dmenu, if you input a new item it gets 
added, otherwise an existed is removed from the file.
Can share if interested.
Pen and paper work best for me when it comes to tasks.

May 13, 2023, 23:01 by s.je...@gmail.com:

> Heyhey!
>
> Страхиња Радић  wrote:
>
>> On 23/05/12 02:11PM, LM wrote:
>> > I'd be curious to know what tools other people use on the list to
>> > handle organizational jobs such as time and task scheduling, todo
>> > lists, habit tracking, displaying/printing calendars, etc.  Any
>> > recommendations?  If you use more than one application, which programs
>> > work together or chain well?  Thanks.
>>
>> http://codemadness.org/todo-application.html
>>
>
> Just chiming in with that years ago I was trying out taskwarrior as
> well but after neglecting this system for years I have simply used a
> ~/TODO.txt file at work.
>
> I always order the items in there according to priority and delete the
> items I have finished using vim. This system has worked very well for
> me and I haven't seen a need to change it yet. Your mileage may vary!
>
> Cheers,
> Silvan
>




Re: [dev] organizing programs

2023-05-13 Thread Silvan Jegen
Heyhey!

Страхиња Радић  wrote:
> On 23/05/12 02:11PM, LM wrote:
> > I'd be curious to know what tools other people use on the list to
> > handle organizational jobs such as time and task scheduling, todo
> > lists, habit tracking, displaying/printing calendars, etc.  Any
> > recommendations?  If you use more than one application, which programs
> > work together or chain well?  Thanks.
> 
> http://codemadness.org/todo-application.html

Just chiming in with that years ago I was trying out taskwarrior as
well but after neglecting this system for years I have simply used a
~/TODO.txt file at work.

I always order the items in there according to priority and delete the
items I have finished using vim. This system has worked very well for
me and I haven't seen a need to change it yet. Your mileage may vary!

Cheers,
Silvan



Re: [dev] organizing programs

2023-05-13 Thread Страхиња Радић
On 23/05/12 02:11PM, LM wrote:
> I'd be curious to know what tools other people use on the list to
> handle organizational jobs such as time and task scheduling, todo
> lists, habit tracking, displaying/printing calendars, etc.  Any
> recommendations?  If you use more than one application, which programs
> work together or chain well?  Thanks.

http://codemadness.org/todo-application.html


signature.asc
Description: PGP signature


Re: [dev] organizing programs

2023-05-13 Thread NRK
On Fri, May 12, 2023 at 02:11:33PM -0400, LM wrote:
> I'd be curious to know what tools other people use on the list to
> handle organizational jobs such as time and task scheduling, todo
> lists, habit tracking, displaying/printing calendars, etc.  Any
> recommendations?  If you use more than one application, which programs
> work together or chain well?  Thanks.

In the past I've used taskwarrior [0] for managing todos. It's a cli
application with pretty much most features you might expect out of a
todo app (and as a result of it, the source isn't as small/lean as
typical suckless style software). Not sure if this is the type of thing
you're after or not, but I figured I'd mention it.

However, I no longer use it (or any other todo application) because I
realized these "organizational" application cause more distraction than
productivity (for me at least).

[0]: https://taskwarrior.org/

- NRK



Re: [dev] organizing programs

2023-05-12 Thread Jeremy
On 05/12/23 02:11PM, LM wrote:
> I'd be curious to know what tools other people use on the list to
> handle organizational jobs such as time and task scheduling, todo
> lists, habit tracking, displaying/printing calendars, etc.  Any
> recommendations?  If you use more than one application, which programs
> work together or chain well?  Thanks.
> 

Because my deadlines tend to be more fluid, I've found "todo trees"
to be helpful in terms of managing tasks & task dependencies.

One of my recent "todo trees":
curl jer.cx/pasta/QtA | dot -Tpng /dev/stdin -o o.png && sxiv o.png

We're using graphviz' "dot" for the visualization here.

In the example, I need a downtime window before I can goto the DC, as
well as some hardware brackets, then when we're there, we can install
the hardware, etc;

Not sure how one would visualize(& make it easy to express) deadlines,
dependencies & conditionals, but I suspect there's a very lucrative market
oppurtunity for someone who could.




[dev] organizing programs

2023-05-12 Thread LM
I've been looking into todo programs, task schedulers and related
organizing programs.  I ran across information about todo.txt and org
mode and that got me interested in chaining some programs together
that could work with text based organizational information.  I just
completed writing a simple SDL program that takes a time as input,
brings up a green square and when the time is reached it gradually
changes the square to yellow and then red to warn a user to transition
into ending a current task (similar to alerts used by some
Toastmasters groups).  Trying to come up with some ways I could use it
with other programs.  From what I read, it didn't look like todo.txt
handled time periods in the specification but the information could
probably be added.  Some articles mentioned using ledger to track time
logging instead of using todo.txt.  For an offline calendar program,
I've used pcal in the past and I'm investigating calcurse at the
moment.

I'd be curious to know what tools other people use on the list to
handle organizational jobs such as time and task scheduling, todo
lists, habit tracking, displaying/printing calendars, etc.  Any
recommendations?  If you use more than one application, which programs
work together or chain well?  Thanks.