Use maven profile to recompile vaadin widgetset #2

Thursday, 26. April 2012 Leave a comment

In a older post I describe my solution to handle VAADIN/GWT widgetset compilation with maven.

Today I  will share some changes to use GWT 2.4 with my solution.

The problem: after GWT compilation a new directory gwt-unitCache exists under the VAADIN directory. I don’t need this ;)

I integrate this workaround in my profile:

<profile>
  <!-- Updates Vaadin widgetset definitions based on project dependencies -->
  <id>update-widgetset</id>
  <activation>
    <file>
      <missing>${basedir}/src/main/webapp/VAADIN/widgetsets/</missing>
    </file>
  </activation>
  <build>
    <plugins>
      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>1.0.2</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>update-widgetset</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.4.0</version>
        <configuration>
          <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets/</webappDirectory>
          <extraJvmArgs>-Xmx512M -Xss1024k </extraJvmArgs>
          <deploy>${project.build.directory}/gwt-tmp/</deploy>
          <soyc>false</soyc>
          <force>true</force>
          <strict>true</strict>
          <style>OBFUSCATED</style>
          <optimizationLevel>9</optimizationLevel>
        </configuration>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- workaround for 
             http://code.google.com/p/google-web-toolkit/issues/detail?id=6397 -->
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/src/main/webapp/VAADIN/</directory>
              <includes>
                <directory>gwt-unitCache/**</directory>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
          <excludeDefaultDirectories>true</excludeDefaultDirectories>
        </configuration>
        <executions>
          <execution>
            <id>default</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

:-)

Categories: GWT, Maven, Vaadin Tags: , , ,

Reset sa password for SQLExpress

Thursday, 12. April 2012 Leave a comment

C:\Program Files\Microsoft SQL Server\80\Tools\Binn>osql -E sa -S [HOSTNAME]\SQLEXPRESS
1> sp_password @old=null, @new=’123geheim’, @loginame = ‘sa’
2> go

Categories: Tricks Tags:

Enable JMX Management for Hibernate EhCache

Wednesday, 14. March 2012 1 comment

Have a look at

  • net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory.start(Settings, Properties)
  • net.sf.ehcache.hibernate.management.impl.ProviderMBeanRegistrationHelper.registerMBean(CacheManager, Properties)
What we need is a system property “tc.active” with value “true”
:)
Categories: Uncategorized Tags: , ,

jmonkey maven support next round

Monday, 23. January 2012 Leave a comment

jmonkey have no maven support … here is my solution :)

1. clone jme3-thirdparty from git, mvn install … done
2. clone jme3-buildhelper, copy pom.xml into jmonkey-engine … done
3. start hacking your jmonkey game with maven build support :)

https://github.com/ahoehma/jme3-maven-helper

Categories: Bloxel, JMonkey Tags: , ,

Good to know this Hibernate Envers API changes

Thursday, 19. January 2012 1 comment

Today I tried to update the hibernate version for an internal customer project from 3.6.0.Final to 3.6.9.Final. In the project we are using Envers to track entity revisions. I already posted about that here.

I noticed that some tests broken with the new version. These tests doing something like this: “create a bean, do changes X times, check available revisions and changed properties from rev A to B”.  In the new version I missed some changed properties.  I’m so happy that we have some tests for that aspect because without them I guess I had found these effects.

I found  this entries in the Envers user forum:

Envers not auditing properties in super class
Envers modification in Hibernate 3.6.8 is causing problems

Then I use the “try and fail” principle to find the latest working version: ONLY 3.6.0.Final works :D

So there was an API change from 3.6.0.Final to 3.6.1.Final. Since 3.6.1.Final Envers doesn’t inspect parent class (es) per default to find out the audit able properties. But it’s easy to fix that:

- put a @Audited to all the base classes
- or use org.hibernate.envers.Audited.auditParents() (if you can’t change the base class)

:)

Use maven profile to recompile vaadin widgetset

Thursday, 15. December 2011 1 comment

Today I will show you my maven profile to configure Vaadin widgetset recompilation.

The Vaadin wiki shows the basics … but I want widgetset update only if its necessary … so I moved the gwt/vaadin plugins in a profile and add a activation per file for this profile:

<profile>
   <!--
     Updates Vaadin widgetset definitions based on project dependencies
     Remove widgetset directory to trigger recompile:
       rm -Rf src/main/webapp/VAADIN/widgetsets/
   -->
   <id>update-widgetset</id>
   <activation>
     <file>
       ${basedir}/src/main/webapp/VAADIN/widgetsets/
     </file>
   </activation>
   <build>
     <plugins>
       <plugin>
         <groupId>com.vaadin</groupId>
         <artifactId>vaadin-maven-plugin</artifactId>
         <version>1.0.2</version>
         <configuration>
           <!-- if you don't specify any modules, the plugin will find them -->
         </configuration>
         <executions>
           <execution>
             <phase>generate-resources</phase>
             <goals>
               <goal>update-widgetset</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>gwt-maven-plugin</artifactId>
         <version>2.3.0-1</version>
         <configuration>
           <!-- if you don't specify any modules, the plugin will find them -->
           ${basedir}/src/main/webapp/VAADIN/widgetsets/
           -Xmx512M -Xss1024k
           ${project.build.directory}/gwt-tmp/
           <soyc>false</soyc>
           <force>true</force>
         </configuration>
         <executions>
           <execution>
             <phase>generate-resources</phase>
             <goals>
               <goal>resources</goal>
               <goal>compile</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>
 </profile>

:)

Categories: Maven, Vaadin Tags: ,

Hierarchical Iterator

Thursday, 17. November 2011 2 comments

import static com.google.common.collect.ImmutableList.of;

import java.util.Iterator;
import java.util.LinkedList;

import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Lists;

/**
 * This Iterator could be used for hierarchical data structure (e.g. Trees).
 *
 * @author Andreas Höhmann
 * @param <T>
 */
