Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. belk123
    3. Post
    B

    belk123

    @belk123

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 7
    • Post 7
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Località roma
    0
    Reputazione
    7
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da belk123

    • importare database mysql dentro un contenitore (docker)
      
      $ cat docker-compose.yml
      version: '2'
      services:
        app:
          build:
            context: .
          image: test-image
          ports:
            - 8080:80
          volumes:
            - .:/srv/app
          links:
            - mysql
            - redis
          environment:
            DB_HOST: mysql
            DB_DATABASE: laravel_docker
            DB_USERNAME: app
            DB_PASSWORD: password
            REDIS_HOST: redis
            SESSION_DRIVER: redis
            CACHE_DRIVER: redis
        mysql:
          image: mysql:5.7
          ports:
            - 13306:3306
          environment:
            MYSQL_DATABASE: test
            MYSQL_USER: root
            MYSQL_PASSWORD: root1
            MYSQL_ROOT_PASSWORD: root2
        redis:
          image: redis:4.0-alpine
          ports:
            - 16379:6379
      
      $ cat Dockerfile
      FROM php:7.2.2-cli
      
      COPY . /usr/local/bin
      WORKDIR /usr/local/bin
      RUN docker-php-ext-install mbstring pdo pdo_mysql
      
      CMD mysql -u $MYSQL_USER -p $MYSQL_PASSWORD $MYSQL_DATABASE < test.sql
      
      $ cat test.php
      <?php
      
      $pdo = new pdo(
          "mysql:host=localhost;dbname=test",
          'root','root1'
      );
      
      $query = $pdo->query("SELECT * FROM people");
      var_dump($pdo->errorInfo());
      
      foreach($query as $row ){  
          var_dump($row);  
      }  
      
      $ cat test.sh
      #!/usr/bin/env bash
      set -e
      cd $(dirname "$0")
      
      docker-compose up --build -d
      docker run test-image php /usr/local/bin/test.php
      
      $ ./test.sh
      Building app
      Step 1/5 : FROM php:7.2.2-cli
       ---> 21c3582549e6
      Step 2/5 : COPY . /usr/local/bin
       ---> Using cache
       ---> e0a9005e2907
      Step 3/5 : WORKDIR /usr/local/bin
       ---> Using cache
       ---> 3efd6cdfab46
      Step 4/5 : RUN docker-php-ext-install mbstring pdo pdo_mysql
       ---> Using cache
       ---> 282ab8fb5896
      Step 5/5 : CMD mysql -u $MYSQL_USER -p $MYSQL_PASSWORD $MYSQL_DATABASE < test.sql
       ---> Using cache
       ---> 7ba640bd690d
      Successfully built 7ba640bd690d
      dockermysql_redis_1 is up-to-date
      dockermysql_mysql_1 is up-to-date
      Starting dockermysql_app_1
      
      Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory in /usr/local/bin/test.php:5
      
      

      Perchè non funziona?

      postato in Coding
      B
      belk123
    • ini_set() non funziona
      
      <?php // test.php
      var_dump(ini_set('mail.log','/tmp/new-value-55557.log'));
      var_dump(ini_get('mail.log'));
      ?>
      
      

      Proviamo...

      $ php test.php
      bool(false)
      string(20) "/tmp/mail-755776.log"

      Come vedete ini_set() restituisce false e il nuovo valore non viene impostato.
      Perchè?

      postato in Coding
      B
      belk123
    • usare il nas Synology come git server

      Sul mio nas ho creato un git repository seguendo più o meno l'apposita guida.

      Quindi ho creato anche l'apposito file composer.json (sul nas), sono ritornato sul mio computer normale con linux/ubuntu, ed ho iniziato a fare qualche prova:

      
      + cd /test
      + cat composer.json
      {
          "require": {
              "test/test": "*"
          },
          "repositories": {
              "test/test": {
                  "type": "vcs",
                  "url": "nas:/volume1/git/test"
              }
          }
      }
      + composer update
      You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
      Loading composer repositories with package information
      Updating dependencies (including require-dev)         
      Your requirements could not be resolved to an installable set of packages.
      
        Problem 1
          - The requested package test/test could not be found in any version, there may be a typo in the package name.
      
      Potential causes:
       - A typo in the package name
       - The package is not available in a stable-enough version according to your minimum-stability setting
         see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
      
      Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
      
      

      Come mai non funziona?

      L'unica soluzione che ho trovato è clonare direttamente il repository

      $ git clone ssh://nas/volume1/git/test
      

      funziona, ma non è proprio quello che voglio...

      postato in Coding
      B
      belk123
    • composer: forzare l'uso del comando require-dev

      Ho creato una libreria contenente essenzialmente strumenti di debug.
      Per questo motivo, il comando corretto per importare tale libreria nei vari progetti, sarebbe

      composer require-dev mio/debug

      e non

      composer require mio/debug

      Si può quindi impedire l'uso del comando 'require' (magari intervenendo sull'apposito composer.json)?

      Ho creato una libreria contenente essenzialmente strumenti di debug.
      Per questo motivo, il comando corretto per importare tale libreria nei vari progetti, sarebbe

      composer require-dev mio/debug

      e non

      composer require mio/debug

      Si può quindi impedire l'uso del comando 'require' (magari intervenendo sull'apposito composer.json)?

      Ho creato una libreria contenente essenzialmente strumenti di debug.
      Per questo motivo, il comando corretto per importare tale libreria nei vari progetti, sarebbe

      composer require-dev mio/debug

      e non

      composer require mio/debug

      Si può quindi impedire l'uso del comando 'require' (magari intervenendo sull'apposito composer.json)?

      postato in Coding
      B
      belk123
    • test funzionali con phpunit

      Si possono fare o è un tool solo per test unitari?

      postato in Coding
      B
      belk123
    • eseguire test-case Selenium da riga di comando...

      ...invece di usare l'apposita estensione di firefox.
      Si può?

      Cioè (io uso linux/ubuntu) apro il terminale è digito

      java -jar selenium-server-standalone-3.4.0.jar -htmlSuite "*firefox" "10.8.100.106" "/mytestsuite/mytestsuite.html" "/mytestsuite/results.html"

      ma mi esce questo errore

      Unable to find the HTML runner. This is normally because you have not downloaded
      or made available the 'selenium-leg-rc' jar on the CLASSPATH. Your test will
      not be run.
      Download the Selenium HTML Runner and
      use that in place of the selenium-server-standalone.jar for the simplest way of
      running your HTML suite.

      Perchè?

      postato in Coding
      B
      belk123
    • eseguire test-case Selenium da riga di comando...

      ...invece di usare l'apposita estensione di firefox.
      Si può?

      Cioè (io uso linux/ubuntu) apro il terminale è digito

      java -jar selenium-server-standalone-3.4.0.jar -htmlSuite "*firefox" "10.8.100.106" "/mytestsuite/mytestsuite.html" "/mytestsuite/results.html"

      ma mi esce questo errore

      Unable to find the HTML runner. This is normally because you have not downloaded
      or made available the 'selenium-leg-rc' jar on the CLASSPATH. Your test will
      not be run.
      Download the Selenium HTML Runner and
      use that in place of the selenium-server-standalone.jar for the simplest way of
      running your HTML suite.

      Perchè?

      postato in Coding
      B
      belk123