Search Results For: simple
Showing 11 to 15 of 17 blog articles.
1323 views · 174 days ago

![Creating a PHP Daemon Service](https://images.ctfassets.net/vzl5fkwyme3u/18L41PfcrcYYkM0qAsCous/7caca26b8cfb5a643d8cb16b14ae5eae/AdobeStock_147870533.jpeg?w=1000)

# What is a Daemon?

The term daemon was coined by the programmers of Project MAC at MIT. It is inspired on Maxwell's demon in charge of sorting molecules in the background. The UNIX systems adopted this terminology for daemon programs.

It also refers to a character from Greek mythology that performs the tasks for which the gods do not want to take. As stated in the "Reference System Administrator UNIX", in ancient Greece, the concept of "personal daemon" was, in part, comparable to the modern concept of "guardian angel." BSD family of operating systems use the image as a demon's logo.

Daemons are usually started at machine boot time. In the technical sense, a demon is considered a process that does not have a controlling terminal, and accordingly there is no user interface. Mo...

857 views · 180 days ago

![Underclocking a Website](https://images.ctfassets.net/vzl5fkwyme3u/1gUKgVHV36U4mqgWwwIA8G/1e350cae18d63baa658ce1ce39eaf991/AdobeStock_142796620.jpeg?w=1000)

For those of you not familiar with the concept of underclocking: it's the opposite of overclocking, that is, you don't speed up CPU but instead slow it down..

### What for?

Ask the underclockers, I'm totally not sure. Actually, hanging around the Web these days leaves a feeling that nearly every website out there must have been underclocked, but most of the time it's about tons of unnecessary images, megabytes of javascript (of which hardly a hundred kilobytes gets actually executed), and all that. In this post I will, however, tell you about a server-side approach to underclocking, with a help of our good old friend - the MySQL Database Server.

Today I had a nice chat in my client's development telegram channel. The two other devs, R** and V**, were making a switch of the old imag...

1831 views · 190 days ago

![Creating a Virus with PHP](https://images.ctfassets.net/vzl5fkwyme3u/1Ake3wrxwAyQSMs0amgYmG/79bd99b12402c71afb4f2290c5962daa/virus.png?w=1000)

In his talk, “[Writing Viruses for Fun, Not Profit](https://beta.nomadphp.com/video/220/writing-viruses-for-fun-not-profit),” **[Ben Dechrai](https://twitter.com/bendechrai)** (after making the viewer take a pledge to only use this knowledge for good and not evil) walks through how many viruses operate, and just how easy it is to build your own self-replicating virus in PHP.

The danger of many of these viruses according to Ben is that the most dangerous viruses often escape detection by not looking like a virus. Instead they encrypt their code to hide their true intent, while also constantly adapting and evolving.

Perhaps even more dangerously, they act like they’re benign and don’t actually do anything - often times laying dormant until called upon by the malicious actor.

### Crea...

1641 views · 206 days ago

![Type Arrays with Variadic Functions in PHP](https://images.ctfassets.net/vzl5fkwyme3u/6e5WrjNthmKmS6C2AAWoi0/889f4e4afe965d040b17fbe7834ad07a/AdobeStock_200448817.jpeg?w=1000)

It's a very common task to work with an array of values, each of the same type. Integers, strings, all kinds of objects etc. But PHP is still a weakly typed language, so it's hard to tell if an arbitrary array actually contains only values of a given type.

Of course, you can always use a class:

```

class IntArray {

private $values = [];

public function add(int $value) {

$this->values[] = $value;

}

}

```

Then, whenever you need an array of integers, you may write something like this:

```

class BatchProcessor

{

private $ids;

public function __construct(IntArray $ids) {

$this->ids = $ids;

}

}

```

Not bad. You'll need a class per type, though, and that may seem a bi...

702 views · 207 days ago

![PHP Basics](https://images.ctfassets.net/vzl5fkwyme3u/6mNUFZDod2SQKm20g4YsoC/b36221b3a8260ee3047a377edc6470b1/AdobeStock_69092685.jpeg?w=1000)

It's 2018, and you're a top-notch modern web developer, with a load of knowledge and tools right there at your disposal: Google and StackOverflow, debugger with a GUI, IDE with autocomplete, you name it. Occasionally, though, you still find yourself in a plain old text console on a remote server, or you have to do something without IDE, or there is no network connection... In such cases it might be helpful to feel comfortable in a simple terminal. In this post I'm going to list some switches for the PHP command that you can use to get information and some utilities.

### Getting basic information about PHP

```

$ php -i

phpinfo()

PHP Version => 7.2.10-0ubuntu1

System => Linux awesome 4.18.0-10-generic #11-Ubuntu SMP Thu Oct 11 15:13:55 UTC 2018 x86_64

Build Date...

SPONSORS