Tuesday, November 17, 2009

Via col vento

Devono intervenire i francesi per spiegarmi cosa succede nella mia nazione?

Non faccio di ogni erba un fascio, ma credo proprio che anche qui, in Sardegna, sussista il fenomeno descritto nell'articolo di Le Monde... dopotutto, per quel che ci pare, siamo italiani anche noi.

E poichè mi pare brutto evidenziare solo le cose meno belle dell'eolico (che poi, a conti fatti, l'articolo di Le Monde parla delle cose cattive di chi l'eolico lo fa, e male) vorrei proporre un'altra interessante lettura.

Ergo, alla fine della favola: l'eolico fatto bene SI; quello fatto solo per speculare, NO. Punto.

Tuesday, September 22, 2009

What if

What if... 
Firefox would let you start different browser profiles:
  • Light, for super-fast web browsing, with only the extensions you need to turn the web upside-down in the minimum amount of time
  • Work, surfing with all the tools you need to accomplish your duties in half the time
  • Developer, the fox you are used to when it comes to play hard with code (and not to mention the add-ons that make it simple writing it...)
  • ... other profiles, that you create on your own and share with your friends

What if...
Firefox could start these different profiles all at once, in different processes, for the best performance.

What if...
Firefox would let the different profiles seamlessly communicate one with the other, moving tabs from Light to Work and then to Developer and viceversa.

What if...
Firefox will be like this.
There will still be room for a different browser in your dreams?

Luca is behind some of these ideas. Thanks!

Sunday, September 13, 2009

Blog redesign

I spent 3-4 hours redesigning this blog. Thanks for the "fleur" template to J. Maloney and Blogcrowds.
Let me know if you like it.

Friday, September 11, 2009

MySQL foreign keys (MySQL Error Nr. 1005)

12-09-2009 - 12:00
UPDATE:
Well, it seems to me that this topic deserves some more attention, so I'm going to investigate it thoroughly.
From this page I found that:
a table [...] must have indexes on the referenced keys. If these are not satisfied [read: "if they are not present for those keys"], MySQL returns error number 1005 and refers to error 150 in the error message.

More in detail, in the rest of the update I'm assuming the following command (as it is reported on the same page I linked above) as reference:
[CONSTRAINT [symbol]] FOREIGN KEY
 [index_name] (index_col_name, ...)
 REFERENCES tbl_name (index_col_name,...)
 [ON DELETE reference_option]
 [ON UPDATE reference_option]

@Dhruva Sagar: I think you were talking about this one:
If the CONSTRAINT symbol clause is given, the symbol value must be unique in the database. If the clause is not given, InnoDB creates the name automatically.

@payal: Check this (same page as above...):
InnoDB supports foreign key references within a table. In these cases, “child table records” really refers to dependent records within the same table.

Furthermore I suggest using the following command to check when errors occur: SHOW ENGINE INNODB STATUS, which displays a detailed explanation of the most recent foreign key error in the server.
I'm trying to replicate this error today; I'll drop you the results as soon as I can.


----------------- old updates -----------------

27-08-2007 - 10:08 (OLD UPDATE!!!)

UPDATE:
It seems the problem is caused by the "ON UPDATE" and "ON DELETE" clauses: they have to be set to the same policy, i.e. you have to write "ADD CONSTRAINT 'new_fk_constraint' FOREIGN KEY 'new_fk_constraint' ('fieldA1') REFERENCES 'tableB' ('fieldB2') ON DELETE RESTRICT ON UPDATE RESTRICT" or "ON DELETE UPDATE ON UPDATE UPDATE", while "ON DELETE SET NULL ON UPDATE RESTRICT" won't work.
Indexes are not the cause of the problem: when you create a foreign key an index for the field involved on the foreign key is automatically created by the MySQL environment, so you don't need to manually create it before adding the foreign key (read: "Bull-Shit at 09:41, Good-Shit at 10:08").

27-08-2007 - 09:41 (OLD UPDATE!!!)
If you want to place a foreign key from field 1 on table A to field 2 on table B, first of all you need to create an index for the field 1 on table A.
If you don't create the index before attempting to create the foreign key you are likely to be stopped by the error "MySQL Error Nr. 1005- Can't create table...".

