Wednesday, April 18, 2007

OpenOffice as service while allowing editing

In order to run OpenOffice as a service, it must be listening on port 8100. It is straightforward to run open office as a service using srvany from Microsoft. But when doing development, this is inconvenient, as OpenOffice runs in invisible mode, and it is therefore impossible to edit documents interactively.

One way around this is to edit the Setup.xcu file (easiest way to find it is to search in the OpenOffice install directory, as the typical location is C:\Program Files\OpenOffice.org 2.1\share\registry\data\org\openoffice), and modify it as follows:

<node name="Office">
<prop oor:name="ooSetupConnectionURL" oor:type="xs:string">
<value>socket,host=localhost,port=8100;urp;</value>
</prop>
...
</node>

Once that is done, locate the quickstart.exe program in your openoffice installation. Drag that to your Startup folder. VoilĂ , you have an OpenOffice running in the backgroung, AND you can edit your files.

So you can keep the true service installation for your production servers.

Wednesday, April 11, 2007

Reverse tunnelling using SSH under Windows

I needed to create a secure tunnel to remotely administer a system located behind a firewall. Simplest solution I found was to use Bitvise Tunnelier S2C (server-to-client) mapping feature, which works nicely together with the Bitvise Winsshd server.

The idea is for the remote machine to open a tunnel to the server. Depending on the context, this can be done manually by a person with access to the machine, or Tunnelier can be configured to run as a service, using Microsoft's srvany so that things fire up at boot time.

By mapping port 3389 (remote desktop) to a port on the server (say 5555) using the S2C mapping, remote administration becomes easy. As soon as the client connects, the server opens port 5555. Using remote desktop to connect to 5555 (by giving localhost:5555 as the address on the server) opens a connection to the remote desktop at the other end of the tunnel.

Bitvise Winsshd is hard to beat, for the price, and much much simpler to administer than the Cygwin versions. For home use, freesshd is ok, but lacks the features like automatic S2C that make Winsshd stand out.

https not working for dynamically-generated files

We generate Excel and other Microsoft Office files on the fly using Java Servlets and JSPs. After moving a site to https things stopped working. Excel complained it could not open the file. Looking at headers returned showed no clear difference between http and https. Things worked just fine in Firefox.

As it turned out, the answer lies in the directives to turn off caching. Ever since Internet Explorer 4.0, there is a flaw in the way caching is handled under https. The answer is to modify the code to set the following headers (setHeader() in the servlet API).

Pragma: public
Cache-Control: max-age=0

For more details, see

http://forum.java.sun.com/thread.jspa?forumID=45&threadID=233446
http://downside.ch/blog/?p=26

Monday, April 9, 2007

Silent Install for OpenOffice.org 2.x

After much searching, I found the following method for installing OpenOffice.org as part of a bigger install:
  1. unpack the installation files by starting the standard installer and hitting cancel once the files are unpacked
  2. cd to the directory where the files were unpacked
  3. run
    msiexec /i openoffice2.2.msi /qb INSTALLLOCATION=pathWhereYouWantToInstall
It appears that INSTALLOCATION is used instead of the standard TARGETDIR or fairly common INSTALLDIR.

Note that this will not suffice if your intent is to run OpenOffice as a document processing server. You will need to override the Setup.xcu file as explained here.

Sunday, April 8, 2007

Here we go!

I intend to use this blog as a chronicle of useful information I find while running a software company.