May 02

Installing Firefox Java Plugin on 64 Bit Ubuntu

Posted by James Netherton | Saturday 02 May 2009 21:40 PM | In Java, Testing

Finally! - I’ve got Java working in Firefox again after upgrading to Ubuntu X64. Lots of guides I found mention installing the 32Bit version of Firefox and the Java runtime. There’s no need for any of this. Just follow the simple guide here:

http://yokohead.com/2009/02/installing-java-x64-in-ubuntu-810/

Apr 22

Debugging a Java Web Start application from Eclipse

Posted by James Netherton | Wednesday 22 April 2009 17:52 PM | In Java

I just spent some time debugging a weird problem that was only occurring when an application was launched via Java Web Start. Something I found useful was being able to attach the Eclipse Java debugger to the application process. Here’s how to set this up.

From the command line execute (In windows use set instead of export):

export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"

In Eclipse, configure a new debug configuration by choosing menu options Run -> Debug Configurations. Find the ‘Remote Java Application’ section, right click and choose ‘New’.

Change the port number to whatever you specified when setting up the JAVAWS_VM_ARGS environment variable. Click the apply button and close the window.

Now start your application:

javaws http://hostname:port/yourjnlpfile.jnlp

You can now attach the Eclipse debugger to the process by running the debug configuration you just set up. Set some breakpoints in your code and you should find the application suspends at the relevant points where you can debug the application as per normal.

Mar 25

Installing Java 1.5 on Mac OS X Panther

Posted by James Netherton | Wednesday 25 March 2009 21:49 PM | In Java, Mac

There is no official support for running / installing Java versions greater than 1.4 on Mac OS X Panther. Here’s how I installed and configured my old Mac Mini G4 OS X Panther machine to run Java 1.5.

1. Download and install Pacifist

2. Download Java 1.5 from the Apple website and run the .dmg file

3. Start Pacifist. Drag the .pkg install file from the mounted Java .dmg file. Select the root of the package hierarchy and click the install button

4. When prompted to overwrite existing files choose ‘Leave Alone’

5. When the installation process has completed you can now set the default Java VM to 1.5. Open a terminal session and run the following:

cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo ln -fhsv 1.5 CurrentJDK

Confirm that everything has worked by executing java -version from the command line.

Feb 20

Eclipse Tip - Show heap status

Posted by James Netherton | Friday 20 February 2009 21:57 PM | In Programming

I can’t believe I never knew about this!

In Eclipse choose menu option Window -> preferences. Then check the option ‘Show Heap Status’. A new item will appear within the window status bar which shows the amount of heap space currently being used. The cool bit is that there’s a button that allows you to run the garbage collector to free up some heap space.

It comes in handy if you find Eclipse starts getting slow when it approaches the maximum allowed limit of heap space.

Feb 13

Party Like It’s 1234567890

Posted by James Netherton | Friday 13 February 2009 22:08 PM | In Linux

*nix geeks will soon be celebrating the moment when Unix time reports the magic 1234567890 sequence of numbers. It’ll occur at 23:31:30 UTC. To keep track of things, run the following from the command line :)

watch -n 1 date +%s

Feb 03

Installing The Java Web Browser Plugin On Ubuntu

Posted by James Netherton | Tuesday 03 February 2009 19:09 PM | In Linux

For some reason Ubuntu by default installs the Java 1.6 open JDK but doesn’t seem to include the Java web browser plugin for Firefox. It took me a while to figure out how to add it. Run the following from the command line:

sudo apt-get install sun-java6-plugin

Jan 26

Deploying ColdFusion on Tomcat under Ubuntu

Posted by James Netherton | Monday 26 January 2009 7:00 AM | In ColdFusion, Linux

I spent ages trying to get ColdFusion working properly with Tomcat 6 on Unbuntu. Tomcat wouldn’t start the ColdFusion application sever and the logs were getting full of exceptions moaning about the inability to access certain resources. For example:

