Sunday, June 30, 2013

Why clojure is the next big thing ?

Clojure




There is plenty programming languages and it's difficult to choice between them.
Here is an interesting article about Clojure. I don't know if Clojure is the the language of the future but I think this article will help you to get a general idea about it  :

http://technotzen.wordpress.com/2013/06/06/why-clojure-is-the-next-big-thing/




Saturday, June 29, 2013

Where are stored Grails temporary files ?


Grails stores temporary files in .grails directory.

  • On Unix system : $HOME/.grails
  • On windows : c:\Users\myUser\.grails

 You can clean with : grails clean
Here is the official description of clean command :

The clean command deletes all compiled resources from the application. Since Groovy is a compiled language, as with Java, this is sometimes useful to clear old instances of classes and ensure correct compilation. It's also a good idea to run this script before running tests or creating a WAR file to ensure a full compilation occurs.


Friday, June 28, 2013

Koans : learn with unit test !

Recently, I spoke to you about Koans and Groovy. But, I didn't know that Koans exists also for other programming language like JavaScript and Groovy ...

This tips come from this excellent blog : http://technotzen.wordpress.com/2013/06/01/koan-are-the-best-way-to-learn-code/

Thursday, June 27, 2013

How to order field by using scaffold ?



Here is the official definition of Scaffolding :

Scaffolding lets you auto-generate a whole application for a given domain class including:
  • The necessary views
  • Controller actions for create/read/update/delete (CRUD) operations

So if you define for example this domain class :

class User {

String name
String tel
String addr

}
You are excpecting to have html fields in this order. But it's not necessary the case.It's seems that the default order is alphabetical.
If you want to define field order, you have to add the following to the domain class :

statics constraints = {
     name()
     addr()
     tel()
}
  With constraints, you will be able to add validation, constraints ...


Scala choice ?

Here is an interesting interview of Cary Horstmann on the web Oracle web site :
http://www.oracle.com/technetwork/articles/java/horstmann-1958988.html


Wednesday, June 26, 2013

Grails : why datas aren't persit ?

By default, under Grails, you are in developpement mode.
So each time, you run your application with grails run-app, you will loose your data.

For example, if you use scaffold, all data you save will be loose after restart :

class RegistrationController {

    def scaffold = true
}
First time, it's a little bit frustating ...
If you want to see datas each time you run, you have to change databases configuration.
There is an another way to see datas :
 grails prod run-app
 Then persit datas and if you start again, you will see you datas.

AsciiDoc vs Markdown


AscciDoc and Markdown allow you to write text with lightweight markup language for writing for example HTML pages. Theses two languages are popular (for example Markdown used by GitHub).
With it, by using a very easy syntax, you will be able to generate HTML page.
Here is an example for Markdown

What is the best choice ?


I can't answer to that now but if you want a comparison betweem them, there is an interesting Thread on GitHub : https://github.com/awestruct/web-editor/issues/12#issuecomment-19943154





Usefull Links :


Daring Fireball
MarkDown
http://daringfireball.net/projects/markdown/ 







AsciiDoc Text based document generation http://www.methods.co.nz/asciidoc/

Tuesday, June 25, 2013

Inialize a List in Groovy and Java


I follow the excellent tutorial of  http://groovykoans.org/ and I note that Groovy have a lot of good things that make codes more readable and thinner.

Here is a simple comparaison between Java and Grovvy to initialize a List :

In Java :

        List<String> javaList = new ArrayList<String>();
        javaList.add("King");
        javaList.add("Queen");
        javaList.add("Prince");

In Groovy :

        def groovyList = ['King', 'Prince']


More details on http://groovy.codehaus.org/JN1015-Collections

IT trend : Redhat EHL choose MariaDB instead of Mysql !

Here is a small interesting news that shows the actual trend...
Mysql is everywhere ! However, more and more, we hear that there is migration to MariaDB ( a Mysql fork !). The last migration is RedHat !

The first reason is because MaraiDB is really Open Source and not Oracle Open source :-). An other reason should be performance ...

If you want to compare Mysql and MariaDB : 
https://kb.askmonty.org/en/mariadb-versus-mysql-features/

The RedHat choice :
http://www.itwire.com/business-it-news/open-source/60292-red-hat-ditches-mysql-switches-to-mariadb

MySQLMariaDB

Saturday, June 22, 2013

How to change Grails server port ?

In your web application, edit conf/BuildConfig.groovy file and add the port number like the following :

grails.server.port.http = 8090

For example :
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
        grails.server.port.http = 8090
    }
    log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve
    legacyResolve true // whether to do a secondary resolve on plugin installation, not advised but here for backwards compatibility

This tips come from http://stackoverflow.com/questions/10955899/how-to-change-grails-localhost-port

Wednesday, June 19, 2013

Saturday, June 8, 2013

Grails instead of Play 1.X ?


Play 1.X becomes old. So, which web framework can I use ?
Play 2 with Scala or Grails. I deciced to learn Grails because it has similarity with Play 1.X.It seems to me Mature and I prefer Groovy syntax.

Here is a good link to learn Grails with Mysql database : http://learnedstuffs.wordpress.com/2012/02/21/using-mysql-as-database-in-grails/