How to debug Chrome in Android 5

I followed these instructions and it worked on my Sony Xperia Z3 running Android 5:

http://www.otherstudy.com/2013/11/how-to-debug-webview-by-using-chrome.html

And you will first need to unlock the Developent configuration in Android, following this other instruction:

http://www.androidcentral.com/android-50-lollipop-basics-how-turn-developer-settings

Advertisements

How to debug WordPress errors

First of all, WordPress provides debugging as an option. It is not activated by default. In order to make it work:

// Enable WP_DEBUG mode
define(‘WP_DEBUG’, true);

There are also ways of storing it into a file or not display it. Please have a look at the detailed options here: https://codex.wordpress.org/Debugging_in_WordPress

If you would like to have a more powerful tool, that also shows the queries and other information, I recommend to use the plugin:

Debug Bar: http://wordpress.org/plugins/debug-bar/

and Debug Bar Console: http://wordpress.org/plugins/debug-bar-console/

Happy debugging!!

WordPress xmlrpc error 200

We wrote some days ago about a problem with xmlrpc.php in WordPress due to having WP_DEBUG active. Today I have discovered another issue that may prevent xmlrpc.php from working correctly.

This time the problem is that when trying to write with xmlrpc protocol, the response is an error 200. The issue discovered today had to do with the theme being used. This theme had a function defined that was causing some type of return that affected the usage of xmlrpc.

The result was that when loading the page /xmlrpc.php there was a redirection to one post. This was very strange. The normal response has to be:

XML-RPC server accepts POST requests only.

I could identify the problem when I compared the theme I was using with another one (take twentyten for example) where I was getting the correct response.

Since I knew that WordPress loads functions.php every time you load a page, I looked at it and, by trial and error, found that there was a function causing the problem. I wish there was more debugging information about it… but I have not been capable of having access to it.

Now I have put among my to-dos, the task of learning more about how to debug in PHP. I have quickly read through this promising post by IBM: http://www.ibm.com/developerworks/library/os-debug/

javascript: how to access the functions from the console

when you are programming and want to test a function of your code inside the console, can you call it directly?

the answer here: http://stackoverflow.com/questions/9354191/calling-custom-functions-from-firebug-console

If the function global scope then it should be fine. If it is inside a function, then it will not work. In my case, I am using $(document).ready ( { function ( …) }); to hold all the code so I cannot. Now I understand why.

Two possible solutions: 

– copy paste the function in the console – may not work..

– or enclose it in this code:

(function() {
    window.myFunction = myFunction;
    function myFunction() {
    }
})();

Enabling Apache logs in MAMP Pro

MAMP Pro uses a template to configure the apache configuration file. So you have to open MAMP  Pro and open templates apache, as described here

http://documentation.mamp.info/en/mamp-pro/advanced-functions/edit-configuration-files

Then change the lines as explained here

http://documentation.mamp.info/en/mamp/faq/where-can-i-find-the-logs/how-can-i-enable-the-apache-access-logs

and restart apache!

You will now be able to see the logs in real time using
tail -f /Applications/MAMP/logs/apache_access.log