29 June 2008

Amabile Processing

After many months, I finally tried Processing.
Don't ask me why I didn't tried it before, I can't remember. I know only that now I understand why it's funny :)

I still have much to learn, expecially with accelerated stuff, but... Well, I enjoyed doing this :D (enjoyed also the video itself, made with kino and xvidcap).


video

Stay --sync

24 June 2008

Talkin' 'bout integration....

Continuing the previous post.

I just discovered google shared stuff, which can be seen like delicious... Interesting, but I won't stop to use delicious.

And, really really interesting one: friendfeed (thanks to Suzukimaruti) in short... Are you registered to 10000 social things sites? Do each of them provide a feed of some kind? Well, you register each of these feeds to friendfeed, then your friends subscribe once to your friendfeed's feed.

So they are updated with all your 10000 (+n) feeds.

Cwte :D

Stay --sync

Computers help, please use them.

If you're doing something again, you're doing wrong.
Humans do things once, machines do things again.
There are so many tools around that I can't even use them all... I'm not talking about programming stuff, but talking in general. I'll take google as example.

To start, google offers one account for multiple services. So, if you have a Google account, you have access to multiple services. This is done by lots of companies right now... Also Microsoft, Yahoo, Blah, XYZ and - of course - Foobar :D

Then it provides an email service (the best ever seen, to me. I'm gmail addicted), blogging, videos, chat, feed reader, online spreadsheets and word processor (well, they aren't that good, like OOo, but they do the job), calendar, pictures, and much more.

There is more! All most of them are well integrated with each other: from gmail you can open your attachments in the online spreadsheets and word processor, your contacts are shared between mail and chat. Blogger uses picasa for image hosting, blogs have feeds and google provide a feed reader, which use contacts for providing... uhm "social feeding" :D (that is, sharing feeds among friends) ...And lot more.

What I find quite... Regreting, is that most of these tools isn't used properly. One day I decided that google was ok to me, more than Microsoft and Yahoo. So I started to use those services completely - which are far enough for me.

And you know what? I don't waste time. They ARE good. I'm not doing things again, I do them once.

If I see an interesting blog entry, I usually don't open a new post on my blog to say "hey, I found this page: take a look". I don't. There is a software that do it for me: I press the "share" button in google reader, and it's done. Why should I repeat myself?

If there is a webpage that I find interesting there is del.icio.us, which is really delicious when integrated with firefox. Yes, it's Yahoo stuff :) But if it helps...

Why writing around "take a look at this video" when there are shared favourites on youtube? It's obvious that I like that video and I wanna share it with my friends. So just subscribe to my videos and when I found an interesting one you'll be notified. I'll do the same, so we'll both save our time.

What's the meaning of all this? That there are very good programmers and engineers working for us everyday, their tool are well designed and improved everyday.
Time is the only resource we can't waste: lost time is lost, you can't get it back. And those people waste their time allowing us to don't waste our time.

One of the marvelous things that computers offer is integration. This is why computers help: in the real world, integration doesn't exists: you're doing the job, there isn't something magic that handle your knowledge and your thoughts allowing you to don't waste time.

Computer is this "something magic": is where imagination becomes real, integration and sharing becomes possible, where knowledge can be handled and it's just up to us to choose if use all this or not. I think we really should.

So, please, use integrated services. Everyone will benefit from it.

Stay --sync

22 June 2008

Cioe', cioe'... Mi ha lasciato tipo :O

Certe cose mi lasciano senza fiato.

Davvero, a volte vedi delle situazioni in cui ti dici:
No, dai... Tutto questo non e' possibile.
Non sto sognando perche' sta succedendo ad altri e non a me, ma sicuramente sono un personaggio marginale in una fiaba magnifica.
A volte, se ti dimentichi della fame nel mondo, ti accorgi che non serve fantasia per scrivere una fiaba: basta conoscere certe persone/situazioni e quella vien da se'.

Stay --sync

16 June 2008

Sono gravemente malato?

Provo gioia nel fare lo studio di funzioni.

Dottori, e' grave?

11 June 2008

Nucleare.

Non c'e' un motivo specifico per cui ho deciso di fare questo post... Non e' perche' credo che il governo stia sbagliando ad incentivare il nucleare. Non e' per l'anniversario del disastro.

Forse e' solo per ricordarmi che la realta' fa male. Forse e' per chiedermi se i politici (magari per caso, non mi aspetto mica che lo facciano per curiosita' o per intelligenza) abbiano mai usato google per stare in contatto con la realta'.

