Note: these instructions also work on OS X 10.6 Snow Leopard, and OS X 10.7 Lion

A few years ago I did a similar tutorial for installing mod_jk on OS X 10.4 Tiger, but yesterday I discovered that those instructions do not work for Leopard. It took my quite a bit of googling and trial an error, but I’ve found a solution that works, which I’m going to share here. This solution is, in my opinion, a best practices solution, and does not involve any changes to your core apache configuration file (httpd.conf). These instructions are for the default install of Apache 2.2 that comes pre-installed on OS X 10.5 Leopard. I can verify that these instructions work for Tomcat 5.0.30, but I would be 99% sure they should also work un-changed for Tomcat 5.5.X and Tomcat 6.0.X.

Read more

I’ve blogged about how great sorttable is before. I use it a lot in work and people love it. However, because of the way sort-table works normally it won’t work with tables that are not in the document when the onload event for the document triggers. What does that mean in real terms? It means that if you use AJAX to render a table it won’t be sortable even if you include the sorttable.js file and set the class of the table to sortable. A quick scan of the source code showed me the answer, you have to manually call the function sorttable.makeSortable() passing it the table you just got back from AJAX. The simplest way to do this is to give your table an ID and then use:

  1. sorttable.makeSortable(document.getElementById('the_table_id'));

Technorati Tags: , ,

Thanks to this nice wordpress plugin/theme from the guys at content robot this blog now displays even better on an iPhone or iPod Touch. It works by first providing a theme that is optimised for use on Mobile Safari and then adding a plugin that uses that theme automatically for just Mobile Safari. It’s a nice idea well implemented. (Thanks to Alison for the tip)

Technorati Tags: , , , ,

I was searching for a tutorial on setting up custom global exception handlers in Struts 1 when I came across this fantastic article. If you develop with Struts 1 or are thinking of starting development with Struts 1 you really should read this – Jakarta Struts: Seven Lessons from the Trenches

Technorati Tags: , ,

Despite the advent of broadband excessive round-trips to the server still slow websites down. Having to send a request to the server to get the same data again but in a different order each time someone wants to sort a table is just not efficient. Hence, what you want is some nice simple JavaScript to do it for you. Ideally this JavaScript should be cross-browser and should not require you to make any substantive changes to your mark-up. Well, the good news is that this ideal has been realized and has been released under the free and open source MIT License. I’m talking about Stuart Langridge’s Sorttable.

Assuming you use proper XHTML markup for your tables, in particluar thead and tbody tags, making your tables sortable is a two-step process:

  1. Include sorttable.js
  2. Set the class of the tables you want sortable to sortable

For a basic setup that’s it! If you want to get a little more fancy you can by doing things like making some columns un-sortable but that too is trivially easy. Honestly, I have no complaints at all about this script, it just works!

Technorati Tags: , , ,

A couple of months back I wrote two articles singing JavaScript’s praises from a programmer’s point of view (JavaScript – Much more than Java’s Mini-Me & Hidden JavaScript). In the last one I hinted that there would be a follow-on article showing a darker side to JS. This is that article, just a few months later than I’d planned. Unlike the previous two articles this one is not really aimed at programmers, it’s aimed at anyone who surfs the web.

JavaScript (JS) can be used to really enhance usability on the web. We all like having drag and drop capability on the web, we like the way AJAX lets pages only refresh the bits that need to change instead of whole pages, and we even like those cool JS transitions and graphic effects. A lot of people refer to these things as Web2.0, but I’m not going to. I prefer to think of Web2.0 as being about community involvement rather than any particular technology. It’s a frame of mind not a software version! You can have Web2.0 without JS or AJAX. The key point is that we are all getting used to the enhancements JS can bring to the web environment. But there is a cloud on the horizon and it is growing.

The sometimes controversial security expert Steve Gibson has been warning us about the dangers of browsing with JS turned on for years now. In the beginning people ridiculed him, but his views are gaining more and more acceptance as the dangers start to become real rather than theoretical. I think the recent MySpace JS worm and the release of proof-of-concept code for a JS port-scanner by SPI Labs have really started to focus people’s minds on the dangers of JavaScript.

Technorati Tags: , , ,

Read more

I’ve done a few previous articles on Apache Tomcat (one for installing it on Linux and one for installing it on OS X), but I haven’t yet mentioned installing the JK Connector (mod_jk) in any environment. For those who are wondering what on earth I’m on about, mod_jk allows the Apache web server to serve your Tomcat web apps so they appear on port 80. There are a number of reasons why you might want to do this. Firstly, it provides a simple and secure way to get Tomcat to respond to requests on port 80 without having to have it run as root. Apache is more efficient at serving static pages so it can help increase the efficiency of your web app, and finally it allows you leverage all the power of Apache’s many features for your Java web app.

Technorati Tags: , , , , ,

Read more

This is the long over-due follow-up article to JavaScript – Much more than Java’s Mini-Me which I want to get published now because I’ve just started another JS article that I think needs to come after this article. I want to finish evangelizing the good things about the JS language before I take a look at JS’s dark under-belly. The next article has the working title JavaScript and AJAX on the Web – a Liability? and should be out within a week (at least that’s the plan).

In my previous JS article I discussed fundamental language features that JS has that give it the ability to do things many other languages just can’t. These features give the programmer extra tools that the common high-level languages like Java just don’t have. In this article I won’t be looking at anything as earth-shattering as that, I’ll just be looking at some nice features JS has that tend to get over-looked by JS programmers.

Technorati Tags: ,

Read more

Struts has support for indexed properties in its form beans. In fact, it has support for both simple and complex indexed properties. Ironically I have been able to find lots of documentation online to explain the more complex situation but none for the simpler one. I have been able to find documentation on using arrays of beans is form beans but not of arrays of simple literals like strings and integers. And I’ve done a lot of googling on the matter. Having the ability to have an array of strings in your form bean is a very handy feature. This is a very handy thing to be able to do and you’d be right to assume that it should be simple, and it is simple, it’s just not documented anywhere I could find (and I spend a lot of time looking). So, to help others who might be stuck with the same problem here is a worked example that should make it all clear.

Read more

Something that has annoyed me for a long time is that JavaScript is looked on by many people as just being a stripped down version of Java. You take Java, you take out most of the features and you get JS. This is completely wrong. The two are two completely different languages which follow different paradigms. One is Hard Typed and Object Oriented, the Other is Loosely Typed and Object Based. To give you an idea of just how different the languages are I would say that Java is to JavaScript like C/C++ is to Perl. I.e. they are completely different languages in just about every respect but their syntax is superficially similar.

Far from being a stripped down version of Java, JS is in many ways a more powerful language and is certainly more feature-rich. And I’m not talking about little conveniences that make programming a little easier but major features that make some things all but impossible to do with Java but which JS does simply and naturally. In this article I’m going to look at some of these features. While I was writing this article, I came up with many less dramatic advantages which JS has over Java, which just make things easier with JS. Initially I had also included those in this article but they made it too long for the modern attention span. Instead, I’m compiling them into a separate article with the working title Hidden JS which I hope to publish within the next week or so. The inspiration for this article was a post by Joel Spolsky entitled Can your programming language do this? which details one of the advantages JS has over Java.

Read more

keep looking »