hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Linux compare files within a folder for file changes

With the diffYou can easily find out command in Linux, What differences are there in two seemingly dusts folders.

An example would be z.B. 2 Projects to compare and find out the differences in the code.

#Ausgabe auf der Console stdout
diff -qr \
--exclude="css" \
--exclude="tmp" \
/myMaster/folder /mySlave/folder


#Pipen der Ausgabe in eine Datei oder less:
diff -ur \
--exclude="css" \
--exclude="tmp" \
/myMaster/folder /mySlave/folder | /tmp/diff.txt
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Install PHP7 with Ansible

Ansible can very easy all PHP7 by Ondrej ’ s install repository by using the commands:

- name: Remove old PHP7 ppa repository
  apt_repository: repo='ppa:ondrej/php-7.0' state=absent

- name: Add PHP7 ppa repository
  apt_repository: repo='ppa:ondrej/php'

- name: Install packages
  apt: pkg={{ item }} state=latest update_cache=yes
  with_items:
   - mysql-client
   - nginx
   - php7.0-cli
   - php7.0-fpm
   - php7.0-dev
   - php7.0-curl
   - php7.0-gd
   - php7.0-mbstring
   - php7.0-mcrypt
   - php7.0-mysql
   - php7.0-soap
   - php7.0-sqlite3
   - php7.0-xml
   - php7.0-zip
   - php7.0-bcmath
   - php7.0-ssh2
   - php-rrd
   - git
   - zlibc
  tags:
   - php
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Run PHPUnit Unit and Integrations test with different configurations in PHPStorm

If you want to develop unit and integration tests with PHPStorm you can easily bootstrap your application and run your tests. But if you want to develop real unit tests in your local development enviroment without having a database connection or a cache, you need to make sure, that your application is configured differently, when unit tests are running. In this article you will learn how to do that and how to make PHPStorm will automatically recognize which tests/tests suites you want to execute.

Requirement:

Your integration and unit tests are seperated in 2 directories, like:

/tests/unitTests
/tests/integrationsTests

Overview more…

hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Elasticsearch Subquery Scoring Optimization

If you want to build a search query in Easticsearch where you can give documents a bonus score depending on how often a property can be found in other documents

- you need is a Subquery which is not supported by Elasticsearch but can be programmed with any Programming Language such as PHP.

An Example for a Subquery is the problem:

Imagine a CD online shop. You want to score CDs ( = documents) higher which

1. match a term query AND

2. and which artist has many other CDs in your shop database

In this case you could use a subquery function like this:

/**
 * @see
 * @param string $index
 * @param string $type
 * @param string $query
 * @return array CDs
 */
public function popularArtistsSubquery($index, $type, $query){
    $response = $this->moreLikeThisQuerySearch($index, $type, $query);
    $response = json_decode($response);
    $hits = array();
    if($response->hits->total > 0){
        foreach($response->hits->hits as $hit){
            $responseMatch = $this->matchQuerySearch($index, $type,$hit->_source->artist);
            $responseMatch = json_decode($responseMatch);
            $artistCount = $responseMatch->hits->total;
            $hit->_score += $artistCount;
            $hit->artistCount = $artistCount;
            $hits[] = $hit;
        }
        usort($hits, function($a, $b)
        {
            return $a->_score < $b->_score;
        });
    }
    return $hits;
}
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Folder from the GIT remove PHPStorm .idea but locally restricted

If one accidentally with has taken over the .idea folder in its GIT versioning, is it unfortunately not possible via the IDE-PHPStorm, to remove this again.

You can run a command but just through the console, removed the folder from the GIT and locally further retains (No delete the painstakingly decorated settings!).

git rm --cached -r -f  .idea/

After that, the folder should be entered in the .gitignore:

/.idea
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

NAS / Save external hard drive itself and repair

If once again the hard disk without backup is greased one or the NAS will no longer record the connection to your own computer, It is interested in data recovery from hard drives.

With a few simple steps and gadgets can be done that fast from home.

1. Step: Core external hard drive, Disassemble NAS

It's just brutal, how it sounds: The modern packaging are hard to crack. The recovery of disk from the enclosure is often more difficult than thought, but with a little violence and head möglch. Most importantly, to find the hiding places of the small mini screw, the randomly placed behind a decal in the back corner of the enclosure, so you can implement his device never together again in any case.

When you're done with its NAS that looks something like this:

IMG_4954

My badly damaged and never again featured NAS, top left is the hard drive built in, which is read out in the next step. 3 years it has kept the piece of crap, Thanks Samsung for the garbage

2. Step: Read the hard disk with the Cloners more…