Total Pageviews

Monday, July 30, 2007

OpenOffice opens nfs files only in read-only mode on Linux

If you ever encounter the problem to open an OpenOffice document from a NFS file server and this document will be opened only in read-only mode try this fix:
  1. Locate the file /usr/lib/openoffice/program/soffice
  2. Comment out all lines containing the following code:
    export SAL_ENABLE_FILE_LOCKING

Note: I have experienced this problem under Ubuntu Linux (Feisty).


Continue reading "OpenOffice opens nfs files only in read-only mode on Linux"

Thursday, July 26, 2007

Howto configure SSL for Apache2

To enable SSL support in Apache2 the first step is to create a SSL certificate. If you are not among the lucky ones having apache2-ssl-certificate installed you can use the Linux shell script below to create a SSL certificate

#!/bin/bash
SERVER=your.server.com
PRIVATE_KEY=$SERVER.private.key
CERTIFICATE_FILE=$SERVER.crt
VALID_DAYS=365

echo Delete old private key
rm $PRIVATE_KEY
echo Create new private/public-keys without passphrase for server
openssl genrsa -out $PRIVATE_KEY 1024

echo Create selfsigned certificate
rm $CERTIFICATE_FILE
# From man req:
#  -x509
#    this option outputs a self signed certificate instead
#    of a certificate request. This is typically used to
#    generate a test certificate or a self signed root CA.
#    The extensions added to the certificate (if any) are
#    specified in the configuration file.

openssl req -new         -days $VALID_DAYS         -key $PRIVATE_KEY         -x509         -out $CERTIFICATE_FILE

echo private-keyfile is $PRIVATE_KEY
echo server-certificate-file is $CERTIFICATE_FILE

ls -l $PRIVATE_KEY $CERTIFICATE_FILE

The SERVER variable is very important. Please name your fully qualified server name there. After executing the script and answering the questions you've got two files: the certificate file (suffix .crt) and the key file (suffix .key).
Copy those two files into the directory /etc/apache2/ssl.
Now install the Apache2 ssl module: a2enmod ssl
The next step is to create a new virtual host for our https sites. Simply copy the default site to a new site called default-ssl:

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-ssl


Replace the first two lines in the file with the following lines:

NameVirtualHost :443
:443>
# SSL (START)

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/my.apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/my.apache.key

SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
# SSL (ENDE)


After this edit the file /etc/apache2/ports.conf and add the following line:

Listen 443


The last thing is to enable the site calling a2ensite default-ssl
Finally restart your Apache2: /etc/init.d/apache2 restart

Tuesday, July 24, 2007

Javolution - Real-Time Java and Fastutil

Boost your application performance (in particular when using collections) with the Javolution API and the Fastutil API.

Java template engine - StringTemplate

I used to use Freemarker as my favorite template engine but I may switch to StringTemplate. The documentation looks very good and the architecture seems to be very clean (enforcing model-view separation).

Sunday, July 22, 2007

Discovering JSF tutorials

If you are interested in learning JSF or just want a quick overview over JSF features and available JSF tutorials have a look at this site: http://www.roseindia.net/jsf/.
Looks like a great collection of JSF tutorials.

Monday, July 09, 2007

Connecting to a Microsoft SQLServer Express 2005 database via JDBC

I discovered a few stepstones when connecting via JDBC to a locally installed SQLSever Express 2005 database. Here are my observations:
  • Activate "Accepting TCP/IP" connections in the SQL Server Configuration Manager. Otherwise the SQLServer Express database won't accept any JDBC connections. This option was disabled in my configuration. Also make sure to use a static TCP/IP port, otherwise (when choosing a dynamic) the port might change on every start of the SQLServer database.
  • When using Microsofts JDBC driver (not recommended) the following two steps should be considered:
  • Copy the file sqljdbc_auth.dll that is packaged within the JDBC driver archive to a location that is part of you PATH variable, e.g. c:/winnt/system32.
  • Open the Microsoft SQL Server Management Studio application and create a new database user account. Be careful not to choose an existing windows account name, but to create a new SQLServer account. Otherwise you might have a chance to run into an error when trying to login via JDBC. Possible error messages and their status codes are described under http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx.