Tuesday, April 29, 2014

Anatomy of Italian TV News (on a Berlusconi Channel)

aka Phenomenology of Berlusconianism - the incessant process of molding the Average Italian's political conscience.


00:13 italian politicians declarations
00:27 berlusconi speaks
01:02 killing of a disabled girl
01:20 found dead old lady mummified
01:30 killing of an italian girl
01:40 mediaset (Berlusconi company) is in active
02:00 woman kills his disabled son
03:12 killing of a skipper
04:40 scary amount of immigrants
05:02 italian political fights

06:00 Berlusconi declarations, saying that opposition is like Hitler or Robespierre, and they will increase taxes
07:50 more Berlusconi declarations
08:40 Berlusconi's company shareholders meeting, optimistic Berlusconi's son, propaganda of his companies

11:20 process of a woman accused of killing of his son
13:50 mummified woman hidden by his relatives
15:16 father of a girl dead drowned talks about her daughter
17:20 man sets himself fire with his daughter
19:20 killing of a girl

20:58 football player eats a banana thrown to him, to say no to racism
22:24 obese woman loses weight to get married
24:17 famous singer beats his wife
27:00 Italian prisons are overcrowded - pledge for amnesty
29:30 Berlusconi's political enemy makes declarations against another enemy of Berlusconi
31:23 current Prime Minister declarations reported by others (no images shown of him) - quite boring and confusing
35:55 European elections : some declarations from each major party - again very boring and confusing
38:40 Italian comedian back from hospital
40:21 gossip on celebrities

42:30 weather forecasts
43:10 end

On the whole, roughly 40% is crime news (and very grim crimes)... the effect is to depress any rational thinking, and make the spectator regress to a very primitive stage of awe and terror and sense of impotence. Everything outside is threatening (immigrants). Rational thinking is depressed, all what remains is humoral belly processing.

