2016-11-20 18:36:13 - We like cherries, but don't cherry pick

Disclaimer: If you are reading this and know enough git to already know what "we are talking about", then just don't read this post. It is not written for expert users that know exactly what they are doing. In the end you probably read a manual about git, so all of this does not apply to you. Instead this is just a wise advice got from hard earned experience.

If you like me come from CVS background, passing by SVN and then to the nowadays ubiquitous git, it may happen, for the sake of making it fast and being "more" productive, that you forgot about actually reading a git manual.

You may have naïvely taken up the commands, maybe after passing from the similar monotone, and started using git quite daily, doing mostly all the unfancy operations you need to do for your routine.

Then a day, with the CVS/SVN paradigm still set in the stone of your mind, you discover the super-wonderful-most-uber-feature(-for-ex-svn-users) of git: cherry pick. To a CVS/SVN brain this looks wonderful, it is basically a patch on steroids: you can pick a single commit from a branch and apply it to another branch. If you love developing features in branches and switch often from one to another this feature may look very handy because it allows you to "migrate" a single "changeset"/"patch" from one branch to another in case you need it.

E.g. Let's say you have branch A and B, and that you fix something in A. At a latter time you see that you want that fix also in B because your latest B-feature is somehow related or dependent on that fix. From what we said above you would just cherry pick the commit with the fix from A and apply it to B. Don't do that. It is bad. If you are not a curious person. You have done. Stop reading this and just don't do that thing.

You are going on reading now. Let's say you did not trust me and did *it* anyway. What happens now is simple, you start to use that lovely feature more than once in the next 2-3 days. All fine and happy. You still think that manuals are for newbies, but trust me it will take only 2-3 more days of work for totally regretting your thinking, your life and your inner (too proud) self.

Indeed one day you decide to merge branch A and B. Then you run your tests and bang, nothing works or, even worse, everything works (for some time). Now what has happened? If you looks at the code you will see that, if git did its job well, all the lines that were in the changeset/commit that you cherry picked will appear twice in the source code. But why? Very simple: if you had read git manual about cherry pick you would have noticed that git will yes apply your changes, but it will do that as a new changeset! And by "new" I mean new!

This "new"-changeset effect shows up when you merge the two branches. Indeed the same modification is present both in branch A, as the first time you did it, and in branch B again from when you cherry picked it and it got assigned a new hash.

Why is git cloning the code? Actually git is very smart and it is doing exactly what it should do. Indeed when it sees that some code is there and it is from different changesets it will be smart and think "Hey even if it's the same code I should put it in twice cause it's from different commits". Notice that this case is actually a true use case: think about a list where you add items and later on you add another item that is the same as one you added before. The right thing to do is indeed to add it twice! Because they are from different commits. SVN was not that smart sadly and may raise a conflict or do the wrong thing. Git is smart. It is following its manual.

So do not use cherry pick if you plan to ever merge the branch from which you are cherry picking with the one you are picking to. By extension, since others may not know that you have cherry picked a commit from a branch, do not share branches from which you cherry picked, that will avoid other devs headaches. Thanks, please don't.

Remember that the best devs:
1) Read manuals before doing. (e.g. Hans Raiser)
2) Cause a few problems to other devs.
3) Talk and share what you do with others in your dev team!

Best Regards,
Gabriele Dini Ciacci

2016-10-30 22:45:37 - SSD Over-provisioning using hdparm

Hello all,

just a fast post after my usual years of inactivity here. So that I just remember what I did myself.

Let's say that you found a decent SSD that is *not* consumer grade, so you did not look the price of it, but the specs. You also managed to understand that the numbers in the specs reported for SSD for consumers and enterprise are different and that you cannot compare them directly.

Ok, now 2016, you found a reasonably priced SSD for your workstation. You learn by reading around that if you over-provision that SSD, manually, a little more than what marketing guys forced engineers to do, you will get a really reliable and fast drive. After some research, that is it, 20% will double the life of the product (remember write amplification). This is a safe estimate as the drive is already over-provisioned, but just to be sure, we stick to that number.

Now there is already a very good guide you can follow for this procedure:
(no, I did not try their hosting services, we are hosting somewhere else, but the article is well written).
There is only a small detail missing there. How do I pick the right number of sectors?

Yes, we want roughly to save 20% of them, but exactly how many?

Here it comes some math. The examples are for my drive.

# hdparm -N /dev/sda

max sectors = 234441648/234441648, HPA is disabled

