Computer & Life Hacks

Enable NumLock at Boot in Lubuntu

Install numlockx:

sudo apt install numlockx

Then go to Menu > Preferences > KDE System Settings, then click on the Startup and Shutdown tab, then Autostart tab, then click the "+ Add..." button, then Add Application, then type in /usr/bin/numlockx on into the textbox and then click OK. You will now see the instruction added to the list of things automatically started. Each time you boot it will be called and will turn on the numlock.

How to sort folders at the top of items in Windows 10 File Explorer

Open File Explorer and set the view to details.

Then click on the modified date column until the down arrow appears.

Then hold shift and click on the name column.

Your folder will now be sorted by date with the folders at the top of the screen.

To set this for all folders, click on File | Folder View | Apply to All Folders.

Lost Network & Settings in Ubuntu 20.04

I rebooted my machine and found that I had no network, and worse, no network settings to restore it with!

TL;DR version is at askubuntu.com

I actually got it working by:

sudo apt-get update

sudo apt remove linux-image-unsigned-5.4.0-42-generic && sudo apt autoremove

sudo apt install linux-image-5.4.0-42-generic && sudo apt install linux-modules-extra-5.4.0-42-generic

And it all works now - well, obviously, or you wouldn't be able to read this - and you are.



How do I resize the screen of Parrot Sec in VirtualBox?

I have searched and found the VirtualBox Guest Addons fix, but that isn't working for me. Every time I resize the window in the VirtualBox settings and/or the Display Settings in Parrot Security, it initially resizes to what I want but reverts back to the 800x600 square default (both the VB machine (if in scaled mode) and the Parrot Sec display, although the display settings still say that they are in the higher resolution - see the screenshot below which shows a VirtualBox screen expanded to fit my display, with a Parrot Sec display resized to 1280x800 but only showing as 800x600. If I click where my mouse is in the screenshot, the window briefly goes to 1280x800 only to drop back to 800x600 a fraction of a second later.

A screenshot of my VirtualBox at 800x600 resolution
VirtualBox running Parrot OS at 800x600

Solution:

After installing VirtualBox Guest Additions, in your guest machine, open a terminal and run:

sudo apt-get update

sudo apt-get install virtualbox-guest-x11

If it asks you about keeping a file or installing the new one, press I to select the new one/package maintainer's version;

sudo VBoxClient --clipboard

Installing the virtualbox-guest-x11 package also resolves the issue where the shared folders are not visible.

And installing this package (and rebooting the virtual machine) also resolves the guest window not auto-resizing when the VM window is resized.

This also resolves the issue where paste after a reboot no longer works and the sudo VBoxClient --clipboard command needs to be repeated. After installing virtualbox-guest-x11, the --clipboard command does not need to be repeated after each reboot.



Use your Mobile as a Webcam

Can't get a webcam during this COVID-19 lockdown?

Simply use your mobile phone...

Android as Webcam



Ubuntu Click-to-Minimise

As a Windows user at home and in work, I was constantly irked by the fact that Ubuntu out of the box doesn't minimise open app windows when you click on the icon on the launchbar.

It turns out that just a simple piece of code rectifies that problem. Enter this into your terminal window:

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'



Windows Clipboard History

In the October 2018 update of Win10, Microsoft introduced the concept of Clipboard History - and I love it!

Remember the frustration of having copied something, then overwritten it by absent mindedly copying something else innocuous like an email address?

Well, with Clipboard History, you can recall your last 10 clipboard items.

Simply use ⊞ Win+V instead of Ctrl+V to paste.



Google Messenger Chat Feature

This fix will also work for the chat feature of the standard Android messenger.

Problem: I had changed my mobile provider from EE to Virgin Mobile. When my new SIM was inserted, I lost the Chat Feature(s) in Google Messenger. Kim has exactly the same handset (Galaxy S8) and we swapped contracts at the same time. Hers worked straight away but mine didn't. I read many articles about deleting the App Cache and Data etc., but nothing worked. I have Google 1 support on my account, and after trying lots of things, they sent me to Virgin Mobile for help. Virgin Mobile didn't really know either - I was provisioned correctly etc. Eventually they advised me to do a Factory Reset on my device (Arrrgh!)

Well, that didn't work at all. So I decided to live with it. Then after about a month, I was getting frustrated with it again and was considering doing a full factory reset and not restoring my apps/settings from Samsung/Google, but doing it all again by hand. I was that irked by the perceived slight that Kim's worked and mine didn't. I guess that's my Engineer peeking out.

