Live data from Hacker News

Toothpaste Null-Terminator

dunkels.com

31–40 of 81 posts

Re: Toothpaste Null-Terminator

#31
> When I find that the only tube of toothpaste left is that special, sentinel toothpaste, then I know it is time to buy more toothpaste.

I buy more $CONSUMABLE whenever I take the last unit of $CONSUMABLE out of storage. If I don’t order online or add it to the grocery list right away, I put the old empty (second-to last) container in a place where it is likely to prompt me to resupply in a timely manner, which is often different from the place where $CONSUMABLE is consumed. Otherwise there’s the risk that the “special sentinel” is always encountered at a place or time where resupplying is inconvenient, and so it might run empty before you get around to it, despite its “special” nature. This approach also has the benefit that you don’t have to switch from your favorite variety of $CONSUMABLE.

Re: Toothpaste Null-Terminator

#32
post #15

Am I the only one that has no trouble buying toothpaste when I have to squeeze the tube extra hard?

Many years ago I learned from some Japanese TV show that you can use centrifugal force to get the very last bit of toothpaste out of the tube even if you can’t squeeze out any more. Something similar to this: https://m.youtube.com/watch?v=u-4MKefJqbc

By that point, I think it's easier just to cut the tube open.

Re: Toothpaste Null-Terminator

#33
post #29

I use an even simpler and more reliable system to avoid running out of toothpaste: brushing with plain water. Evidence suggests that brushing with toothpaste (called "dentifrice" in scientific papers) does not remove any more plaque than brushing without it. Here's a systematic review from 2016: >Does dentifrice use help to remove plaque? A systematic review https://pubmed.ncbi.nlm.nih.gov/27513809/ "The cumulative e…

Wow! Thanks for sharing.

So do you change your toothbrush every quarter?

Re: Toothpaste Null-Terminator

#34
post #29

I use an even simpler and more reliable system to avoid running out of toothpaste: brushing with plain water. Evidence suggests that brushing with toothpaste (called "dentifrice" in scientific papers) does not remove any more plaque than brushing without it. Here's a systematic review from 2016: >Does dentifrice use help to remove plaque? A systematic review https://pubmed.ncbi.nlm.nih.gov/27513809/ "The cumulative e…

Huh, interesting. Not exactly conclusive, though. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3841993/

Re: Toothpaste Null-Terminator

#35
post #33
post #29

I use an even simpler and more reliable system to avoid running out of toothpaste: brushing with plain water. Evidence suggests that brushing with toothpaste (called "dentifrice" in scientific papers) does not remove any more plaque than brushing without it. Here's a systematic review from 2016: >Does dentifrice use help to remove plaque? A systematic review https://pubmed.ncbi.nlm.nih.gov/27513809/ "The cumulative e…

Wow! Thanks for sharing. So do you change your toothbrush every quarter?

Yes. I buy moderately cheap ones, which I find work just as well as expensive ones.

Re: Toothpaste Null-Terminator

#36
post #19

Hahaha, why not just check if the toothpaste you're grabbing is the last one?

Because it's too easy to not bother checking that, whereas you can't avoid noticing that you got the "sentinel" tube. You might still not bother exhaustively checking the cupboard but that's fine - it just means you order more toothpaste slightly too early rather than slightly too late, which would be much worse.

Still I think this is a stretched analogy. Decent strategy in real life, but programming is not the same and in my experience in-band signalling like this generally leads to fragile code. I mean nobody would recommend null terminated strings as a sane design today...

Re: Toothpaste Null-Terminator

#37
post #31

> When I find that the only tube of toothpaste left is that special, sentinel toothpaste, then I know it is time to buy more toothpaste. I buy more $CONSUMABLE whenever I take the last unit of $CONSUMABLE out of storage. If I don’t order online or add it to the grocery list right away, I put the old empty (second-to last) container in a place where it is likely to prompt me to resupply in a timely manner, which is of…

My day to day shopping list is literally the leftmost foot or so of my desk—which is large enough to accommodate the extra space, and that space positioned right by the door leading outside.

I put anything needing resupply, empty or approaching empty depending on the item, right there on that part of my desk. Unless I’m rushed or preoccupied, checking that space before I leave for the store is usually pretty effective for my defective executive function.

Remembering to clean up the queue afterward is a bit more challenging. But that’s just a mild inconvenience compared to prior years of consistently failing to stock essential items on a routine basis.

Re: Toothpaste Null-Terminator

#38
> When I find that the only tube of toothpaste left is that special, sentinel toothpaste, then I know it is time to buy more toothpaste. And then I have ample time to do so.

I might suggest phrasing this a little differently. Obviously, when you find that any tube is the only tube left, you know it’s time to buy more toothpaste. The problem is that you realize this early in the morning or right before bed, and so you’re likely to forget. The advantage of the “sentinel toothpaste” is that it continues to remind you after that moment, so that you’ll actually remember when you have time to do something about it.

And I think that captures the key thing about a sentinel value: it captures state in a place where you’re already storing state, without requiring you to wrap the state in some external structure, e.g. putting a sticky note on your mirror or storing a string’s length in a separate field.

Re: Toothpaste Null-Terminator

#39

Buy two tubes, while true, when you finish a tube, add one toothpaste tube to the shopping list, done. Works great for an average person who usually visits the store. Adjust the initial putchase if you visit the store twice a year. Also works great for many suplies like coffee, pasta, legumes...

This is a much simpler way. Now only to remember to do it next time I get groceries.

Re: Toothpaste Null-Terminator

#40
post #29

I use an even simpler and more reliable system to avoid running out of toothpaste: brushing with plain water. Evidence suggests that brushing with toothpaste (called "dentifrice" in scientific papers) does not remove any more plaque than brushing without it. Here's a systematic review from 2016: >Does dentifrice use help to remove plaque? A systematic review https://pubmed.ncbi.nlm.nih.gov/27513809/ "The cumulative e…

The idea that a "minty fresh" mouth (or the idea that "mint" implies "fresh" at all) was the product of an ad campaign in the 1930s. It's not some sort of human universal.
Post reply on HN