Category Archives: Computing

GRUB vs Windows

While my main driver (laptop) is dual boot Linux (Arch) and Windows 11, ocassionally Windows Update manages to disrupt GRUB so that the system can’t boot. Yesterday was one of those days.

So for prosperity / my own sanity, here’s a quick reminder of how I got it working again.

Booting

In order to boot the system, I used the GParted USB stick that I keep for exactly such emergencies. I can’t recall the number of times having this around has helped save my bacon! Booting into the GUI is simple, and it automatically loads the Gparted application. Useful to help see what is on which partition. For me this looks like:

PartitionFilesystemDescription
/dev/sda1FAT32700MB – EFI / ESP
/dev/sda2Microsoft ReservedWindows put this here, and I just keep it as it’s only 16MB
/dev/sda3NTFSWindows C:
/dev/sda4NTFSHidden, diagnostic partition, only 650MB
/dev/sda5EXT4Arch Linux /
Partition Table on Laptop

Danger, Here Be Dragons

The following is performed as root, in a terminal. Be careful – these are the commands I need to execute on my system. Your system will be different.

Firstly, I setup and entered the chroot Arch environment:

mkdir /tmp/arch
mount /dev/sda5 /tmp/arch
cd /tmp/arch
mount /dev/sda1 efi/
mount -t proc /proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
chroot /tmp/arch /bin/bash

Next I needed to run some GRUB commands to re-install the boot loader. These commands are specific for UEFI systems.

grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

To read more on these see the Arch Wiki GRUB pages.

Once sucessfully completed, it was simply a process of rebooting!

Laravel Telescope

Today I tried out Laravel Telescope. From the official Laravel Telescope page, it is designed to:

Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more.

https://laravel.com/docs/9.x/telescope

Installation

I was adding Telescope to in-progress app that I was developing in VSCode on Github.

These are the commands I followed to add to this existing project:

Firstly, I brought my local development Docker environment up, using Laravel Sail:

./vendor/bin/sail up -d

I followed the Local Only Installation instructions, so I added the Telescope dependency, for the dev environment, using Composer within Sail:

./vendor/bin/sail composer require laravel/telescope --dev

After installing Telescope, I published its assets using the telescope:install Artisan command. After installing Telescope, I also run the migrate command in order to create the tables needed to store Telescope’s data:

./vendor/bin/sail artisan telescope:install
./vendor/bin/sail artisan migrate

After running telescope:install, you need to remove the TelescopeServiceProvider service provider registration from your application’s config/app.php configuration file. Instead, manually register Telescope’s service providers in the register method of your App\Providers\AppServiceProvider class. We will ensure the current environment is local before registering the providers:

public function register()
    {
        //
        if ($this->app->environment('local')) {
            $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
            $this->app->register(TelescopeServiceProvider::class);
        }
    }

Finally, you need to also prevent the Telescope package from being auto-discovered by adding the following to your composer.json file:

"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/telescope"
        ]
    }
},

Configuration

After publishing Telescope’s assets, its primary configuration file will be located at config/telescope.php. This configuration file allows you to configure your watcher options. Each configuration option includes a description of its purpose, so be sure to thoroughly explore this file – all very well documented.

Accessing the Telescope UI

The Telescope dashboard may be accessed at the /telescope route. By default, you will only be able to access this dashboard in the local environment.

http://localhost/telescope

I’ve not had chance to fully explore Telescope yet, but at least the installation was very straight forward. I’m hoping it will be a very useful framework-level debug tool.

Laravel Telescope UI

WordPress Plugins: PlatformInfo & Cachify

The sense of irony in writing about a WordPress plugin, on a WordPress blog, hosted on a system where I can’t install plugins (welcome to wordpress.com!) is not lost on me, however I shall persevere…

Over the winter break I’ve been writing and contributing to WordPress plugins, as a means of:

  • contributing to an Open Source Community,
  • learning something to prevent brain-rot, and
  • it’s PHP, so you’ve got to love it

