31 October 2007
Why can only root listen to ports below 1024?
(This article has been edited since it’s first publication.)
In Linux, and other UNIX-like systems, you have to be root (have superuser privileges) in order to listen to TCP or UDP ports below 1024 (the well-known ports).
This port 1024 limit is a security measure. But it is based on an obsolete security model and today it only gives a false sense of security and contributes to security holes.
The port 1024 limit forces you to run all network daemons with
21 May 2007
Common mistakes with exceptions in Java
Unintentional catching of runtime exceptions Unfortunately, checked exceptions in Java are defined as all Exceptions which are not RuntimeExceptions. This makes it a bit tricky to catch all checked exceptions (but not any runtime exceptions). It would have been better if checked exceptions were defined by a specific class, CheckedException, but that’s too late to change now.
Too often Java programmers catch all exceptions when they really only should catch checked exceptions.
28 March 2007
Linux on diskless workstation
When the built-in HDD controller in my computer broke down, I decided to try running my computer diskless with LAN booting. I use Ubuntu Linux 6.10 and I have another computer with a large HDD acting as server.
I followed the instructions in this HOWTO. I changed MODULES to “netboot” in initramfs.conf and I had to add a driver for my network adapter to the modules file in the initramfs configuration.
8 September 2006
Poor Javascript performance is an obstacle in AJAX development
I’m currently developing my first AJAX based web application. The goal is to have a pure AJAX application, i.e. never reload the entire page, use only background XMLHTTPRequest to contact the server.
My observations so far is that it is possible to do most of the application logic I need. But the performance of Javascript execution in the browser is a big obstacle. The application is centered around a list of data items in a scrollable area.
11 May 2006
Who needs rmiregistry?
Java Remote Method Invocation (RMI) contains a tool rmiregistry to run a stand-alone remote object registry. According to the RMI tutorial, rmiregistry is normally used in an RMI application.
I wonder why. It’s actually almost as simple to run the remote object registry within the RMI server. You only have to use java.rmi.registry.LocateRegistry#createRegistry(int port) method like this:
Registry registry = LocateRegistry.createRegistry(port); registry.bind("Foo", stub); Here is a complete example.
This is also more efficient since you don’t have to start a separate JVM for the registry.