As you see my drive has 234441648 sectors that makes up (multiply by 512):
234441648*512 = 120034123776 bytes
Now start octave (or your favorite open source tool for calculations) and factor the sector count:

octave:1> factor(234441648)
ans =

2 2 2 2 3 3 3 7 77527

As you can see that is realistically the layout of the sectors on the disk, so to my guess here is that they are arrays of 77527*512 = 39693824 bytes chips.

Now what you want to do is to take out a multiple of a single chip, not half of it! This is the just smart in case the whole chip dies or wears out, instead of just a sector.

So what we want is to remove multiples of 77527 until when we have left about 20% of extra sectors (the percentage being relative to the number of sectors you will *use* not the total number you have, including the extra ones, i.e. like when you calculate VAT). Consequently we want to remove about 234441648/1.2*0.2 =~ 39073608 sectors. To round it so that it is a nice multiple of the hdd structure we can use the factorization we got before. Playing a bit with the factors you get some choices to respect the layout:
77527 * 7 * 3 * 3 * 3 * 2 = 29305206
77527 * 7 * 3 * 3 * 2 * 2 * 2 = 39073608 (how "lucky" we are)
77527 * 7 * 3 * 2 * 2 * 2 * 2 * 2 = 52098144
77527 * 7 * 3 * 3 * 3 * 2 * 2 = 58610412

You can pick the number you like more. I like the 2nd. In general if you are on an enterprise drive, even entry level, you can take the number below your target, trusting the manufacturer (Intel in this case) that he has already done enough over-provisioning (by our guess [3], about 15000000 sectors in this case, so we could easily reach our target of 20% over-provisioning by picking the lower number). If you are doing this on a consumer drive, take the *larger* number, or better even larger.

Now you have your sector count to feed to hdparm, just take the total sector count and subtract what you picked from the above calculation:
234441648 - 39073608 = 195368040 sectors
195368040 * 512 = 100028436480 bytes (~ 100 Gb)

That's it, it will for sure have at least 20% free sectors.

So the final command is:

# hdparm -Np195368040 /dev/sda

setting max visible sectors to 195368040 (permanent)
Use of -Nnnnnn is VERY DANGEROUS.
You have requested reducing the apparent size of the drive.
This is a BAD idea, and can easily destroy all of the drive's contents.
Please supply the --yes-i-know-what-i-am-doing flag if you really want this.
Program aborted.

If you are sure, give it the --yes-i-know-what-i-am-doing extra option. And believe me, if you are reading this, you do not ;)

# hdparm -Np195368040 --yes-i-know-what-i-am-doing /dev/sda

setting max visible sectors to 195368040 (permanent)
max sectors = 195368040/234441648, HPA is enabled

Congrats, you have done.


1) The drive I like is an entry level enterprise SSD from intel, the S3510 . It is hence marketed for 120 Gb, and likely the consumer version shares the same chips and is marketed as 128 Gb (the enterprise version has extra features also). That gives us a minimum of 8Gb of extra space/sectors above what Intel gives to consumers.

2) Notice that of the same drive series/model, drives with largest size, or just a notch under it, tend to have larger percentage of over-provisioned sectors.

3) As you can imagine the sector count above matching is not luck.

4) Remember to power up your enterprise SSD at least once every 3 months and your consumer drives at least once in a year. If they are worn out drives, do that more often. Do not use SSD as log term off-line storage. Not a matter of over-provisioning (even if it will help also in this regard, as worn out sectors will hold their state less longer). Watch out also storage temperature (write in a hot environment and store in a cold one).

Best Regards,
Gabriele Dini Ciacci

2012-10-31 23:38:45 - Updated umesh2dgui (and happy Halloween)

Thanks to the great stimulty that my professor L.P. Quartapelle is always able to bestow upon me, I made a new release of umesh2dgui.

We finally reached 0.4.3, and that includes the solver for Helmholtz problem that I worked on so much some time ago. Solution visualization is not yet too great, as it will cheat on you and you will not notice well when a solution is oscillating (notice that there is no stabilization in the solver).

On the other side of things the program is nice to toy with if you are a student of fluid dynamics and it is quite simple to use.

Compilation on a recent version of debian should not be a problem as all libraries, apart fltk2, are included in the disto repository. The only sad library is fparser. Fparser has been recently revomed from debian, so you will have to get it also by hand. I will follow the same policy and move the next version to use muparser. So this is the last release to use fparser library.

Last but lot least: Happy Halloween!

Best Regards,
Gabriele Dini Ciacci

