sort functions – access class member

If you want to sort a class member with the functions uasort, uksort, usort (the u stands for user-defined comparison function) you have to take care of some things. bool uksort ( array &$array , callable $key_compare_func ) The function takes as first parameter the array you want to sort as reference. Thereby no copy is made to the function stack and any changes are directly made on… Read more →

WordPress change post_date for tests

If you want to create a post via the post factory in you tests you can do it like this:

Make sure to pass a date! Unix timestamps or other formats won’t work. This creates 2 posts with different dates. You can test the function getPostsInYear(2014) as follows:

Post1 should not be returned by getPostsInYear( 2014 ) because… Read more →

How to install Scrapy

This line installs all requirements for pip first. After that you can install pip. With pip you can install Scrapy.

This should avoid errors like:

The reason for this error might be “out of memory”. Check the last lines of  dmesg | tail Read more →

WordPress action or filter not called

If you are using the wordpress api to hook into actions or filters there are some pitfalls. But these pitfalls are not wordpress related but likely your faults. I wan’t to show how to NOT hook into wordpress. 1. add_action( "actionA", array( __CLASS__, "processA", 10, 3) ); Please check the array declaration. Stupid mistake, but it’s hard to locate the error. You can output $wp_filter and check… Read more →

Problems Solved for Setting Up Jenkins

You must set the %JAVA_HOME% and Path environment variables for jenkins. Otherwise you should get errors like:

To do so follow this steps: Create a %JAVA_HOME% var with path to the Java jdk/jre (without /bin) Add %JAVA_HOME% to the Path var. Extend the string with \bin now. Check the result by enter javac in the cmd. If something java… Read more →

toString(), equals() Contract

Any Object is an Object or a child of an Object as described in the Java Language Specification: The class Object is a super class (§8.1) of all other classes. A variable of type Object can hold a reference to the null reference or to any object, whether it is an instance of a class or an array (§10). All… Read more →

wget Seite rippen

Man kann perfekt alle Dateien eines Web-Verzeichnisses mit dem tool wget laden. Hier ein Beispiel:


  Read more →

For – Know the difference

I would like to write some words about the difference of the for loop behaviour. At first you should read the code and notice 2 different for usages. Both should do the same. Do they?

I assumed the first loop would also overwrite the string in the array – as the second one does. But it does not! –… Read more →