Ogni tanto mi capita, di farmi del male e guardare cose che non ho mai vissuto, che spero che nessuno viva in nessun momento storico futuro. Pero' lo faccio, per ricordarmi quanto male fa la realta', per ricordarmi di non essere cosi', come le persone che hanno sbagliato e continuano a sbagliare... Non sono infallibile, ma vorrei sperimentare altre strade e non essere un puntino nella storia che si ripete.

Google, youtube, la forza delle immagini. Puoi pensare ad una strage nucleare, ma solo quando la vedi ne hai paura.

Chernobyl effects

Chernobyl effects

Chernobyl effects

Chernobyl effects

Chernobyl effects

Chernobyl effects

10 June 2008

Rply fst pls doin' hmwrk

This is a question for all my programmer|researchers|CEOs|gods|Zeuses|l33t|h4x0r5|nerd (oh, and friends, of course :D) readers (so, please answer the question. Shame on you if you don't :D).

Assume you're writing a programming language which actually helps the coder. Let's say... You want to implement in the language this statement:
main() {
setup whatever I need;
my_program();
}
Assume that the language is "smart enough" to understand the environment you need, so you just build your program in a magical way, and the language helps you choosing The Right Thing To Do (when you ask him, of course).

Now, the question is: am I crazy?

AhAhA, no, I'm kiddin' :'D the real question is:

should I start to develop the language interpreter as usual, doing parsing, building syntax trees etc etc and then trying to associate the language to the magical code

or

should I start developing the magical code, see if it runs with a UI (any kind of interactive media of communication) and then building a language which use it?

If you don't know nothing about programming languages development, please tell me anyway: which does seem more logic to you?

Thanks :)
Stay --sync

Intercettato!

Sembra il nome di un gioco di societa', tipo "Risiko!" o "Scotland Yard".

E questo e'.
Le intercettazioni sono un problema reale? E chi viene intercettato? I potenti, i politici, i criminali.
Ecco cos'e', e' il gioco dei grandi.

Perche' cavolo i politici (e anche te, caro Presidente Napolitano... Altro che larghe intese, il parlamento dovrebbe pensare ad altro! Scuotili un po' tu, che sei saggio e canuto) pensano alle intercettazioni e non alle cose davvero importanti? Cioe' le cose che toccano tutti?

Ecco, lo sapevo: Berlusconi e' tornato su per fare il comodo suo... E se non e' il suo e' quello dei suoi amici/parenti/colleghi.

E il governo ombra e' troppo ombra e meno governo. Dovrebbero battersi per le cose serie (che il governo Berlusconi 4 naturalmente non caga di striscio) e invece anche loro fanno i giochini, anziche' svegliare e coinvolgere il popolo.

Doppia delusione: Veltroni si sta rivelando meno presente di quanto pensassi e Berlusconi non e' cambiato.

Stay --sync

04 June 2008

Bordeo Interpreter (a.k.a. why templates sometimes sucks)

For a C++ project for university course, I did a little interpreter as testing application for the library developed for the project. Actually, cppunit wasn't enough, I wanted interaction. So I did an interpreter.

Quite easy, the language was a straightforward list of command :) No branches, no loop, no jumps. Nothing if not few commands like: create db, destroy db, insert, remove, print, search, and so on.

The things itself was quite easy. What was troublesome is the data behind: my library have an interface Dictionary, then implemented in different ways (RBST, Splay).
The problem is: that library uses template.

And the test program should support allocation and insertion for int, float and string types.

So, we should allocate an arbitrary number of
template <class K, class V> RBST<K,V> or Splay<K, V>
where K and V can be int, float, std::string.

Problem #1: containers.
Even if all dictionaries inherits from Dictionary<K,V>, the template makes all these types different among them. So it's not possible to use a generic easy container like

vector <Dictionary*> ds;

I used boost::any

vector ds;

This works flawlessly, but to use boost::any, you should use
Problem #2: any_cast.
the problem is that I've 9 data types, all similar (i.e. almost the same interface). I need to get string from an input, convert them to the right data type and then pass them to the right dictionary in the right form.

So, without reorganizing the classes, I ended up doing something like:

insert(boost::any d, data) {
if (d.type() == RBST<int, int>)
(any_cast<RBST<int, int>>(d)).insert(data.toInt());
else if (d.type() == RBST<int, float>)
(any_cast<RBST<int, float>>(d)).insert(data.toFloat());
// A long list of 16 other combinations XD
}


And of course, this was done for each action! Insertion, removal, search, load from file, print...