Solution: Quite by accident, I was in the settings of my phone and noticed that since the factory reset (or so I thought), the roaming slider had been set to off. I generally keep it switched on as I don't go roaming very often and when I do I call my mobile operator to tell them. Anyway, I switched it to on and went back to whatever I was doing on the phone.

Well, within seconds, a message flashed upon the bottom of the screen telling me that the chat features were now enabled! I tested it out by sending a chat message to Kim and then a gif. It works fine.

Disclaimer: I don't know if the roaming feature needs to stay on or if it's just a one-time configuration thing. I keep mine on anyway, as mentioned above. Please let me know if you turn it off and it breaks it again.



Enabling HTTP/2 in Apache on Ubuntu >= 19.10

I struggled to find out how to set up Apache for Http/2. Turns out that a number of requirements must be met before HTTP/2 can be enabled for a website.

HTTP/2 Requirements

Requirement #1: HTTPS

HTTP/2 only works with HTTPS. If you have not switched your site to HTTPS, now is the time to do it.

Requirement #2: Apache >= 2.4.24

The first version of Apache to support HTTP/2 is 2.4.24. If you are on an old version of Ubuntu, this means you need to upgrade to Ubuntu 18.04 or above.

Requirement #3: PHP FPM

Short version: if you run PHP in Apache via mod_php, you need to switch to FPM. That is not a bad thing. FPM is newer and faster.

Long version: HTTP/2 is not compatible with Apache’s prefork multi-processing module. However, prefork basically seems to be obsolete so it does not hurt to switch to something more modern, i.e., the event MPM. That, in turn, requires a change in the PHP module from mod_php to php7.x-fpm.

Configuration Changes for HTTP/2

Switching Apache’s PHP Module from MPM Prefork to Event

Run the following commands:

sudo apt install php7.4-fpm

sudo a2enmod proxy_fcgi setenvif

sudo a2enconf php7.4-fpm

sudo a2dismod php7.4

sudo a2dismod mpm_prefork

sudo a2enmod mpm_event

sudo systemctl restart apache2

Caveat: W3 Total Cache Shows Apache Modules as Not Detected

W3 Total Cache seems to rely on the function apache_get_modules() to detect Apache modules, which does not work with FPM. According to this support article from Plesk , this issue can be ignored.

Installing and Enabling HTTP/2 in Apache

Enable the module mod_http2:

sudo a2enmod http2

sudo systemctl restart apache2

Enable the HTTP/2 protocol by adding the following to the end of /etc/apache2/apache2.conf:

Protocols h2 http/1.1

How to Verify that HTTP/2 is Working

At the command line type:

curl -I -k --http2 https://localhost

The output should look something like (noting the first line of HTTP/2 200):

HTTP/2 200
date: Sat, 01 Feb 2020 21:44:24 GMT
server: Apache/2.4.41 (Ubuntu)
last-modified: Sat, 01 Feb 2020 20:37:01 GMT
etag: "1f1e-59d88a6d9fa0f"
accept-ranges: bytes
content-length: 7966
vary: Accept-Encoding
content-type: text/html

Or use this online checker.



Mercedes W203 Auto Transmission/Gearbox Reset/Relearn

05 March 2020 - Update

It turns out that this may have been placebo. Now, I'm still convinced it works, but the literature says that it really is just our perception.

After all, Placebo is the strongest drug known to humankind.



Outlook - How to Sign Your Own Macros/VBA

It's very simple - use SelfCert.exe which is included with Microsoft Office.



Office365 Credentials

For the last few months whenever I open Word, Excel, PowerPoint or Publisher from my Office 365 subscription - The apps installed on my Windows machine - I get a pop-up asking me to enter my credentials. Although there is a "Keep me signed in" checkbox, the pop-up appears every time the app is opened.
Weirdly, all the 'O's - OneDrive, OneNote and Outlook all work perfectly OK (I get that OneNote is technically part of Win10, not Office365).
Searching the interwebs just brought up similar problems with Outlook.
I tried the suggestion of clearing the stored credentials in Credential Manager (Click Start and then start typing "Credential Manager") by deleting the stored credentials, but nothing seemed to work.

I raised the problem on the Office Community site and after going over the basic things again, another user suggested just re-installing Office365.

It worked! And it was painless!
I didn't really want to have to uninstall Office, but that was the only thing that seems to have worked.

If anyone else has the same issue, the process was quick and easy and the only thing that really changed was the order of the Office Apps in the Start Menu (which are easily dragged back into the position you like). Everything else, like the recent documents etc. remains the same.