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.


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


Overview more…

hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...
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:


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…

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

PHP how to use password_verify, password_hash and password_needs_rehash right

With the PHP 5.5. introduced password hash functionality you can bypass the problem, must be that new hash functions use, because the old one is too easy knackbar.

For existing projects, then standing at the point, where it has existing hashes in the database and this not simply new hash can, because one does not know the plaintext. This functionality is one of the new password_verify Decreased function.

A new login feature could look like, which works around this problem. When lifting the hash security (Time to calculate the hashes) can you get the value $currentHashOption['cost'] increase

$username = '%MINIFYHTMLd209ff533be848a1ec1540cbfda775666%';
$password = 'xxxxxx';

$user = User::findByName($username);

if(password_verify($password, $user->password_hash) === false){
 throw new Exception('Invalid Login');
$currentHashAlgorithm = PASSWORD_DEFAULT;
$currentHashOption = ['cost' => 15];

$passwordsNeedsRehash = password_needs_rehash(
 $algorithm = $currentHashAlgorithm,
if($passwordsNeedsRehash === true){
 $user->password_hash = password_hash($password, $currentHashAlgorithm, $currentHashOption);
hard mistakes - please write a commentsome mistakesokgoodvery good 3.00 of 500 (1 Users)
Loading ... Loading ...

Analysis of very large gzip/bzip2 compressed log files streamed

You can stream in PHP in the process the data very large log files, are several GB large, easily analyze with the help of Stream compression filter.

Thus the file without it can fully load into memory to unpack and be analyzed when importing the file.

This way you can search while reading the log file after any places in your code:

$file = 'X:/file.log.bz2';
$searchString = '2017-01-01';

   $handle = fopen($file, 'r');
   stream_filter_append($handle, 'bzip2.decompress');
      $line = fgets($handle);
      if(strpos($line, $searchString) !== false){
         echo $line;
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

Why you develop software projects not agencies should be

Agencies employ most freelancers, be einegstellt for development, should be exclusively your own programmers to use. The focus is on a fast and efficient programming of the project. This manifests itself in a poor code quality, d.h. practical, If an other programmer to change something later, then it takes ages, because the code is so bad, that you can't see through. Good code is especially readable and understandable, what it does need experienced programmers, which given also time is to write good code.

Agencies, the programmer will not in any way stop to write good code and often you choose as freelancers only “in exceptional cases” to work with an agency, because this usually with many overtime, Time pressure and low pay goes hand in hand. That's why land not good programmers at agencies, but rather the black sheep.

My recommendation is, not to put in the development of software on an agency, but rather to one or several good Freelancer, which implements the project conscientiously and in direct communication.

The comparison of offers by various freelancers should be not only on the price, but a focus on the experience of the programmer and the quality of the resulting software.

I have collected my thoughts about it from my and the experiences of other freelancers over the years in Berlin.

hard mistakes - please write a commentsome mistakesokgoodvery good 1.00 of 500 (1 Users)
Loading ... Loading ...

Vera width of large files in PHP using generator

To process large amounts of data with PHP you need much memory memory, because large amounts of data are loaded and then processed. A memory-efficient alternative Generators from PHP 5.5., the yield Command through large amounts of data can iterate and occupy only space for a data set.

Example: Process a large CSV file using generator:

class CsvFile {

    protected $file;

    public function __construct($file) {
        $this->file = fopen($file, 'r');

    public function parse() {
        while (!feof($this->file)) {
            yield fgetcsv($this->file);

$csv = new CsvFile('/pathTo/file.csv');
foreach ($csv->parse() as $row) {
    echo $row;
hard mistakes - please write a commentsome mistakesokgoodvery good 1.00 of 500 (1 Users)
Loading ... Loading ...

Comparison: Sell books at Momox and rebuy

I've cleaned everything up today and my programming books that are no longer taken for years trying to sell at momox.de and rebuy.de.

I downloaded the app of the respective provider to me and scanned my books. You will immediately receive a prize and can decide, If you want to sell the book/CD/DVD. If you have at least €10 together, You can close the sale and gets a Packetgutschein for mail or DHL free and then be send packet to the provider. He looks at the article and the State and then transfer the money.

Advantage of momox

The app is better, the bar code scanner to handle and easier/more intuitive to use.

About the app you can select shipping with DHL (rebuy also DHL offer has, but the app offers only Hermes).

To get the discount coupon €5 (for me, it was momox16 or soon momox17, have a look).

Momox sucks one less with marketing for the sale of their articles.

Rebuy will transfer the money directly to the account, but one first writes a “Have good” well in your shop, to make you shop there. To get the money on the account, you have to have extra active.

Advantages of rebuy

You have to type less data on the app, I had however not even enter my bank data initial, what I find funny, but let's see.

Intermediate results

Both packages on the way with the DHL providers are now, I hope everything runs smoothly.

I found it very interesting, for sale both, because one often pays more than the other, You can compare the prices as well and seek out the best.


Both rebuy and Momox have paid full money me after a week without any problems with the goods.

That's why my recommendation is: Momox

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

MySQL Monitoriong of the ProcessList / Queries with a console command

A hilreicher command for problem analysis of MySQL servers is to look at the ProcessList, to see, What Quueries are currently running. If you combine this with the watch command, and these 1 reload times per second can be and reduced to the queries, you did a good review, What is going on on the MySQL server and what queries are problematic could:

watch -n 1 "mysql -u root --password='XXX' -h localhost -s -e 'SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE Command=\"Query\";'"

It is important, the command as root to run, to see all queries.

With the help of the parameter n, you can specify the refresh rate in seconds.

The MySQL root password is to complement.



5361925476      user     localhost       NULL    Query   0       executing       SELECT * FROM xxx WHERE yyy

5361925477      user     localhost       NULL    Query   0       executing       UPDATE zzz WHERE zzz
hard mistakes - please write a commentsome mistakesokgoodvery good
Loading ... Loading ...

WordPress links car that mark as spam posts

Thus you bots not is annoyed by dn all spam, their goal always is to place a comment with one or more links on one website, have I written a short script, What in the function.php must be added. The script marked all comments as spam, containing a link.

add_action( 'comment_post', 'show_message_function', 10, 2 );
function show_message_function( $comment_ID, $comment_approved ) {
   $comment = get_comment( $comment_ID);
      $content = $comment->comment_content;
         $content = strtolower($content);
         $hasLink = strpos($content, 'http') !== false || strpos($content, 'www.') !== false || strpos($content, 'href') !== false;
            //when has link, set to spam
            $commentarr = array();
            $commentarr['comment_ID'] = $comment_ID;
            $commentarr['comment_approved'] = 'spam';
            wp_update_comment( $commentarr );