Fill test data into existing database with JDO

I wanted to fill test data into an existing database with many foreign keys. These foreign keys were somewhat unusual because the tables were not linked via their primary keys but via a combination of other fields. Since I did not want to rebuild all foreign keys in my classes with JDO annotations I searched for a way to disable the checking of the keys and constraints. The usual

SET foreign_key_checks = 0;

did not work. Also disabling the keys for every table did not work and I still got the foreign key constraint violation error messages. After searching for some time I found a very simple solution. One can append the directive foreign_key_checks = 0 to the connection URL in the jdoconfig.xml config file:

<property name="javax.jdo.option.ConnectionURL"
          value="jdbc:mysql://localhost:3306/db_name?sessionVariables=FOREIGN_KEY_CHECKS=0" />
Posted in Uncategorized | Leave a comment

gwt-maven-plugin for GWT 2.1.0

Since the second milestone of GWT has been released (Google Web Toolkit 2.1.0 M2 Downloads) I wanted to give it a try and check some of the new features, especially the new MVP framework. In the past I used gwt-presenter and gwt-dispatch and wanted to use GWTP (gwt-platform) for one of my next projects. But now I will try the new MVP framework included in GWT 2.1 first (see Large scale application development and MVP).

I had some trouble with the current version 1.2 of the Google Web Toolkit Maven Plugin since it apparently does not support some of the 2.1.0 features. After google-ing for some minutes I found a repository for both the GWT 2.1.0.M2 SDK and a special (ahem) 1.3.1.google version for the Maven plugin:

<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-servlet</artifactId>
  <version>2.1.0.M2</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <version>2.1.0.M2</version>
  <scope>provided</scope>
</dependency>
 
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>1.3.1.google</version>
</plugin>
 
<repository>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <id>gwt-dev-release</id>
  <url>http://google-web-toolkit.googlecode.com/svn/2.1.0.M2/gwt/maven/</url>
</repository>
 
<pluginRepository>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <id>gwt-dev-release</id>
  <url>http://google-web-toolkit.googlecode.com/svn/2.1.0.M2/gwt/maven/</url>
</pluginRepository>
Posted in Uncategorized | 12 Comments

Eclipse hangs at startup showing only the splash screen

Today my Eclipse Galileo hung at start up. After trying some tricks such as eclipse -clean, or eclipse -debug -console, searching for hints in the log files, removing xulrunner from the java.library.path environment, deleting some of the most recent history files and so on I found the solution. In your workspace directory perform the following steps:

  1. cd .metadata/.plugins
  2. mv org.eclipse.core.resources org.eclipse.core.resources.bak
  3. Start eclipse. (It should show an error message or an empty workspace because no project is found.)
  4. Close all open editors tabs.
  5. Exit eclipse.
  6. rm -rf org.eclipse.core.resources (Delete the newly created directory.)
  7. mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.)
  8. Start eclipse and start working. :-)
Posted in Uncategorized | 129 Comments

Google GWT SplitLayoutPanel: How to style the Splitters

I wanted to change the default style of the splitters of the new Google GWT SplitLayoutPanel. Unfortunately the height and the width of the VDragger and the HDragger are hardcoded. In the source code one can find the following comments:

 * NOTE: This class is still very new, and its interface
 * may change without warning. Use at your own risk.

and

* TODO(jgw):
 * - RTL Support.
 * - implement insert().
 * - Come up with a decent way to specify splitter style and size.

OK, I use it at my own risk and use a not so decent way to change the style of the splitters:

interface Binder extends UiBinder <SplitLayoutPanel, MyView> { }
private static Binder binder = GWT.create(Binder.class);
...
public MyView () {
  initWidget (binder.createAndBindUi (this));
}
...
public void setVDraggerHeight (String height)
{
  SplitLayoutPanel p = (SplitLayoutPanel) this.getWidget ();
  int widgetCount = p.getWidgetCount ();
  for (int i = 0; i < widgetCount; i++) {
    Widget w = p.getWidget (i);
    if (w.getStyleName ().equals ("gwt-SplitLayoutPanel-VDragger")) {
      w.setHeight (height);
    }
  }
}

Issue 4620: Hardcoded styling in SplitLayoutPanel

