New javascript document

A small javascript code fragment for creating a new document containing part of an existing document
var newDoc = document.implementation.createDocument(“”, “”, null);
var sd = newDoc.importNode(content, true);

Sorting out CAS and Drupal installation problems

How to install self signed certificates for use with the CAS single sign on system:
(Note that you will need to use the hostname as installed)

Menu items not showing up when clean urls are switched on.
It’s probably a problem with apache mod_rewrite.

How to switch off clean urls using the database
In the variables table change the value of clean_url to s:1:”0″;
Then truncate all the cache tables

How to enable mode_rewrite
sudo a2enmod rewrite

How to check if mod_rewrite is enabled
Create a .htaccess file containing the following:
RewriteEngine on
RewriteRule testpage.html [R]

If going to testpage.html sends you to google then it’s working

If it’s not working…
[Ubuntu] check /etc/apache2/mods-enabled to make sure that there’s a sym link to ../mods-available/rewrite.load
Check in sites-enabled that
AllowOverride is set to All (by default it’s None)

dojo filtering select

A couple of things that weren’t immediately obvious with dojo filtering select.
The attribute order matters – I had value as the last attribute and it didn’t work – moved it and it did.
When putting together the query attribute the format is query=”{value1:data1,value2:data2}

Geocoding with PHP and Google Maps

After changing hosting companies I was having problems with the message:
URL file-access is disabled in the server configuration

In the end the simple solution is to replace:
$xml = simplexml_load_file($request_url) or die(“url not loading”);

$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$xml = simplexml_load_string($response);

I’m not in Ireland…

I’ve been having problems with various web sites thinking that I’m in Ireland not in the UK – google and the BBC among others which is something of a nuisance especially when try to use the BBC iPlayer.
I tried renewing my DHCP binding to get a new IP address but that didn’t work.
It turns out that I’m not the first person to have this problem on Virgin Media and the solution is to use their webcache. The webcache address is and it uses port 8080.

So now I can use the iPlayer – of course the Virgin Media ebilling system still doesn’t think I’m on their network but I’m less worried about that!


I’ve been having problems with a JAXB based program which I’m making changes to – when marshalling the bean into the XML doc some of the elements were empty even though they were populated in the bean.
I thought I found the solution in this article which pointed me to use the javax.xml.bind.Validator class which showed that some of the data in the bean is invalid according to the schema however having fixed this it still wasn’t working…

In the end I upgraded to JAXB 2 which sorted out the problem

Axis SOAP Client problems

I’ve recently been attempting to connect to a Axis webservice using a PHP client and I’ve had problems where the Body has been returning empty – no fault just an empty body.
This can be solved by removing any line feeds from the request

GWT and I18n, authorization on the server/in a service

I’ve read various posts on how to internationalize text in a gwt service – these usually recommend adding the locale as a string in a constants file and passing this as an extra parameter to each service call.

The approach I’ve adopted is to override the service method from HttpServlet and use this to make the request available by storing it in a class variable. Once you’ve got the request then you can use it to read the locale and therefore avoid the mucking about with your properties files and method parameters.
This technique is also quite useful because it allows you access to the session which means that you can get hold of user information which is stored in the session

Also as an aside it appears that the IE operation aborted problem should be fixed in 1.4.61, having said that it also can’t hurt to move the inclusion to the end of the page

public abstract class GwtRpcListener extends RemoteServiceServlet {
private HttpServletRequest m_request;
private HttpServletResponse m_response;
* @return Returns the response.
public HttpServletResponse getResponse() {
return m_response;
* @param response The response to set.
public void setResponse(HttpServletResponse response) {
m_response = response;
* @return Returns the request.
public HttpServletRequest getRequest() {
return m_request;
* @param request The request to set.
public void setRequest(HttpServletRequest request) {
m_request = request;

/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#service (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected void service(HttpServletRequest arg0, HttpServletResponse arg1)throws ServletException, IOException {
super.service(arg0, arg1);