Here we will discuss steps needed to add selenium acceptance tests with codeception to existing yii2 project with docker-compose setup that uses nginx as the http server with FCGI. The problem with acceptance tests is that the testing browser will access the app through the main files, not through the testing files, as it is…
Benchmarking javascript inserting a new element into a sorted array – three approaches
Task: having a sorted array add one value so that the array remains sorted in browser-based JavaScript. Assumption: internal array sort may win to some extent over interpreted search and insert. What I did is implemented all three algorithms and made a post to demonstrate the results of the benchmarking. Tests are run in async…
Intellectualist game rules
How to play the intellectualist game. It’s a verbal literacy game that allows players to increase their vocabulary. Suits for middle school or older. Take into account players vocabulary, don’t choose words they don’t know at all. Purpose of the games is to guess the hidden word. One of the players is chosen as the…
Find docker swarm host on which a container is running by id or container hostname
When running apps on a docker swarm sometimes we know from the monitoring/alerting system just a container hostname, but measures should be taken on the host. For example, free up some disk space. I’ve struggled to find a way to find it out in an easy way, but haven’t succeeded. So, I came up with…
Run pdftk on Ubuntu 18.04 or later
The convenient pdf manipulation tool [cci]pdftk[/cci] is not available in Ubuntu 18.04 repositories because of some licensing incompatibilities. Using some docker magic and a small script we’ll use it as in previous Ubuntu releases, since it’s still available in 16.04 repositories. Here we will exploit the docker capabilities to run the [cci]pdftk[/cci] binaries in the…
Custom php.ini to the docker library php using docker-compose config
An approach that adds additional ini files to be parsed by php by just adding two lines to your docker-compose.yml. It’s a convenient practice for small projects without ad-hoc tailoring to use prebuilt images from docker hub. Sometimes we need to change some php.ini settings for a php container, for example, increasing upload_max_filesize parameter. The…
docker-compose logs sorted by time
Trying to understand what’s happening inside your code running in multiple docker-compose containers by reading logs could be a terrible idea if log lines are outputted in a random manner. Which is true at least for docker-compose version 1.8.0, build 94f7016. This could be simply checked by running the following command several times. docker-compose logs|head Here…
Nodejs cache images or other binary data on local disk filesystem
I’ve been looking for a simple npm package that will allow caching arbitrary binary data (images, specifically) on a local fs storage. I could have do the work for saving the files locally, but cache invalidation task was too much. In a hope that someone already created the package I’ve looked through the npm. What…
Terminating wp-pro-quiz quiz on first wrong answer
There’s an awsome quiz plugin for WordPress which lacked the option for terminating a quiz on first wrong answer. Pull request for that option is submitted.
Disable transparent HugePages in Ubuntu or Kubuntu for TokuDB on boot
To enable TokuDB engine in MariaDB one has to be sure that transparent hugepages are disabled. I assume you’ve already installed MariaDB and edited config files so that TokuDB should be enabled. Test if transparent hugepages are enabled or disabled: root@sheershoff-kbnt:/etc# cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never] root@sheershoff-kbnt:/etc# cat /sys/kernel/mm/transparent_hugepage/defrag always madvise [never] If you see…