Monday, January 23, 2023

The secret of the Dreadco perpetual motion machine

Back in 1981 I was an A Level science student. Suggested reading was the New Scientist magazine, which at the time was a serious academic publication. (It seems to be more general interest science now.) Being a fairly lazy A Level science student, I would read the first third of a few articles before getting lost in the detail, skip the middle of the magazine, which was just job adverts, and read the page inside the back cover, a humorous page written by Dr David Jones under the pseudonym Daedalus. 

I don't remember much of what I read, to be honest, but I do remember that in one issue David Jones issued a challenge to readers to work out how a "perpetual motion" machine he had built worked, with the answer and the names of those to guess correctly to be published in the magazine in the next issue. Of course, this being a serious scientific magazine, there was no suggestion that it was a real perpetual motion machine.

I thought about it for a while, and had an idea as to how the wheel was supplied with energy to keep turning. I wrote to David Jones and he wrote back to say my suggestion was correct. Unfortunately my letter just missed the deadline. The names of two other people who had guessed correctly were published in the magazine. I seem to remember that he wrote that he had decided not to reveal how the machine worked for a while longer, to keep people guessing...

I didn't think about it again until a few days ago when a YouTube suggestion for a video about the very machine appeared while I was watching something else. I never thought that over 40 years later it would still be a source of mystery and debate.

I wish I had kept my letter from David Jones, but as far as I knew he was going to reveal how the machine worked in a week or so, so I chucked it in the bin. Apparently all David Jones' letters about the machine are archived, so my letter could be in there!

So what is the secret? Well, I would hate to spoil a 40 year old mystery. It's not really that difficult to guess. A number of people in the YouTube comments have suggested the answer I came up with. As Virginia Mills intimates in the video, look for a mundane explanation, rather than an exotic one. She also gives a huge clue in talking about Orffyreus' weighted wheel perpetual motion machine. The idea of falling weights adding impetus to a wheel is initially attractive until you remember that there is actually no net input of energy because the momentum of the wheel has to drag the weight upwards from a lower level on the way up. Without a source of energy it won't work.

But with a source of energy?

Sunday, January 22, 2023

Email clients for GMail in Debian Bookworm

I've been using the Thunderbird email client in Debian Bookworm XFCE for a while, but it seems to have a bug causing it to use 50-60% of the CPU and 500-600MB of RAM constantly, so I thought I would try out the alternatives.

I tried Geary but that won't run without the Gnome online accounts service, so I tried Claws Mail. That can read emails from GMail with an application password, but cannot send emails by SMPT, [See correction below] I suspect because GMail is constantly imposing increasingly restrictive security requirements. Claws now supports OAuth2, Google's latest security hoop, but getting an authorisation code is a process intended for software developers and not users. I tried it at one point, but gave up when I was asked for my credit card details. It's a shame because Claws seems quite suited to the feel of XFCE.

Which left me with Evolution, actually my favourite email application in Gnome. It installs without bringing down a lot of Gnome stuff with it, and runs OK.  Unlike Thunderbird it only uses 300MB of RAM, and CPU usage at idle is 0-1%.

It's a shame only big projects can afford the cost of enabling OAuth2 login for users (for which Google apparently charges a fee). GMail users on XFCE really only have the option of using Evolution a the moment it seems. I would be nice is there was a more minimalist option like Geary is in Gnome. Claws could be that option, but at the moment it is crippled by Google's security restrictions.


Update: Correction, Claws can send emails with a GMail application password, just, for some reason, not to yourself, which is how I was testing it. LinuxQuestions.

I also managed to get it to work with OAuth2 (entirely by accident) without giving Google my credit card details. I will try to work out how it happened in a future post.

Monday, January 2, 2023

Folder retention policy in Thunderbird

I have a folder of promotional emails which I look at from time if I need some service parts for the car or a new cartridge for the printer because sometimes there are sales or discounts worth taking advantage of. In Thunderbird I set the retention policy to delete messages more than 30 days old, because obviously these offers expire after some time.

I checked the folder recently and found that all my emails were still there.

After quite a bit of checking and searching, I found that you have to run File/Compact Folders to make the policy active for the first time.

Red Hat Bugzilla

A feature not a bug, apparently.

 I entirely agree with Mike A. Harris' comment on the bug report.

