le Wadablog

Aller au contenu | Aller au menu | Aller à la recherche

mardi 7 février 2012

JPA, EclipseLink and the DOH!

There is something you must know exists when you encounter problems of the "does not work as expected" kind.

This is
<property name="eclipselink.logging.level" value="FINEST"/>
that you must put in persistence.xml to get spammed in your console and check, for example, that all your entities are recognized.


Oh, and prefer 
@Entity
@Table(name="a_name")

to

@Entity(name="a_name")
if you want to master the table name used. 

Else this is your entity that is renamed and you'll get your queries wrong ;-)

jeudi 24 mars 2011

(FR) Application "Contrepeteries" pour Android

Entre autres choses, j'apprécie les traits d'esprit et les jeux de mots.
Il y a quelques années, je me suis intéressé aux contrepeteries et j'ai constaté que le web n'en manquait pas, mais qu'il y avait souvent les mêmes, dupliquées de sites en sites.
J'ai initié le site http://contrepeteries.free.fr pour qu'il soit collaboratif : que les visiteurs l'enrichissent et puissent récupérer les contrep's pour les utiliser sur d'autres supports.
Il y a eu des échanges fructueux avec le créateur d'une appli pour mac, des visiteurs qui ont beaucoup participé (Merci encore à Maud du fond du champ).
Mais le site vivote à 50 visites par jour.

Comme dirait le chien parlant que je n'ai pas : ça c'est de la niche !

A partir des données de mon site, j'ai créé une appli pour smartphones Android.

