L’esperienza della politica

Ripenso spesso alla campagna elettorale che mi ha visto protagonista nel 2011 e la considero una esperienza magnifica. Tra le cose che non mi sono sfuggite sono quelle voci relative all’inesperienza del gruppo di cui facevo parte. Ritengo che tale voce sia corretta dal punto di vista logico ma molto carente dal punto di vista del contenuto. Accusiamo spesso la nostra classe politica di incapacità ma non permettiamo a nessuno di sostituirla perché “non hai esperienza”. Come fa uno a farsi l’esperienza?

Chi mi dice che il modo in cui hanno amministrato fino ad oggi sia quello corretto? Direi che i risultati parlano chiari. La classe politica attuale ha fallito a tutti i livelli, dal consiglio comunale, al consiglio di amministrazione della partecipata, al consiglio dei ministri. A questo punto, il fatto di non avere esperienza, è davvero una cosa così negativa? Magari grazie alla mia “inesperienza” posso vedere le cose da un punto di vista nuovo e probabilmente meno “clientelista”.

Sbaglio?

How can full-time telecommuters overcome feelings of isolation?

I’m working as full time telecommuters since 3 years and I periodically feel really uncomfortable with that (something that remembers a sine wave). Of course, isolation is the biggest issue that afflicts a telecommuter. I was reading some post on Internet about that a it seems to be an actual problem with many solutions, but anything that work for my small town.

Looking at this post on workplace.stackexchange.com and one of best solution was to search coworking places… in San Francisco :)

BTW, it seems to be really hard to explain to not IT people that telecommuting has some vexing cons…

Some fun pics about TC:



Tagged

Facebook: can we consider it a tailoring content platform?

I was looking at my Facebook home page and with complacency I seen I’m finally able to get my almost perfect online journal. Just hiding not important updates and liking the pages I am actually interested, I can be able to see all news that are tailored for me. Finally a gossip free web page without invasive advs.

Facebook can be used for this purpose btw the problem I see is be sure people near you understand you aren’t wasting your time with chat or stupid game :)

Tagged

How many calories are in a drink from STARBUCKS?

Another interesting post from I love Coffee. See the entire post here

I love Coffee

** or Second cup etc….

Get auto generated keys with JdbcTemplate

Sometime you need to get the auto generated key of last record inserted into a table. It is possible to use Interface JdbcTemplate() and KeyHolder interface; this sample has been tested with mySql DB and Spring 3.2:

final String sqlCommand = new String("INSERT INTO Template_request(title, descriptio) VALUES (?, ?)");
KeyHolder holder = new GeneratedKeyHolder();
 
getJdbcTemplate().update(new PreparedStatementCreator() {           
 
    @Override
    public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
        PreparedStatement ps = connection.prepareStatement(sqlCommand, Statement.RETURN_GENERATED_KEYS);
        ps.setString(1, templateRequest.getTitle());
        ps.setString(2, templateRequest.getDecription());        
        return ps;
    }
}, holder);
 
Long request_id = holder.getKey().longValue();

This is the definition of Template_request table:

DROP TABLE IF EXISTS `Template_request`;
CREATE TABLE Template_request
(
    id_templaterequest	INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    title				VARCHAR(256) NOT NULL,
    description			VARCHAR(2048),
    date_uprec 			TIMESTAMP DEFAULT now() ON UPDATE now(),
    CONSTRAINT PK_Template_request PRIMARY KEY (id_templaterequest)
);

interface KeyHolder
Interface for retrieving keys, typically used for auto-generated keys as potentially returned by JDBC insert statements.
Implementations of this interface can hold any number of keys. In the general case, the keys are returned as a List containing one Map for each row of keys.

Most applications only use on key per row and process only one row at a time in an insert statement. In these cases, just call getKey to retrieve the key. The returned value is a Number here, which is the usual type for auto-generated keys.

public class JdbcTemplate extends JdbcAccessor implements JdbcOperations
This is the central class in the JDBC core package. It simplifies the use of JDBC and helps to avoid common errors. It executes core JDBC workflow, leaving application code to provide SQL and extract results. This class executes SQL queries or updates, initiating iteration over ResultSets and catching JDBC exceptions and translating them to the generic, more informative exception hierarchy defined in the org.springframework.dao package.
Code using this class need only implement callback interfaces, giving them a clearly defined contract. The PreparedStatementCreator callback interface creates a prepared statement given a Connection, providing SQL and any necessary parameters. The ResultSetExtractor interface extracts values from a ResultSet. See also PreparedStatementSetter and RowMapper for two popular alternative callback interfaces.

Can be used within a service implementation via direct instantiation with a DataSource reference, or get prepared in an application context and given to services as bean reference. Note: The DataSource should always be configured as a bean in the application context, in the first case given to the service directly, in the second case to the prepared template.

Because this class is parameterizable by the callback interfaces and the SQLExceptionTranslator interface, there should be no need to subclass it.

All SQL operations performed by this class are logged at debug level, using “org.springframework.jdbc.core.JdbcTemplate” as log category.

Make jquery function run on page load

Load jQuery when the HTML document is loaded:

$(document).ready(function() {
	// business code
});

Load jQuery when all the images on a page have also loaded:

$(window).load(function() {
    // business code
});
Tagged

Installing Parallels Tools in Linux Virtual Machine

Sometime happens you need to manually mount the cdrom to be able to install the Parallels Tools. Follow these instructions to do that:

1) Start the virtual machine. When the guest OS boots up, choose Install Parallels Tools from the Virtual Machine menu.

At this point, the prl-tools-lin.iso image file will be connected to the virtual machine’s CD/DVD drive.

2) Start a terminal in your Linux guest OS. Type the following command to gain the root privileges:

sudo su -

3) ount the Parallels Tools installation disc image, enter the following:

mount -o exec /dev/cdrom /media/cdrom

Note: /dev/cdrom is the virtual machine’s CD/DVD drive and /media/cdrom is the mount point for this device. In some of the Linux operating systems the virtual CD/DVD drive may appear as /dev/hdb and the mount point /mnt/cdrom. Some Linux OSs do not have the CD/DVD drive mount point. In this case, you should create the mount point directory manually.

4) When the installation disc image is mounted, change the directory to the CD/DVD drive directory using

cd /media/cdrom/

In the CD/DVD drive directory, enter the following to launch Parallels Tools installation:

./install

Note: You must have the root privileges to run this command.

Follow the Parallels Tools Installer instructions to complete the installation.

Tagged

Round art of π, φ, and e

Progression and transition for the first 10,000 digits of π. Created with Circos.

Look at that pictures and check how it has be done here

Back in Toronto (3rd)

Here we are, back in Toronto for the third time, first time in winter. This city is really impressive, never seen something similar in North America (I guess New York it’s more or less similar). The City of Toronto is working on the extension of the northwest PATH* that will provide guests with additional connections to the world’s largest underground shopping complex.

Two things (except the Path) impressed me: the people is really nice and ready to help you every time you should be in pain and the number of food shops.

* PATH is downtown Toronto’s underground walkway linking 30 kilometres of shopping, services and entertainment. Follow PATH and you’ll reach your downtown destination easily in weatherproof comfort.

Tagged