Using Jquery Formbuilder

2 Jul 2020

, ,

jQuery formBuilder is a lovely stylish formbuilding tool, with all the front-end features a developer could desire. But the documentation is a little short of examples for integration with a backend system + database, and the gitter chat is completely full of people struggling with the basics.

I’m writing down some integration notes to keep it clear for myself in my head.

I’ve tried to keep this code as simple and as framework agnostic as I can.

Example code = dirty code. Do not use in real-life.

Read More

The case of the 500-mile email

18 Jun 2020

I love this story. It’s from the early days of the interwebs, mid 1990s.

Many stories from the world of IT support will leave you feeling that “everyone who asks for help is a fool”. It’s a world where the Bastard Operator from Hell is still seen a positive role-model, and any assistance often comes with a hefty side-helping of contempt.

This one starts with the classic:

“We can’t send email more than 500 miles,” the chairman explained.

I’m reading this, and I’m braced for the traditional “Ha! Ha! These lesser mortals are such fools!”

But it goes on, and there is some investigation, and test emails are sent, and the user is entirely right. They can’t send email more than 500 miles.

It’s complicated; there are sendmail configuration files, and the speed of signals in a fiber backbone is relevant (this story has a FAQ page) but my main take-away is that.. wait for it…



Finite State Machines

4 Jun 2020

, ,

What is a finite state machine?

A finite-state machine (FSM) is a mathematical model of computation. It can change from one state to another in response to some inputs; the change from one state to another is called a transition. An FSM is defined by a list of its states, its initial state, and the inputs that trigger each transition.

Thank-you Wikipedia. That’s helpful.

Read More

New in PHP 7.3 – Flexible heredoc syntax

23 May 2020

Heredoc is a useful tool for larger strings, though they have an indentation quirk which always put me off.

To quote from the PHP Requests-for-Comments:

The heredoc and nowdoc syntaxes have very rigid requirements. This has caused them to be, in-part, eschewed by developers because their usage in code can look ugly and harm readability.

PHP 7.3 introduces two changes to the syntax for heredoc and nowdoc syntaxes:

Read More

Carbon Dating

16 May 2020

, ,

Over the years, I’ve built a whole library of helper functions for working with dates in php, but I think they’re all a thing of the past now. Because I’ve been playing with Carbon Date library by Brian Nesbitt. It’s best described as Php’s DateTime for humans.

Here follows a quick summary, but I’m just looking at the very tip of the iceberg. Lots more!

Read More

Using Bootstrap Modals with Laravel

9 May 2020

, ,

I use modal popups all over the place in my web applications. The most frequent use is to make the user confirm deletion, either by typing DELETE into a form or by giving a reason for deleting the item in question. And I want to make this work in Laravel.

Note: this is klunky.  I’ve been playing with Laravel for a few weeks and if I end up using it as an ongoing development platform, then yes, things will be rewritten.

Read More

Your password must be at least 8 characters long, contain a mixture of uppercase and lowercase letters, and include at least one number or symbol

2 May 2020

Familiar with password forms like this?

Restrictive password rules are not just frustating and unhelpful for people trying to manage logins for a multitude of sites; they (officially) do not do much for security on your website.

Read More

Using the Macintosh without taking my hands off the keyboard

25 Apr 2020

Every time I take my hands off the keyboard and reach for the mouse, and drag the mouse across the desk, I’m losing time. I’m going slower and moving out of flow. It’s especially true when I’m working with a large monitor, or dual-monitors, and I have to moooove the mouse all the way to where it needs to me. Or the mouse cursor has disappeared on me, and I have to frantically slide the mouse until the movement traps my eyes and I can see where it is on the screen.

We all know the basics are Cmd+C for Copy, Cmd+X for Cut, and Cmd+V for Paste.

Read More

Think Small: The Surprisingly Simple Ways to Reach Big Goals, by Owain Service, Rury Gallagher

1 Aug 2019

These are my reading notes & a quick summary.  If we’re aiming for big things, it’s easier to succeed if we get the small details right.

Read More

What went wrong?

30 Oct 2018

Okay. So I had a problem with my Mac. Basically, about 10 minutes after a restart, the application switcher and the dock would stop working. Whichever application I had at the front (chrome, terminal, editor whatever) would be fine but I won’t be able to load or change to any other application. Alt-Ctrl-Esc would work, so I could kill applications, but that wasn’t particularly helpful.

The cause of the problem took FAR TOO LONG to track down. It was apache. More specifically, I had installed Homebrew’s Apache and the built-in version of apache hadn’t been disabled properly, so they both started up on a reboot. NO IDEA why this broke the dock.

(Note: I had setup apache using this guide macOS 10.14 Mojave Apache Setup: Multiple PHP Versions – and thank-you grav people, very helpful.)

If I killed all the httpd processes (sudo pkill httpd) immediately after the restart, and then restarted apache I was fine but that wasn’t exactly a longterm solution.

This command should stop the running instance of Apache, and record that it should not be restarted.

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

But it gave the error:

/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service

Basically, the native OSX instance was still running, but it had become separated from launchctl, so launchctl couldn’t unload or stop it.

First of all, I took the brew apache out of the picture

brew unlink httpd

Then try

which httpd

This showed /usr/sbin/httpd Okay, we can now FINALLY see the OSX apache. Try restarting it.

sudo apachectl restart

It gave this error:

Address already in use: AH00072: make_sock: could not bind to address [::]:80

That’s my problem. Because of this error, the apachectl process would start up, but the launchctl couldn’t shut it down properly.

A little bit of headscratching, but fixed by editing the apache config file (for OSX, not brew apache) /private/etc/apache2/httpd.conf and setting:


Now the command sudo apachectl restart works. And sudo launchctl unload ... also works.

Restart the mac, check the processes and (hurrah) no httpd processes found.

Link brew version back up.

brew link httpd
brew services restart httpd

Normality restored. But it took me a long time to get there.

Pretty sure all this kicked off when I upgraded to Mojave 10.14.

TL;DR launchctl thought it had properly shut the apache process down, but the apachectl agent refused to stop because reasons, resulting in a decoupled process