Thursday, December 26, 2013

Problem while deploying ROOT.war on Openshift Tomcat application

I had a problem when I deployed  my war on Tomcat in OpenShift cloud.
It always takes OpenShift's ROOT.war and not the ROOT.war I had copy in the webapps directory.
It's because when you make git push, it runs a mvn command or in my case, I don't want to build my project but only deploy a single war file.
To solve this problem :

- Delete src/ directory
- Delete pom.xml


Thursday, December 19, 2013

Bootstrap add active class to li

In the following example, we use a classic Bootstrap menu.Note that, none li had a class active.We will use after.
    <div class="navbar navbar-default span12" role="navigation">
            <...>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a href="/fjLearning/"><g:message code="menu.home" /></a></li>
                    <li><a href="/fjLearning/page/training"><g:message code="menu.training" /></a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><g:message code="menu.about" /> <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="/fjLearning/page/about"><g:message code="menu.about.perso" /></a></li>
                            <li class="divider"></li>
                            <li class="dropdown-header"><g:message code="menu.about.site" /></li>
                            <li><a href="/fjLearning/page/under"><g:message code="menu.underTheHood" /></a></li>
                            <li><a href="#">FAQ</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
    </div>

To make it works you have in each page to add :
<body>
<script>
    $(document).ready(function() {
        $('a[href="' + this.location.pathname + '"]').parent().addClass('active');
    });
</script>
...

Now, when I clicked on the menu, the link active changes automatically. If you want to see an example, go on my GittHub project : https://github.com/drieu/fjLearning

Here is the usefull files :
https://github.com/drieu/fjLearning/blob/master/grails-app/views/layouts/_menu.gsp
https://github.com/drieu/fjLearning/blob/master/grails-app/views/page/training.gsp

Sunday, December 15, 2013

Bootstrap : span doesn't work

I tried this simple Bootstrap row without success :

<div class="row" style="border: 1px solid green">
        <div class="span2" style="border: 1px solid red">Foo!</div>
        <div class="span2" style="border: 1px solid red">Bar!</div>
        <div class="span2" style="border: 1px solid red">Baz!</div>
        <div class="span2" style="border: 1px solid red">Foo!</div>
        <div class="span2" style="border: 1px solid red">Bar!</div>
        <div class="span2" style="border: 1px solid red">Baz!</div>
</div>

In fact, it's simple.I used Bootstrap 3.x and not Bootstrap 2.x which contains some change in class names.
For example, span-* became col-md-*.

So the solution, for this example above :

<div class="row" style="border: 1px solid green">
        <div class="col-md-2" style="border: 1px solid red">Foo!</div>
        <div class="col-md-2" style="border: 1px solid red">Bar!</div>
        <div class="col-md-2" style="border: 1px solid red">Baz!</div>
        <div class="col-md-2" style="border: 1px solid red">Foo!</div>
        <div class="col-md-2" style="border: 1px solid red">Bar!</div>
        <div class="col-md-2" style="border: 1px solid red">Baz!</div>
</div>

See following link for details :
http://getbootstrap.com/getting-started/#migration
http://stackoverflow.com/questions/18527466/twitter-bootstrap-span-columns-not-displaying-correctly/18527554#18527554

Thursday, December 12, 2013

Add social buttons with Grails

Here is a simple way to add social button without time'sloading problems.

Example :


            <a target="_blank" title="Twitter" href="https://twitter.com/share?url=<g:createLink action="${params.action}" absolute="true"/>&text=<g:message code="training.title" /> sur <g:createLink action="${params.action}" absolute="true"/>" class="tweet-button" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"><img src="/fjLearning/images/twitter_icon.png" width="32" height="32"/></a>


In this example, we used <g:createLink action="${params.action}" absolute="true"/> to generate full url of your gsp web page.
params.action variable contains current action.

If you want other example (Facebook, Google + ...), you can see that link : http://korben.info/bouton-partage-twitter-facebook-sans-tracking.html

Wednesday, December 11, 2013

Road to Grails 3.0

An interesting video on InfoQ about Grails 2.3 and future Grails 3.0 feature :
Road to Grails 3.0

Friday, December 6, 2013

Grails : full URL of a gsp.

If you need the full URL of a gsp, you can use tag createLink :
<g:createLink action="${params.action}" absolute="true"/>
It will generate something like taht : http://localhost:8080/fjLearning/training

The params.action variable give us the current action.In our case it's training.

More details about tag createLink on http://grails.org/doc/latest/ref/Tags/createLink.html

Friday, November 29, 2013

Deploy your grails application freely on the web with OpenShift



If you want to make a web site and deploy it on the cloud, a possible solution is to make a Grails application and then to deploy on Tomcat.
After that, you can deploy it for free on Openshift :
 
https://www.openshift.com/blogs/day-6-rapid-web-development-on-the-jvm-with-grails

