Benford’s law used for election data, deepfakes, Genome data, scientific fraud detection, accounting fraud detection and macroeconomic data.

Dr. Frank Benford discovered that in many cases, the number 1 is the first digit about 30,1% of the time. For example, most numbers in a set (about 30,1%) will have a leading digit of 1. This is followed by about 17.6% starting with a number 2 and each subsequent numeral, 3 through 9, will be the leading digit with decreasing as seen in the image.

Testing Benford’s Law in Symfony Framework

In the traditional Symfony web application we want to find out how often “1” to be…


The API system has built-in content negotiation capabilities. By default, only the JSON-LD format is enabled. However, API Platform Core supports many more formats and can be extended.

Available formats are: JSON-LD, GraphQL, JSON, JSON:API, HAL, XML, YAML, CSV, HTML (API docs).

1. JSON-LD


In this article i want to show how to implement composer to PHP projects with autoload config. Also i will show getting real data from github with guzzle.

Firstly create a new directory with mkdir command named composer-guzzle;

mkdir composer-guzzle

Navigate to folder with cd command;

cd composer-guzzle

Create composer.json with composer init command. When you run the command it will ask you to fill in the fields, while using some smart defaults;

composer init

Snappy is a PHP wrapper for the wkhtmltopdf conversion utility.

Snappy works with wkhtmltopdf, so you need to install on your system wkhtmltopdf. I installed it on my Mac via brew as below.

Install command;

brew install --cask wkhtmltopdf

Check for configuration where it’s installed;

which wkhtmltopdf

Installation

With composer, require:

composer require knplabs/knp-snappy-bundle

Configuration

knp_snappy.yaml;

.env;

.env for docker;

Example

If you have error as below;

Warning: Blocked access to file: Worked in 0.12.5

Usage of many https link in html causes “Failed to load about:blank, with network status code 301 and http status code 0 — Protocol…


I made this scenario easier to understand by visualizing it.

Assume that scenario;

There are 100 students.

There are 50 lockers.

70 students have lockers.

Some of the lockers are shared by a few students.(40 lockers are shared)

Some lockers are not used by anyone (10 lockers are completely empty)


curl wttr.in/Istanbul

In this article I want to share with you the commands I most commonly used when working with symfony projects.

  1. ls command used to list files and directories. This command display the contents of your current working directory as below.


“I’m convinced that about half of what separates the successful entrepreneurs from the non-successful ones is pure perseverance.” Steve Jobs

Perseverance tends to be associated with a steadfastness on mastering skills or completing a task; having a commitment to learning. It is the staying power to follow through and exert effort till the end to achieve your goals, dreams and vision.

Success often has much more to do with perseverance than it does with a person’s innate qualities. None of us get to where we are in life without some level of grit and perseverance. Success comes to those who…


In this article i will show cascade={"persist", "remove"} operations with examples. It is often used on mappedBy property side of the relationship. But can be use it both sides.

For example, assuming that there is class Cv(Curriculum Vitae) an entity and the OneToMany no cascade option as below;

You just need to call persist() on any new objects after form submitted in your controller as below;

But If you add cascade options to the OneToMany in Cv class;

cascade={"persist"} meaning that persisting entity Cv, doctrine will also persist all Reference and Certificate entities in the Collection as below;


If you have error like this.

MySQL said: Cannot connect invalid settings.

Access Denied for User ‘root’@’localhost’ (using password : NO)

Solution

Firstly check your mariadb or mysql already installed or not

brew info mysql

brew info mariadb

If installed already open your terminal and run;

$ mysql.server start
Starting MySQL
. SUCCESS!

Set your root password same as in phpmyadmin.config.inc.php

/usr/local/etc/phpmyadmin.config.inc.php

mariadb -h 127.0.0.1 -u root -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword!';

If doesnt work try below commands;

$ sudo rm -rf /usr/local/var/mysqlbrew reinstall mysql

After installation start mysql

$ mysql.server start

mariadb -h 127.0.0.1 -u root -p

or

sudo mysql -u root -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword!';

Solution

Changing Folder Permission by Command:

According to the StackExchange website, a user suggested the solution:
“On Mac OS X (Leopard), the Apache HTTP Server runs under the user account _ www, which belongs to the Group _www. To permit WordPress to set up wp-config.php throughout the installation, update documents throughout upgrades, and also upgrade the .htaccess file for very permalinks, offer the web server to create permission on the documents.

cd /<wherever>/Sites/<thesite>sudo chown -R _www wordpresssudo chmod -R g+w wordpress

Yusuf Biberoğlu

💻 PHP/Symfony Developer. E-mail: mail@yusufbiberoglu.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store