Schlagwort-Archive: Java

Identity Management: OpenID mit openid4java

Heise Online hat aktuell 2 Artikel um Thema Single-Sign-on (SSO) via OpenID im Newsticker publiziert. Dabei wird auch auf das Projekt OpenID4Java eingegangen.

Java Image Scaling Algorithm

The following article explains the different pitfalls for image scaling with java quite well. And it includes some code how to do it right.

http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html

If you use the multistep scaling flag of the provided helper method, ensure that your server has enough memory.

WebKit Browser-Engine für für Java und Qt

WebKit for SWT (ver. 0.5) is an embeddable Java™ WebKit browser component developed by Genuitec. This component can be used in the development of a wide range of Java SWT applications that require integration of rich HTML5, CSS3, JavaScript and Flash content and functionality.

Find more information at www.genuitec.com/about/labs.html and www.golem.de/0903/65697.html.

Java: get the time of another time zone

public Date getLocalCurrentDate() {
TimeZone timeZone = TimeZone.getTimeZone(“Greece”);
TimeZone defaultZone = TimeZone.getTimeZone(“GMT”);
Date localDate = new Date();
Date yourDate = new Date();
yourDate.setTime(localDate.getTime() + timeZone.getRawOffset() – defaultZone.getRawOffset() – defaultZone.getDSTSavings());
return yourDate;
}

Java: timezone shift / Zeit in andere Zeitzone umrechnen

To calculate a time to another time zone, just

  1. get a timezone object for the new timezone
  2. register the timezone object to a formatter
  3. recalculate the time with the formatter to a string

code sample:

// formatter
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
// local date
Date now = new Date();
// instanciate timezone
TimeZone timezone = TimeZone.getTimeZone(“Japan”);
// register on formatter
df.setTimeZone(timezone);
// recalculate
System.out.println(“Japan time is:”+df.format(now));

AWT ohne X / Windows / grafische Oberfläche

Seit Java 1.4 gibt es die Möglichkeit, die AWT-Klassen auch ohne laufendem X-Server zu nutzen. Es reicht, beim Aufruf des Programms den Schalter “/…/jre/bin/java -Djava.awt.headless=true” zu setzen.