TOP

JAX-RS, JAXB, Jersey, and CDATA

Today I had to reuse my code snippet from the JAXB and CDATA blog post to integrate it into a Jersey web application. The application produces some content which could contain some „strings“ which must be wrapped by a CDATA section. To realize this I implemented a javax.ws.rs.ext.MessageBodyReader and javax.ws.rs.ext.MessageBodyWriter by extending from the class com.sun.jersey.core.provider.jaxb.AbstractJAXBElementProvider. This implementation is registered at the Jersey Application by returning the class object in the com.bosch.im.jaxrs.ImApplication.getClasses() implementation.
(mehr …)

Read More
TOP

IE9 / IE10 CSS shadow not rendered

Yesterday I got the problem that IE does not render the box-shadow property. After a while a figgured out that the property „border-collapse: collapse;“ for a surrounding table prevents the rendering. I got the property inherited from a stylesheet of a JS Framework. After manipulating my css to the following configuration:

.shadowed {
   -moz-box-shadow: 0 0 5px 5px #DDD;
   -webkit-box-shadow: 0 0 5px 5px #DDD;
   box-shadow: 0 0 5px 5px #DDD;
   border-collapse: separate;
}

it also works for IE, Safari, and Firefox. Thanks to thirtydot who gives me the right clue.

Read More
TOP

JavaScript Parser Generators

When validating the content of an HTML text input field it is often ineffective to trigger the remote validation for each character change. Sometimes you can use a buffer, so validation is only done after a fix time interval. For other scenarios it is a good solution to create a validator which works completely on the client side, using JavaScript. This blog post provides a quick overview and a simple tutorial for creating a JavaScript parser. (mehr …)

Read More
TOP

JAXB and CDATA Sections

Because I spended a few hours for that, I decided to write a small blog post about that. The challenge was to create a JAXB implementation independent solution for writing CDATA sections with a JAXB marshaller. There are a lot of solutions out there but they are not satisfying me. A lot of them reference the MOXy CDATA annotation or using the Apache XMLSerializer. They are either not implementation independent, does not work, reference deprecated code or have other pitfalls.  The following solution fixes these by using a custom implementation of javax.xml.stream.XMLStreamWriter and has not 3rd party library dependencies. Only the classes of the Java 6 JDK are used. The solution is able to create the following xml:

<test xmlns="http://www.example.org/test" msg="foo">
	<text><![CDATA[<o>]]></text>
	<text>foo</text>
</test>

(mehr …)

Read More
TOP

Portlet Spring Vaadin Integration

Based on blog post from Nicolas Frankel I created the same class which works with portlets. So the method getNewApplication returns an application which is created via Spring.

import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletRequest;
 
import org.springframework.context.ApplicationContext;
import org.springframework.web.portlet.context.PortletApplicationContextUtils;
 
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.AbstractApplicationPortlet;
 
public class SpringApplicationPortlet extends AbstractApplicationPortlet
{
 
   private Class<? extends Application> clazz;
 
   @Override
   public void init(PortletConfig config) throws PortletException
   {
      super.init(config);
 
      ApplicationContext appContext = PortletApplicationContextUtils.getWebApplicationContext(config.getPortletContext());
 
      Application application = appContext.getBean("application", Application.class);
 
      clazz = application.getClass();
   }
 
   @Override
   protected Class<? extends Application> getApplicationClass() throws ClassNotFoundException
   {
      return clazz;
   }
 
   @Override
   protected Application getNewApplication(PortletRequest request) throws PortletException
   {
      ApplicationContext appContext = PortletApplicationContextUtils.getWebApplicationContext(request.getPortletSession()
            .getPortletContext());
 
      return appContext.getBean("application", Application.class);
   }
 
}
Read More
TOP

Ordered Adobe Lightroom3

Found a nice deal on mydealz.de for a full version of Lightroom 3. I want to use it not because of my big camera equipment (a Panasonic DMC-FX500), nor to start a career as photographer but for managing my photos and to remove small unbeautiful things like red eyes or a overexposure.

Read More
TOP

It is shipped!

I received a mail:

Dear Michael Ernst,

We are pleased to send you this dispatch regarding your Apple Store order W289XXXXXX.

Your Delivery Reference Number is 813XXXXXX.

We expect your order to be delivered to your shipping address on or before 27.09.2010.

So I think it will be in my hand at the end of the next week.

Read More
TOP

The plan to buy an iPhone in Strasbourg is canceled

I ordered it today on the apple website in the United Kingdom. It should be deliverd in 4 weeks. Let’s see! To handle the no address in UK problem I used borderlinx from DHL. They provide me an address in UK, so I can place my order.

Update: We estimate your order to be shipped 04 Oct, 2010.

Read More
TOP

JPA and custom data types

I even answered a guy in the Hibernate community how to map a datatype like java.net.URL and than I asked myself why some people have problems to provide them in a JPA annotated bean. It is very easy and you don’t have to implement any special JPA provider dependent interface. The solution is so easy. Break your bean down into their properties and annotate this properties as you normally do. And than – no magic – do your mapping in your getter and setter operation. Through this, you hide the information that your bean does not hold a value of your complex type. You break the type down in a setter and recreate it in the getter operation. For performance you can hold a field of your complex type and annotate it with the javax.persistence.Transient annotation.

Read More
TOP

The plan: buy an iPhone 4 in Strasbourg

I’m looking for a new smartphone. My old one, a 5 years old Xda from my carrier O2 is loosing the memery and all phone numbers etc. all the time I forgot to load the phone. This is very cumbersome. So I decided to buy a new one, an iPhone. I will not buy it at the local carrier t-mobile and their very expensive contracts.

Costs at t-mobile:

  • Monthly rate: 59,95 * 24 months: 1438,80 €
  • 32 GB iPhone 4: 199,95 €
  • Service charge: 24,95
  • Price per minute: 0,29 € (when not t-mobile)

So where can I buy an iPhone else? I googelt a lot and first I thought I buy it in the Glattzentrum close to Zurich. But than I thought why should I buy it in a country which is not part of the EU and to pay value added tax for it at the border again. So I decided to look for countries which are part of the EU and sell iPhones without any sim-locks and hey I could buy it in France. Next month I have an appointment 50 km away from Strasbourg so I googelt again and than I found lots of sites which describes where you can buy it in Strasbourg. I found a good link to a shop locator of apple:  http://www.apple.com/fr/buy/locator/

The page lists the following shops for Strasbourg:

  • FNAC Srasbourg
    La Maison Rouge – 22, Place Kléber
    Tel:  (+33) 03 88 52 21 21
    Tagged as an Apple shop
  • BEMAC
    14BIS, Rue de la Mesange
    Tel: (+33) 03 88 22 78 87
    Tagged as a premium reseller
  • BEMAC
    18 Quai St Nicolas
    Tel: (+33) 03 88 25 84 88

A car park is next to Place Kléber:

  • Vincie Park Services
    24 Rue du Fossé des Tanneurs
    (+33) 03 88 23 14 30

Read More