Joined August 2012
·

Stefano Azzolini

CTO and Lead Senior Engineer at Caffeina Srl - http://caffeinalab.com
·
Parma, Italy
·
·
·

Posted to Moving a WordPress site between hosts over 1 year ago

This method breaks serialized data.

An easy solution is uploading your sql-dump to http://pixelentity.com/wordpress-search-replace-domain/ instead of manual search-replace.

Posted to Debugging with Die() not always works over 1 year ago

die is an alias of exit()

From http://php.net/manual/en/function.exit.php

void exit ([ string $status ] )

void exit ( int $status )

If status is a string, this function prints the status just before exiting.

If status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

@cryode

If you want to take advantage of method chaining, modify the classes as you see fit, using return $this; where appropriate.

You can't (or mustn't) always change the direct source of the target class. This is a tip for a wrapper class, not a lesson on how to implement a Named Parameter Idom Design Pattern.

That's fine for your own applications, but if you're trying to teach people, keep it as simple as possible.

Again, it's a tip, not a lesson. If you have a simpler, descriptive, version of a wrapper class for method chaining, please post it here, I'll be glad to learn from it. :)

Posted to JavaScript Looper over 1 year ago

It's fast, compact and easy to read, I use it every chance I can (but it's not always the best choice due to the fact that it loops in reverse).

You can always Array.reverse() the data first.

var i = bigArray.reverse().length;
while(i--) {
doWork(bigArray[i]);
}

Yes, the return queue is a LIFO, and you can retrieve it even at the end of the chain. However It's useful using the get_return method after the call result you want to retrieve, just in case you need the return value for passing it as parameter for the next chained methods.

Why do you have an array of return values?

Simply for convenience.
If you need, you can also implement a clearresults() method for purging the results queue, freeing some memory.

However you are free to change it to a single variable, storing results and replacing previous value.

@obayesshelton , @bdgeeksfoysal
Here is an example for you :
https://coderwall.com/p/_ss6sa
^__^

Achievements
352 Karma
35,569 Total ProTip Views