le Wadablog

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

lundi 8 avril 2013

On BatooJPA on the Andoid platform

As you may know, I've done more serverside than mobile dev.
Therefore, I was looking for a way to unite the JEE serverside part and the mobile app.
You know, not having to code same things twice. 
Thus the idea to share code between the two. Not the UI of course, but the JPA entities.

I found BatooJPA (https://github.com/BatooOrg/BatooJPA) which is a competitor to Hibernate and has a sample project for use on Android (it creates data and displays a listview).

Seemed like a good finding however, that does not really match well with me because : 
* Maven based (I used maven 1 and still have nightmares) 
* maven plugin to build & install 
* eclipse 3.7 only 
* uses H2 instead of SQLite 
* Android sample not maintained anymore 
** has to tweak it to make it recognized as an Android project in Eclipse 
** a dependency seems not to be in maven central anymore 
* heavyload APK & app (several Mb) 
* class not found exception at runtime 
As the sample was not working out of the box, I had to recreate it. 
I did it with http://androidkickstartr.com/ then updated the pom and copy/pasted the code.
 
Should had been ok but ended with a runtime exception. 
I concluded that its not the time for BatooJPA on mobile yet. 
Its sad because, I wanted to present it at DroidCon Paris ... 
Consequently, I recommend to use BatooJPA on the serverside and to make your mobile app a dumb REST consumer if you can afford your app to need network at all time. 
Alternatively, with a need for local storage, one can write a converter from JPA to ORMLite annotations. 
Or lets fund +Gray Watson and +Kevin Galligan to make ORMLite JPA compliant (hi guys).

jeudi 11 octobre 2012

Hands On Cloud Foundry chez Xebia


A nouveau dans les magnifiques locaux de Xebia pour un évènement communautaire hier soir.

Cette fois, le sujet était Cloud Foundry, proposé par @jduchessfr et présenté par @ebottard et @fbiville.

A nouveau, des têtes connues mais pas Sam, pour une fois ....

L'avantage de l'évènement est que cela me fait gagner du temps et d'avoir accès à des connaisseurs, par rapport à découvrir la ptforme chez soi et forcément, bugger sur les écueils habituels. 

Nous avons pu tester le net @ Xebia par OVH.
Qui n'aime pas bcp Maven ;)

De mon côté, je ne suis pas fan de Spring et de son côté BDD. Bof.
Je me dis qu'il me faut vérifier le support de JEE étant donné que Spring, Rails et Node, ne m'attirent pas.
Sauf si je fais générer une app Spring avec Roo ...

Bref, une fois rentré, un tweet m'apprends que TomEE peut être mis sur CloudFoundry :)

Excellent, reste à savoir quelle sera la politique de facturation à la sorte de phase béta.
J'espère une tranche (confortable) gratuite pour les petites applis, comme GAE fait (faisait?).

Bref, je prends CF comme backend de ma prochaine app (ou celle d'après)

vendredi 5 octobre 2012

BL'IMEI, a new app

Hi all,

Just pushed an app on the playstore last night.

https://play.google.com/store/apps/details?id=org.wadael.blimei

Blimey, it will show you your IMEI (International Mobile Equipment Identity, see http://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity)

It can show it via the ussd/samsung/dialer bug AND via the normal way of calling the dialer with an intent.

So that you'll know your IMEI without removing the battery.

Don't tell me it looks ugly, I know it :)


mercredi 26 septembre 2012

Go on Rasp Pi

Nothing new here, I'm not the first to install Golang on the ARM-based Raspberry Pi.

What was fun was to open a terminal on my nexusOne, open a SSH session on 3G to my Pi @ home then apt-get the dependencies, hg clone and make it.
Next geek time at home, I'll give a try to the web frameworks for Go

Now I need to open more ports :)

Have a nice day

lundi 17 septembre 2012

Screen configurations

My dual screen eclipse configuration @ work

left screen (secondary) :
3/4 for console + other tabs (javadoc, junit, problems, ..)
1/4 for package explorer (+ navigator, error logs)

front screen (main):
3/4 for editors
1/4 for outline

both are large

Home hacking config is
laptop (16/10) + 4/3 17p external monitor
most of time only laptop

lundi 13 août 2012

Hunt for dead code

I recently tweeted that I was not happy with CodePro's feature of finding dead code.

I am to maintain an old Swing based software that has seen several years and people.
It has classes named like Class AB with A & B being meaningful complicated words.
Trouble is also that it can have a class BA for each class AB.
Not forgetting that there is AB classes in several packages.

Do you feel the pain ??

I do.
Therefore, I thought I should remove the unused code, hoping there would be a lot of code to remove.
Thus the use of CodePro plugin

Having used source-manipulating tools before, I know they can do more bad than good.
So I commented by hand the unused classes and methods.

Good idea !
I ended de-commenting the previously commented lines of code.

The tool did not work well for me, presumably because there is a custom classloader in use. I have not looked deeper.

vendredi 6 juillet 2012

Bragging time :)

Today, I've had this funny feeling to hold a magazine with my name in it.

Holding a real thing may sound useless to the even-more-digital-than-mine generation but still, this is huge for me : real paper :)