2012-06-20 00:52:39 - Why dolphin upgrades downgrades?

Not a real piece of a news, just a minor post that someone may find useful if they upgrade to Dolphin 2.0 and Kde 4.8.3 (that will happen in those days if you are a Debian unstable user).

A program that I really like is Dolphin. It is really a great file manager and I enjoy it much of the time. It has only one problem. Each time they make a new version it "downgrades". What I mean? Simple, it becomes more idiotic, with new version having less options instead of more, forcing you to do something in a way they decide for you. In some sense it becomes more Mac-like.

Time ago it lost the ability to have more than one "Places"... and it has not recovered yet... you can either have one "Places icon" on the side of the breadcrumb or one "big" open, but not both. I naturally liked having both...

This time it's the treeview that has become a dogma. The treeview is that lot of "+" signs on the side of directory names that allows you to "open" dictories and see them like a tree. Great if you like it! I don't... There used to be a simple option tick in Settings -> Configure Dolphin -> View Modes -> Details called "Expandable folders", but in this particualr version it's gone... sigh :(

Ok, now let's fix it. It is rather easy. Open .kde/share/config/dolphinrc in your home folder and then add:


that will make the damn treeview go away. Neat and easy... and my eyes can relax without seeing all those "+" everywhere.

If you want to read the whole story of how Peter Penz removed this option thinking he was the new Steve Jobs (so he can decide for all the users) you can read it here:

ppenz gave a great contribution to dolphin with the new view. But he really did it off with this move and expecially with the replies in the above bug report. People should never forget humility.

2012-03-26 12:11:15 - So much, so much, so much! Time!

After so much time e nearly feel very stupid to do a post...

The reason is that I actually think it *is* that stupid! But I really want to give this thing some visibility, cause I lost a week end on it and I would really like all Nokia N900 users to be happy and understand how cool is their phone and how much stuff they can do with it if they are a bit geeky about it!

So what I did that made me so happy? I did a very basic stuff. I finally managed to sync my contacts and my agenda on my N900, and what? I did it in a "not too hacky way"... so no custom scripts or code or anything that a "end user" can't do.

This "wonder" is achieved by using syncML and some glue from syncEvolution that allows Horde and the N900 calendar app to communicate.

You can find the HowTo on maemo wiki here:

Hope this will help someone to sync their phone in 5 mins instead of 6 hours like for me :)

Best Regards,
Gabriele Dini Ciacci

2008-12-24 16:33:11 - And so this is Christmas

And so this is Christmas
The time where I code
And what have we done
I released a new version
Another year over
Not yet, don't run too much
And a new one just begun
I still have to drive 500 km before the new year starts, please..
And so happy Christmas
Mmm.. let's say version is 0.4.1
I hope you have fun
Considering I will have to rewrite most of the code...
The near and the dear one
Ho, btw, the program is umesh2dgui
The old and the young
Now, and the last 3 Xmases I worked on this

Actually this new umesh2dgui version is a big piece of a news, cause it includes the umesh2d mesher, making it finally a complete suit for generating a 2d mesh.

I admit it's not as pretty as I would like it to be, but it works. Indeed next release will be aimed to add features for usability, but those requires major code cleanup, so that is all what will happen till the next release.

I wish everyone my best Christmas Wishes and hope you enjoy.

Best Regards
Gabriele Dini Ciacci

2008-02-26 10:26:32 - About pizzas, movies, and other false propaganda...

If I'm taking the microphone to speak to you today², it is because the previous news entry was obviously a feeble attempt to twist facts to fill darkschneider's own hidden agenda. So my own conscience is now forcing me to correct those, so that the Faithful Reader(tm) can get an objective picture of the events.

Let's have a short look at what he said, and answer them step-by-step:

Life is marvelous, you never know where it brings you!
Lie ! Of course you did know ! It was written on your plane ticket ! Do not try to fool the Faithful Reader(tm) like that - you *knew* what to expect.

A day you leave from your city to meet a friend, with the excuse of an Open Source meeting
That was not an excuse. But we never really managed to see much of the Open Source meeting for sure.
Ok, it is true that common wisdom tells you to always rely on local guides to find your way through mountain passes or, in our case, through the Brussel's public transport system. I didn't, listening instead to the devious advices of an italian foreigner. "All paths lead to Roma", they say - but I guess most of them are going far away from the FOSDEM.