It would be nice to make something like:
boost::any d = aDictionaryGotSomewhere;
d.insert(data);
So that data is automagically converted into the right data type (maybe using operator int/float/blah), and without need to cast the data.... Eh, would be nice :D But don't seems possible from here.

So, what's the meaning of this post? There are many.
  1. Maybe there is a method for using templates in a smart way, which allow to use a pointer to store an arbitrary template with any kind of parameters.... But I'm not too 1337 to know it :D and I think that something similar simply doesn't exists: templates are just like "macros", they aren't code and they need to be instantiated on compile time. That's why they are generic, but aren't used as generic: when instantiated, a template is a different data type.
  2. Probably it would be a better option to create a generic container using boost::any, instead of containing template containers with any. I've not tried yet.
  3. If you intend to do dynamic things like these, it's better to think about it before implementing :'D
A pointless post, anyway. But if you've suggestions about how to do such things, please share :D

...Next time I'll try with a nice hierarchy of classes...

Stay --sync

02 June 2008

Splay Tree

I was finding the recursive implementation of Splay Trees quite hard to do.
If you start from a node, to bring it on on the root you have to:

  1. start from the root and using returns value to reassign the tree, keep tracking of parents etc

  2. use Node** and parent links for starting from a node and going up to the root.



I was using the second, and it was quite painful :D (even if I did it)

Then I looked at the original code (in java, for ease) for splay
tree
and I saw he's using top-down iterative method.

That's by far more smart :)

Stay --sync

Eredita'.

Iniziamo con le note di servizio: buon 2 giugno.

Per gli N preoccupati dalle recenti ba-ba-bastonate
... Si ecco, mi son ripreso. Non voglio entrare nei dettagli, sappiate che la bella serata mi ha tirato su il morale.
Poi in realta' ho avuto diciamo una... Uhm, "ufficiosa" smentita, quindi il problema non si pone.

Per chi non sa i dettagli (e anche per chi li sa), mettiamola come: ho solo male interpretato i fatti... Questo non toglie che siano avvenuti e non toglie che comunque, per lo piu', mi son calmato per non inciampare in un classico errore.

Ho vinto a minigolf, ma sappiate che il gioco professionistico e' davvero una mazzata. In confronto, questo gioco di parole era acqua distillata. Insomma ho fatto pena, quindi non me ne vanto :D

Ora, veniamo al titolo del post... Eredita'.
Per eredita' si intende qualcosa che si eredita da qualcuno e detto informalmente vuol dire assumere qualcosa da qualcuno che, nell'ambito della propria vita, decidesse e/o fosse obbligato a non usufruirne ulteriormente.

Sta sera, alle 2 e mezza (il che dice tutto), io e l'amico tony ci siam messi a fare un discorso molto profondo, al termine del quale lui mi ha pregato di scrivere i miei pensieri perche' li trovava utili o importanti. Quindi riporto.

Faccio notare che sono le 3:21 (fantastico orario :) in questo istante, ho bevuto un po' e sono abbastanza stanco. Capitemi, qualsiasi cosa dica o faccia: capitemi :D Domani mattina me ne pentiro'.

Il discorso profondo e' iniziato dal... Cito (circa), che faccio prima:
T: "Ale, dopo questa sera ho capito che insomma a te piace parlare"
A: "Anto cazzo, mi conosci da 15 anni, lo sai che ci campo di certe cose... Io parlo e ascolto tanto. Quando gli altri parlano, se sei capace di ascoltare, tu vivi un pezzo della loro vita"
T: "Anche io ascolto, anche se a volte, non so, i miei mi dicono di fare una cosa, io voglio farla in un altro modo, alla fine non do retta a loro, perche' ho voglia di farle a modo mio".

Da questo, insomma. Dal fatto che si ascolta e si parla (quanto?) con gente, genitori e amici. Del fatto che ci sono esperienze nella vita di una persona, di tutte le persone, e che e' un bene prezioso.

A: "Anto, se tuo padre vivesse delle esperienze, tu vorresti ripeterle?"
T: "No"
A: "E se tu ne vivessi, vorresti che i tuoi figli le ripetessero?"
T: "No"

Questo e' il fatto.

Noi siamo tante piccole vite, l'insieme di esse e' la nostra storia. Tante piccole vite, tante piccole esperienze in sequenza, formano una storia complessa ed intricata.

Il fattaccio e' che non dobbiamo ripetere le stesse cose: se una persona nasce, cresce, fa esperienze, ha un figlio e muore, e il figlio dovesse ripercorrere la stessa vita... Non avremmo 2 vite. Ne avremmo una.

