Daniel Gafitescu Freelance web developer focused on open source solutions


10 km – Edelweiss Night Run (2nd edition)

Website : https://edelweissnightrun.ro

Length: 10 km (but GSP show 11.5 km)

Time: 02:04:05


Overall : 72 / 141 (159)

Male: 57 / 91


Due to weather I was almost 1 hour slower than in 2016.



Filed under: Personal No Comments

21,3 km – I..AȘI în Trail – Semimaraton Transgor Logistik

Website : http://iasiintrail.ro/

Length: 21.3 km

Time: 02h 32m 45s


Overall : 112 / 237

Male: 99 / 169

Age category: 44 / 84


Almost 10 minutes faster than last year.


Filed under: Uncategorized No Comments

30km – Radical Race Rarau

Website : http://www.radicalrace.ro/alergator/

Length: 30 km

Time: 5h 24m 28s

Place: 60/75 (Male General) 24/31 (30-39 age)



Filed under: Running No Comments

Half marathon – Via-Maria-Theresia 2016

Website : http://via-maria-theresia.ro

Length: 21.8 km

Time: 04:17:28

Place: 104/167



Filed under: Running No Comments


I switched from using Vagrant boxes to Docker .

There are few reasons why I did that :

- starts very fast

- low memory & disk usage

- there is no need to use Virtualbox anymore

- can deploy to AWS , DigitalOcean and Rackspace  same server configuration as on your local

- scale easier

I watched a couple of training videos :

1. Learning Docker from O'Reilly

2. Real World Docker from O'Reilly

Tagged as: No Comments

Send SMS using AWS SNS

Usually I go with Twillio for sending SMS but AWS has a cheaper and easier solution for this.
Here is the code to send a sms using AWS SNS

First thing install aws/aws-sdk-php package

require __DIR__.'/../vendor/autoload.php';

use Aws\Sns\SnsClient;
$client = SnsClient::factory([
    'credentials' => [
            'key'    => 'your key',
            'secret' => 'your secret',
    'region'  => 'us-west-2',
    'version' => "latest"

$sent = $client->publish(
        'Message' => 'This is the message',
        'PhoneNumber' => '+123344545',
        'MessageAttributes' => [
            'AWS.SNS.SMS.SenderID' => [
                'DataType' => 'String',
                'StringValue' =>  'The sender'


Tagged as: , , No Comments


I wanted to see more statistics on my server over a period of time and one of the open source solutions was Collectd .

In order to view the graphics I installed Collectd-web which comes with a stand along python server that I can start when I want and just start ssh tunnel to see web page.



“Build APIs You Won’t Hate” & “Modern PHP: New Features and Good Practices”

Finish 2 books this holiday that I really like:

1. Modern PHP: New Features and Good Practices
If you are uncertain which programming language you like to learn and you are not sure if PHP is the right way this book will certainly change your mind.









2. Build APIs You Won't Hate

Last year most of my work evolved around API and specially building  REST API. This book gave me confidence that I am on the right track and also what I can improve when moving forward.

While driving I also listen to Rework which was a interesting as well.


​ O’Reilly – Up to Speed with PHP 7

Recently I had updated my VPS Php version to 7. It was easy and pretty smooth. I only had to add a single file so that WordPress would work with mysqli extension instead of old mysql extension which was deprecated.
I wanted to see what's new in Php 7 and I saw that O'Reilly had a course about it so I went and what it. Here is a short review of the course.

Php 7
- first major version release since PHP5 in 2004 after Php6 was abandoned in 2010
- is powered by a new engine PHPNG ( Php new generation)

Changes :

Internal changes
- according to Rasmus Lerdorf 100%+ performance on the most real-world apps
- lower memory usage
on Wodpress 4.1.1 PHP7 is slightly slower than HHVM 3.6.1
- simplifies creating add-on tools
- yield doesn’t require parentheses
- empty list() now allowed
- 64-bit integer support in Windows
- support for strings >= 2^31 on 64-bit builds ( video file conversion as string )
- very few breaks in backward compatibility
- most fatal errors now catchable ( Exception being thrown)
- mysql extension has been deprecated
- new json extension
- assert controller by configuration settings
- posix regex has been removed
- alternative php tags have been removed
- assign of new by reference has been removed

New operators:
- Spaceship operator ( already in Perl & Ruby )

$a = 6;
$b = $c = 10;
echo ($a <=> $b); ==> -1
echo ($b <=> $c ); ==> 0
echo ($c <=> $a) ==> 1

- Null coalesce operator

$variable = $non_existent ?? ‘default’ ;
also can be used in cascade
$var = $non_existent ?? $name ?? ‘default’;

Unicode escape syntax

$name = “Caf\u{00e9}” => Café

- random_bytes(20) ( Usage bin2hex(random_bytes(20));
- random_int(1,6) ==> generate a number between 1 and 6

Return type declaration
- is optional
prevent unintended return values
- forces sub classes to return expected data type

function convertor($string) : array {
return $array;

- Scalar type hinting
used for boolean (bool ), integer(int), float & string
- optional
- have 2 modes week & strong ( is done by declare(strict_types=1);
and needs to be first statement in the file

function multiply(int $a, int $b): int {
return $a*$b;

Anonymous classes
-can be assign to a variable
-return from a function
-pass as argument to a function
-extend a class , implement interface & use traits
- can’t be serialised

$testClass = new class() extends SplHeap {
protect function test($data1,$date2)
return ($data1 <=> $data2);

Generators return expressions

function generate() {
$total = 0;
for($i=1; $i<10;$i++) {
yield $i;
$total += $i;
return $total;
$counter = generate();
foreach($counter as $number)
echo $number;
echo “total = “. $counter->getReturn();

Generator delegation;
Binding to closures at call time;
Grouping Use Declarations

use SomeNamesSpace\SomePackage\SomeClass;
use SomeNamesSpace\SomePackage\SomeOtherClass;
use SomeNamesSpace\SomePackage\SomeDifferentClass;

Some as

use SomeNamesSpace\SomePackage\ {SomeClass, SomeOtherClass , SomeDifferentClass};

- Can be used for constants a function as well & even mix and match;

-catching fatal errors using Error class
-errors and expectations belong to different classes
-both implement the Throwable interface
-errors/exception can be catch in block

Other improvements
-improve security of unserialize;
-preserve 0 fraction when encoding as JSON

Tagged as: , , No Comments

The Martian by Andy Weir

A month ago I went with a friend of mine an saw at the cinema "The Martian" and I loved it.

Then I look over Youtube and are a bunch of interview with Andy Weir about the book.

After I seeing those videos I decided to read the book as well. In just a week, for a couple of hour a day, I manage to finish it. I kindly recommend it.

Here a few quotes from the book I love:

Me: “This is obviously a clog. How about I take the it apart and check the internal tubing?” NASA: (After 5 hours of deliberation) “No. You’l fuck it up and die.” So I took it apart.

NASA, however, is absolutely shitting itself. They see the Water Reclaimer as a critical survival element. There’s no backup, and they think I’l die instantly without it. To them, equipment failure is terrifying. To me, it’s “Tuesday.”

Most of the book NASA is "shitting bricks" ... fun read for sure.