Drupal PHP Fatal error Call to a member function getElementsByTagName()

I suddenly started getting the following error:

PHP Fatal error:  Call to a member function getElementsByTagName() on a non-object in public_html/drupal/modules/filter/filter.module on line 1122

I checked what there is on line 1122. I could clearly see that the error needs to happen because $body_node was null. For a quick fix I just implemented a null check as follows:

function filter_dom_serialize($dom_document) {

if ($body_node != null) {
  foreach ($body_node->getElementsByTagName('script') as $node) {
    filter_dom_serialize_escape_cdata_element($dom_document, $node);

  foreach ($body_node->getElementsByTagName('style') as $node) {
    filter_dom_serialize_escape_cdata_element($dom_document, $node, '/*', '*/');

  foreach ($body_node->childNodes as $child_node) {
    $body_content .= $dom_document->saveXML($child_node);


This seems to resolve the problem for now.

Interesting Swiss Maps

They always hide interesting stuff on map.geo.admin.ch. You need to search “somewhere” for additional layers. One nice layer is the Zeitreihen layer because it allows anyone to see the maps from the 80s and 90s. Those maps (1:25’000) have a lot more detail than the ones used today. Today lots of small routes for example inside of forests are not visible anymore.

Check it here: Swiss Map from 1844 till 2012

Check it here: Swiss Map with Building Numbers

Backup all MySQL Databases of a User

The following script can be used to backup all MySQL-Databases of a user each in it’s own compressed. sql file inside a folder with todays date:


mysqlshow -uusername -ppassword | awk '{print $2}' | grep -v Databases | sort >$DBASELIST
cd /backuplocation
mkdir -p `date +%Y%m%d`
cd `date +%Y%m%d`
for x in `cat $DBASELIST`; do
    echo "Backup Database: $x";
    mysqldump --opt -uusername -password $x >$x.sql;
gzip -f *

You just need to substitute username, password and backuplocation. If you use the root-MySQL user all databases of the whole MySQL-server are backed up.

Using SSH to copy files between systems

Copy something from this system to some other system:

scp /path/to/local/file username@hostname:/path/to/remote/file

Copy something from some system to some other system:

scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file

Copy something from another system to this system:

scp username@hostname:/path/to/remote/file /path/to/local/file

Source: Stackoverflow: how-to-download-a-file-from-server-using-ssh

Oracle Log Script Errors

Table to Hold the script errors

create table script_error_log (
  error_timestamp TIMESTAMP(9),
  script_name VARCHAR2(255),
  error_number NUMBER,
  error_message VARCHAR2(255),
  error_stack VARCHAR2(2000));

Method to call from within the script

create or replace procedure log_script_error (scriptname VARCHAR2) is
  errornumber NUMBER;
  errormessage VARCHAR2(250);
  errorstack VARCHAR2(2000);
  errornumber := sqlcode;
  errormessage := sqlerrm;
  errorstack := substr(dbms_utility.format_error_stack,1,2000);
  INSERT INTO script_error_log(error_timestamp, script_name, error_number, error_message, error_stack) VALUES (SYSTIMESTAMP, scriptname, errornumber, errormessage, errorstack);

Small example how to use it

create or replace

Backup a DVD

The following command can be used to backup/rip a DVD. All files are decrypted and stored in a folder (with the name of the DVD).

dvdbackup -i /dev/dvd -o ./ -M

If you want to create an iso file from those decrypted files you can use the following command:

mkisofs -dvd-video -udf -o ./dvd.iso ./movie_name

How to properly deprecate methods

If you work with a C# class that has many deprecated methods in they clutter intellisense and you cannot see the useful methods anymore. To avoid this you can add the Annotation EditorBrowsable and disable intellisense:

[System.Obsolete("use new method abc instead")]
        public void OldMethodThatShouldNotBeUsedAnymore() {
            // Do some stuff