Wednesday, November 27, 2013

Error No default container found with grails


I've found solution about this problem on StackOverFlow : http://bit.ly/1a5otJX

Grails internationalization testing

I had some problem with internationalization with Grails.
I tried to change the language by adding ?lang=us at the end of my request but without success.
I found a simple solution : just switch the language settings of your browser by adding first the language you want. It will change "Accept language" in the HTTP request.

For example, in Firefox, you have to go in Tools -> Option -> Content -> language then choose the preferred language.
After that, you only have to reload your web page.

Wednesday, November 20, 2013

Coding Dojo

Here is an other web site to learn coding online : http://bit.ly/1dpne8b
Lot of languages are available !

Monday, November 18, 2013

JMC in Java 7u40

A new tools is available in bin directory of your Java distribution ( 7u40) to manage, monitor, profile and eliminate memory leaks. More info here :

http://blog.eisele.net/2013/09/java-mission-control-52-is-finally-here.html

Wednesday, November 13, 2013

codeacademy : a good way to learn html,css,php,javascript or jquery



You search a good way for learning some techno like html,css,php,javascript or jquery, you should look at : Codeacademy



http://www.codecademy.com/assets/codecademy_logo_smallest-0323fdd409fc100a1991db8aa706f57e.png


This web site helps you to learn easily by making courses and exercises online.
Courses are divided in severeal small courses and small exercises.
For example, the lesson explains how to set id on html element and you have to modify the html.

Example :

Sunday, November 10, 2013

Google+

New google+ page about my blog http://totalprogus.blogspot.fr/

Saturday, November 9, 2013

Grails : turn on GZip compression



If you want to improve your web site performance, you should enable GZip compression.


What is GZip compression ?


It's simple : you zip date before sending it over the net :
  1. Server compress data (HTML code, CSS, JavaScript...)
  2. Data go through the net
  3. the navigator uncompress data when it arrives before showing them

It's describe in HTTP/1.1

Is performance really better ?

You can check it here : http://stevesouders.com/hpws/rule-gzip.php



Grails et GZip

To enable GZip compression, it's simple.You have to install plugin ui-performance :

grails install-plugin ui-performance

Then restart Grails.

Comments :
  • If you want to be sure that GZip compression is enabled, you can go in "Audits" tabs on Chrome developpement tools.
  • ui-performance plugin do also severeal things like rules of Steve Souders and Yahoo performance team : http://stevesouders.com/hpws/rules.php  

Greyhound, the 2nd fastest land animal

Wednesday, November 6, 2013

Win a free pass for Devoxx France 2014

Developpez.com permits to win a pass for Devoxx France 2014 with a quizz :
Go one http://java.developpez.com/evenements/devoxx2014/quizz/


Wednesday, September 25, 2013

Sunday, July 7, 2013

Grails generate-all No domain class found for name

Problem :

I'm try to use "generate-all" command and I had this error message each time I use it : "No domain class found for name User".
I typed this command :

grails generate-all User


I use Grails 2.1.5 so perhaps it works better in last version ;-)

Error :
| No domain class found for name User. Please try again and enter a valid domain
 class name
| Error 2013-06-30 13:51:40,907 [Thread-10] ERROR plugins.DefaultGrailsPlugin  -
 Error configuration scaffolding: Error creating bean with name 'instanceControl
lersApi': Singleton bean creation not allowed while the singletons of this facto
ry are in destruction (Do not request a bean from a BeanFactory in a destroy met
hod implementation!)
Message: Error creating bean with name 'instanceControllersApi': Singleton bean
creation not allowed while the singletons of this factory are in destruction (Do
 not request a bean from a BeanFactory in a destroy method implementation!)
   Line | Method
->> 722 | run in java.lang.Thread


Solution

grails generate-all racetrack.User
In fact, my domain class was in a directory named racetrack.
I have the following tree directory : $GRAILS_APPdomain/racetrack/User.java


Saturday, July 6, 2013

Grails automatic timestamp

In your domain class, you can add a field which has automatic timestamp (When creating or when updating).
The date field must have the name dateCreated or lastUpdated.
It's a convention define by Grails.

Example :

class Person {
   Date dateCreated
   Date lastUpdated
}
 
 
If you want to disable this feature, you can make the following :
 
class Person {
   Date dateCreated
   Date lastUpdated
   static mapping = {
      autoTimestamp false
   }
} 

See also :

Learn Grails with a book


I'm learning Grails.
I choose "Grails getting started" because it's easy to understand and not annoying :-)
I appreciate this book that's why I post this link : http://www.infoq.com/minibooks/grails-getting-started

Tuesday, July 2, 2013

Grails : Do you know CRaSH plugin ?

Grails



You have the possibility to embeded CRaSH in Grails by installing the CRaSH plugin.
It's very easy :

