About the author:

All posts by Terence:

Comparing the performance of String, StringBuilder, StringBuffer

Try it yourself: Compare the performance of Java’s String vs. StringBuilder vs. StringBuffer

If you are dynamically generating strings in your Java program, one of the best things you can do for your program is to build your string using a StringBuilder or StringBuffer, as opposed to using a regular old String.

The reason for this? In Java, strings are immutable, and every time you concatenate a string that the program hasn’t seen before, a new string object is created and stored in the heap. This means the whole process involves a lot of reading from and writing to the memory. The StringBuilder and StringBuffer in Java are objects that are designed to do string concatenation in a more efficient manner, but how much more?

We’ve got a simple Java program here that you can run from your browser so you can see it for yourself.

Continue reading
How to convert double dash to em dash in WordPress Gutenberg

How I made double dashes automatically convert to em dashes in WordPress Gutenberg Editor

Over the weekend, I was tackling a client request requesting for us to help modify their WordPress backend so that when writing posts, the Gutenberg Editor will automatically convert consecutive double dashes -- to an em dash character.

It was a particularly difficult task for me, despite having coding in WordPress for many years, simply because the Gutenberg editor was relatively new, and there is very little documentation regarding it.

Continue reading
How to override Astra Pro templates in a child theme

How to override Astra Pro templates in a child theme

At the recommendation of a fellow web developer, I’ve been using the Astra theme in WordPress to develop Terresquall’s client websites for years now, and it’s been by and large a positive experience. Astra is a very versatile theme that can be used to build many different kinds of website, and their paid Astra Pro plugin adds even more customisation options, allowing for even more rapid customisation options.

If you are building your site upon the addition features that Astra Pro provides using a child theme, however, customising Astra Pro templates can be a bit difficult to do, because there isn’t much documentation about this.

Continue reading