I experienced this situation while using InnoDB.

Monday, August 31, 2009

How to save an XML file in Java and Eclipse

One problem I faced today was saving the content of an XML document (org.w3c.dom.Document) to a newly created file.
The file I was outputting to was an Eclipse abstraction (precisely org.eclipse.core.resources.IFile) of a regular one and the method offered by this IFile for setting its contents is "IFile.setContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor)".
I needed to bridge the gap between that org.w3c.dom.Document and the InputStream required by "IFile.setContents()", and here's the way I did it:
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

try
{
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();

transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");

PrintWriter writer =
new PrintWriter(outputStream);

transformer.transform(new DOMSource(document),
new XMLWriter(writer).toXMLResult());

writer.flush();
}
catch (TransformerConfigurationException exc)
{
// DEBUG
exc.printStackTrace();
}
catch (TransformerException exc)
{
// DEBUG
exc.printStackTrace();
}
InputStream source = new ByteArrayInputStream(outputStream.toByteArray());

The main classes being used here are from package "javax.xml.transform", with the method "Transformer.transform(javax.xml.transform.dom.Source source, Result result)" basically taking care of all the stuff.

I'm going to package this one into a library called "LifeSavingUtilities"...

Friday, July 17, 2009

Copy-right?

The "new" Italia.it is tragicomically "inspired" to Spain.info.

Warning: I'm Italian, despite our current prime minister and the Italian people that vote for him.

Copy-right?

Il "nuovo" Italia.it è spudoratamente copiato dal suo omologo spagnolo, Spain.info.

Esiste una parola nella nostra lingua per esprimere cosa penso di Italia.it: "tragicommedia"

Tuesday, July 14, 2009

Oggi sciopero



Sveglia gente!



P.S.
Tornerò... non appena finisco tutta la roba che c'è da fare, tornerò.

Wednesday, May 13, 2009

La ricerca (della felicità e) del lavoro

Una mia amica cerca un buon lavoro qui in Sardegna.
Attualmente vive e lavora a Milano (Blulabs e SISAL) ma vorrebbe tornare dalle nostre parti. Se qualcuno avesse notizia di un'opportunità lavorativa per lei non esiti a contattarmi al mio indirizzo di posta (o, per i fortunati che lo hanno, al mio numero di cellulare).

Qualche informazione professionale su di lei:
  • Laurata nel 2007 a Sassari nella Facoltà di Economia, con indirizzo in Nuove Tecnologie
  • Nel 2008 ha partecipato al Master in Marketing & Comunicazione proposto dalla Facoltà di Economia di Torino
  • Stage del Master svolto a Torino nell'Area Web di Alpitour (lancio del sito e-mall, analisi di mercato e comparazione con i competitor, cura di alcuni aspetti del sito come l'inserimento testi e la comunicazione mediante l'utilizzo della piattaforma Documentum, un po di SEO con successiva verifica del raggiungimento degli obiettivi della campagna, scelta delle keywords e delle creatività per il lancio di alcune campagne google con l'utilizzo di Google AdSense)
  • Esperienze all'estero: Progetto Erasmus svolto a Valencia, due mesi e mezzo ad Amsterdam (dove ha maturato un buon inglese) 

Fatemi sapere, grazie.

Monday, April 6, 2009

Monday, March 30, 2009

PD 2009 Professional Edition

Franceschini somiglia a Bill Gates (e viceversa).

Non ho ancora capito se sperare che sia una coincidenza o il contrario.

Friday, March 20, 2009

Laboratorio analisi paralizzato

Gli effetti del cambio di giunta nella Regione Sardegna cominciano a farsi sentire. Per non meglio specificati "problemi" che sembrano affliggere la rete della Regione il laboratorio analisi del Policlinico Universitario di Monserrato stamattina non ha potuto effettuare analisi per le persone che stavano li ad aspettare.

Sembrerebbe che sia stato anche richiesto l'intervento delle Forze dell'Ordine (che ci scappi qualche denuncia?).

Immagino che il Signorino Cappellacci abbia già iniziato a smontare le cose buone che erano state fatte dal suo predecessore...

