WD TV Live HD Streaming Media Player, 3. Generation

Als Besitzer des WD TV Live der ersten Generation musste ich nun feststellen, dass Western Digitial anscheinend Modellpflege betrieben hat. Mit dem aktuellen WD TV Live – HD Streaming Media Player hat Western Digitial dem guten, zuverlässigen WD TV Live Media Player nicht nur ein Facelift verpasst, sondern diesem auch neue Funktionen hinzugefügt.WD TV Live HD Streaming

So waren bisher Funktionen wie z.B. MovieSheets, USB-Hub Support, Webfrontend, Android App Support u.ä. nur mit einer Custom Firmware a la WDLXTV möglich. Wollte man zusätzlich Plugins verwenden, musste man sich allerdings für eine ältere (Custom) Firmware Version entscheiden und schmerzhafterweise auf neuere Funktionen wie z.B. MKV Header Compression verzichten.

Die neue Version des WD TV Live (3Gen) scheint nun einige der o.g. Funktionen bereits in der original Firmware mitzuliefern und macht für die meisten Anwender den Einsatz einer Custom Firmware überflüssig. Dieser Erfahrungsbericht soll ein paar Einblicke in die neuen Features bieten. Weiterlesen…

Oracle still treats empty string as null

It is really a joke that Oracle still treats empty (zero length) strings as null, even in the year 2012! Recently I came (again) across this fact when we were adding support for Oracle 11g in our application.

I was shocked that this is still an issue. Although they may had their reasons in the past, this is really annoying nowadays. I can’t understand why they didn’t make a cut a some point, made the default SQL92 compliant and added an option for the legacy systems. If you don’t know what I’m talking about:

When you have an Entity that has a String attribute, put an empty String (“”) into it and persist it. When you read it back this String attribute is now null instead of “”! This leads to unfunny side-effects especially when you’re already supporting other databases like MySQL, MSSQL or PostgreSQL where this isn’t an issue. Be prepared to re-check queries, required attributes and JSF pages.

How are you handling the situation? Is there a new option I’m probably not aware of?

CDI BeforeShutdown Event not fired

Ever wondered why the JEE6 CDI Event BeforeShutdown isn’t fired when the container shuts down as described in its javadoc?

Well, this is because it’s one of the container lifecycle events that are not accessible for normal CDI managed beans. To get access to these special events, your implementation has to be an CDI Extension.

First, implement the Extension interface:

package org.nightprogrammer.examples.cdi;
 
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
public class BeforeShutdownTest implements Extension {
 
	private static final Logger log = LoggerFactory.getLogger(BeforeShutdownTest.class);
 
	public void onShutdown(@Observes BeforeShutdown beforeShutdownEvent) {
		log.debug("shutdown event received!");
	}
}

Second, create a META-INF/services/javax.enterprise.inject.spi.Extension file containing the full qualified classname of your Extension:

org.nightprogrammer.examples.cdi.BeforeShutdownTest

That’s it! Now you receive the Event as soon as the container goes down. Would be great if the javadoc would mention that directly in the BeforeShutdown Event though. That would have saved me an hour of research :(.

What do you use for cleaning up resources before a container shuts down?

(Besides contextDestroyed() for webapps and addShutdownHook() for JavaSE applications.)