I expected this moment two or three years ago when Wave was hype and I was close to write a chapter about my WadRobotFramework for a real book (and ebook too).
Alternative was that the chapter got written by someone else.
Unfortunately, another alternative got real : book was cancelled then Wave. 

So today tastes like a kind of revenge. Sweet.

dimanche 24 juin 2012

OSGi/Eclipse plugin, I'm puzzled

Some time ago, I found a pretty dead simple solution to a problem with GWT compiler (issue 5621).
It leaves files in TMP dir.
Sometimes BIIIIG  files (not for me).
And it slows down Eclipse even more.
AArrgghh, someone has to do something about it.

So I took my best cape and thought of a bundle that would clean the mess on start and stop of Eclipse.

That is level 1 OSGi, an Activator that does the job.

Its also for I will have to do something that must autoload JARs at work.

Then, boom ! In my face !
The Activator does not get activated even though I explicitly set lazy loading to false.

WTF ??
The module either appears as LAZY or RESOLVED depending on the MANIFEST.MF configuration.


This adds one more line to the funky stuff I found in the little I know about OSGi
* General Manifest syntax
* 80 columns Manifest
* unclear lazy loading directives, combinations 
and now,
* Activators that do not auto-start

And I do not know much.
I presume, I'll look at the bare Java modules (JDK7 ? 8?) for the job.

If you have an idea, share it in the comments. 

Thanks

Jérôme

2012/07/06 Update : The truth is in the source. The wizard added a line in the Manifest.mf that was making it lazy. Dropping that line made the plugin work as intended. The project can be found on GitHub   https://github.com/wadael/GWTCleaner , the path comes from user mudelta

vendredi 4 mai 2012

GWT(F)'s ListBox

Nothing new but yesterday, I was doing some upgrade to a GWT based app.

Surprisingly, the ListBox class has none of these methods. 
  • getValue() to return the selected value
  • empty() / clear()  to remove all values
  • addAll(List<String> newValues)  to add a group of new methods
And it was a shock again.
Subclass my friends, subclass !

dimanche 22 avril 2012

Devoxx France is over

Back to office with lots of ideas to put in projects.

mardi 10 avril 2012

Nouvelle app pour bientôt / New App soon

[FR]
Ma nouvelle appli sera bientôt sur le market.
Elle commence à avoir une tête présentable, il y a encore et il y aura toujours des détails à améliorer.

L'annonce est pour bientôt. 

Quelques éléments tout de même, pour un peu de teasing :
  • la cible franco-française (IDF dans un premier temps)
  • utilise ORMLite
  • utilise AndroidAnnotations
Comme la précédente, je n'y passe que quelques heures de temps en temps en soirée donc ce n'est pas la meilleure appli du monde.
Néanmoins, je crois qu'elle sera utile.

Fin du teasing :)

[EN]
My next app is to be released soon, it will target mostly French ppl or French-speakers living around Paris. I did not do any I18N.
I used AndroidAnnotations and ORMLite to build it.

I recommend both although I was kind of deceived by ORMLite, as I'm coming from Hibernate/JPA grounds.

lundi 9 avril 2012

Android tip of tonight

As I work on an app that loads stuff in DB, I frequently have to go to "Manage Apps" then find my app in the list then click on it and then "clear data". 
As my app's name starts with "P" and I'm using my everyday phone, thats quite a quantity of apps to browse before I find mine.

Easy tip : prefix your app's name with "_____" for example, to have it at the top of the list of your apps.

mardi 27 mars 2012

Article dans une vraie revue du monde réel

