Difference between htmlspecialchars_decode and html_entity_decode

There are quite a few similar functions in PHP. Some of them are almost identical like echo and print and some have subtle differences which are not obvious at the first glance. We can put htmlspecialchars_decode and html_entity_decode in this category. There is a lot of confusion between notions of HTML special characters and HTML entities so let’s look into the difference.

Continue reading “Difference between htmlspecialchars_decode and html_entity_decode”

PHP – Convert special character &quot to real quote

In certain situations, you could be messing with HTML special characters in a text. At first glance, you might not even notice these are existing in the text. For example, if you’re looking text in a browser these characters will look just like normal characters. But when you peak into the page source you’ll see very different representations, (&amp; for &, &quot; for “, &lt; for <, &gt for > and so on). So how do you convert it to the normal characters?

Continue reading “PHP – Convert special character &quot to real quote”

How to copy file with SCP from one server to other without password

Sometimes we will need to automate file copying between our servers. For example, our shell script might need to copy the backup from time to time and we don’t want to provide the password in the clean text format. So what we can do about this?

Continue reading “How to copy file with SCP from one server to other without password”

Multiple MySQL instances on one server

When you enter the field of multiple MySQL instances on one physical server you might run into the trouble. Lack of documentation, cryptic bugs, and insane settings is something you need to get used to. I almost quit a few times in the process and only my habit of trying unusual things when everything logical failed kept me up to the solution.

Continue reading “Multiple MySQL instances on one server”

Invalid characters in JSON

Recently I run into problems trying to save JSON into MySQL database. Even though MySQL supports JSON type for some time now, there are still plenty of gotchas while you work with it. The situation is pretty critical with special characters. This time we are going to be short and on the topic of invalid JSON characters.

Continue reading “Invalid characters in JSON”

PHP – What is the difference between echo and print?

PHP can sometimes be confusing where it shouldn’t be. One area of confusion is the issue with duplicate built-in functions. I’m always inclined to think that developers probably had good reason to make duplicates and the most of the times its good assumption.

But is it always true? Let’s see on the example of echo end print functions.

Continue reading “PHP – What is the difference between echo and print?”

PHP – What is the difference between single and double quotes?

Difference between single and double quotes in PHP can be confusing. Moreover, it can lead to unexpected results, so it’s better to get familiar with it so you can avoid bugs.

Let’s dive into the details…

Continue reading “PHP – What is the difference between single and double quotes?”

How many CPU cores do I need?

In the 3rd installment of the Beginners guide to programming, we will explore Central Processing Unit (CPU) and its role in the computer system and programming. I hope that you remember everything from first and second level programming guide. If not, you can refresh your memory before you jump into this one.

We will start exploring CPU role from the perspective of simple question many people are asking these days which is: How many CPU cores do I need?

Continue reading “How many CPU cores do I need?”

Why is my computer or phone so slow? – part 2

Welcome to the level 2 of computer and programming guide. Remember all from level 1 guide for programmers?

The answer to the question from the title could be that you have RAM issues. RAM is the main memory of your computer or phone and it seems that your apps are eating to much RAM. Your whole operating system (Android, iOS, Windows) is slow because it requires more RAM but how it’s possible when you uninstalled some apps but nothing much is changed? It’s still slow.

Continue reading “Why is my computer or phone so slow? – part 2”