and next you find yourself in a car, back from a cinema where you just looked a french movie without knowing a single french word.
Ok, ok, that one is *mostly* correct. Though Gabriele failed (purposedly, I'm sure) to mention that the movie was "Jumpers", a kind of pseudoscientifical world conspiracy tale that hardly needed any linguistic knowledge to be understood (the plot is much simpler than, say, your average Tex Avery short anime). Moreover, a significant part of the action takes place in Italy, with French dubbers of American actors making a huge effort to sound like genuine italian lads speaking.

Then, suddently, you say "I'm hungry"
One thing the Faithful Reader(tm) needs to know is that Charleroi is not much that of a touristic place (except if you are interested by industrial ruins...). Saying "I'm hungry" at 23:30 there is like spilling water on the ground in the middle of a Saharian encampment, and you can expect the same terrified, puzzled looks directed at you.

and you find yourself in a Libanese pizza night shop, that does not list "margherita" on his menu and it sells pizzas shaped like a Roman trireme...
The Libanese status of the pizzeria is a sketchy point - it is more exact to say that it is a Turkish pizzeria held by Libanese people; but given that Liban was under the rulership of the Ottoman Empire until 1918, this is ok.
Regarding Margherita's listing, my bet is that it is indeed on the menu, but given that most names were not translated from Libanese (Turkish ?), it is hard to tell.
Finally, the triremes are probably a rememberance of the boats of the Turkish fleet that fought the Christian forces at Lepante. That, or the Pizzaiolo never learned to make round bases for his pizzas.

and you feel lucky! Because you have avoided "Fried Feddy", that only god knows what it is... I Just love life.
It is "Robert". And that guy makes the best Belgian fries one can find (that is, when he isn't in jail for being accused of having poisoned another customer).

Now, Faithful Reader(tm), you know all the Truth. So be careful when reading news there, always keep a sketpical eye on everything, and watch out for other "Voice-of-the-Truth Gros" entries in the future.

Have fun !

²: Could you even imagine a guy like Castro *typing* ? Neither can I, so for the sake of my own self-image, we'll say I'm using a microphone.

2008-02-23 00:10:05 - Libanese pizza with an Italian at Charleroi

Life is marvelous, you never know where it brings you! A day you leave from your city to meet a friend, with the excuse of an Open Source meeting, and next you find yourself in a car, back from a cinema where you just looked a french movie without knowing a single french word.
Then, suddently, you say "I'm hungry", and you find yourself in a Libanese pizza night shop, that does not list "margherita" on his menu and it sells pizzas shaped like a Roman trireme... and you feel lucky! Because you have avoided "Fried Feddy", that only god knows what it is... I Just love life.

This is just my "today" in Belgium, after chocolate, a good entrecote and a beer.

Best Regards
Gabriele Dini Ciacci

2008-02-17 00:57:33 - Another new feature!

Tonight, independently by my headache, I managed to add the delete news feature. Now users can delete the news they post from the edit page.
I also coded a pop up javascript confirmation dialog, just to be sure to not miss click on a news and delete it... that would be nasty.

The next feature to code is quite a boring one, it is the caching of news, that is needed to avoid the server to have to "HTML-ize" the news each time, adding the needed HTML tags to make the news format nice.
This is indeed a costly operation, because the server has to parse all the news text while doing it.

If my morale is not enough high to go for a boring coding, I will add support for images in the news, that is nice coding, cause you can see a nice image that will show along with the new, and I have some great pics already to post.
Boring part is anyway around the corner, since, if for parsing some lines of text cache is just "optional", for serving images, it is nearly mandatory, if you do not want to end up with a very slow loading.

Will see if reason wins or if appearance will. Virtus is in the middle!

Best Regards,
Gabriele Dini Ciacci

2008-02-16 02:53:39 - New feature

Tonight I coded the edit feature. Now I should be able to correct all the typos that I normally do when writing, so, if you find a typo, do not hesitate to write me, so I can try my edit news feature!

The code took about 1 hour of planning and 2 hours for deployment. A news delete feature is still missing, but that is probably a matter of 30 more minutes. Indeed that feature can be just added by extending the edit code, what needs to be double checked is that it is secure, but you never know, since I do not have enough experience to code "mostly safe" PHP yet.

Best Regards,
Gabriele Dini Ciacci

2008-02-14 15:07:38 - A nice test News

Finally I found time to update this site.
I did this because I needed to improve my PHP and MySQL knowledge, so I coded the login engine and this new news engine. Now I'm able to post news directly online, without editing and uploading the HTML files.
While this is not an uncommon feature, it is anyway nice that I managed to code it from scratch, it was very funny. Until now the work took about 10 hours, split like 2 hours for login, 4 hours of planning and 4 hours for the news engine.

For the future I plan to add editing of posted news, online user registration with email confirmation, image upload for a news and an image upload page for registered users.
The list is quite big and will take lot of time, I am really sure I will not find time to make all this stuff, but you never know...

If someone needs this code, I can haply share it under GPL v2 license. Also if someone needs hosting I offer a nice hosting with shell access, site and database for a real cheap price.

On the umesh2dgui side, some work has been done, but I did not released a new version yet.
When a new version will come it will most probably contain the finished mesh visualization, that code just need touch-ups. Indeed umesh2dgui is finally able not only to help you in the mesh definition but after the mesh generation to show you the output, so literally removing the need to use mtvplot, that is unmaintained and not widely available as it is supposed to be.

Best Regards,
Gabriele Dini Ciacci

24-03-2005 - Code, Code, Code!
Life is always strange... I notice that it is greatly influenced by moods. Sometimes you are in the mood of doing something, sometimes not... Fact is that I am in a "good mood" time, so I am spending every minute of my spare time on something, especially one of my projects, umesh2dgui.
So surprisingly I have released another version of it, 0.3.6 and as previously announced it has one of the key features in it, closed object recognition. As a bonus the "Primitive Browser" feature got in too and I think that it is really a lovely addition for the end user.
Now umesh2dgui just miss one key feature so I think that with some more efforts we will soon see a new stable version, the 0.4.0, that will finally be really usable for production.
Salutes and happy Easter to everyone!
Gabriele Dini Ciacci
12-03-2005 - News, News, News!
Ha! Found time for an update. First reason that caused this update is that I worked on one of my project I host here, so that part of the site needed some new links and such so to make the most of I decided to post this news too.
First of all. No I did not had time to finish my story on the water cooling system, but I can say that the guy for whom I built it modified it to a "Mk II" version, taking out the evaporative tower and replacing it with a Seat Toledo radiator bought for 20 euros.
Second. I finally decided to not work on the RTai code for two main reason, one, it takes too much of my time, two, now it is not the rigth time to do it.
Third. I finished the work on the ducted prop fan for my university, it ended up with 2 nice thesis of my friends, but the results where not satisfactory. Moreover I had only marginal role in the work and that not enough to write an article.
Fourth. Mmm you still reading... so you are interested in the only real interesting news I may give here. Hold your breath....... naa that too much. Breath again. I have released a new version of umesh2dgui, it is naturally another development version numbered 0.3.5, but it has some quite nice polishing features I loved to add. Important is that the next feature will be the first of two key feature it miss. It will identify closed objects alone. So wait for 0.3.6 since it will be a good turning point for usability.
As a last note, I will say that I have some ideas for a new section, but it will be only for Italians, since it will hold all my didactic writings I do with LaTeX. Stay Tuned!
Gabriele Dini Ciacci
02-11-2003 - My first Rant
It took time to me to update this site, you know why?
Before opening the site (and paying the bills for it, by my personal money) I asked some friends if they where willing to help me to keep up a site where we can store some news and info on other peeps we think was worth to have a site but for some reason could not affront a one or was not able to make one by themself. Since they agreed to offer help and said "Wonderful idea!", I payed the space the registration and opened it.
None of them was seen again...
This was a bad way to discover that not many are willing to help others. Yeah they can do it, but only if it look for "free", but it is not. They long for a supreme thing a thing they cannot buy. Glory. Now what happens? Easy!. If this site starts to have success people will offer their help, even the same friends will probably come back here and provide what they should have provided time ago.
Now my question is "What to do?" accept their help and politely thank them or throw in their face the fact that they was away when I needed help.
Gabriele Dini Ciacci
01-11-2003 - Site updated!
After many days and many months finally I updated this site.
My idea now is to keep this updated with some news I feel important about myself, my family and the world that I have around, and yes, that is the same world you have around. Here I hope to find a place to post my rants, my thoughts and maybe some poetry things I like to write. Here I wish to particularly thank hoxu, he is a guy from an irc channel that helped me to design this site, answering my questions and expecialy convincing me that it needed an update, He told me to use css and not lot of php as I did before.
I cannot forgot I love php a lot.. I am C in my hearth (as my linux-wildo project show) but I have seen that there is other things you can use to make "art".
I wish to thank philc too from the same irc channel, that gave me artistical suggestions.
Gabriele Dini Ciacci
Valid HTML 4.01! Valid CSS! MSIE is evil