Tiddler titles using UUIDs

I thought I saw a discussion on creating tiddler names as UUIDs but I don’t seem to be able to locate it.

In case it’s relevant, I am thinking it would be useful in creating a task or to-do list. After a short time I may forget what I’ve already used and try to create a new one with the same name and then have to modify the name just to get the tiddler created - I don’t want to deal with a dozen “get a hair cut” variants. I realize I could use the date/time as a unique ID but I’d rather use a hash of X characters.

Has anyone created a method of doing this? Is there a reason to avoid it?

Wouldn’t using UUID’s in the title make this problem worse? Tiddlywiki will tell you if you enter a title which already exists. If you use a UUID you could potentially create a dozen with the exact same displayed text.

While writing my personal project/task tracker I started by using a timestamp as a unique id in the title. They were also system tiddlers because I did not think I wanted them cluttering up the default lists such as the Open and Recent tabs. Then I used the caption field for the text of the task. A typical tiddler title ended up looking like $:/tid/20210830214007220 and had various tags and fields for its type and status.

It seemed like a nice idea but it quickly became a rabbit hole. Because your task tiddlers don’t show up in default lists or searches, you then need to basically recreate a lot of TW functionality just to work with your unique titles and captions.

I eventually gave up on the idea and now just use the normal title field for the task summary because I have actual work to do other than working on the wiki. My advice is to take advantage of what TW has available by default.

Just my experience and opinion - for what it’s worth.

1 Like

I think that’s a very good advice. I did play with the same idea may be 7or8 years ago and came to the same conclusion as amreus. It’s not worth wasting time using concepts that need you to recreate the UI.

Thanks Amreus. My thought is to use the title similar to a database primary key - unique and auto generated. In the absence of a true UUID method, I’ll probably try to adapt the date used with the journal feature. I’ll likely want to hide tabs such as Open and Recent to make it more of a team tool that limits access to certain areas of the TW - at least as much as can reasonably be accomplished.

I expect to have several tiddlers with the same task description since many tasks are periodic (.e.g. Change Oil, take the dog to the groomer) but only one of them should be an active task at any given time.

While I understand you need to accomplish work more than you want to get bogged down in customizing TW for your purposes, my primary goal is to learn the technology and see if I can create a custom solution. I really appreciate you taking the time to respond.

I think for recurring tasks that’s a possibility. … Then the “Oil” tiddler is not the task, that can be done. It’s a resource that can be “changed” or be “bought”. …

So there may be “change Oil” and “buy Oil” task-tiddlers

The unique task tiddler may be: 2021-09-05-17:52:00-123 It may have a “due-date” field and a “subtitle” field. Where the “subtitle” may be “change Oil”. …

In my example I did use a “created date” for the title. You could also use the “due-date” as the title if you want to. …

You can also use the “caption” field, BUT caption is mainly used with “short texts”, because the tabs-macro, the recent-tab and so on use caption if it is available by default.

I personally use “subtitle”, if I need a “caption-like” field with long text.

Just some thoughts.

IMO, that’s a perfectly valid aim.

The vast majority of my tiddlers use a numeric-format title (e.g. 400-010) denoting chapter number and section number. While it’s an infrequent occurrence, I do sometimes change/renumber the titles which might break a bunch of things.

So, I use a field:uuid which allows me to rename tiddlers with impunity and link to them via their permanent uuid. The links, of course, are not regular TW links, they are implemented via macros, which in general terms look like…

<<uuid-link uuid:hex-string-here text:"friendly text">>

And since, like @pmario, I use a field:subtitle, typically the friendly-text defaults to the subtitle text.

The UI for these chapter-section tiddlers offers an easily triple-clicked copy of the uuid (saves me having to dig into TiddlerInfo or having to edit the tiddler:

image

The JavaScript for getUUID (which I lifted from StackOverflow, IIRC) is…

function getUUID() {
  var d = new Date().getTime();
  if(window.performance && typeof window.performance.now === "function"){
    d += performance.now(); //use high-precision timer if available
  }
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = (d + Math.random()*16)%16 | 0;
    d = Math.floor(d/16);
    return (c=='x' ? r : (r&0x3|0x8)).toString(16);
  });
  return uuid;
}
1 Like

Just a reminder UUID’s, GUIDs My TSN (tiddler serial Numbers) have being discussed at length in the Google Groups. In fact I have visited this so many times I feel too fatigued to contribute here.

However my most important points are;

  • There are so many ways to uniquify tiddlers and make links title change resilient
  • The relink plugin solves 90% of these
  • In many cases you need only qualify a tiddler with its parent and then give the sub tiddlers a unique serial for being a child or the parent only.
  • We should get a collaboration going to develop a set of “tiddler titles generation algorithms” and share these. I have done this for streams which allows you to provide the node title; I use the following in streams;
    $:/s/<<now "[UTC]YY-0MM-0DD 0hh:0mm:0ss XXX">>
    then if I wish, I rename them through Streams, so it “comes out of hiding” from behind the system prefix, and gets a regular tiddler name.