Monthly Archives: April 2008

Irgendwie ist das mit Oesterreich…

… wie mit dem Spruch “Gelegenheit macht Diebe” oder den Waffengesetzen in den USA.

Anscheinend werden in Oesterreich schall- und gasdichte Kellerbunker vom Staat gefoerdert. Da kommt der alpenlaendische Durchschnittsperverse und Hausbesitzer natuerlich auf sehr unschoene Ideen :(

New p300 look

The new p300 version will have an updated look which is more messenger-like. Also I have done some usability improvements.

Contact me if you want to test :)

OS X Vorschau vs. Adobe Reader

Ich weiss schon wieso ich hier auch den Adobe Reader habe obwohl die Apple Vorschau 5 mal so schnell ist:

  1. Bessere Darstellung mancher PDFs, besonders von meiner Uni. Die haben mit Vorschau eine schreckliche Schrift.
  2. Besseres Kopieren aus mehrspaltigen Seiten. Die Vorschau will volle Breite kopieren, der Adobe Reader gottseidank nur das aus der Spalte, in der meine Maus ist.

Window locations in Java

I’m currently changing the windows in p300 to a MDI interface.

While doing this, I have found a nice Java thing: setLocationByPlatform enables you to let your JVM choose the position of a new Window. This means that windows won’t be placed at 0,0 but will be overlapped according to what your platform thinks is nice.

Ixi Ogo

Hab gestern im Kino gesehen wie jemand mit einem Ixi Ogo ueber ICQ chattet.

Ich wuerde mir ja sowas auch gern holen, aber die Vertraege und die Software sind zu einschraenkend: Ich will nicht nur ICQ, ich will auch Jabber, IRC und SSH. Oder eigentlich nur SSH, da mein Chat-Kram eh im screen laeuft. Dafuer waer ich dann sogar bereit 20 EUR im Moant zu zahlen.. nur leider gibts das was ich will nicht *seufz*

Update: Gibt auch Inoffizielle blogs und Foren. Muesste ich mich mal schlau machen ob es “gehackte” Firmwares gibt.

p300 641 has been released

The latest version of p300 is a bugfix release, fixes and enhancements include:

  • Better usage of Selector
  • Global exception handler
  • Properly set application name on OS X
  • Check if we can really allocate a new file (does not work that properly yet)
  • Do not query ourselves when getting a hostname pointing to us
  • Only use ipv4 for the moment
  • Fail if DISPLAY environment variable is set but we cannot initialize the UI
  • Make sure we don’t save duplicate addresses for a host
  • Fixed move problem with downloading 0-bytes files
  • When 75% of incoming connection slots are in use we deactivate HTTP keep-aliv

Have fun :)

Catching Exceptions with an UncaughtExceptionHandler in Java

I’ve recently spent some hours to track down a mysterious bug and I just couldn’t find it. Since my application is using a lot of Threads/Workers  it came to my mind that a RuntimeException I did not catch could be the cause. I wrote a global handler for it and found where the problem was :)

The code in p300 I am using:

Somewhere in main():

Thread.setDefaultUncaughtExceptionHandler(new P300UncaughtExceptionHandler ());

The class:

public class P300UncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
    public void uncaughtException(Thread t, Throwable e) {
        System.err.println ("Uncaught exception by " + t + ":");

How to test it:

new Thread () { public void run () { throw new RuntimeException ("x");}}.start ();

Using a Selector in Java NIO

For p300 I am currently using a Selector to check if I can read from or write to a socket.

However this lead me to a weird problem: I am selecting for at most 30 seconds and I have received a timeout for writing even though this can’t really be and only happens with some OS combinations. I’ve found this thread in the Sun Forums and adapted my internal logic to the information from this thread:

Instead of always selecting for OP_WRITE when I want to write, I just try to write. If i was not able to write everything (that is, buffer.remaining () > 0) I select for OP_WRITE.

This seems to work fine :)

(That fix is not in p300 619 yet, it will come with the next bugfix release in the next days)