A chi mi accuserà di paranoia ci tengo a ricordare che "a pensar male a volte si fa torto, ma spesso [quasi sempre nell'italietta odierna N.d.A.] ci si azzecca".

Come

Monday, March 2, 2009

L'Italia sta tornando fascista

A volte le cose vanno chiamate con il loro nome: http://www.inviatospeciale.com/2009/03/litalia-sta-tornando-fascista

Roberto Barbera espone quella che è una verità limpida come acqua di fonte: in Italia sta tornando il fascismo che, pur se impostoci in modo diverso, sempre fascismo rimane.

Mi permetto di citare un concetto molto importante esposto nell'articolo del Barbera:

Si guardino con attenzione alcuni telegiornali, che cominciano con un incidente stradale, passano ad un omicidio, poi ad una rapina, quindi allo sgombero di un accampamento di senza casa, lasciando nel dimenticatoio le centianaia di migliaia di cassintegrati, le ragioni di migliaia di profughi, la pericolosità della crisi in atto. E dando l’impressione di un Paese che ha bisogno di ‘pugno di ferro’, di un ‘uomo forte’, di un ‘governo duro’.
Ed ecco che con incredibile semplicità il gioco è fatto. Senza camicie nere e senza manganelli, ma col ‘maggioritario’, con la ‘governabilità’ imposta da una ‘maggioranza’ che mal sopporta di discutere, con la ’semplificazione’ del quadro politico che elimina interi partiti o aree di pensiero. Coi candidati al Parlamento scelti dalle segreterie di tre, quattro partiti in liste bloccate.

Go Franceschini, go!

A me questo Franceschini mi sa di uno che a un certo calvo di bassa statura potrebbe davvero piazzargliela in saccoccia.

P.S.
La frase di cui sopra è decisamente un capolavoro di diplomazia e linguaggio sofisticato, nevvero?

Monday, February 23, 2009

Installing CubicTest

Have you ever been in need of an advanced testing tool that makes it easy to:
  • Test your web-applications by interacting with them as an human user would do
  • Let you define test-steps by drawing simple flow-chart-like diagrams
  • Auto-draw the test-steps by recording your actions from the browser window
  • Automatically re-execute so-recorded texts against a web-browser
Well, this kind of tool really exists: it's CubicTest and in the last days it really lived up to its promises.

In just one day I wrote a complete test-plan and linked each one of the tests planned to a testcase created with CubicTest.
And not only I "wrote" the tests by simply recording my activities inside the browser, but I also left CubicTest the task of executing them automatically, presenting me with the exact step where the failures occurred.

This way I obtained a "real" test-plan, consisting of human-readable, auto-generated and repeatable acceptance-tests.
Something I could easily bundle into an Eclipse application that could be used by my customers when they will try out my project.

Here's how to install CubicTest:
  1. Download and install Eclipse at http://download.eclipse.org
  2. Add the following update site to Eclipse: http://boss.bekk.no/cubictest/update/ (or download it from http://boss.bekk.no/cubictest/download.html)
  3. Select the CubicTest plugins and install them
  4. When asked whether to apply the changes or restart click "Apply Changes" and then manually shut-down Eclipse
  5. Open the eclipse.ini configuration file (/path/to/eclipse/eclipse.ini or C:\Program Files\Eclipse\eclipse.ini) and add the following line:
  6. On Linux: -DfirefoxDefaultPath=/path/to/firefox_installation/<firefox_executable>
    On Windows: -DfirefoxDefaultPath=C:\path\to\firefox_installation\firefox.exe
  7. Start Eclipse
  8. Follow the tutorials provided by the CubicTest Team and start using it

Let me know if you like this tool (by clicking the title of this post and leaving me a comment).

Saggio breve