Another 30% is Berlusconi's propaganda - the effect is elating: in the midst of this dark world, Berlusconi is a phare of success, rationality and hope.
After all Catholic Church has done the same for centuries: first they terrorize you with images of sins and hell, then the promise you salvation. The whole experience is RELIGIOUS: Hell (crimes), Purgatory (Italian politics), Paradise (Berlusconi's world).

This treatment is done repeatedly, in successive waves.... crimes and Berlusconi success... more crimes and more Berlusconi propaganda.

Some 10% is gossip, and 20% is Italian politics.
Italian politics is boring and confusing... what is clear is that Berlusconi is good, the rest is bad or ambiguous.
Some positive values are fostered: racism is bad, but only when it's against a famous football player. Nobody seems to care about poor immigrants.
Weather forecast are at the end, like  milk in supermarkets: most people want them, and they have to go through all the rest to get them.

The Crisis doesn't exist.No international news - there is no world outside Italy. No Ukraine crisis. No wars in half a planet occupied by USA troops.

Fascism was different: they would never publish any crime news: no crimes were committed in Fascist Italy. Publishing a lot of crime news has also the effect of making you think that this is a very imperfect world, and needs some radical change (i.e. Fascism).

Monday, April 28, 2014

Book: Pro Git

If there is a book that everybody should read and put in practice, it's PRO GIT.

Git goes a long way beyond traditional VCS, but it definitely takes some time to master it. This book gives a lot of practical examples who make it easier to visualize the concepts. Great job.

Saturday, April 26, 2014

Wojtyla and Pinochet

Lest we forget who he really was.... the most right-wing Pope in modern times, with the heaviest political agenda ever run by the VatiCIAn.

Book: Java performance, the definitive guide

This book is DEFINITELY loaded with information on all aspects of performance-related stuff on:
  • JVM tuning (heap, GC, permgen) 
  • JIT compiler
  • diagnostic tools (vmstat,  jmap, jcmd)
  • MultiThreading issues, Synchronization
  • Tuning JEE 
  • XML parsers
  • JDBC

and it covers also Java 8.

However, don't try to read it front to back, it's definitely HEAVY stuff.
Sadly, it doesn't contain many real life examples and code that one can run to experiment a little.
Personally I learn best when I can actually play with the code and run some tests myself.
This book is definitely not "cookbook" oriented.However, it's definitely worth keeping in your library.

Java Posse strikes again


Italy is going down the train

I have taken a short trip through Italy, the first since a long time - 5 years at least.

A few shocking changes.

People in Rome look really dejected, sad and VERY aggressive. Services are very poor and neglected. I had to take bus number 90, I have been running right and left without finding the stop and asking 10 different people where the stop was... finally they show me a place, there was no sign of stop, but local residents knew that habitually the bus stops there....

I get the bus, after 10 minutes the bus stops and everybody gets off angry and insulting the driver and walking 100 meters to another stop.... it turns out that the bus had a failure and made an emergency stop, but no announce was done... people started also insulting each other, especially an old Italian man insulting a young black man...

People have become openly racist, they hate immigrants and have no moral restrain in insulting them.

Trains have become extremely expensive, almost all regional trains have been suppressed and replaced by high speed / high cost trains. This when the vast majority of the population struggles to make ends meet. Local trains are simply disgusting, VERY dirty and in a quite poor shape.

Some stations, like Torino Porta Susa, Milano Centrale and Bologna, who once upon a time were lovely, simple, enjoyable stations, have now turned into modern nightmares. They are a confusing labyrinth where you have to walk disproportionate distances to get to the trains, with hardly any signals, no benches to sit and wait, no services, no waiting room, everything very impersonal and unwelcoming.
This lack of infrastructure is intentional, to push the passengers towards the bars and shopping centers where they are supposed to consume. This is Hard Core Capitalism, baby.
Most platforms are underground, no natural light, just concrete and glass. Utterly depressing. There was stench of solvents, I could hardly breathe, I had to leave and wait in the upper floor.

more than in a train station, one would think he is in an airport... a VERY ugly one...

no plants, no art, no nothing, you are only left to contemplate this neo-fascist symbol of power, it feels like Nazi Germany 

They are not working at the High Speed train Torino-Lyon... needless to say it will be just a monstrous waste of public money to deliver a concrete energy-inefficient nightmare.
What Mussolini didn't manage to destroy, this Troika-run government is devastating fast and furious.

Needless to say, most of the times the trains - especially the local ones - were desperately late. From Torino to Roma I gave my seat to an old lady - overbooking, 86 seats for 110 tickets - and traveled 6 hours sitting on the floor.
The return trip, Rimini to Aosta, 530 Km in 8 hours for 86 Euros... call it High Speed... 20 years ago it was faster...

Friday, April 25, 2014

Java, discover all available flags with PrintFlagsFinal

not many people know that you can get the list of all supported JVM flags with -XX:+PrintFlagsFinal
java -XX:+PrintFlagsFinal -version | grep -i gc
will print:
    uintx AdaptiveSizeMajorGCDecayTimeScale         = 10              {product}
    uintx AutoGCSelectPauseMillis                   = 5000            {product}
     bool BindGCTaskThreadsToCPUs                   = false           {product}
    uintx CMSFullGCsBeforeCompaction                = 0               {product}
    uintx ConcGCThreads                             = 0               {product}
     bool DisableExplicitGC                         = false           {product}
     bool ExplicitGCInvokesConcurrent               = false           {product}
     bool ExplicitGCInvokesConcurrentAndUnloadsClasses  = false           {product}
    uintx GCDrainStackTargetSize                    = 64              {product}
    uintx GCHeapFreeLimit                           = 2               {product}
    uintx GCLockerEdenExpansionPercent              = 5               {product}
     bool GCLockerInvokesConcurrent                 = false           {product}
     bool GCOverheadReporting                       = false           {product}
     intx GCOverheadReportingPeriodMS               = 100             {product}
    uintx GCPauseIntervalMillis                     = 0               {product}
    uintx GCTaskTimeStampEntries                    = 200             {product}
    uintx GCTimeLimit                               = 98              {product}
    uintx GCTimeRatio                               = 99              {product}
     bool HeapDumpAfterFullGC                       = false           {manageable}
     bool HeapDumpBeforeFullGC                      = false           {manageable}
    uintx MaxGCMinorPauseMillis                     = 18446744073709551615{product}
    uintx MaxGCPauseMillis                          = 18446744073709551615{product}
     bool OptimizeStringConcat                      = false           {C2 product}
     intx ParGCArrayScanChunk                       = 50              {product}
    uintx ParGCDesiredObjsFromOverflowList          = 20              {product}
     bool ParGCTrimOverflow                         = true            {product}
     bool ParGCUseLocalOverflow                     = false           {product}
     intx ParallelGCBufferWastePct                  = 10              {product}
     bool ParallelGCRetainPLAB                      = true            {product}
    uintx ParallelGCThreads                        := 10              {product}
     bool ParallelGCVerbose                         = false           {product}
     intx PerfMaxStringConstLength                  = 1024            {product}
     bool PrintClassHistogramAfterFullGC            = false           {manageable}
     bool PrintClassHistogramBeforeFullGC           = false           {manageable}
     bool PrintGC                                   = false           {manageable}
     bool PrintGCApplicationConcurrentTime          = false           {product}
     bool PrintGCApplicationStoppedTime             = false           {product}
     bool PrintGCDateStamps                         = false           {manageable}
     bool PrintGCDetails                            = false           {manageable}
     bool PrintGCTaskTimeStamps                     = false           {product}
     bool PrintGCTimeStamps                         = false           {manageable}
     bool PrintHeapAtGC                             = false           {product rw}
     bool PrintHeapAtGCExtended                     = false           {product rw}
     bool PrintJNIGCStalls                          = false           {product}
     bool PrintParallelOldGCPhaseTimes              = false           {product}
     bool PrintReferenceGC                          = false           {product}
     intx QueuedAllocationWarningCount              = 0               {product}
     bool ScavengeBeforeFullGC                      = true            {product}
     bool SpecialStringCompareToCC                  = true            {product}
     bool SpecialStringCompress                     = true            {product}
     bool TraceParallelOldGCTasks                   = false           {product}
     bool UseAdaptiveGCBoundary                     = false           {product}
     bool UseAdaptiveSizeDecayMajorGCCost           = true            {product}
     bool UseAdaptiveSizePolicyWithSystemGC         = false           {product}
     bool UseAutoGCSelectPolicy                     = false           {product}
     bool UseConcMarkSweepGC                        = false           {product}
     bool UseG1GC                                   = false           {product}
     bool UseGCOverheadLimit                        = true            {product}
     bool UseGCTaskAffinity                         = false           {product}
     bool UseMaximumCompactionOnSystemGC            = true            {product}
     bool UseParNewGC                               = false           {product}
     bool UseParallelGC                            := true            {product}
     bool UseParallelOldGC                          = false           {product}
     bool UseParallelOldGCCompacting                = true            {product}
     bool UseParallelOldGCDensePrefix               = true            {product}
     bool UseSerialGC                               = false           {product}
     bool UseStringCache                            = false           {product}

oracle database find version

When you open an SR with Oracle Support you must answer a lot of embarassing questions, like "Database/Version".
Open a connection with SQLDeveloper and run "SELECT * FROM V$VERSION;"
This is what you get:
Oracle Database 11g Enterprise Edition Release - 64bit Production
PL/SQL Release - Production
"CORE Production"
NLSRTL Version - Production

Ruby editor in Geppetto

Something quite annoying is having to use the generic Text Editor for Ruby files in Geppetto/Puppet.

You can install the Ruby Plugin from http://download.eclipse.org/technology/dltk/updates/ and select only the Ruby section (it comes with a zillion languages support.... no need to install them all)

If you are behind a http proxy, you might find convenient to install http://www.proxifier.com/, you have 31 days trial . Eclipse is so bloody crappy that most of the time it can't connect to the internet even if you try all the possible options (direct/manual...). Eclipse SUCKS.

Thursday, April 24, 2014

the crazy story of securerandom.source=file:/dev/./urandom

More or less everybody know that if SSL encryption operations are slow, the culprit must be the source of entropy from /dev/random, and that you can replace it with /dev/urandom.

Everybody know that you can do this in 2 equivalent ways:

  • either you enter securerandom.source=file:/dev/urandom in $JAVA_HOME/jre/lib/security/java.security

  • or you start the JVM with the argument -Djava.security.egd=file:/dev/urandom

What really is striking is that although this value might already be set by default on Windows, one should actually set as a value "/dev/./urandom" on Linux systems, otherwise APPARENTLY the setting is not actually accepted by Java and it defaults again to /dev/random

How in 2014 we still have to manually take care of these things, it's a mystery. And whether this is actually true, another mystery.

Apparently this is intended - and not a bug http://bugs.java.com/view_bug.do?bug_id=6202721, however it's disheartening. See also Oracle Doc "Long Delay During Startup of SOA Managed Server (Doc ID 1336411.1)" and
However, it says "Note that this workaround should not be used in production environments because it uses pseudo-random numbers instead of genuine random numbers."

Tuesday, April 15, 2014

adding a timestamp to bash stdout

Assume a shell script writes without timestamp info:


how long it took to complete bla? and mumble? no clue. You could hack the script to add a timestamp for each echo, but that's not practical. Workaround:

vi timestamp.sh

#! /bin/bash

while read line
echo `date +"%Y%m%d-%H%M%S"` $line

chmod 775 timestamp.sh

now you can use it this way:

myscript.sh | ./timestamp.sh

20140415-145529 bla
20140415-145529 mumble

In alternative, you can also compile this c program:
//gcc timestamplog.c -o timestamplog


time_t now;
struct tm  *ts;
char buf[80];

void printTime() {
    now = time(NULL);
    ts = localtime(&now);
    strftime(buf, sizeof(buf), "%Y%m%d-%H%M%S  ", ts);
    printf("%s", buf);

int main() {
 int startLine = 1;
 int ch;
    while ((ch = getchar()) != EOF) {
  if (startLine) {
   startLine = 0;
  if (ch == 10 || ch == 13) {
      startLine = 1;

  } else {

    return 0;

osb_server1, where does it come from?

When you create a new OSB domain, typically you include 2 templates:

SB_BASE_TEMPLATE = '/common/templates/applications/wlsb_base.jar'
SB_TEMPLATE = '/common/templates/applications/wlsb.jar'

in wlsb.jar there is a tiny config.xml defining the osb_server1 managed server.

So, a brand new domain will contain this osb_server1.

To customize the domain, you can either delete it (not advisable, since there are singleton services targeted to it) or rename it (better this way)

In the same way, a datasource wlsbjmsrpDataSource will be created automatically, using some default values:

<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source">

Of course you will have to customize this Datasource to suit your needs, with code like this:
            DS_NAME_REP = 'wlsbjmsrpDataSource'
            db_driver = 'oracle.jdbc.OracleDriver'
            db_url = 'jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.acme.com)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=myservice)))'
            db_password = 'bla'
            db_name = 'myservice'

            cd('JDBCSystemResource/' + DS_NAME_REP + '/JdbcResource/' + DS_NAME_REP )
            set('DriverName', db_driver)
            set('URL', db_url)
            set('PasswordEncrypted', db_password )
            # set/create all properties
            create('databaseName', 'Property')
            create('serverName', 'Property')
            create('portNumber', 'Property')
            cd('/JDBCSystemResource/' + DS_NAME_REP + '/JdbcResource/' + DS_NAME_REP )
            set('TestTableName', db_testtable)

            set('InitialCapacity', 0)
            cd ('JDBCDataSourceParams/NO_NAME_0' )
            set('GlobalTransactionsProtocol', 'LoggingLastResource')

All this is very beautiful and instructive.

Monday, April 14, 2014

intercept all java JVM calls

Good man David wrote a script to log all the calls to Java with the parameters passed:
mv /usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java /usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java_
vi /usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java

#! /bin/bash

echo "+++++++++++++++++++++++++++++"  | tee -a $LOG_FILE
echo "+++ EXECUTING JAVA. CMD: java" "$@"  | tee -a $LOG_FILE

java=$(readlink -f $0)
echo "+++ EXECUTING JAVA. time: "`date +"%Y%m%d-%H%M%S"` | tee -a $LOG_FILE
echo "+++ EXECUTING JAVA. java: $java"  | tee -a $LOG_FILE
echo "+++ EXECUTING JAVA. cp: $CLASSPATH"  | tee -a $LOG_FILE

for arg; do
#  if [[ ${arg: -3} == ".py" ]] || [[ ${arg: -4} == ".xml" ]]; then
  if [[ ${arg: -3} == ".py" ]]; then
    echo "+++ EXECUTING JAVA. cat $arg. START."  | tee -a $LOG_FILE
    cat $arg  | tee -a $LOG_FILE
    echo "+++ EXECUTING JAVA. cat $arg. END."  | tee -a $LOG_FILE
    f=file-$(basename $arg)-$(date +"%Y%m%d-%H%M%S")
    cp $arg $LOG_DIR/$f

f=$LOG_DIR/log-$(date +"%Y%m%d-%H%M%S").txt
echo "+++ EXECUTING JAVA. running. log: $f"  | tee -a $LOG_FILE
set -e
(($original_java "$@") 2>&1 ) | tee $f


echo "+++ EXECUTING JAVA. cat $f. START."  | tee -a $LOG_FILE
cat $f | tee -a $LOG_FILE
echo "+++ EXECUTING JAVA. cat $f. END."  | tee -a $LOG_FILE

echo "+++ EXECUTING JAVA. exit code: $EXIT_CODE" | tee -a $LOG_FILE
echo "+++ EXECUTING JAVA. END."  | tee -a $LOG_FILE


chmod 775 /usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java
At this point, all calls will be logged to /tmp/log_puppet_weblogic/log.txt and the stdout of each command will go into a separate file in /tmp/log_puppet_weblogic/ folder. This is particularly useful to trace all the WLST calls.

Sunday, April 13, 2014

The Holocaust, a World Conspiracy against the Jews

I have dedicated almost all my free time in the last one year to study the history of the Holocaust. I have read dozens of books and screened hundreds of interviews of survivors.

Some conclusions that I find basically sure are:

  • Nazism has been internationally engineered with financial weapons of destruction (the Versailles treaty, the high unemployment and devastating inflation of the Weimar republic) and implanted in Germany, with the sole purpose of making Europe implode from within and bring USSR down with it. The winner (USA) takes it all.

  • Hitler built his political success in the 1933-1939 on huge financing from international loans (still looking for actual facts)

  • The annihilation of the Jews was perpetrated by the Germans, but with the complicity of all other countries, who denied any way of escape to them. USA granted only 19K visas per year. All countries signed an agreement to deny any kind of visa to Jews

  • No attempt whatsoever has been done by the Allied to hinder the annihilation process: they could have easily bombed the railways and the camps, they never did. They did bomb some camps, but only in the production areas, never the imprisonment areas - when they did, it was to kill all inmates.  
  • The Brits, when they liberated the camps - like Bergen Belsen - overfed on a mass scale the survivors, bringing them to immediate death. Most survivors died not of malnutrition, but of nutrition inappropriate for their debilitated body. It's hard not to think that this was deliberate, since it happened quite systematically.
  • All political and military leaders, the Red Cross and the Church knew it all, but they turned a blind eye - actually often the Catholic Priests even helped the Nazi identify the Jews

  • Hitler didn't invent anti-semitism: it was deeply rooted in the German population after centuries of Catholic and Protestant propaganda. Hitler merely amplified this feeling.

  • With few rare exceptions (Czech, Italians, Danes, Belgians), local populations widely participated in the looting and killing of Jews

  • Hitler dedicated more energies to the annihilation of the Jews than to the war itself. The destruction of 1 million Hungarian Jews took place when the war was already 100% lost. Was he crazy, or his agenda was dictated from elsewhere? And from where? assuming that Hitler was just a puppet, who was the real Puppet Player, and how could they control so strictly the German politics?

  • The destruction of European Jewry brought more damage than advantage to Germany, because the Jews were mostly very skilled in all sort of arts and trades ("essential workers") and their belongings ended up mostly in private hands, rather than in the State.

  • most Nazi criminals either escaped - with the help of the Church and the Occupying Armies - or went to work for the Allied intelligence. Nuremberg Trials was just a make-believe.

The biggest mystery for me is: excluding that the annihilation of the Jews was dictated by ideological reasons (economy is the real motor or human actions), what larger geopolitical purpose could it serve? Just to manufacture a pretext to occupy Palestine and make a US military basis in the Middle East? To further weaken Europe and make it more dependent on USA? Mmmmm...

Why am I so involved in this research? Because I am sure it will happen all over again, and in a not distant future, and in this same Old Europe.Wait for the Economic Crisis to get worse...maybe Muslims will be the next Jews... who knows what the Economic Masters of this Planet are brewing for us... nothing nice for sure.

dedicated to the heroes of the Warsaw Ghetto Uprising

In the most optimistic vision, the prosecution of the Jews was just a trick to unify the Pure Germans and a means to transfer Jewish wealth to them, in order to increase the Regime's popularity. No wonder most of the Germans would support Hitler. Jews nowadays and for instance the migrants who cross for instance the Sahara (and we know next to nothing about them) and then the Mediterranean sea, and we know a bit more about them: it seems that in the Sicily channel fishermen catch human remains together with fish, but at most media mention the migrants who manage to arrive to Lampedusa.

The migrants are a weapon of mass distraction, the average Italian says : "they take away the little job and houses we have", and he doesn't see all what the Troika is taking away and that the migrant themselves are victims and the consequence of the passage of African Natural resources (mainly oil and gas) in new hands. Check the average per capita income of Libyans before and after Qaddafi and then tell me who gained from a regime change in Libya.

The day after tomorrow, if and when the enormity of this massacre will emerge (by and large far more than the 6 millions killed by Hitler), someone will surely question how all this could happen in the general indifference, actually bordering with approval. This indifference is functional, for us, to the Business As Usual, exactly as for the Germans in Hitler's time it was essential to ignore the Holocaust in order to carry on with their daily lives.

The Extermination of Jews was a huge Ethnic Cleansing, as the World has known many before and after.
But the official historiography - the one in the school history books, the one written by the winners - presents this Ethnic Cleansing as "THE" Ethnic Cleansing, the all time worst, the Absolute Evil.
The winners of the WW II say: we have defeated The Absolute Evil, and don't even dare to discuss this.

However, with Hitler is was a great Evil who was defeated, but it was not the Worst Evil of all times, neither The Absolute Evil. Take Lampedusa, Afghanistan, Syria, Iraq, Gaza, all the refugees camps in Lebanon for example. They are all Warsaw Ghettos, GeneralGouvernment, Exodus, Resettlement, Final Solution, Konzentrationslager, slaughter of the Intelligentsia.

Dedicated to those who lost their lives trying to cross the Sea.

Saturday, April 12, 2014

Poll result: most popular logging framework is.... good old log4j !!!

while quite a few people use the abstraction of slf4j (I wonder how many users of logback also checked slf4j, since the recommended way to use logback is to go through slf4j...)

Anyway having used myself log4j for several DECADES, I can only recommend upgrading to logback, it's effectively rich with new features and substantially very similar to good old log4j...

Elasticsearch seems to be still quite a niche technology... personally I foresee a great growth (I normally fail all my forecasts anyway... in 1986 I forecast no future for Windows.. and in 1995 no future for Java...)

Tuesday, April 8, 2014

Book: functional programming in java (Java 8 Lambda)


This is one of those rare books who focuses not much on technology, but on methodology, and does it with simple examples that everyone can follow.

Starting from a few simple examples, it will hammer in your head the various reasons why imperative programming often (not always) is dangerous and verbose, and illustrates how to solve the same problem in an elegant, concise and readable functional way using Java 8.

To be perfectly honest, in a few cases I still believed that the imperative way was more readable - at least to my eyes - than the slightly cryptic functional way... yet I got the message, use lambda functions on Collections is the way to go, and not only in Java...

puppet create directory recursively

The whole VERY OLD rant is here  http://projects.puppetlabs.com/issues/86
Why on earth in 8 years the Puppet Gods have kept ignoring this very basic and common need, they only know.

In a nutshell, I have a variable
file { "$mypath":
   ensure => directory,
   owner => 'soa'

This will of course fail if /opt and /opt/oracle have not been already defined.

Of course since $mypath is a configuration value there is  no way I can hardcode all the parents directories.

Hence I am screwed, and Puppet doesn't offer me any way around.

I can think of only one elegant way, that is writing a Ruby function (I am not good in Puppet stinky DSL) "pathExpand" to transform a full path into an array of his components:

assert [ '/opt', '/opt/oracle', '/opt/oracle/fmw11_1_1_6' ] = pathExpand('/opt/oracle/fmw11_1_1_6')

and a define "conditionalDirectory($mypath ):

if (! defined($mypath)) {
  file { "$mypath":
    ensure => directory,

All this sucks, but not as much as Puppet DSL anyway.

This is a Puppet solution (hack) to the problem:

define common::mkdirp(
  $owner     = 'root',
  $group     = 'root',
  $exec_path = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin') {

  exec { "create ${name}":
    command     => "mkdir -p ${name}",
    creates     => $name,
    path        => $exec_path,

  common::ownership { $name:
    user        => $owner,
    group       => $group,
    exec_path   => $exec_path,
    require     => Exec["create ${name}"]


define common::ownership(
  $group     = undef,
  $dir       = $name,
) {

  $real_group = $group ? {
    undef   => $user,
    default => $group

  exec { "full '${dir}' directory ownership for ${user}:${real_group}":
    path    => $exec_path,
    command => "chown -R ${user}:${real_group} ${dir}",
    unless  => "test `find ${dir} -user ${user} -group ${real_group} | wc -l` -eq `find ${dir} | wc -l`",


Saturday, April 5, 2014

Book: Puppet Types and Providers


This is a rather specialist book, but worth reading for all those who use Puppet in a less-than-basic way.

It shows the structure of a Puppet type (resource) with simple and detailed example, so you get to understand all the possibilities of the language and what is going on under the hood.

Friday, April 4, 2014

Object Oriented Puppet

One of the most shocking aspects of working with Puppet is that it goes to a great length at providing a High Level Interface to Resources, but it provides literally no facility to abstract access to configuration values.

All is a hiera() and Hash/Array manipulation, from which to painfully extract subset of data with totally garbled and complex manipulations of the Hashes, Keys and Values, interspersed with some create_resources() to be able to cycle over a collection of homogeneous resources.

People who come from ANY Object Oriented, functional and fluent-interface programming languages, like Groovy or Java 8,  can only scream in horror in front of the total inelegance, un-refactorability, un-maintainability and lack of encapsulation of the Puppet DSL.

To this, add that YAML is not generally associated to a schema - hence you can't validate that you haven't broken your model somewhere in your hundred of YAML files - on per each host - and you have the mother of all Spaghetti Western Code.

For all these reasons, please Puppet Gods, heed my call, dump that pathetic DSL and adopt some OO language.

Thursday, April 3, 2014

More on UML Modelling with PlantUML

Here an excellent explanation of the different types of dependencies amongst classes.

Here are all the sort of relationships you can draw.
As a simple reminder, Composition, Aggregation, Dependency, Association are in decreasing order of "tight coupling" between 2 classes.

  • Composition = B cannot exist without A
  • Aggregation = B is a part of A
  • Dependency = change in B affects A
  • Association = very loose relationship

left to right direction
Class01 <|-- Class02 : Extension
Class001 "1" *-- "many" Class002 : contains (one to many)
Class03 *-- Class04  : Composition
Class05 o-- Class06 : Aggregation
Class07 .. Class08 : Dependency
Class09 -- Class10 : Association
Class11 <|.. Class12 : Implements
Class13 --> Class14: Unidirectional Association
Class15 ..> Class16: Unidirectional Dependency
Class19 *--> Class20: Unidirectional Composition
Class21 -- Class21: Reflexive Association

Wednesday, April 2, 2014

plantuml : quick UML diagrams (with Eclipse plugin available)

Follow installation instructions here:

you MUST install Grephvz 2.28 (NOT 2.30, it will not work)
I installed to C:\pierre\Graphviz 2.28\

Then you must declare the environment variable GRAPHVIZ_DOT=C:\pierre\Graphviz 2.28\bin\dot.exe

Then copy the  plantuml.jar to a folder c:\pierre\plantuml

Then open a new CMD window, cd c:\pierre\plantuml,  and run:
java -jar plantuml.jar -testdot 
It should show success. If not, scream.

At this point you can run "java -jar plantuml.jar" and if you place any .pu file in the c:\pierre\plantuml folder, it shall be converted to a png file.

try this:

Object <|-- ArrayList

you should get this:

Pretty simple.... but don't expect it to compete with a Rational Rose....

More on UML Class Diagrams: http://en.wikipedia.org/wiki/Class_diagram

Tuesday, April 1, 2014

JKS check expiration date

Use the -v option with the keytool -list command, and look at the "until" field:

keytool -keystore /opt/oracle/certs/acme.com.jks -v -list

Alias name: acme.com
Creation date: Jun 5, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Owner: CN=acme.com, O=acme acme SA, L=Paperopoli, ST=Duckland, C=DU
Issuer: CN=acme Issuing CA 01, DC=acme, DC=com
Serial number: 1fe97622099100001948
Valid from: Mon May 13 13:46:49 CEST 2013 until: Thu Apr 11 13:46:49 CEST 2015
Certificate fingerprints:
         MD5:  2B:97:58:CA:35:18:38:AA:BB:2D:C4:BA:81:56:AD:1E
         SHA1: E4:0D:DD:EE:1F:3E:2B:F7:07:FE:CC:C2:F2:55:05:E6:74:98:26:2A
         Signature algorithm name: SHA1withRSA
         Version: 3