25 November 2010
Web applications and web frameworks
If you are to develop a web application, there are a lot if frameworks to choose between.
I assume that the web application by its nature needs to have bi-directional communication between the web browser and the server during the execution, initial downloading of resources is not enough. I also assume that the available technologies are HTML, CSS and JavaScript/AJAX; no Flash, Java applets, ActiveX, Silverlight or other browser plug-ins are used.
21 August 2010
Mount your home directory with SSHFS in Linux
If you have your home directory on another machine, it’s common to use NFS to access it. NFS is easy to set up and works more or less out of the box on Linux. However, NFS is not secure, and you need to have a carefully setup firewall in order to use it safely.
SSHFS is a more secure alternative, but it’s quite tricky to set up on the client side.
9 June 2010
Using Vaadin with Maven
Vaadin is a comprehensive framework for developing web applications in Java. The Vaadin web site presents a number of ways to use Vaadin with Maven, but I am not completely satisfied with any of those. Here is how I do it.
Use a pom.xml like this:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.thecompany</groupId> <artifactId>theapp</artifactId> <version>1.0</version> <packaging>war</packaging> <name>The App</name> <dependencies> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin</artifactId> <version>6.3.3</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.
29 April 2010
Implementing POX Web Services with Spring WS and JAXB
Spring Web Services together with JAXB 2.0 provides a convenient way to implement POX Web Services in Java.
POX means Plain Old XML, and a POX Web Service is a protocol based on sending XML over HTTP without using any well-known protocol framework like SOAP or XML-RPC.
First you have to define annotated JAXB classes for all XML request and response messages. If you have a schema, you can generate them with the xjc tool.
16 April 2010
How to implement RESTful JSON Web Services in Java
You can implement RESTful Web Services in Java using the JAX-RS framework.
JAX-RS is part of the JavaEE 6 platform. But if you are not using a JavaEE 6 application server, you can use the reference implementation Jersey and embed it in any web application server.
However, it’s quite awkward to produce JSON output from Jersey.
Jersey has some support for producing JSON via JAXB, but to get the NATURAL encoding (which you probably want) you need JAXB 2.
15 November 2009
Linux with / mounted read-only 2.0
(This is a new version of a previous post updated to work with Ubuntu 9.10 (karmic).)
I wondered why you usually mount / (the root file system) read-write in Linux and decided to do some experiments to find out if it is possible to have it mounted read-only.
So why do you want to do that? Perhaps you have the root file system on a read-only media, such as CD-ROM. Or on a writable media which can only handle a limited number of writes, such as a CD-RW or flash disk.
18 September 2009
How to get microphone to work un Ubuntu 9.04
I finally got the microphone input on my Acer Veriton X270 to work un Ubuntu 9.04.
The trick is to uninstall PulseAudio and use ALSA only.
It even works in Skype.
13 August 2009
java.util.Map is broken in Java 5
Java 5 added generics. The collection classes was modified to make use generics to provide compile-time type-safe collections. Sadly, this was not done properly.
The worst problem is in the interface java.util.Map:
public interface Map<K,V> { // more methods... V get(Object key); V remove(Object key); boolean containsKey(Object key); boolean containsValue(Object key); } The key parameters to these methods ought to be declared to be K and not Object. Now we don’t get any type-safety for those methods.
17 July 2009
Misuse of HTTP GET is a cardinal sin
According to the RESTful style, you should make use of the four HTTP methods GET, POST, PUT and DELETE. However, in many cases only GET and POST is used, and POST is used when you really should use PUT or DELETE. I consider this as a quite minor issue.
However, using GET instead of POST (or PUT or DELETE) is much worse.
The current HTTP 1.1 specfication (RFC-2616) clearly states that a GET request must be safe, i.
3 July 2009
Running Ubuntu Linux on Acer Veriton X270
I recently brought an Acer Veriton X270.
Ubuntu Linux 8.04 works well except for sound. Basic stereo sound output works, but sound input (microphone) and some advanced 3D and surround sound does not work. The front headphone jack does not work correctly either. (All this works in Windows, so it’s not a hardware problem.)
Apart from the poor sound support in Linux, I am quite happy with this computer. It’s small (though not super small like Mac Mini or Fujitsu ESPRIMO Q), quiet, has all features you need and works out of the box.