Firstly, I’ve written a WordPress plugin called PlatformInfo. It’s fairly simple, so that I can learn the plugin ecosystem, refine my tooling, etc – but it’s designed to do one thing fairly well. PlatformInfo displays, ad-free and no-nag, important information to help you diagnose issues with your WordPress setup or plugin development.

It’s useful for issues related to common php.ini settings, environment variables, user constants, and OPcache.

I’ve even managed to get it published in the official WordPress Plugin Directory, so other WordPressers can install it straight from WordPress: https://wordpress.org/plugins/platforminfo/

Secondly, I’ve contributed Redis support to the well-known and popular caching WordPress plugin called Cachify. This plugin is one of many looked after by the pluginkollektiv.

Both have taken me about a week, in between Christmas, New Year, family Zooms, walking, trying to keep my mental health in a reasonable place, etc – but I’ve learned a lot (WP Coding Standards, SVN, PHP’s output buffering, Sniffs for phpcs, GitHub Actions, etc) and am already working on plugin contribution #3… watch this space.

In the mean time, for those of you interested, here are some links to code and documentation that you may find useful if you’re developing WordPress plugins:

DK’Tronics Dual Port Joystick Interface

As part of my Z80 revival, I managed to get my hands on a DK’Tronics Dual Port Joystick Interface for my rubber-keyed ZX Spectrum 48k.

The interface provides two joystick ports, and according to Spectrum Computing, the left port implements the Kempston ( IN (31) ) protocol. The right port implements the Sinclair Port #1 protocol (keys 6,7,8,9,0) but there is a known error that UP/DOWN (keys 8 & 9) are reversed from the Sinclair standard.

https://spectrumcomputing.co.uk/entry/1000120/Hardware/DKTronics_Dual_Port_Joystick_Interface

Inside, there are a couple pf 74LS367AN’s (Hex 3-STATE Buffer/Bus Driver), a 74LS138BI (Decoder/Demultiplexer), 10 diodes, and a couple of resistors.

Interestingly there is no ZX Spectrum Expansion Port pass-thru, however the case does have a slot where one could be added.

The case is help together with three identical screws; two of which go through the PCB.

You can see from the underside of the PCB, only some of the connections are soldered. Presumably only those required, to reduce cost / manufacturing time.

Marking on the board include:

  • “JS3.1”
  • “dk’tronics”
  • “DA84” (presumably suggesting year of manufacture as 1984?), and
  • Some felt tip markings “T” and “23”, presumably from some QA processes

I’ve included a whole bunch of photos of the exterior, inside and both sides of the PCB.

Ubuntu / Gnome – Switch Windows, not Applications

So, if you have recently switched from Windows to Ubuntu, you will notice that the Alt+Tab groups windows of similar applications.

For instance, if you have 3 windows of the same web browser application running, Alt+Tab won’t let you switch between those windows. Turns out, you have to use Alt+` to switch between windows of the same applications. Annoying, right?

My muscle memory of using Alt+Tab for years on Windows, I cannot resist it. So, I found a way to separate windows of the same application in the tab switcher. So, here’s how you do that.

Search “Keyboard Shortcuts” on the GNOME launcher.

Within the keyboard shortcuts and under the Navigation tab, you would find a shortcut called “Switch Windows“.

Click on the shortcut and it will ask you to provide the hotkey. In our case, we will keep the hotkey as “Alt+Tab“. Click on the Set key to save this hotkey.

Once you have done this, now Alt+Tab would work as switching between Windows rather than Applications.

You may thank me later 🙂

Ventoy

If like me you have several USB sticks hanging around the home office, and each one contains a bootable ISO that you keep just in case (like a copy of Ubuntu, for fixing GRUB2 issues, or a copy of GParted for partition / filesystem issues) then you’ll also know the pain of a) not having enough USB sticks for all of these, and hence b) the pain of having to use Etcher / Rufus / dd to put the right ISO on the risk USB stick at the right time.

Enter Ventoy.

Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. With ventoy, you don’t need to format the disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)/EFI files to the USB drive and boot them directly.
You can copy many files at a time and ventoy will give you a boot menu to select them (screenshot). x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.

https://www.ventoy.net/