Allora, dove stanno le due vite? Nell'arricchirsi, ascoltando.

La nostra eredita' e' la storia, e' il verbo. Una persona ti racconta la sua vita e non ci metti "una vita" a saperla. Certo, magari non la sai tutta, ma sai le parti importanti, quelle per cui vale la pena di aver vissuto, quelle che danno una svolta all'esperienza e alla crescita di una persona.

Se ti racconto la mia vita, io non ho piu' vissuto per me: ho vissuto per noi. La mia vita, che da sola non ha senso, ora un senso lo assume. E' il senso della continuita', siamo fuori dalla vita in se'. Siamo al livello di "vita globale", di comunita', di riproduzione e perpetuazione della specie.

La parte che il mio amico Antonio ha particolarmente apprezzato, e' quella che segue. Forse perche' e' molto chiara; forse perche', per la sua storia personale, e' esattamente il quadro di come lui vede la sua vita.

Una persona vive con genitori e - si spera - amici. I genitori, normalmente, sono persone molto piu' grandi di te. Parliamo di 25/30 anni, a volte anche 40. Gli amici invece sono coetanei, spesso.

Un genitore cerchera' sempre di dare consigli ai figli, con la visione del "io ci sono gia' passato e so quel che dico". Gli amici invece, danno consigli con la visione "abbiamo davanti N strade, scegliamo quella che sembra migliore".

Ascoltare i genitori pero' non e' per forza la cosa giusta :) Se cresci ad immagine e somiglianza di chi ti educa, non solo non avrai una tua personalita', ma inciamperai inutilmente negli stessi suoi errori.
Detto questo, e' evidente che e' necessario saper bilanciare questi fattori.

L'unica cosa fissa e certa e' questa: chi crepa lascia in eredita' solo le sue parole.

Meglio ascoltarle, anche se a volte vorresti fare di testa tua.

Stay --sync

PS: Era un post iniziato alle 3, e' finito 1 ora dopo. Motivo? DOTA -wtf :D

01 June 2008

Ba ba ba batoste

Il titolo dovreste canticchiarlo o almeno fischiettare un gingle-ino di accompagnamento.

Ah, e congratulazioni alla mamma che ha aperto (finalmente!!! :D) il suo centro olistico per il relax. Si, il sito non l'ho ancora finito... (E quel che c'e' non e' pubblicato XD) Ma come vedrete a breve ho altri fatti per la testa. Esami in primis?

Sapete cosa mi da sui nervi? Che non dovrei essere qui a scrivere, dovrei essere a studiare. Ad implementare quegli Splay Tree della ciolla.
Ma non e' questo il problema di fondo: e' invece il fatto che io non sappia davvero tenere fuori la mia vita privata da quella che e' la carriera.

Non importa che io mi fidassi di qualcuno.

Non importa che questo qualcuno mi abbia tradito.

Non importa che qualcuno qui si stia sbagliando.

Non importa che io sappia simulare piu' o meno bene altri stati d'animo.

Non importa che io sia ancora capace di sorridere, con il cuore (e le labbra e la tastiera :), per le grandi cose che invece ho ancora.

Non importa che io mi sia illuso. Ancora, l'ennesima alla ennesima alla ennesima volta.

Non importa che io sia in grado addirittura di illudermi *ancora adesso*, dopo la triste realta'.

Non importa che il mio lieto fine sia andato a puttane.

Non importa il romanticismo.

Tutto questo, non mi importa piu'. No, no. Davvero. La rabbia, l'entropia, la tristezza, l'amarezza che avevo in corpo, sono andate... Quasi del tutto.

Ma cavoli, devo studiare. Devo essere una roccia. Devo essere immune agli altri. E' normale che mi sia sbagliato. E' normale che la mia lei non sia lei. Tutto regolare.

Ma no, non riesco a studiare. Ho la testa su quel dannatissimo attimo. Su quello che avrei preferrito non sapere. Ho la testa dove non voglio che vada e dove non deve andare.

Ho una testa e cerco di convincermi che tutto questo non la riguarda. La mia testa e il mio cuore devono essere separati.

Forse questo post mi ha aiutato. Ora l'ho detto, l'ho scritto, ci ho ragionato. Son contento e meno focalizzato.

Ma che rabbia, accorgermi che d'altronde, se sono qui ad autoconvincermi di dover far qualcosa, vuol dire che non ne sono in grado come pensavo.

Un'altra bastonata sulle gengive.

Almeno ne usciro' piu' forte.
Stay --sync