java.security.AccessControlException: access denied (java.util.PropertyPermission coldfusion.classPath read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
at java.lang.System.getProperty(System.java:669)

Eventually I came across a solution posted to House Of Fusion in 2007. Open up your catalina.policy file, comment out what’s in there and add the line:

permission java.security.AllPermission;

It’s a bit of a hack - but it works! This is obviously something that you wouldn’t want to do on a production machine!

Jan 25

Switching from Windows to Ubuntu

Posted by James Netherton | Sunday 25 January 2009 19:17 PM | In Linux

Last week my four year old Windows XP installation started creaking at the seams and doing all kinds of weird things so I decided to back up my data and give Ubuntu a try. I’ve been switching back and forth between operating systems for the last eight years, installing Linux, getting frustrated or missing certain aspects of Windows.

Not so this time! I can’t see myself making a permanent switch back to Windows, Ubuntu has everything I need. Anything that didn’t come pre-installed is easily installed with APT. Should I need Windows for anything, I’m running XP virtualised under VirtualBox (which so far seems superb).

Overall, OS X is my preferred operating system but I’m more than happy with Ubuntu. Hopefully I can stick with it for more than a few weeks this time.

Jan 23

Blog migrated to Wordpress

Posted by James Netherton | Friday 23 January 2009 23:01 PM | In Blogging

I toyed with the idea of converting the blog from BlogCFC to Wordpress in 2007 but ended up sticking with BlogCFC. I’ve now decided to migrate over to Wordpress. It’s been an interesting exercise and overall, quite a simple one. I had all of my blog data imported into Wordpress via my BlogCFC to Wordpress conversion tool (which I’ve updated to fix a few small issues).

Recreating the look and feel was also pretty simple. Writing Wordpress themes isn’t as daunting as it first looks. So long as you have a clean XHTML & CSS layout, it’s a simple case of marking up the required header, footer & sidebar layout templates.

Any other BlogCFC specific functionality (like CF syntax highlighting) I managed to cover off by installing a few Wordpress plugins. Finally, I have Apache 301 redirecting any BlogCFC / CF URL’s, so hopefully my search rankings wont be affected too much!

Dec 01

My final month working with ColdFusion

Posted by James Netherton | Monday 01 December 2008 2:12 AM | In Blogging

This month marks the end of my four years of (almost) day to day ColdFusion programming. In the new year I’m moving on to pastures new and will be working exclusively with Java from then onwards.

So why the change? In the main, it’s due to wanting a new challange and something to rekindle my motivation for software development, which has been waning over the past year. I also wanted to get some solid experience of another programming language as a sort of career protection thing.

I’m not planning on giving up CF programming entirely, I’ll definately be checking out CF 9 but I’ll be trying to post more about Java related stuff in future.

Nov 30

Disable windows indexing service to prevent VMWare Fusion maxing out CPU

Posted by James Netherton | Sunday 30 November 2008 7:11 AM | In Windows

A while back I posted about disabling the automated Windows hard drive optimisation service in order to save CPU time and prevent parallels from grinding to a halt.

I’ve since switched to VMWare Fusion and have noticed that every so often, the VMWare process consumes 100% of the CPU even though Windows is idle in the background. I figured out that the culprit was the Windows indexing service, which kicks in when the OS is idle to index files.

Simply disable the indexing service from the Windows services control panel area and that should solve the problem. I haven’t seen any negligible effect of doing this so far, Windows searches are usually pretty sluggish even with the indexer turned on!.

Nov 04

Make your XML look pretty

Posted by James Netherton | Tuesday 04 November 2008 11:11 AM | In Java

Credit goes to Joe Rinehart for most of this from this post.

ColdFusion ships with JDom which gives you full access to the JDom API. Many of the applications I work with have some kind of XML component to them and sometimes the XML is difficult to read if it’s not formatted nicely.

I’ve used Joe’s code example to create a simple interface on top of it. It also works with valid XHTML.

<cfparam name="form.submit" default=""/>
<cfparam name="form.xml" default=""/>
<cfscript>
function prettyXML(xmlString){

	var fileObj = "";
	var builder = "";
	var format = "";
	var out = "";
	var document = "";
	var fileInStream = "";
	var fileOutStream = "";
	var filePath = expandPath("./prettyXML.xml");

	try{
		fileWrite(filePath, arguments.xmlString);

		fileObj = createObject("java", "java.io.File").init(filePath) ;
		builder = createObject("java", "org.jdom.input.SAXBuilder").init() ;
		format = createObject("java", "org.jdom.output.Format").getPrettyFormat() ;

		format.setIndent("	");
		out = createObject("java", "org.jdom.output.XMLOutputter").init(format);
		fileInStream = createObject("java", "java.io.FileInputStream").init(fileObj );

		document = builder.build(fileInStream);

		fileInStream.close();

		fileDelete(filePath);

		return out.outputString(document);
	}
	catch(Any excpt){
		if(isDefined("fileInStream") and fileInStream neq ""){
			fileInStream.close();
		}

		writeOutput("<p>#excpt.message#</p>");
		writeOutput("<p>#excpt.stacktrace#</p>");
	}
}
</cfscript>
<html>
<head>
<title>Paste your ugly XML</title>
<style type="text/css">
	body, input{
		font-family:Trebuchet MS;
	}
</style>
</head>
<body>
<h3>Input your XML:</h3>
<cfoutput>
<form action="#cgi.SCRIPT_NAME#" method="post">
<p><textarea name="xml" rows="20" cols="100">#form.xml#</textarea></p>
<input name="submit" type="submit" value="Go"/>
</form>
<h3>Pretty XML</h3>
<cfif len(form.submit) and len(form.xml)>#htmlCodeFormat(prettyXML(form.xml))#</cfif>
</cfoutput>
</body>
</html>

Oct 16

London fashion - Reading whilst walking along

Posted by James Netherton | Thursday 16 October 2008 17:10 PM | In Blogging

Just one of many observations made on my commute to and from work……

Tis the current fashion in London to read a newspaper or book whilst walking along. While this does allow one to finish a chapter or complete the crossword whilst on the move, it does have the minor drawback of not being able to see where one is going.

This behaviour usually exhibits itself on crowded streets, busy tube platforms and station concourses. The effect of this is demonstrated thus…..

The unfashionable non reader walks by using the standard method of looking where he is going and thus avoids others:


Standard Walking

The alternate method of reading whilst walking along produces the following effect:

Reading While Walking

So absorbing is the book that the reader weaves from side to side while others take avoiding action until the inevitable collision occurs.

Oct 10

MySQL - Can’t connect to MySQL server on ’server’

Posted by James Netherton | Friday 10 October 2008 5:10 AM | In MySQL

I’ve just wasted a couple of hours trying to figure out why my mac keeps getting the response “Can’t connect to MySQL server on ’server’” when trying to connect to MySQL on my new vmware Ubuntu setup.

The solution is rather simple!

Open up your MySQL configuration file and find the –bind-address directive. It’s most likely that it’ll be set to 127.0.0.1 which makes MySQL listen for connections only via the loopback IP.

Comment out this line and save the configuration file. Restarting MySQL didn’t seem enough to make this work for me so I had to restart the OS.

Sep 13

Just married

Posted by James Netherton | Saturday 13 September 2008 11:09 AM | In Blogging

Just married nearly three weeks ago in fact! Hence my lack of blogging or interest in anything computer related over the past month or so, since there has been so much to do and organise.

My wife Sophia and I had a fantastic day. We were married at Romsey Abbey in Hampshire which proved to be a spectacular setting for the marriage service and a great backdrop for our (many) photographs.

The reception was also really enjoyable and my speech seemed to go down well with everyone, which was a relief considering I wrote it on the morning of the wedding!

There were some slight hiccups. Closer inspection of my marriage certificate revealed some embarrassing spelling errors on my father’s, Sophia’s and my occupation description. Not sure who the illiterate person was who filled out the details but I’m trying to get it changed.

Then there was the debacle over our (rather expensive) wedding cake. The staff at the reception cut portions of the cake so everyone could have a piece. Overnight it transpired that the reception venue staff had dumped the remainder of the cake in the bin, without any consultation with our parents or Sophia and I! Even worse, I recently found out that some of the staff had been helping themselves to bits of the cake while the evening party was going on.

For honeymoon we decided to go to Paphos in Cyprus for two weeks. The first five days were quite relaxing and then Sophia fell ill with a nasty stomach virus. Things got so bad that she ended up in hospital for three days. When she was released there was a strict diet for her to follow, so we were pretty much confined to the hotel for the remainder of the holiday. I didn’t expect to be tested on the ’sickness and in health’ vow quite so soon!

Problems aside, we still had a great time together and there’s still a day or so for us to enjoy together before we head back to work.