public abstract class AbstractHierarchialIterator<T> extends AbstractIterator<T> {

   private final LinkedList<Iterable<T>> stack = Lists.newLinkedList();
   private Iterator<T> current;

   public AbstractHierarchialIterator(final T start) {
      this(of(start));
   }

   private AbstractHierarchialIterator(final Iterable<T> start) {
      current = start.iterator();
   }

   /**
    * An concrete hierarchical iterator has to implement a method to 
    * visit the children of an element.
    *
    * @param currentElement
    * @return never <code>null</code>
    */
   protected abstract Iterable<T> childrenOf(T currentElement);

   @Override
   protected T computeNext() {
      while (true) {
         if (current.hasNext()) {
            final T next = current.next();
            stack.add(childrenOf(next));
            return next;
         }
         if (stack.isEmpty()) {
            break;
         }
         current = stack.removeFirst().iterator();
      }
      return endOfData();
   }
}

Examples

AbstractHierarchialIterator<Foobar> i = 
    new AbstractHierarchialIterator<Foobar>(foobarStart) {

    @Override
    protected Iterable<Foobar> childrenOf(final Foobar currentElement) {
        // <--- here you have to implement something
        return currentElement.getFoobarChildren(); 
    }
};

// example 1 - show all foobars
while (i.hasNext()) {
    System.out.println(i.next());
}

// example 2 - search the first "foo"
Foobar foo = com.google.common.collect.Iterators.find(i, new Predicate<Foobar>() {

      @Override
      public boolean apply(final Foobar input) {
        return "foo".equals(input.getName());
      }
    }, null);

:)

RIP Steve Jobs

Friday, 7. October 2011 Leave a comment

Steve Jobs 1955 – 2011

Categories: Uncategorized

Gregor Gysi macht die Merkel zur Schnecke

Sunday, 18. September 2011 Leave a comment

 

Categories: Uncategorized

Yet another gource svn video example

Friday, 19. August 2011 2 comments

# makesvnvideo.sh
svn log $1 --xml --verbose --quiet > svn-log.xml && \
python $GOURCE_HOME/svn-gource.py --filter-dirs svn-log.xml > svn-gource-log.xml && \
$GOURCE_HOME/gource.exe --log-format custom svn-gource-log.xml -c 2 -s 0.1 --max-files 500 --hide dirnames,filenames,files,mouse,progress --stop-at-end -i 60 --multi-sampling --user-image-dir ~/.avatars --camera-mode overview --font-size 18 --font-colour FFFFFF  --background 000000 --date-format "%d.%m.%Y" -r 25 -640x480 --highlight-users --user-friction .2 -o svn.ppm && \
$FFMPEG_HOME/bin/ffmpeg.exe -y -b 10000K -r 25 -f image2pipe -vcodec ppm -i svn.ppm -vcodec libx264 -threads 4 -bf 0 svn.x264.mp4

  1. download/install gource, put a $GOURCE_HOME in your .bashrc
  2. download/install svn-gource.py into $GOURCE_HOME
  3. download/install ffmepg, put a $FFMPEG in your .bashrc
  4. put avatar images in your ~/.avatar directory
  5. put makesvnvideo.sh in your PATH

makesvnvideo https://bloxel.googlecode.com/svn/trunk/

Follow

Get every new post delivered to your Inbox.