Elle s'enrichira au fil des versions. Aujourd'hui (v1.1), elle permet de

  • consulter +500 contrepeteries au hasard
  • partager la contrepeterie affichée (par mail, facebook, twitter, etc ...)
  • voir la liste des évolutions à venir (affichage des solutions est l'évolution la plus demandée)


Voici le lien vers le market web https://market.android.com/details?id=org.wadael.contrepeteries

Et le QR code correspondant

Amusez-vous bien et donnez-moi votre avis.
Merci

lundi 9 août 2010

Goodbye to Wave

As you may know, Google Wave will be stopped by the end of the year.
For sure, that's a bad surprise.
RIP Google Wave  20 May - 4 August 2010

For me, it means that the WRF ends too. Actually, it ends now.
Sure, there's plenty of time between now and december but I have already spent a lot of time on WRF.

The generator may find a second life, who knows ... it's only the templates that must be changed.

However, WRF was a very good experience for many things.
First is my collaboration with Romin  (@iRomin), who has become a friend. Mon ami, our daily (live) exchanges through Wave were lots of fun and knowledge sharing.

I gained pride as WRF was for a long moment (during the V1 days) the subject of three (from eleven) articles listed on the dedicated page on google's site.

Not bad for a project done little by little on my sleeping time (meaning I was often half asleep while coding)

Thanks to @fbaligand, I had the occasion to speak of WRF during the "JumpCamp 4 IT" event in Paris. My first public speaking since ... long ago.
I proposed to present WRF and a usage of it at the Devoxx 2010 conference. Well, no answer yet but I think I know it.
I really wanted a MAJOR speaking experience to push my limit. Too bad. Have to create something else.

During Google I/O, I have met people who followed me on twitter and knew my project, have met googlers IRL, spoke of WRF to some of them.
I even chatted with Vic G (fantastic speaker) !
 
Incredible San Francisco where three French guys named Jérôme can stand in the same square-meter (have a look at SnapABug.com). That never happened to me in France as Jérôme is a quite rare first name.

About Googlers, Wave's DevRel @pamelafox is a fantastic I.T woman. Talented, funny, clear minded and such a good speaker.

I am certainly forgetting other + points about the WRF episode.

Overall, the Wave experience was very good for me that's why I am so bitter that it's over.
So, goodbye Google Wave, rest in pieces, we'll meet again.
 

dimanche 29 novembre 2009

Feed your other self (twitter, GAEJ,CRON,Twitter4J )

Introduction and goal

As I know that will help at least one person, here is how I publish new spoonerisms on my other Twitter account @kontrepeteries on a regular and automated basis.

(A) Solution

The solution I chosed is to CRON a servlet deployed on GAE/J. This servlet uses Twitter4J, a very quick & simple API.

Servlet code

The code is shortened for brevity.

Actually, the servlet displays what is tweeted so that I could verify all went well at write+test time.

public class FetchLatestContrepServlet extends HttpServlet {

        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
        {
                ...             
                // get spoonerism (gets PHP-generated JSON from my Free.fr website and unmarshall it)
                Contrep c = VaVoirChezFree.getUneContrepAvecIdSuperieur(bi.getHighestContrepId()); // just the id of the latest fetched contrep as parameter. 
                
                // UPD twitter status
                Twitter tw = new Twitter("YOUR_LOGIN","YOUR_PASSWORD");
                try {
                        tw.updateStatus( c.getText() );
                } catch (TwitterException e) {
                        log("twitter update error " + e.getMessage() );
                }

                writer.append( c.getId() );
                writer.append( c.getText() );
                w.flush();
                w.close();
        }
}

Configuration

Do usual conf in war\WEB-INF\web.xml

Example for file war\WEB-INF\cron.xml.

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
        <cron>
                <url>YOUR APP-RELATIVE URL HERE (starts with /) </url>
                <description>tweete a spoonerism</description>
                <schedule>every 8 hours</schedule>
        </cron>
</cronentries>

There is a possibility to restrain usage to the "admin" role so that you get sure it's only executed by the CRON launcher. See official documentation. But if you want to run it by hand, don't.

Epilogue

No rocket science here. This is how to do a CRON in GAEJ, you may modify this code to read tweets on a regular basis and save them to wherever you want (cloud, Free, ....).

If you have an Android device and a wave account, you may also check A wave regularly to save new blips to another place (twitter, DB) so that you can use your own (lighter) client to read waves. I've been told GW is slow on Android,

IMO, for wave-to-whatever data-transfer, use a wave robot.

Stay tuned for the release of my wave robot framework.

Meanwhile, if you understand French wordplays, @kontrepeteries may entertain you.

Follow me @wadael , it's sometimes worth it.

See you

Jérôme

mercredi 18 novembre 2009

Google Wave, how many different robot types

Being a java guy for quite some time, I got interested in Google App Engine (later GAE) as soon as it supported Java.

I can be used to host web application as you know and, more recently, Google Wave (later GW) robots.

For instance, GW robots can only be hosted on GAE for the moment.

I wrote a robot, following the tutorial and found it very brain-teasing. You know, robots, A.I., .... stuff you have read/seen times and times. It is now put at hand's reach (well sort of) and it's no use knowing the Lisp language to write one.

My robot is rather simple, it's only action is to react to the content of a blip (roughly the same as a post), find the longest word (that is more than 5 characters) and display in another blip all the contrepeteries (French for spoonerisms) known to it (500 entries to choose from), containing the selected word.

Browsing some waves, I recognized different groups of GW robots :
  • those that modify a blip  (add a map, replace :) with a picture of a smiley, ...)
  • those that react to a blip (like mine)
  • presumably, those that work in stealth mode, doing whatever they can like logging blips, participants, ...
  • those that react to commands, like Today Special Robot 
That last group is the one I find the most intelectually teasing.
Of course this is vast, but there is space for something I can do.

Stay tuned for more ...
Jérôme

mardi 29 septembre 2009

JavaBarCamp Paris 17

Mon feedback sur le javabarcamp du 29 09 2009 à Paris

Lire la suite...

dimanche 23 août 2009

Bien savoir sur quel GlassFish on travaille :)

GlassFish est un superbe produit.
J'ai travaillé avec la v2 et j'en suis plus satisfait que d'autres beaucoup plus chers.
Un problème que j'ai rencontré est d'administrer le serveur de pré-prod au lieu du serveur de développement. Les deux étant de la même version, la console (webapp) d'administration est la même :)

Donc, voila comment j'ai éteint la pré-prod :) (pas longtemps)

J'ai pensé à rendre le style de l'affichage du nom du serveur plus claquant, plus visible.