cd $PATH_TO_MY_GRAILS_APPLICATION
grails install-plugin crash


Now, you can connect to your Grails application by using CRaSH.
Two steps for that :
  • Find the Java Process PID of your Grails application with :
cd $JAVA_HOME/bin
jps
  • Launch CRaSH
Then you will be able to access to CRaSH command by typing :

cd $CRASH_HOME/bin
crash.sh PID

Now, you have access to all CRaSH command jdbc,jpa, thread ... and you can make your own !

CRaSH web site : http://www.crashub.org/
Grails CRaSH plugin : https://github.com/crashub/grails
Grails : http://grails.org/



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/

Thursday, May 9, 2013

Maven and Java 7 : Fatal error compiling: invalid target release: 1.7


 Problem

On a Maven Project I change Java version (1.6 to 1.7) in my pom.xml file and I have the following error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project MetricViewer: Fatal error compiling: invalid target release: 1.7 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException



Solution

You have probably Java 1.6 in your classpath.
Do the following to check it :

mvn clean install --debug

  1 Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
  2 Maven home: /usr/share/maven
  3 Java version: 1.6.0_35, vendor: Apple Inc.
  4 Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home





I found this solution at http://stackoverflow.com/questions/14043042/compiling-java-7-code-via-maven

Saturday, April 27, 2013

CRaSH 1.2.2 release

New version of CRaSH is available.

This version make minor improvement. More informations on https://groups.google.com/forum/?fromgroups=#!topic/crash-users/p06x34J_Uy8

You should see also  http://www.crashub.org/

Saturday, March 30, 2013

Friday, March 22, 2013

CRaSH : a good way to test it !


If you don't know CRaSH, it's time to test it !
You can test it online and discover all the potential of this wonderful tool !

http://try.crashub.org

Send a POST request on Google App Engine

To send a request, you need to use Url Fetch service.The URL Fetch service uses Google's network infrastructure for efficiency and scaling purposes.Here is the code to send a simple POST request on Google App Engine :

   public void send(String messageToSend, String date, String level, String servers) {

        try {
            String message = URLEncoder.encode(messageToSend, ENCODING);
            Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl, Integer.parseInt(proxyPort)));

            URL url = new URL(urlDest);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
            connection.setDoOutput(true);
            connection.setRequestMethod("POST");

            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write("date=" + date);
            writer.write("&level=" + level);
            writer.write("&servers=" + servers);
            writer.write("&msg=" + message);
            writer.close();

            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                logger.info("OK ! message returned:" + connection.getResponseCode());
            } else {
                logger.info("KO ! message returned:" + connection.getResponseCode());
            }
        } catch (MalformedURLException e) {
            logger.error(e.getMessage());
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
    }

I've made a small java project ( 2 class ;-) )that send a simple POST request : See https://github.com/drieu/Tools
More details on https://developers.google.com/appengine/docs/java/urlfetch/overview

Wednesday, March 20, 2013

Feedback about the creation of an application on Google App Engine


Goal : Create a small alert's application on Google App Engine and evaluate the easiest method.
Here is my small feedback :

Test 1 : Create a small project with GWT


Drawback


1) Installation
- Netbeans : Not working for me.Installation problem with plugin ...
- Intellij : I didn't find any plugin
- Eclipse : OK and it's easy

2) Create his own application

I want to made a small application but in my mind, GWt is too complex and not quick
Here is an example : see https://github.com/drieu/gwtalert).


Advantage


Quick deploy on Google App Engine facile.


- Test 2 : Create a project with Play 1.2.5 and GAE plugin.


Advantage 



Easy to develop because of framework Play.

Drawback

- I've some difficulties with my proxy
Here is the Play application with solution  https://github.com/drieu/PlayWithGoogleAppEngine

- Play 1.2.5 isn't maintain.See if Yalp will work ...

Monday, March 18, 2013

Play Job monitoring



SiIf you want to monitor Play jobs (1.2.5) easily , you can use CRaSH and with command line, you type the following :
% dashboard | thread ls -n "jobs-thread*"
More information on http://www.crashub.org/

Thursday, March 14, 2013

First step with the cloud OpenShift of RedHat

My goal : Deploy an Play 1.2.5 on OpenShift.

For this purpose, I follow that link : planet_jboss


Steps summary:


- Create my application :

I create my application directly on the web site.It was quick and simple.
Moreover, all usefull command to connect with ssh and clone are available.You just have to make copy and paste.

- Gentoo install :


emerge dev-ruby/rubygems
ruby -e 'puts "Welcome to Ruby"
gem install rhc


- Initialisation (as a user)

rhc setup

- Clone of our application's repository


git clone ssh://XXX/~/git/monapp.git/

Then, I follow steps ICI

- Export of the war dans monapp/deployements :


play war -o /home/toto/monapp/deployments/cookies.war
git add deployments/cookies.war*
git push

