Tuesday, December 3, 2013

Yeoman-scaffolded applications and i18next

i18next is a great lib to handle internationalization in javascript. When i first attempted to use it with Yeoman, I had to slightly change the Gruntfile.js to tell it to package the translations in the dist repository.

You first add the dependency to your project :

bower install i18next --save

Then, if you store your translations in the default path (/locales/en/translations.json and so on) then add the following to the Gruntfile.j copy:dist definition :

copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'images/{,*/}*.{gif,webp}',
            'fonts/*',
            'locales/**/*'
          ]
        }

Yeoman and images handling issues (on Windows 7 64b at least)

I'm trying out Yeoman these days, along with AngularJS, Bootstrap and the Yeoman Maven plugin to integrate everything in a tool I already know :-)

The bootstrapping phase works great, even on Windows assuming that you already have a batch like cygwin installed. However I started facing some issues as soon as I added some images in the project.

After adding some images, I got the following error during grunt build :

   Warning:
    g:\dev\proj\intranet-homepage\yo\node_modules\grunt-contrib-compass\node_modules\tmp\lib\tmp.js:261
      throw err;
            ^
    Error: spawn ENOENT
        at errnoException (child_process.js:980:11)
        at Process.ChildProcess._handle.onexit (child_process.js:771:34) Use --force to continue.


As it turns out, Grunt does not like jpg files. That is, the imagemin module does not. So, converting those jpg files to png did the trick.

Thursday, April 4, 2013

Objectify and strange errors with GWT serializations

OK, so it turns out Objectify returns non-serializable lists when using the list() method. Using the following method :



ofy.load().type(Plant.class).list();


And directly returning the value to GWT client side throws a cryptic serialization exception, where the class that raises the problem is called Proxy$XX where XX are digits.

That problem is going to be fixed in GWT next version, but meanwhile we have to use the workaround provided in the bug report.

Sunday, March 24, 2013

App Engine Channel API and Angular JS

I've been using Google App Engine for a while now, and it is hard to go back to traditional java webapp development given how easy it is to deploy a demo version for a customer, and how great some of the tools provided in the App Engine SDK are.

Among those tools is the Channel API. It offers push messaging with only a few lines of code. There are some drawbacks (mainly regarding the reliability of the communications) but it still is a great tool to provide real-time notifications to the user.

A also recently discovered Angular JS. A great Javascript MVP framework (also by Google, it turns out). If you don't know it already, have a look at their web site. The web-binding part is quite amazing.

Now, I read Angular JS provides some support for Comet notifications, but nothing for the Channel API. On a project I'm developping on my spare time there's this need to send chat messages to various users.