How to debug Drupal or ... How I fell in love with the debug() function

Let's say you see recurring error messages in your db log file and you want to try and pinpoint the issue to be able to apply a fix.
So, how do you go about debugging your code?

Well, there are many different ways. You could go old-school and use

var_dump();

or

print_r();

.
Or you could go a step further and use

debug_backtrace();

to try and pinpoint the source of the error.

[in progress] My first unmanaged Virtual Server .. what do I do first?

I finally bit the bullet and got myself an unmanaged VPS (Virtual Private Server). The main reason being that my current shared hosting account was just way to slow for certain web apps.

Example hosts.deny file

Here is the body of a host.deny file from my current host:

Weather API update ...

Ok, so most of you will now have heard that the much used and loved unofficial google weather api has closed for good. In my previous post I mentioned this and gave you a couple of alternatives to use instead.

Now here is a follow up ...

Fix validation 'Byte-Order Mark found in UTF-8 File' in drupal installations

So I stumbled across this issue the other day. I usually make sure I save all my files as Encoded as UTF-8 without BOM. But somehow, somewhere there may be a file that was saved incorrectly and thus it will give you a validation error on w3c.

Now, how do you go about finding which file is causing the error? Is it a theme file, or is it a custom module or is it a drupal file which you may have modified (I know, hacking drupal core is BAD!)

The solution is: run a shell script to find the file causing the issue.

Find the BOM files:

Google Weather API shuts down?

Anyone using the Google Weather API would have noticed some strange behaviour early last week. Namely some 403 errors - then lastly the response code became 'Unsupported API'
Here is an example:

http://www.google.com/ig/api?hl=de&weather=london

Now one should start using different api's to grab required weather data in widgets or other programs. Some I have had a play around with are:

Creating a custom module that mimics the node full view

I've called this module 'stadtinfo_subpage'.

It creates a tab menu item, registers a path alias for it and lets you change the template to suit you ..

Subscribe to Mindpiss RSS