venerdì 3 agosto 2012

git: adding all untracked, modified and deleted files

This is a memento for the future.

To git add all the untracked, modified or deleted files files in a repository:
$ git status -s|awk '{ print $2 }'|xargs git add
To git reset HEAD all the previously staged files:
$ git status -s|awk '{ print $2 }'|xargs git reset HEAD

venerdì 15 luglio 2011

Recording streams with VLC and cron

Here a quick and dirty shell script that can be crontabbed to download your favorite streams from the web via VLC


#!/bin/bash
# arguments "Name_of_file" "stream_uri" "duration_in_minutes"

FILE="/tmp/$1_$(date +%F_%H:%M).avi"
vlc -I dummy --sout file/avi:$FILE $2 &
PID=$!
echo "kill -STOP $PID" | at now + $3 minutes


The stream will be saved in /tmp/ with the name provided and a timestamp.

lunedì 16 maggio 2011

MonoCov fixed

I recently fixed the build problems of MonoCov on mono 2.10 (should work with 2.8 too).

The build errors were due to the dropped glib debendency from the mono runtime, which was still needed by monocov.

Now I can test the code coverage of Epic's unit tests even on my beloved Debian workstation. :-D

Should you encounter problems with the coverage of properties do not forget to run the unit tests with the -O=-inline
argument, like this:

$ mono -O=-inline --debug --profile=monocov:outfile=/tmp/Epic.cov,+[Epic.Core] nunit.exe -run Epic.nunit

Indeed mono inlines simple proprieties to get better performances, so that to get the coverage information you have to disable inlining.

giovedì 27 gennaio 2011

Corporate fishes

An enterprise system is a system that supports the day to day operations of an enterprise or organization in real time.
Strong, D.M. & Volkoff, O. (2004) 'A roadmap for enterprise system implementation', Computer, 37 (6), pp. 22-29.

This is the best definition of enterprise system that I've ever found.

Keeping this definition in mind is strategic for design and development decisions.

But it is even more important for corporate managers that choose technological patners.

Recent experiences with Microsoft lead me to think that no bank, school or medical institute should base their own software infrastructure on such a big company.

No matter how cheap could seem their solutions: the time will come when they put your interests after their own. And then you'll pay a lot more than you saved before.

Banks are big fishes, in the world's economy.

But even big fishes should avoid to depend upon bigger ones.

Enterprise software's README

Here is the last diff between two released Readme.txt files of an module of an enterprise application.


The file contains an italian exclamation "pirla!" that means "you are dumb!".

It's the only module that have a README file.

Fortunately, Windows' users just click. They can't read! :-D

venerdì 31 dicembre 2010

How to move a partition's filesystem

Today my /usr/ partition has been overwhelmed by Texmaker required package.

I had to rapidly find a solution, but had no time to study how to redesign the lvm partition table.

Since I had and unused disk I installed system-config-lvm and created a new partition.

Than I had to find a way to move the /usr contents, preserving links and permissions.

This was the solution:
# mkdir /mnt/usr
# mount /dev/newlvm/partition /mnt/usr
# (cd /; tar cf - usr) | (cd /mnt; tar xf - )

The last line is a poem: it use a pipe between two tar commands, executed on different folders.
The first tar is executed in root and send to the standard output a backup of /usr.
The second tar is executed in /mnt and extract the backup it recieve from the standard output.

There is a great power in such a command.

venerdì 26 novembre 2010

Synthesis vs compromise

My job is all about complexity.

Designing and developing an enterprise application for a big bank, is a huge challenge.
It's all about understanding and solving concrete problems that are complex by nature, since they mix the human habits and needs with the rigidity of a software system.
You can't miss a word, neither when you write the code nor when you talk with customers and users.
You have to deeply understand both.

It happens that people requirements collide with developers' experience and habits.

In these cases, project managers, developers and architects brainstorms.
Such brainstorm are really similar to political talk-shows: many people talk, fews listen.

I'm actually both a developer and an architect, so I'm often required in such brainstorms.

During the last years I noticed that there are two different approaches to problems:
  1. serching compromises
  2. serching syntesis
The two always conflict.

Compromises are easier and faster to obtain: you only need to negotiate.

Synthesis are by far harder to achieve: everyone have to listen and understand the reasons of the others and to propose solution that others can endorse.

Compromises don't solve problems, but seem cheaper in the short term.
Synthesis avoid the problems, solving the human errors that lead to them, but are harder to get.

Recently we have a problem that has been approached with compromises: the agreement was taken in an hour by a project manager and an architect.
After 97 man/days of hard work we had to throw it all.
Than we tried to search a syntesis. It took 5 day for 5 people to understand the problem, the errors we did before and so on.

5 people brainstormed for 5 days.

After that 2 developers built the solution we defined. In a week.


It was an emblematic experience.

Most italian politics search compromises.
Compromises are cheaper: all they need is to keep their voter's consensus.
Moreover with compromises you can focus to ensure a practice of favouritism.

They forgot (when they know) our wonderful Constitution that states:
Each Member of Parliament represents the Nation and carries out his
duties without a binding mandate.
Art.67 of the Constitution of the Italian Republic

They should avoid compromises.
They should always search synthesis.
They should work for all italians, not only for their voters.

Political compromises clean your garden while your home burns.
May be you are looking the garden and vote them again, but you'll eventually have to go home.


On the other hand synthesis is always possible: we all have legitimate needs and egoistic pretensions.
By mortifing such pretensions you don't win elections but you find compatible needs.

But how to find politics that avoid compromises?
How to find men that works only for the common good?

A first step: don't allow anyone to run for parliament twice.