9 Jan 2012

Compleanno 2012

Posted in LEGO

LEGO 7936

LEGO 7936-1: Level Crossing

22 Dec 2011

Six month ago we started a new project with GWT, Guice and MyBatis.
Our previous experience was very intensive, we used Spring, old-Struts and classic implemented view tier (jsp, html, jquery).
Our two goals: deliver the business requirements (obviously) – produce a GWT framework reusable in other projects.


We reached the first objective, our application is deployed in production.
But on the other side, until two days ago, we had a big problem: GWT complile time was near to 30 mins and needed almost 4Gb ram.


We were pretty sure that the problem derived from our mental form, and we started to analyze it trying to get rid of any preconceptions.


As you know, the key feature of GWT is the Deferred Binding.
Quote …/doc/latest/DevGuideCodingBasicsDeferred.html
>>There are two ways in which types can be replaced via deferred binding:
Replacement: A type is replaced with another depending on a set of configurable rules.
Code generation: A type is substituted by the result of invoking a code generator at compile time.
<<


We develop in java, filled by java paradigms, but GWT generates javascript… was not easy for us to keep in mind this postulate, mostly at the start of the project.
At permutation time GWT “solves” generic types (interfaces or superclasses) used in RPC calls with every possible concrete type that implements/extends them.
So, if you write java you are right, but permutations are slow.


We instantiated MyBatis Criteria in the client side, passing them to the business via RPC… and also we passed though RPC too much superclasses instead of their specific type.
It wasn’t a real mistake, nor a java mistake. But surely was a bad approach to the GWT logic.


Also we learned you should never be scared of the too much code needed in order to let GWT do its job as best as it can. Every time we thought it would be better to replace a class with its superclass or interface, just for refactoring purposes, we did bad. In other words, try to be always as much detailed as you can when writing methods signatures and defining variable types.


So… after changing MyBatis generator to write specific types that extend the Criteria superclass, and after a brief refactoring, now the GWT complation takes 2 mins and 1Gb ram.


You can find a more specific explanation here: http://stackoverflow.com/a/3060233, wrote by Ashwin Prabhu.


Antonio & Federico

14 Dec 2011

D-Day

Posted in Frasi celebri

Your task will not be an easy one. Your enemy is well trained, well equipped and battle hardened. He will fight savagely.

Eisenhower 6/6/44

20 Nov 2011

Pende un uomo dal pennone
tutto nero di catrame
non è certo un buon boccone
per i corvi che hanno fame.

Pa zum! Pa pa zum!
Pa pa pa pa zac!


Cinque teschi tutti neri
stan sul cassero di prua
son dei cinque bucanieri
che son morti alla tortura.

Venti ombre tutte nere
vengon su dal boccaporto
sono venti schiavi neri
che son morti nel trasporto.

Sulla tolda biancheggianti
stan tre scheletri a ballare
sono i resti dei briganti
giustiziati in alto mare.

Un cadavere inchiodato
sulla prua sotto vento
è un ribelle che ha pagato
con la morte il tradimento.

Inchiodato al gabinetto
sta il nostromo maledetto,
che ha pagato con la vita
per averla fatta a letto.

Sulla cassa posta a poppa
stan tre scheletri a giocare.
Come premio c’è una coppa
ch’era il teschio del compare.

Se una notte tutta scura
sentirete un gran lamento
è la voce di Tortuga
morto in ammutinamento.

Coricandovi stanotte
sentirete un sordo tonfo
è il fantasma del vascello
che reclama il suo trionfo.

Aggiunte per la ninna nanna…

E la mamma dei pirati
è davvero molto bella
lei sta su una nave
che si chiama “La Marcella”.

Al comando dei cannoni
c’è un pirata tutto biondo
è il più forte dei leoni
ha conquistato tutto il mondo!

11 Nov 2011

ora ti faccio ridere
ero dalle ragazze nell’ufficio di là
entra un tizio
“è qui che avete preso un topo?”
“eh sì… la trappola è lì”
e vedo sto tizio che prende dietro un mobile un asse di legno con inchiodata una trappola per topi (con topo incluso!)