CKEditor Tutorial: Adding a ‘Link to local page from site’ field

UPDATE 4TH March ’14
The method described in this article is over 3 years old and doesn’t work properly with recent versions of CKEditor but Simon Georget has improved this implementation for CKEditor 4.2.2 and you can find it on Github here.

CKeditor is a great piece of work, not least because it’s free to use by anyone who wants to integrate it into their project. Myself, I am using it for a web content management system that I am developing and it’s definitely the best javascript WYSIWYG editor I’ve yet to come across, especially since it provides a comprehensive and well documented API framework.
Continue reading

Creating a large storage volume on a Linux VM running on an ESXi host

I have an ESXi host in my office with a RAiD10 array that has around 925GB in capacity – 95% unused. I have a couple of VMs on it that hardly use any of that space and I wanted to make use of all the spare storage space to make a backup of our family photos which were previously stored on two 500GB external drives and take up over 700GB. That’s quite a lot isn’t it? … you might say. Well, I agree, but my wife is rather trigger happy and loves to take 10 slightly different versions of the same shot so that she can choose the best one…. unfortunately the choosing of the best ones rarely involves deleting more than 1 out of each 10 of what was taken, hence the monstrously large library. Ah well!
Continue reading

Script to automate adding virtual hosts to OpenBD (using Apache)

As mentioned in my post from yesterday, adding virtual hosts to OpenBD is slightly awkward in that it not only requires adding them in the Apache config but also in the Tomcat’s server.xml file.

The following shell script works for a standard Centos installation where the webserver used is Apache with the following default paths used:

Apache vhosts file -> /etc/httpd/conf/vhosts
Tomcat server.xml file -> /opt/openbd/tomcat/conf/server.xml

Assuming all virtual hosts live inside the same parent directory then this directory can be set in the script’s configuration on line 5. Once set, adding a new virtual host is as simple as saving it as something meaningful (in this case ‘’) and calling it with the full domain name of the virtual host passed as a parameter like so:

$ su
# ./

One important point: this script relies on Apache’s usage of a separate vhosts file in the /etc/httpd/conf directory. This file can be pulled in and read by the main httpd.conf file by adding the following line to it.

Include /etc/httpd/conf/vhosts

What the script does?

1. creates a new document root folder for the virtual host and places an index.cfm test page inside it.
2. adds the virtual host entry to the httpd.conf file
3. adds the virtual host entry to the server.xml file
4. restarts Apache
5. restarts OpenBD

Once the script has run then if all goes well you should be able to browse to your new virtual host and check the CFML parsing by typing http://<new virtual host domain>/index.cfm

Here’s the script:

# Configure the script
email=''		# email address of administrator
vhroot='/www' 				# no trailing slash 
# Create the new document root folder
if [ "$1" = "" ]
	echo "No arguments passed. Usage: addvh <vhostName> where <vhostName> is the full domain"
	echo "(or subdomain) of the virtual host. E.g,"
# Try to create the new document root
elif ! mkdir $vhroot/$1 
	echo "ERROR: "$vhroot"/"$1" could not be created."
	echo "Virtual host document root created in "$vhroot"/"$1
	# Add the virtual host to the vhosts file
	if ! echo "
<VirtualHost *:80>
	ServerAdmin $email
    	DocumentRoot $vhroot/$1
	ServerName $1
	ErrorLog logs/$1_log
</VirtualHost>" >> /etc/httpd/conf/vhosts
		echo "ERROR: the virtual host could not be added to the Apache vhosts file"
		echo "New virtual host added to the Apache vhosts file"
		# Update the Tomcat server.xml file with the new virtual host
		rs='	<Host name="'$1'" appBase="webapps"\
		unpackWARs="true" autoDeploy="true"\
		xmlValidation="false" xmlNamespaceAware="false">\
		<Context path="" docBase="'$vhroot'/'$1'/" />\
		sed 's|</Engine>|'"$rs"'|' </opt/openbd/tomcat/conf/server.xml >tmp 	
		mv /opt/openbd/tomcat/conf/server.xml /opt/openbd/tomcat/conf/server.xml.BAK
		mv tmp /opt/openbd/tomcat/conf/server.xml
		echo 'New virtual host added to the Tomcat server.xml file'
		# restart Apache
		service httpd restart
		# restart Tomcat/OpenBD
		/etc/init.d/openbd_ctl restart
		# create a demo script for testing the CFML works in the new vhost
		echo '<cfdump var="#CGI#">' > $vhroot/$1/index.cfm
		# show the finished message
		echo "Complete! The new virtual host has been created.
To check the CFML functionality browse http://"$1"/index.cfm
Document root is "$vhroot"/"$1