I saw an article about cities doing various things to reduce heat, including lighter road surfaces and planting trees. Trees provide good shade and reduce temperatures, and are generally good for the environment, but can require quite a bit of water for dry areas. I got to thinking that we could build artificial tree-like structures to provide shade. But it would require a lot of material, and it would be undesirable cost-wise and environmentally to dig up new materials for this purpose. So I wondered about building them from waste materials.
Continue reading post "Ideas: Waste material as shade structures"solution posts
MySQL: DELETE with sub-query on same table
I had an issue with a MySQL query containing a sub-query recently where it worked fine when done as a SELECT
query, but gave an error when switching it to a DELETE
query. The error given was something like ‘You can’t specify target table “items” for update in FROM clause’. The sub-query was referencing the same table as the main query, which apparently can’t be done directly in MySQL because the table will be modified during deletion. But there is a sort of a hack I found in this StackOverflow answer, among others, to force it to create a temp table and allow it to work.
Firefox: Weird rendering with high contrast mode
I figured out why Firefox 91+ seemed to break some CSS rendering for me (as I blogged about a few weeks back): high contrast mode. I’ve used the accessibility setting “Increase Contrast” on Mac OS for some time to make it easier to see some interface elements. Apparently, via Firefox 91 release notes, “Firefox now automatically enables High Contrast Mode when ‘Increase Contrast’ is checked on MacOS”.
Continue reading post "Firefox: Weird rendering with high contrast mode"Javascript: Submit form with overridden submit method
I come across the situation occasionally where I am trying to submit a form programmatically with javascript, but it happens to contain a field with an id
or name
attribute of submit
.
Automatically reconnect PDO when connection times out
In PHP scripts that run queries to a MySQL database over a long period of time, the connection may time out and give a “MySQL server has gone away” error.
Continue reading post "Automatically reconnect PDO when connection times out"Symfony router: check for match on different host
I found myself wanting to check if a given URL path exists on another host of a multi-host Symfony application from within a controller action. The router service, which is the instance of Symfony’s routing component used to route requests to actions, has a match()
method, but it only accepts the path part of the URL. It also has a matchRequest()
method, but that seems to ignore the HTTP_HOST
and SERVER_NAME
of the passed Request
object.