Thursday 15 April 2010

dns cache

I installed dnsmasq a long time ago, but it turns out I never told my dhcp to use it.
All done now thanks to the following post:
http://www.ubuntugeek.com/local-dns-cache-for-faster-browsing-on-ubuntu-machine.html

My steps (for in case I need to do it again :) :
sudo apt-get install dnsmasq

Now edit /etc/dhcp3/dhclient.conf
and uncomment the following line:
prepend domain-name-servers 127.0.0.1;

I didn't have a /etc/dnsmasq.conf , and it does not seem to be needed because my dns caching works fine now without it; I assume its got good defaults.

To test it quickly add nameserver 127.0.0.1 to the top of /etc/resolv.conf
(it normally gets overwritten by the network manager)
dig yahoo.com

You will see something like
;; Query time: 38 msec
there.
Now do it again, and you should see something like:
;; Query time: 2 msec

sweet!

Wednesday 7 April 2010

Vaadin addons and maven and eclipse.

Afters struggling for almost 3 days, I finally got some vaadin add-ons working for me.
No matter what I did, I could not get maven to compile the custom widget sets :'-(

Wanting to do it with maven I started off with the instructions at http://dev.vaadin.com/wiki/Articles/MavenIntegration.

I got error messages like:
Failed to load the widgetset: 
/my-project/VAADIN/widgetsets/my.company.my.project.widgetset.My_ProjectWidgetset/
my.company.my.project.widgetset.My_ProjectWidgetset.nocache.js?1270654337749

Building it with the eclipse plugin said:
Compiling widgetset my.company.my.project.widgetset.My_ProjectWidgetset
Updating GWT module description file...
07 Apr 2010 5:46:09 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Widgetsets found from classpath:
com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources

Done.
Starting GWT compiler
Widgetset compilation completed

But when running the webapp, I got:
Widgetset does not contain implementation for org.vaadin.browsercookies.BrowserCookies. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

org.vaadin.browsercookies.BrowserCookies(NO CLIENT IMPLEMENTATION FOUND) id=PID7

variables
Widgetset does not contain implementation for com.github.wolfie.meteorcursor.MeteorCursor. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

com.github.wolfie.meteorcursor.MeteorCursor(NO CLIENT IMPLEMENTATION FOUND) id=PID8 gr=75 th=10 pl=1000 di=2 im=theme://images/logo.png fr=0 disabled=false

I thought that it was building, since the addons that I wanted to use got detected.
Little did I know that it was not actually building!
Building with maven said:
[INFO] Updating widgetset my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] establishing classpath list (scope = compile)
[ERROR] 07 Apr 2010 5:38:31 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Widgetsets found from classpath:
[ERROR] com.github.wolfie.meteorcursor.MeteorcursorWidgetset in jar:file:/stf/opt/maven/repository/com/github/wolfie/meteorcursor/1.0.0/meteorcursor-1.0.0.jar!/
[ERROR] org.vaadin.browsercookies.widgetset.BrowserCookiesApplicationWidgetset in jar:file:/stf/opt/maven/repository/com/vaadin/sami/browsercookies/1.0.2/browsercookies-1.0.2.jar!/
[ERROR] com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
[ERROR] my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources
[ERROR]


The reason it was not building was because I was trying to use the stable version of the gwt-maven-plugin: 1.2
After reading this forum post again, I tried 1.3-SNAPSHOT of this plugin; and all my troubles went away.


So now I build it with maven, and it should give output like this:
[INFO] [gwt:compile {execution: default}]                                                                                                                    
[INFO] using GWT jars from project dependencies : 1.7.1
[INFO] auto discovered modules [za.co.enerweb.ebr.gui.vaadin.widgetset.Ebr_vaadin_webWidgetset]
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] Compiling module my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] Scanning for additional dependencies: jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java
[INFO] Computing all possible rebind results for 'com.vaadin.terminal.gwt.client.WidgetMap'
[INFO] Rebinding com.vaadin.terminal.gwt.client.WidgetMap
[INFO] Invoking
[INFO] Detecting Vaadin components in classpath to generate WidgetMapImpl.java ...
[INFO] Widget set will contain implementations for following components:
[INFO] com.github.wolfie.meteorcursor.MeteorCursor
[INFO] com.vaadin.ui.AbsoluteLayout
[INFO] com.vaadin.ui.Accordion
[INFO] com.vaadin.ui.Button
[INFO] com.vaadin.ui.CheckBox
[INFO] com.vaadin.ui.ComboBox
[INFO] com.vaadin.ui.CssLayout
[INFO] com.vaadin.ui.CustomComponent
[INFO] com.vaadin.ui.CustomLayout
[INFO] com.vaadin.ui.DateField
[INFO] com.vaadin.ui.Embedded
[INFO] com.vaadin.ui.Form
[INFO] com.vaadin.ui.FormLayout
[INFO] com.vaadin.ui.GridLayout
[INFO] com.vaadin.ui.HorizontalLayout
[INFO] com.vaadin.ui.Label
[INFO] com.vaadin.ui.Link
[INFO] com.vaadin.ui.ListSelect
[INFO] com.vaadin.ui.MenuBar
[INFO] com.vaadin.ui.NativeButton
[INFO] com.vaadin.ui.NativeSelect
[INFO] com.vaadin.ui.OptionGroup
[INFO] com.vaadin.ui.OrderedLayout
[INFO] com.vaadin.ui.Panel
[INFO] com.vaadin.ui.PopupView
[INFO] com.vaadin.ui.ProgressIndicator
[INFO] com.vaadin.ui.RichTextArea
[INFO] com.vaadin.ui.Select
[INFO] com.vaadin.ui.Slider
[INFO] com.vaadin.ui.SplitPanel
[INFO] com.vaadin.ui.TabSheet
[INFO] com.vaadin.ui.Table
[INFO] com.vaadin.ui.TextField
[INFO] com.vaadin.ui.Tree
[INFO] com.vaadin.ui.TwinColSelect
[INFO] com.vaadin.ui.Upload
[INFO] com.vaadin.ui.UriFragmentUtility
[INFO] com.vaadin.ui.VerticalLayout
[INFO] com.vaadin.ui.Window
[INFO] org.vaadin.browsercookies.BrowserCookies
[INFO] Done. (2seconds)
[INFO] Compiling 1 permutations
[INFO] Permutation compile succeeded
[INFO] Linking into /stf/prj/My_Project/src/main/webapp/VAADIN/widgetsets
[INFO] Link succeeded
[INFO] Compilation succeeded -- 40.785s


To be able to serve my webapp using tomcat launched from eclipse I need to compile the GWT stuff into src/main/webapp . So unlike the instructions I mention at the top of this post, some key parts of my pom is as follows:
  <properties>
<vaadin-widgets-dir>src/main/webapp/VAADIN/widgetsets</vaadin-widgets-dir>
</properties>
<build>
<plugins>
<!-- Compiles your custom GWT components with the GWT compiler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.3-SNAPSHOT</version>
<executions>
<execution>
<configuration>
<webappDirectory>${vaadin-widgets-dir}</webappDirectory>
<extraJvmArgs> -Dgwt.style=PRETTY -Xmx512M -Xss1024k</extraJvmArgs>
</configuration>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Updates Vaadin 6.2 widgetset definitions based on project dependencies -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<!-- also delete the generated vaadin web content -->
<directory>${vaadin-widgets-dir}</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>