Silvio Berlusconi (l'unica persona per la quale si può dire che la legge Basaglia sia stata un errore), a parziale scusante dell'essersi fatto eleggere quale presidente della Regione Sardegna, ha "regalato" ai sardi il Festival di Sanremo.

È sicuramente questo l'unico regalo che ci si può aspettare dal Líder máximo.
Gli altri regali, ne siamo certi, li terrà per se.

Saturday, February 14, 2009

Cose che è meglio sapere

Un link a una discussione piuttosto interessante: link.

Riporto il mio commento (ma quanto sono egocentrico...):
[..]
Poi, per quanto riguarda la discussione in corso, io vorrei focalizzare l'attenzione sul Perchè, ponendo una domanda che già il nostro RRobe ha implicitamente fatto: sono delle coincidenze quelle che vedono queste leggi spuntare in un momento così difficile per i media tradizionali?
Io credo proprio di no, e sono inoltre convinto che questo sia solo l'inizio: se davvero vogliono, come io credo, fermare l'Internet che dissente e che "ruba" la raccolta pubblicitaria a giornali e televisioni, allora ci dobbiamo aspettare molto di peggio;
tra le altre cose: "strani ed inspiegabili" black-out verso siti "scomodi" o, più probabilmente, verso le communities dove il dissenso e il "furto della banda pubblicitaria" si veicolano più facilmente (non solo youtube, ma anche facebook e le piattaforme di blogging come blogger).
Datemi del paranoico, ma io sono il primo che vorrebbe esserlo...

Infine, Roberto, una risposta alla tua domanda (anche se non sembrava una domanda lo era, vero?): non è vero che non si risolve niente a parlare di queste cose; il semplice e pur "piccolo" impegno di un Roberto Recchioni da solo può valer poco (ma io credo che neppure questo sia vero), ma moltiplicato per parecchi Roberto Recchioni (Oddio ve lo immaginate?!?!?), ciascuno capace di raggiungere un bacino d'utenza diverso, sia l'unica cosa che può smuovere la coscienza della nostra italietta dal torpore in cui ci vogliano lasciare questi loschi figuri (anche se credo che siano tanti i cittadini italiani ai quali questo stato di torpore stia molto bene).

Volevo concludere ringraziando il RRobe per l'argomento e per l'ottima trattazione... e voi che commentate: piccoli contributi, ma di sicuro non inutili.

Ciao,
Nicola

Friday, February 6, 2009

"L’Italia non è più un paese civile."

L’Italia non è più un paese civile.

(Beppino Englaro, il padre di Eluana Englaro, ieri)

Friday, January 30, 2009

What is keeping us busy

As the post title suggests, this is what is keeping us busy:
Come da titolo, ecco cosa ci tiene occupati al lavoro:



Note for non-italian readers:
"Cacca" is italian for "poo"...

Saturday, January 3, 2009

Arteriosclerosi nazionale

Ho trovato interessanti queste considerazioni, apparse su IlMessaggero.it, e voglio condividerle con voi:
Riflessione di una cittadina che paga le tasse (le ‘sue’ e non quelle degli altri): l’Italia è un paese nato vecchio, con un’arteriosclerosi patologica; ricorda il passato, con generosità di dettagli, ma non è in grado di vivere il presente. E’ malata di una grave forma di anacronismo ed una buona dose di presunzione non le permette di scendere a patti con gli altri individui europei.

Quindi, competitività, professionalità, competenze, giustizia sono mondi sconosciuti, astri vaganti nell’universo italico. C’è qualche speranza? Dovrei dire no, ma qualcuno mi accuserebbe di pessimismo o, peggio, di anziana precoce e poco nazionalista, oppure mi ripeterebbe che non sono questi i problemi gravi del nostro paese!

Anche se il problema della Sig.ra citata è meno grave rispetto a quello che sta succedendo altrove, mi piace poter leggere quanto ella sia riuscita a guardare dentro alcuni dei mali della nostra nazione, decrivendoli con rara efficacia.

Anche grazie a lei, a persone che ho da poco conosciuto e ad altre che conosco da anni, sono giunto alla conclusione che è impossibile che in una nazione come la nostra tutte le persone chiudano gli occhi di fronte a quello che sta succedendo (anche a livello globale e in contesti molto più violenti... vedasi Gaza).

Alcune con gli occhi aperti ci sono e so di per certo che sono pronte a lottare, SEMPRE E COMUNQUE IN MANIERA NON VIOLENTA, contro chi gli occhi vorrebbe che li chiudessimo.

L'unico errore della Sig.ra citata è quindi che sta perdendo la speranza (non che non abbia motivi a sufficienza comunque).
Un errore che mi sento di perdonarle Sig.ra. Mi creda.