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

Amazon MWS PHP: Compile Error: Redefinition of parameter $quotaMax

Die Amazon MWS Library hat zu Recht Probleme in PHP7.1 mit der Datei: /MarketplaceWebServiceProducts/Model/ResponseHeaderMetadata.php (line 31)

Vorher:

class MarketplaceWebServiceProducts_Model_ResponseHeaderMetadata {

...

  public function __construct($requestId = null, $responseContext = null, $timestamp = null,
                              $quotaMax = null, $quotaMax = null, $quotaResetsAt = null) {
    $this->metadata[self::REQUEST_ID] = $requestId;
    $this->metadata[self::RESPONSE_CONTEXT] = $responseContext;
    $this->metadata[self::TIMESTAMP] = $timestamp;
    $this->metadata[self::QUOTA_MAX] = $quotaMax;
    $this->metadata[self::QUOTA_REMAINING] = $quotaMax;
    $this->metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
  }

Nach dem Fix:

public function __construct($requestId = null, $responseContext = null, $timestamp = null,
                            $quotaMax = null, $quotaMaxRemain = null, $quotaResetsAt = null) {
  $this->metadata[self::REQUEST_ID] = $requestId;
  $this->metadata[self::RESPONSE_CONTEXT] = $responseContext;
  $this->metadata[self::TIMESTAMP] = $timestamp;
  $this->metadata[self::QUOTA_MAX] = $quotaMax;
  $this->metadata[self::QUOTA_REMAINING] = $quotaMaxRemain;
  $this->metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
}

Grund ist, dass die Variable $quotaMax doppelt benutzt wird in der Kontrultor Definition.

 

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

Linux vergleichen von Dateien innerhalb eines Ordners auf Dateiänderungen

Mit dem diff   Befehl unter Linux kann man sehr einfach herausfinden, welche Unterschiede es in zwei scheinbar identsichen Ordnern gibt.

Ein Anwendungsbeispiel wäre z.B. 2 Projekte miteinander zu vergleichen und die Unterschiede im Code herauszufinden.

#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 ...

PHP7 mit Ansible installieren

Mit Ansible kann man sehr einfach alle PHP7 von Ondrej’s Respository installieren mittels der Befehle:

- 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 weiterlesen…

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 ...

PHPStorm .idea Ordner aus dem GIT entfernen aber lokal behalten

Wenn man ausversehen den .idea Ordner mit in seiner GIT Versionierung übernommen hat, ist es leider über die IDE PHPStorm nicht möglich, diese wieder zu entfernen.

Man kann aber einfach über die Konsole einen Befehl ausführen, der den Ordner aus dem GIT entfernt und lokal weiter behält (kein löschen der mühsam eingerichteten Einstellungen!).

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

Danach sollte in der .gitignore der Ordner eingetragen werden:

/.idea