- Check of the deployement

- Connexion with ssh on the RedHat cloud
- tail -f jbossas-7/logs/server.log


Comment:

- I try the cloud at my job but I didn't succeed because of proxy and firewall.I also tried to use ssh over
90 but without success.
- At home, no problem : it was easy end fast.

Saturday, March 9, 2013

JavaFx project on GitHub


To learn JavaFx, I've began a small project on GitHub.
I use JavaFx 2 and Maven.Perhaps, It could help you to begin  in your project.

See https://github.com/drieu/MetricViewer for more information.

Thursday, February 7, 2013

sbt.ResolveException: download failed: org.slf4j#slf4j-api;1.6.6

Problem


 When I ran play run , I have the following error :

[error] (*:update) sbt.ResolveException: download failed: org.slf4j#slf4j-api;1.6.6!slf4j-api.jar
[warn] some of the dependencies were not recompiled properly, so classloader is not avaialable


Solution

vi ./project/plugins.sbt

You only have to edit this file and add the last version of play (2.1.0) :

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

Then you can launch play run again

Saturday, January 26, 2013

KnowledgeBlackBelt will definitely shut down.

Bad news ! KnowledgeBlackBelt will definitely shut down on Jan 31st 2013.
Content is available for free ...

play 2.1 : Create yout first projetc with IntelliJ Tips


Create a project with Play is easy :

$ play new my-app 
$ cd my-app 
$ play idea


However, I had some diificulties with how to import in IntelliJ.In the documentation, it says that you have to import a module.But it doesn't work for me.
To succes, I've just done the following :

File --> Open

And now it works every times :-)



Sunday, January 6, 2013

java 8 : Functional Interfaces


In this article, we will try to learn new Java 8 concept : functional interface. It's an entry point for using lambdas and other JAVA 8 features ...

Definition from JSR 335

A functional interface is an interface that has just one abstract method, and thus represents a single function contract. (In some cases, this "single" method may take the form of multiple abstract methods with override-equivalent signatures (8.4.2) inherited from superinterfaces; in this case, the inherited methods logically represent a single method.)
In addition to the usual process of creating an interface instance by declaring and instantiating a class, instances of functional interfaces can be created with lambda expressions, method references, or constructor references.
The function descriptor of a functional interface I is a method type—type parameters, formal parameter types, return types, and thrown types—that can be used to legally override the abstract method(s) of I.

 In short, a functional interface is only one interface with just one abstract method. The goal of Functional Interface is to use JAVA 8 feature like lambdas.

Simple example


Here is a short example :

ICode.java

 package fr.dr.practice;

/**
 * Interface with just one abstract method.
 */
public interface ICode {
    String generate(int codeNumber);
}
Main.java

package fr.dr.practice;

/**
 * Created with IntelliJ IDEA.
 */
public class Main {

    public static String generateTmpCode(int newCode) {
        ICode code = new ICode() {
            @Override
            public String generate(int codeNumber) {
                return "MAIN_" + codeNumber + Math.random();
            }
        };
        return code.generate(newCode);
    }

    public static String generateTmpCodeWithLambda(int newCode) {
        ICode icode = codeNumber -> "MAIN_" + codeNumber + Math.random();
        return icode.generate(newCode);
    }

    public static void main(String[] args) {
        System.out.println(Main.generateTmpCode(12));
        System.out.println(Main.generateTmpCodeWithLambda(12));

    }
}

More complex examples

The JSR says the following :

In some cases, this "single" method may take the form of multiple abstract methods with override-equivalent signatures (8.4.2) inherited from superinterfaces; in this case, the inherited methods logically represent a single method.

So, you can make the following because equals method is public in Object class :

public interface ICode {

    String generate(int codeNumber);
    boolean equals(Object obj);
}

But you can't make this because clone method (protected Object clone() throws CloneNotSupportedException {) isn't public in Object class :

public interface ICode {

    String generate(int codeNumber);
    Object clone();
   
}

Function descriptor 

The JSR 335 add also a the concept of Functional descriptor.
Here is an example from JSR :

interface X { void m() throws IOException; }
interface Y { void m() throws EOFException; }
interface Z { void m() throws ClassNotFoundException; }
interface XY extends X, Y {}
interface XYZ extends X, Y, Z {}

// XY has descriptor ()->void throws EOFException
// XYZ has descriptor ()->void (throws nothing)

Conclusion

Functional interface permits to use lambda or other JAVA 8 features.It exists yet some functional interface (e.g : java.util.Comparator ). Java 8 has also a new package : java.util.functions which defines new Functional Interface.You could see this good blog for example with it : http://datumedge.blogspot.fr/2012/06/java-8-lambdas.html.
This article permits me to learn JAVA 8 feature.If you have comments or if you see errors, please post it ! In next article, we will study lambda feature ...