Après recherche, la CSS est planquée au fond d'un JAR. Et en plus l'appli. est en JSF.

Sur un forum (http://forums.java.net/jive/thread.jspa?threadID=64679&tstart=0) , on me remémore GreaseMonkey. Qui permet de faire tourner des scripts Javascript sur des pages une fois chargées.

Un coup de FireBug plus tard, l'identifiant du texte est trouvé.
Sous
  • GlassFish v2 : propertyForm:Masthead_serverInfo
  • GlassFish V3 : headerForm:Masthead_serverInfo

Ci-dessous le code pour GF v2
// GlassFish V2 - HOST WARNING
// version 0.1 BETA!
// 2005-04-22
// Copyright (c) 2009, Jerome BATON
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Hello World", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          GFV2_ADMIN-UI__HOST-WARNING
// @namespace     http://jeromeb.free.fr/greasemonkey/gf2admin_host
// @description   Script to display the host in a more distinguishable way (bigger)
// @include       http://localhost:4848/*
// @include       http://127.0.0.1:4848/*
// @exclude       http://diveintogreasemonkey.org/*
// @exclude       http://www.diveintogreasemonkey.org/*
// ==/UserScript==
    
    // headerForm:Masthead_serverInfo
    
    var tag = document.getElementById('propertyForm:Masthead_serverInfo');
    var txt = document.getElementById('propertyForm:Masthead_serverInfo').innerHTML ;
    
    var nvoTxt ='';
    if(txt != 'localhost' && txt != '127.0.0.1')  {
      // Other hosts that localhost
      nvoTxt = '<blink><font size=\'54\' color=\'yellow\'>' + txt + '</font></blink>' ;
    }
    else{
      // Localhost
      nvoTxt = '<font size=\'6\' color=\'green\'>' + txt + '</font>' ;
    }
    tag.innerHTML = nvoTxt; 
Un petit copier/coller, une adaptation pour les IP/noms de serveurs, et c'est fini : vous voila avec un joli nom de serveur géant ET qui clignote.
Enjoy.

mercredi 8 avril 2009

Excitant ! (pour les neurones)

Ah ah, enfin !

Aujourd'hui, de bonnes nouvelles sont arrivées pour qui code en Java dans le web.

Notre grand frère préféré, Google annonce aujourd'hui:

  • Disponibilité de GWT 1.6
  • Support de Java dans App Engine (beta)
  • Plugin Eclipse dédié facilitant les développements en GWT pour App Engine.

Je n'avais déja pas le temps de faire une version GWT connectée à la base MySQL par du XML/JSON généré en PHP ... Me voila à rêver d'une version App Engine de mon site de contrepeteries.

Je pense que je vais ouvrir une souscription pour me faire offrir un portable pour développer cette nouvelle version.

Est-ce que le quota de 5 millions de pages vues par mois sera suffisant ??

Et est-ce qu'il y a support de smartGWT ?

mardi 24 mars 2009

J'y serais


J'y serais, le 31 uniquement aux ateliers/conférences Sun autour de GlassFish.




mercredi 18 mars 2009

Mes impressions sur SmartGWT 1.0beta2

En résumé, avec cette béta2, j'ai des problèmes de dimensionnement des éléments.

Avant cela, j'ai découvert des problèmes d'interopérabilité avec les composants GWT. Le principe a retenir est qu'il vaut mieux éviter de mélanger les composants GWT et SmartGWT, sauf à rester dans le même cadre que l'intégration présentée dans le showcase (du GWT contenu dans du SmartGWT) et surtout pas l'opposé.

Ce qui est décevant, c'est la perte de fluidité à l'utilisation par rapport au GWT basique. Toutes ces lignes de codes pour valoriser les hauteurs et largeurs des composants

L'aspect positif de cette librairie est qu'elle est plus riche, beaucoup plus riche que le GWT basique. On a ENFIN un composant de tableau présentable. On peut passer deux minutes à lire les propositions d'auto-complétion sous Eclipse.

La version finale corrigera on l'espère les défauts actuels