Posted in Uncategorized | 3 Comments

GWT 2.0 TabLayoutPanel display problem with Internet Explorer IE8

The Google GWT TabLayoutPanel is working fine on Chrome and Firefox but currently on IE8 only the first tab is visible. I ran into this problem a few days ago. But as always with such kinds of problems in software development you’re probably not the first one. The issue shall be fixed in the next Google GWT release 2.0.1. Until then you can add

.gwt-TabLayoutPanelTab { float: left; }

to your CSS stylesheet.

TabLayoutPanel not working on IE8
Issue 4447: TabLayoutPanel tabs don’t line up properly on IE

Posted in Uncategorized | Leave a comment

URL encoding problems with GWT running on Tomcat

I ran into problems with a GWT application for which I use the OpenID4Java library to provide a simple one click login for users with existing accounts at Google, Yahoo or other OpenID providers. Everything worked fine on the embedded Jetty server running in the GWT development mode.

In GWT development mode I had no problems signing in with my Google account. When running the application on Tomcat I got the following error: “Local signature verification failed” from the OpenID4Java ConsumerManager although I received a positive auth response and Google delivers my name and email address of my Google account.

The problem was a special character, a german umlaut, in my name which was not decoded properly with the correct character encoding. Because of this wrong URL encoding the calculated signature in the OpenID4Java Association was different from the original signature.

Adding the attribute URIEncoding=”UTF-8″ to the connector
element in Tomcat’s server.xml explicitly directs Tomcat to use UTF-8 character encoding instead of its default (ISO-8859-1) and fixed the problem.

Tomcat and UTF 8 encoding
Apache Tomcat Configuration Reference

Posted in Uncategorized | Leave a comment

Google GWT Application shows blank page in IE8

I wanted to try a GWT application based on the new layout classes introduced in Google Web Toolkit 2.0 with the Internet Explorer 8. To my surprise the IE 8 showed only an empty page. Switching to IE7 standards mode with the following meta tag solved the problem.

<meta http-equiv="X-UA-Compatible" content="IE=7"/>

If you know the reason for this behavior please leave a comment.

Posted in Uncategorized | 1 Comment

VIRUS (Exploit.PDF-9669) with clamav 0.92.1 on Ubuntu 8.04 Hardy Heron

Solution to the problem:

apt-get remove libclamav3 clamav and every other dependency with apt-get autoremove and download and install all "*0.95.3*hardy2*.deb" packages from http://archive.ubuntu.com/ubuntu/pool/universe/c/clamav/ with dpkg -i libclamav*; dpkg -i install clamav*.

Have a nice weekend.

Posted in Uncategorized | Leave a comment

Problem with Ubuntu 9.10 “Karmic” and Eclipse 3.5 Galileo

After upgrading to Ubuntu 9.10 “Karmic” I had some problems using Eclipse 3.5 “Galileo”. Some buttons did not show any reaction, especially the installation of new plugins or the update of already installed plugins did not work. The solution was to explicitly set the environment variable GDK_NATIVE_WINDOWS to true, preferably by using a shell script to start Eclipse

#!/bin/sh
export GDK_NATIVE_WINDOWS=true
YOUR_COMMAND_TO_START_ECLIPSE

See also:
Bug 291257 – [Widgets] Buttons functionality problem with GTK+ 2.18
Migrating to client-side windows

Posted in Uncategorized | Leave a comment

Eclipse + Maven + AppEngine: Invalid classpath publish/export dependency

While working with Eclipse and Google Plugin for Eclipse the Maven Integration Plugin I ran into the problem that the dependency on the JDO API library jdo2-api-2.3-ea.jar appears in the App Engine SDK and in the Maven dependencies imported from another project. The Eclipse Classpath Dependency Validator showed the following error message:

Invalid classpath publish/export dependency /local/eclipse/galileo/plugins/com.google.appengine.eclipse.sdkbundle_1.2.2.v200907291526/appengine-java-sdk-1.2.2/lib/user/orm/jdo2-api-2.3-ea.jar. The project contains another dependency with the same archive name.

The solution for this problem was using the notion of explicit dependency exclusion of Maven 2.x in the pom.xml.

Posted in Software Development | Tagged , , | 1 Comment