(In English after the French §)
Certains savent que j'adore les livres et que je rêve d'un jour écrire un cycle comparable à Dune. 

Après une déception sur un projet qui n'a pas vu le jour (un chapitre sur mon WadRobotFramework dans un livre consacré à Wave chez un gros éditeur américain), 

En 2010 et 2011, j'ai eu la joie de tenir des livres où mon nom apparaissait dans la préface pour indiquer la qualité de ma collaboration en tant que relecteur technique.

Mars 2012,  j'ai le plaisir d'annoncer que j'ai écrit un article qui doit paraître dans un Hors Série d'une revue que j'apprécie particulièrement. 
Un premier article (rémunéré) dont je reparlerai quand il apparaitra en kiosque.

Je vais proposer un 2e article pour creuser le sujet, pour un numéro suivant.

J'espère participer à un livre en 2013 et pourquoi pas en co-signer un en 2014.

MAJ 2012-04-16 : j'apprends ce matin qu'il y aura DEUX HS Android à la suite.
Le premier sortira le 27 avril. Je ne sais pas encore si mon article sera dedans ou dans le suivant.
MAJ 2012-04-28 :  Mon article sera dans le suivant.
MAJ 2012-07-06 :  Mon article est paru dans GNU/Linux Magazine France, Hors-série n°61 Android. Vous le trouverez page 64.
http://diamond.izibookstore.com/produit/169/9786000049683/GNULinux%20Magazine%20HS%20n61%20%20Creez%20vos%20applications%20Android%20comme%20un%20pro%20 

Hi guys,
I have signed an article to be published in a real magazine later this year.

In 2010 & 2011, I had the pleasure to see my name in the prefaces of excellent Android books in sentences underlining the quality of my contribution. And its still huge memories for me to have worked with people I already respected for their previous books/blogs/dW articles (even kilometers of dW articles).

2012 is when I will finally have something published as author : an article in a special issue of a well-known French magazine.

Next step is propose & write a second, to go deeper into the topic.

My envy for 2013 is participating to a book. And co-sign one in 2014.

Dreams are what we live for. Aren't we ?
Update : My article will be in the issue to be published in July.
Update : My article is published. You can browse the magazine online at http://diamond.izibookstore.com/produit/169/9786000049683/GNULinux%20Magazine%20HS%20n61%20%20Creez%20vos%20applications%20Android%20comme%20un%20pro%20 , see page 64

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 19 janvier 2012

Alfresco's AuthenticationUtil.getFullyAuthenticatedUser()

I am using version 3.4.d community and I plugged custom pages in for company specific matters.
In those page, I need to know the logged in user.

So, I found  
AuthenticationUtil.getFullyAuthenticatedUser();
which I later found out does return the authenticated user but the last one who logged in.
So, I had a fucking problem with my app reacting like the user in front of the screen is someone else.

Oo !!!??!!! WTF ???

Guess what .... Its written black on white in the javadoc  (see http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/data-model/source/java/org/alfresco/repo/security/authentication/AuthenticationUtil.java)

/**

 * Get the fully authenticated user. 
* It returns the name of the user that last authenticated and excludes any overlay authentication set
* by {@link #runAs(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork, String) runAs}.
*
* @return Returns the name of the authenticated user
* @throws AuthenticationException
*/


Lessons learned, again :
  • do not assume people use meaningful names.
  • method name is not enough
  • reading first line of javadoc is not enough
  • one never stops learning with Alfresco

HELL, THAT NEARLY SCREWED MY LAUNCH !
Fortunately, this has been detected during internal tests.

mardi 17 janvier 2012

GWT ListBox & events - for records

Note for future self :) (and yesterday's self)

On a GWT ListBox widget, it is natural to write 

listbox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {...}
}


But do not forget to
listbox.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {...}
}

for else, the event "the listbox has been selected and value is modified with the keyboard arrows"
will not be handled even though the value "changes".


Now, shouldn't the ChangeHandler be called ChangeByMouseHandler ? No ?

mardi 3 janvier 2012

ORMLite for Android - episode 1

If you read my blog, you certainly know I am an Android fan.

But I am not fond of its SQL features. Some times ago, I looked for alternatives and I found ORMLite for Android.
My first use was very simple (yet unpublished).

Recently, I tried it with a parent-child relation. There is a persistent object in another persistent object.

As I wrote in https://plus.google.com/u/0/117007069948230044999/posts/fGyVgXPPf57

