The markup declarations contained or pointed to by the document type declaration must be well-formed.

This error is caused by the DTD file not being valid. You have most likely created a DTD-file containing:



Simply remove the first and last line delcaring the DTD data, since those are only to be used when having the DTD within your XML file.

Development PHP

Wonder how many would like that PHP function

Oh, and yes. It is fake, something i made last year.

Web development

Simple Apache trick to increase Google Speed Test score

Google Speed Test will (unless set up) complain if you have not set up images to take use of browser caching. To get the browser to start caching static content you can add the following to your Apache vhost file:

ExpiresActive On
ExpiresByType image/gif "access plus 365 days"
ExpiresByType image/jpeg "access plus 365 days"
ExpiresByType image/png "access plus 365 days"
ExpiresByType image/bmp "access plus 365 days"
ExpiresByType image/png "access plus 365 days"
ExpiresByType text/css "access plus 365 days"
ExpiresByType text/x-js "access plus 365 days"
ExpiresByType application/x-javascript "access plus 365 days"


A lesson in PHP stupidity

1:  post_max_size >= 2GB makes PHP overflow, resulting in a negative post_max_size:
“POST Content-Length of 0 bytes exceeds the limit of -2147483648 bytes”

2: defining post_max_size (etc) with MB instead of M causes PHP to only read the last character, in other words 10MB becomes 10 bytes . How hard can it be to either use the first character or even better, both?

(note 1: this can be avoided by actually reading the manual, but this should have been handled better from PHP`s side IMO)

(Note 2: This experience come from the latest stable PHP version in SLES 10SP2, hopefully this has been fixed in later releases.)


Display clock each 10 minutes x times forward in PHP

Here is a simple code PHP snippet to display the clock each 10 minutes x times in the format of:

php5 test.php



$j = 0;
for($i=0;$i<10;$i+=1) {
        $j += (10*60);
        $hour = date("H", (time()+$j));
        $min  = ceil((date("i", (time()+$j))/10))*10;
        if($min > 50) {
                $min = "00";
        echo $hour.":".$min."n";


Hint: “org.apache.jasper.JasperException: java.lang.NumberFormatException”

Getting the exception “org.apache.jasper.JasperException: java.lang.NumberFormatException” when developing a JavaEE-app?

If you are basing yourself on data from a query, make shure that you are doing a SELECT against the table name and NOT the individual fields!


A hint for the “Object foo is not a known entity type” errors from Glassfish

As a JavaEE-codemonkey you have perhaps noticed this error:

java.lang.IllegalArgumentException: Object: Ting@193c227 is not a known entity type.

This will occur when you have redeployed an app f.ex through Eclipse to Glassfish, the Glassfish server has not quite understood that it`s time to update its version, so what you need to do then is to simply restart the server (or domain).

Web development

Show/hide a div with javascript

Looking for a simple javascript to show/hide a given text/element?

Here`s all you need! 🙂

   Simple show/hide system
   @author - Tor Henning Ueland
<script language="javascript" type="text/javascript">

        //ShowHide function - takes the div ID as argument
        function showHide(divId) {

                //Switch the display mode for the the div to hide
                var theDiv = document.getElementById(divId);
                if( == 'block')
               = 'none';
               = 'block';

                //Remove this part if you dont want a "show/hide" text
                var showText = document.getElementById("showText");
                var hideText = document.getElementById("hideText");

                //Switch the display mode for the the show/hide text/div
                if( == 'block') {
               = 'none';
               = 'block';
                } else {
               = 'block';
               = 'none';

<div id="showHideMe" style="display:none;">
        Now you see me!

<a href="#" onClick="showHide('showHideMe')">
        <div id="showText" style="display:block;">Show</div>
        <div id="hideText" style="display:none;">Hide</div>
Java Linux

One possible solution for Glassfish cluster node-agent startup problems

Just a quick hint for those of you who are experiencing problem with getting node-agents up and running in a Glassfish cluster.

If the problem is that the asadmin start-agent command simply times out/uses a long time to start, and even possibly returning a filenotfoundexception. The problem could be as simple as a firewall blocking traffic to/from the master-node. A quick way to check it is to simply disable the FW.

Note that if the master-node does not see the node-agent status, it is also caused by FW-issues, fix the FW and then restart the node-agent(s), then it all should work like a charm!