I chose "File->Compact Folders" in and it does not seem to work, however if I right click directly on the folder with a retention policy and choose the "Compact" option, it causes the folder to flush mail older than the retention timeframe. I'm not sure if thunderbird will auto-flush mail in that folder afterward or not, or if you have to constantly manually choose "compact".

Personally, I still consider this a bug because the majority of users who choose to set a retention policy of n days are neither informed that, nor are they likely to guess that they have to perform another action like "compact". So if it isn't considered a bug per se. then it definitely is a design flaw. Having said that, it probably belongs in the upstream bugzilla I guess. 

Hopefully thunderbird 3 has a more intuitive design that works like one would expect. :)

I checked my promotions folder again today, and it seems the retention policy is now in force, as emails older that 30 days have been deleted. As Mike pointed out, you need to right click the folder and choose the Compact option for the policy to work.

Action buttons in notify-send notifications

Search for "action button notify-send", and the first two results currently say "It seems notify-send can't do this", or "No, notify-send doesn't support the use of actions/buttons", which isn't true any more.

This action was added about a year ago.

From the manual:


       -A, --action=[NAME=]Text...
           Specifies the actions to display to the user. Implies --wait to
           wait for user input. May be set multiple times. The NAME of the
           action is output to stdout. If NAME is not specified, the numerical
           index of the option is used (starting with 1).

Action buttons return a specified output (or an output of 0, 1... if no output text is specified). If they are not clicked, output is null. Thus

--action=yes=Okay --action=no=Cancel

Returns "yes", "no" or null.

--action=Okay --action=Cancel

Returns "0", "1" or null.

Output can be redirected to a text file and used to run a command:

notify-send --icon=system-software-update -w --action=yes="Click to update" "Updates available" > output.txt
action=$(cat output.txt)
if [ "$action" == "yes" ]; then

or to a function:

action=$(notify-send --icon=system-software-update -w --action=yes="Click to update" "Updates available")
if [ "$action" == "yes" ]; then

which seems like a better way to do it.

To have the number of updates in Debian:

updates=$(aptitude search '~U' | wc -l)
action=$(notify-send --icon=system-software-update -w --action=yes="Click to update" "$updates Updates available")
if [ "$action" == "yes" ]; then

This can be used in my update notification Genmon script for XFCE.


Update: If used with Genmon script, add the following to refresh the Genmon panel notification after the update:

if [ "$action" == "yes" ]; then
synaptic-pkexec && sleep 2 && xfce4-panel --plugin-event=genmon-<n>:refresh:bool:true

Where <n> is the Genmon ID number obtained by hovering over the Genmon item item in Panel Preferences > Items.

Sunday, January 1, 2023

Scanning from an HP All In One printer without HPLIP

My old HP Deskjet 3050 j610 doesn't need the HP Linux Imaging and Printing (HPLIP) package to print, just printer-driver-hpcups, but I've never been able to get it to scan without HPLIP. I wondered if it was possible get scanner support without installing the HPLIP package. Indeed it is.

The SANE backend libraries are in libsane-hpaio, which can be installed without installing HPLIP by doing

# apt install --no-install-recommends libsane-hpaio

Debian Wiki.

To scan over the network, it's necessary to supply the URI of the scanner, in my case, like this

$ simple-scan hpaio:/net/deskjet_3050_j610_series?ip=

Debian Wiki.

To get Document Scanner (simple-scan) to find the scanner when launched from the XFCE menu, I appended the URI to the launcher.

And scanning now works without HPLIP.

This method applies to all HPAIO printers, although some may need a plugin. The Debian Wiki describes how to install this if needed.

This is of course an old printer. More modern HPAIOs support driverless scanning and should be detected automatically without needing HPLIP or any of its dependencies.

Debian Wiki.

Sunday, December 18, 2022

Customising the GUI in DeaDBeeF Music Player

A video of the GUI customisation process in the DeadBeeF music player in XFCE with the Arc Darker theme. (Speed is x2). Just to show what can be done.

Plugins used were:

Playback Status Widget

Musical Spectrum

File Browser


Waveform Seekbar


Saturday, December 17, 2022

Build your own music player with DeaDBeeF

I've been playing with DeaDBeeF. (No, that's not as horrible as it sounds.) I wondered if I could come up with a an elegant, minimalistic design for the customisable music player, inspired by the screenshot at the website. I think I did.

Inspiration was the Audacious GUI of course, for anyone au fait with that excellent music player. It took me quite a while to wok out how to customise the player to my liking, and I'm thinking recording a screencast of the whole process might be fun.