After some browsing, I found that parentDao.refresh(parent) must be done explicitly, else the child is not loaded.
Well ... ok ... its weird for me, as I'm used to server-side ORMs.

Unfortunately it did not work with only
@DatabaseField(foreign= true) on the child field (yes, I believe in magic ;) )

so, I annotated it with

@DatabaseField(foreign= true, foreignAutoRefresh = true, foreignAutoCreate = true) and it worked.

I have not tested the updates behaviour yet or the performance as for the moment, I just want to load my db.

This lib is a nice tool for your android toolbox.

vendredi 23 décembre 2011

Exchange, JavaMail & le temps perdu

"Le temps perdu" (the lost time) including extra hours trying to solve this problem ...

I managed to have a sort of "hello world" of email sending working with exchange and javamail.

First, let's make things clear. I'm in a corporate environment. I am forced to use exchange, I have to deal with the proxy, a slow machine and a lack of documentation.
Fortunately, the web access is not too restrained. 

Thank you http://stackoverflow.com !
With all the threads openned on javamail + exchange I could 'compile' something.

If ever that can help someone else than me, here are the ingredients I used (might differ in your environment)
  • use TLS props.put("mail.smtp.starttls.enable","true");
  • use port 587  (not 25, not 685)
  • use a javax.mail.Authenticator
  • add the necessary certificates to the keystore used by your VM

    On a *nix system, try   find / -name cacerts |more
    and find / -name .keystore |more
  • You will find the certificates from your browser settings
Other findings
  • McAffee protection against 'mass emailing worms'  prevents you from developing on your dev station
What I should not write
  • Write simple test programs on the PROD env. to be sure it CAN work
And now a poem
LE TEMPS PERDU (de Jacques Prévert)
Devant la porte de l'usine
le travailleur soudain s'arrête
le beau temps l'a tiré par la veste
et comme il se retourne
et regarde le soleil
tout rouge tout rond
souriant dans son ciel de plomb
il cligne de l'oeil
familièrement
Dis-donc camarade soleil
tu ne trouves pas
que c'est plutôt con
de donner une journée pareille
à un patron?

mercredi 30 novembre 2011

NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference

Got this while compiling my GWT app
Java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference

It did not occur when compiling with previous GWT compiler, but occurred with 2.4.0. Another WTF?!?? -- code was unchanged.

A handy message on the GWT Google group says that the order of export put in place by Maven was guilty.
I up-ped the GWT dev and user JARs
 with my answer

mercredi 9 novembre 2011

Alfresco - install on a linux VM, protip from real life

As I was installing an Alfresco on a Linux machine, I learned AGAIN.
Damn Alfresco, I know it since the "not yet 1.0" version (was 0.6??) and everytime I use it, I learn new stuff.

Problem:
It all started with my test user seeing mixed languages, English and French in the web interface despite the choice of English at login time. 


OK, problem is solved but it was a pita as I had to "DROP DATABASE alfresco;". Was empty, fortunately.

Short version :
As the "system spaces" like "data dictionnary" are created upon first boot of the webapp, you must not leave YOUR language packs (.properties files) in the .war file. Main culprit was bootstrap-spaces_fr.properties in alfresco.war\WEB-INF\classes\alfresco\messages\

Long version :
I installed on a Linux machine, not using the 1-click installer provided by Alfresco but it would not have changed a thing considering it's the .war file the guilty.

I am not a US resident, nor EN.
I use a Linux VM that I have not set up, physically located in fr_FR, which I tend to forget as I mostly write/code in english (sometimes frenglish).

On first start, the .war file deployed in Tomcat is unpacked and its content is used by the initial process -- including the deadly bootstrap-spaces_fr.properties. 

This process creates what I'll call the "system spaces" (like "data dictionnary") and they are created accordingly to the locale whenever the files are available. If not, the default are used and they are plain English, which is better for a system to be used by people around the world.

The culprit file can be found at alfresco.war\WEB-INF\classes\alfresco\messages\bootstrap-spaces_fr.properties. I moved all _fr.properties files to a subfolder -- just in case.

My advice is to remove all I18N files from the .war before to use it.
Or, you'll have to drop the database and empty the alf_data folder and of course, bear with another looong first start. 


Hint: Setting the JVM's locale to "en_US" could be an option (not verified) at install time.

- page 1 de 4