Thursday, November 12, 2015

There is a study with 55 slides by Oracle showing the performance difference between lambda and anonymous inner classes.

The most important is this slide showing that lambda is slow during warm up and as fast as anonymous classes after JIT optimizes the performance.

It does NOT mean we should avoid using lambdas. Because they have quite few proposals and ideas for performance improvements (if you want to know what, see the study) and mainly because lambas are different to anonymous inner classes. So, it just means we need to wait after JVM gets optimized. And who knows, maybe lambdas are going to be faster than anonymous inner classes.

Wednesday, October 21, 2015

When you try to publish your JavaFX application into Mac App store with Java 1.8.0_60, you are going to get the following rejection.

The issue is that Your.app/Contents/PlugIns/Java.runtime/Contents/Home/jre/lib/libjfxwebkit.dylib libray is importing this library libicucore.A.dylib. And this issue is caused (probably) by this issue: Update to Newer Version of WebKit.

You can verify the issue by running otool for Java 1.8.0_51, 1.8.0_60 and 1.8.0_65. You will find that Java is importing that library since minor version 60.

The javapackager fix for JDK 8u72 does exactly this when generating .pkg files. So in short, libjfxwebkit.dylib is unchanged for 8u72, but will be excluded when generating an app for the Apple app store.

So, the solution is to remove libjfxwebkit.dylib from your .app (in case you package the

Thursday, January 23, 2014

The code below shows how to run your custom tests in functional test environment (so the application is running). For the integration tests you will need to use IntegrationTestPhaseConfigurer instead of FunctionalTestPhaseConfigurer.

Friday, January 10, 2014

We are curious who is using the plugin for integration of Vaadin into a Grails application. We could get little info based on 'likes' displayed on grails.org/plugins/vaadin, but that is not reliable.

Then we have made vaadinongrails.com page, to provide basic info about the plugin and give a few link to continue with. This page gives us better overview who is interested in the plugin. Drahomir Mach did the editorial work, many thanks for that.

The number of visitors has increased in 2013 probably due to 'Grails integration' chapter that we have included in Vaadin 7 Cookbook.

Thursday, August 15, 2013

The main motivation is to have a custom logger setup, which every developer can easily adjust. Also, we don't want to put logback config, which is meant for developers only, on the class path.

We can place logback.xml into the root folder of our project and then pass it when running up the application

grails -Dlogback.configurationFile=logback.xml run-app

The biggest disadvantage is: it is annoying to always include additional properties in the command line and it also means you need to tell that to the new developers. Also, it is not following Grails principle "convention over configuration".

We need to provide the default configuration for the development mode if logback.configurationFile property is not set.

Sunday, July 21, 2013

When an user has already an account in the Meteor application, we don't want to create another user in MongoDB when he tries to login with other OAuth service. Rather we connect the accounts and add a new login service to the existing user's services collection.

This code doesn't work for Twitter, because Twitter does not return email in the user data. Therefore, there is no way how to to connect Twitter account by email. I propose to exclude Twitter from your application until it is solved by Meteor (requestPermissions).

Also Github can have an account without email. So when user tries to login with GitHub without email, a new account is created.

Just create a new file oauth.js in server folder and copy paste the code below.

I have promised to publish a tutorial showing how to compile the widget set inside Grails project with Vaadin 7. Here you are.

Create a new widget set definition file AppWidgetSet.gwt.xml in the grails-app/vaadin directory.

Open VaadinConfig.groovy that is inside the grails-app/conf folder and add there a note about the new widgetset file.widgetset = "app.AppWidgetSet"

Create a folder libs-widgetset (for example inside the project root folder) for libraries that are needed during the widget set compilation. Download all-in-one archive of Vaadin 7 from https://vaadin.com/download and move all the .jar files from the archive into libs-widgetset folder. Do not forgot to move also .jar files from lib folder from the archive.

Create build.xml file with the following content.

Open the console inside the project root and run the ant command. The widget set compilation will start. Before you run the ant command, remove all the content of vaadin-grails-addon/web-app/VAADIN folder.

This is a short version of tutorial "Adding Vaadin Add-on into Grails project" taken from the Vaadin 7 Cookbook.

Open the root folder of you Meteor project in console (you need a Git repository in order to deploy applications to Heroku, just set up one or use the one provided by Heroku, it becomes accesible after you create new application)

Setup other than default MongoDB for your Meteor application (you can get all the details for constructing the MONGO_URL from yours Mongolab account): $ heroku config:set MONGO_URL=mongodb://<username>:<password>@ds027308.mongolab.com:27308/<dbname>

Or this, in case you have got a domainheroku config:add ROOT_URL=http://yourdomain.com

Add the Heroku Git repository as another remote to your git repository and push the code to that remote. The application will be automatically deployed and becomes accesible on <appname>.herokuapp.com $ git remote add heroku git@heroku.com:<appname>.git$ git push heroku master

When you make changes to your code, just run git push heroku master again and all the commit from your origin/master will be released.

Tuesday, May 21, 2013

Trying to get Google Analytics working with Meteor framework is so much fun. It took me quite some after I got this wonderful view:

How to get there: that is the question which is answered in the following gist.

Create new template, so we can hook to Template.googleAnalytics.rendered function. So, when googleAnalytics template is rendered, we can call Google Analytics service.
Insert the template into the HTML page that should be reported to Google Analytics.
Implement the call to Google Analytics service as follows (just replace 'UA-111111-1' with your token).
Thanks to these twosources.

Thursday, May 9, 2013

We started writing the book since Vaadin 7 alfa versions - which was hard because we needed to made a lot of changes before releasing the book. But, it gave us a lot of knowledge about Vaadin 7 and we could put it into that book. And that makes the book amazing for those who are starting with Vaadin 7.

One of the first feedback, was "If I would be a beginner with Vaadin, this is the kind of book I’d like to study - a lot of examples that do a single thing, and everything regarding to that one thing is well explained. ... that’s how I learn new things, not by reading theoretical ramblings regarding things and stuff." - vaadin blog

Luckily, I could participate a project where we used Vaadin 7 with Grails, which was amazing experience. Many notes are included in the book.

Jaroslav Holan accepted my offer to be co-author, thanks to him the book is more rich for recipes that I would hardly include. Thank you for that, Jaroslav.

Thursday, December 27, 2012

There are few options how to make lazy loaded table. When I say lazy loaded table then I mean a table that fetches data lazily from database.

Use standard Vaadin table with scroll bar.

Client (running in browser) loads items lazily from server (and that is awesome). But there is unfortunately no "lazy container" in Vaadin core and therefore we need to use an add-on. We can use JPAContainer for $299 USD "only". Or LazyQueryContainer for free. I tried LazyQueryContainer and worked well but I noticed that design of that add-on is a bit heavy. Therefore I have decided to build a new LazyContainer.

Vaadin scrollable table needs to call COUNT of the selected items from a database table when rendering table and also when scrolling. There are also not efficient calls of getItemIds method from container in standard Vaadin table. It is easy to explain. When we scroll in the table then client requests data from the server. Server calls the container method getItemIds(startIndex, numberOfIds) where startIndex and numberOfIds have usually this kind of values.

Then we make SQL or some other kind of query to database that looks like this select * from orders limit 0 offset 15;
It is nice that the data is lazy loaded and therefore we don't fetch N thousands of items from database but it is wasting resources on the server. I tried to play with cache rates but I couldn't tune it to this kind of result.

We need to use PagedTable add on in order to get that kind of strict fetching data from database. But there are few problems with PagedTable. First it doesn't have good architecture and it not easy to use when we need to do localization or customization of navigation items plus there are some defects. I have fixed some of the defects, converted it to Maven project and made customization of the navigation components easier. It is accesible from forked PagedTable.

When we use PagedTable together with LazyContainer then we get quite efficient lazy loaded table. How the code of that kind of table could look like?