archivio

life

Nel momento in cui comincia ad avvicinarsi, un guerriero della luce riconosce il Cammino.

Ogni pietra, ogni curva, gli danno il benvenuto.

Egli si identifica con le montagne e i corsi d’acqua, scorge parte della propria anima nelle piante, negli animali e negli uccelli della campagna.

Allora, accettando l’aiuto di Dio e dei Suoi segnali, si lascia condurre dalla propria Leggenda Personale verso le incombenze che la vita gli riserva.

Alcune sere non ha un posto dove dormire, altre soffre d’insonnia. “Questo è coerente“, pensa il guerriero, “Sono io che ho deciso di procedere lungo questa strada“.

In questa frase è riassunto tutto il suo Potere. Egli ha scelto la strada che sta percorrendo e non ha nulla da recriminare.

Paulo Coehlo

Grazie.

Annunci

No, I haven’t been living under a rock in the past months, it’s just that life came knock-knocking at my door and I’m happy with it! 🙂

Things to take care of, new things to do, new adventures in front of me! I will probably be somewhat offline or less present for still a while: I’m moving out of Italy, living with my girlfriend, starting a new job, learning a new language! A little bit scared, but excited nonetheless!

We’ll be living in France (well… she’s already there since this week, I’ll reach her at the end of May) in Antibes, a very cute city between Nice and Cannes in the Cote d’Azur region! Next to the sea! Closer to it than where I’m living right now!

I will be working for INRIA in Sophia-Antipolis on a two years contract: the project is very interesting and exciting, and everything runs on Ubuntu! I couldn’t ask for more! 🙂 It’s an European project that will be open-sourced (don’t know yet if under a GPL or an Apache license). They are building a P2P kind of social platform, using pretty cool technologies, and I’m looking forward to start working on it!

It’s is a little bit scaring leaving the place you grow up, your family, my little niece, your friends, your work, and start a new adventure also in such a short time (I found the job two weeks ago!), not knowing the language spoken there (I’m starting to study it, but luckily where I’ll be working they speak English!). Even if it’s not that far away from Italy, it’s a totally unknown place to me: new habits, a new culture to discover, new places and cities to visit… a new life to build!

It gives you strange sensations and feelings… a mixture of excitement, fear, and curiosity, something that you are eager to do, eager to start… something to you look at in some sort of awe, but you so want to start it that the happiness of all of this is overwhelming! It gives you excitement, and adrenaline that you can’t even sleep at night, thinking about things to do, things to buy, stuff to move; thinking about the new job, the new house, the new life…

I will need a little bit of time to settle down as soon as I reach my new place, but i will be back, more excited than ever! 🙂

PS: any Gnome/Ubuntu users from Antibes? Wouldn’t mind having a beer or two sometimes! 😉

PPS: know any French teacher in Antibes or a cool place where to learn French? Apart for practicing it as much as you can by yourself with the local people 🙂

Wow, I haven’t update this blog since November… long time ago!

I have to say to work has pretty much sucked up my life: have been very busy there (and probably will be more in the future). The cool part is that I have been working with different technologies, most of them unfortunately had to deal with Windows, some of them with both Windows and Linux, but it has been fun.

I’ve been playing around with JNA (Java Native Access), a bridge between the JVM and the underlying operating system: like JNI, but easier to use since what you only need to write is Java code. It all started with the problem of killing a process tree in Windows having only the root process PID: Windows, unlike Linux, will kill only that process PID, and the rest of the tree will be detached from where it was, staying alive.

The old way of killing a Windows process in our software was achieved with some kind of ActiveX magic (voodoo-poison, I say) and the use of the small Windows utility taskkill. Moving to use Windows functions to create processes, taskkill couldn’t be used anymore: what I experienced were strange behaviors (not always killing all the processes), and also lots of BSOD (still don’t know the exact cause, but removing the use of taskkill resolved the issue). Finding a way to kill a process tree in Windows has been a hard task: looking into MSDN is kind of a mystic experience. I find it a mess. But as always, when you find the solution to your problem, you find it easy and wonder why you didn’t think first about that.

So, to sum it up, if you need to create a process that spawns other processes, and you need to kill that process tree, these are the Windows functions from the kernel32.dll I used:

There are other things it is necessary to take into account, like the creation of the necessary structures, but basically you need to create a job object, create the process and attach it to the job object, and when it’s necessary, terminate the job object. All of this has been done with JNA, writing only Java, and is pretty robust: I tested it on a remote computer for 7 continuous days, creating and killing more than 500000 processes in batch of 4-5 processes at a time, processes that didn’t last more than 5-6 seconds (I even tested it for 3 days with 2-3 hours long processes).

An interesting part has been finding a way to check if a process was still alive, or had completed its run or had already been killed. The first implementation for this was using GetHandleProcessCount. Basically this functions checks how many handles a Windows process still has open, but with such many processes being created in a short timespan, I experienced OutOfMemory exceptions in the JVM (probably caused by many JNA Pointer objects being created and not cleaned up in time by the GC, but I didn’t investigate the cause). The solution has been using the WaitForSingleObject function, monitoring its return state. I only hope the API will not change with some of the too many Windows updates…

Now I’m playing with some really cool stuff: numpy and scipy. I’m trying to “embed” Python into our software, or at least to use numpy and scipy libraries and routines to avoid having to write complex mathematical algorithms when there are already valid and strong ones out there, and also to be able to write internal routines in an easier way with Python. I’m running some comparative tests right now (my computer at the office is still running): I’m trying to see if the same algorithm written in Java is slower or faster than the numpy/scipy internal functions. Right now I’m doing 1500 iterations over square matrices ranging from 10×10 to 700×700 calculating the determinant, and tomorrow I’ll implement the inverse of the matrix. Right now, looks like numpy is faster than Java on matrices from 150×150 and up.

Funny times ahead… also because on March 19th I’ll be heading to Chicago for the Desktop Help Summit with Shaun, Paul, Jim and other cool guys! Looking forward to that!