Article of the week

Substituting file contents in place with BASH and sed

Substituting file contents in place with BASH and sed

05 Mar 2017 16:33:19


Article on substituting pieces of contents of a file in place with BASH and sed.


The problem of substituting file contents in place on the command line is an old one. Often it creeps out when dealing with configuration or other text files. You just need a quick substitution , perhaps with sed, but what you end up with is frequently either none or a wrong ...

Read full article »

Recent articles

Sorting objects by their property in PHP

10 Dec 2016 13:10:14

Sorting objects by their property in PHP

Lets say you have got an array of assorted objects, each with the same set of properties, which are either numbers or strings, and you would like to sort them by one of those properties using PHP. Since it is a fairly common requirement, you can expect the basic tools are ...

Read more »

Setting home and siteurl dynamically in Wordpress

10 Dec 2016 09:44:06

Setting home and siteurl dynamically in Wordpress

If for some reason you have set siteurl and / or home options wrong in your WordPress installation database and as a result can't access admin panel, or perhaps have a reason not to change these options in wp_options table, you can overwrite them either in wp_config.php or ...

Read more »

The most used Wordpress hooks

28 Nov 2016 20:53:05

The most used Wordpress hooks

Below is a list of the most often used hooks (sorted by the number of callbacks attached ) on a vanilla installation of WordPress (v.4.6.1) with twentysixteen theme loaded. On such a setup, in total I found 261 hooks, something was attached to. As seen in the list, the most ...

Read more »

Find total of a column of numbers with BASH

28 Nov 2016 20:53:05

Find total of a column of numbers with BASH

Suppose you have a file with a long list of items followed or perhaps preceded by whole numbers and you are asked to find the total of those numbers. The file might look like this (case 1): aaa:23 bb:2 ccc:98 . . . or perhaps like this (case ...

Read more »