Vista è già superato?
E' passato circa un anno e mezzo dall'uscita di Windows Vista e, come vi ho già raccontato, le mie prime impressioni non sono state sicuramente le migliori, tanto da spingermi a reinstallare XP.
Quello che non vi ho detto è che, grazie all'acquisto del nuovo notebook, ho dato una seconda chance a Vista e sono finalmente riuscito ad apprezzarlo a pieno.
Tuttavia, a quanto si legge su Internet, la maggioranza delle persone continua ancora a preferire Windows XP, sostenendo che il nuovo sistema operativo sia pieno di bug e, in generale, di scarsa qualità.
Si tratta di giudizi motivati o di semplice opinione diffusa ma senza fondamenti, anche grazie alla martellante campagna negativa Mac vs Windows di Apple?
Per sciogliere questo dubbio, in Microsoft hanno fatto un esperimento, che io personalmente trovo geniale.
Questo esperimento, chiamato Mojave Experiment, consisteva nell'invitare circa un centinaio di utenti Windows, Linux e MacOS per fargli provare in anteprima il successore di Vista, chiamato proprio Mojave.
Alla fine del test, gli utenti erano invitati a valutare questo nuovo sistema operativo e ben il 90% di essi lo hanno giudicato molto positivamente (in media 8,5 su 10), mentre il voto medio per Vista era stato circa 4,5.
Peccato che Windows Mojave non esista e che il sistema operativo appena testato fosse semplicemente Vista sotto falso nome!
Non dico che Vista sia perfetto, ma di sicuro ci sono troppi pregiudizi e molta gente si lascia trasportare da quello che si dice in giro.
Ecco perché l'azzeccato slogan della nuova campagna di Microsoft è "decide for yourself"...
Google Interview Question: Product of other Elements in an Array in O(n)
Last time I was interviewed for a software development engineer position, the recruiter asked me some of the classical Microsoft interview questions, such as "How Would You Move Mount Fuji?" or "How many gas station are there in your country?".
It was the first time for me to be asked such questions but having obtained the job I think my answers were good enough.
After that day, I looked for other well-known interview questions and I discovered that Google has a totally different approach, focusing on algorithms, data structures and complexity.
For instance, one of Google interview questions says:
There is an array A[N] of N integers. You have to compose an array Output[N+1] such that Output[i] will be equal to the product of all the elements of A[] except A[i].
Example:
INPUT:[4, 3, 2, 1, 2]
OUTPUT:[12, 16, 24, 48, 24]Solve it without division operator and in O(n).
Without the two constraints at the end of the puzzle it would have been straightforward, but now we have to be smart.
Actually, the product of all elements of A[] except A[i] is equal to the product of all elements before A[i] and those after A[i].
We can traverse A[] twice, once from left to right and once in the opposite way and multiply all the elements we find before A[i].
We'll pretend to have a new array called Output[] to store the output of the first pass, assigning Output[i] the product of all elements preceding A[i]:
let rec firstpass product input =
match input with
| [] -> []
| x::xs -> product :: firstpass (product * x) xs
For the second pass we need to move from right to left, but this can be done by reversing the input arrays and moving as usual:
let secondpass product input arr =
let rev_input = List.rev input
let rev_arr = List.rev arr
let rec rev_secondpass product (input:list<int>) arr =
match arr with
| [] -> []
| x::xs -> rev_secondpass (product * input.Head) input.Tail xs @ [(x * product)]
rev_secondpass product rev_input rev_arr
Both firstpass and secondpass expect an integer argument called product, which will be always be 1 at the beginning and will be used to store the intermediate products during the recursive calls.
With these functions we can just define an input array and apply them to get the result.
The following is the complete F# code:
#light
let input = [ 4; 3; 2; 1; 2 ]
let answer values =
let rec firstpass product input =
match input with
| [] -> []
| x::xs -> product :: firstpass (product * x) xs
let secondpass product input arr =
let rev_input = List.rev input
let rev_arr = List.rev arr
let rec rev_secondpass product (input:list<int>) arr =
match arr with
| [] -> []
| x::xs -> rev_secondpass (product * input.Head) input.Tail xs @ [(x * product)]
rev_secondpass product rev_input rev_arr
values |> firstpass 1 |> secondpass 1 values
Guardare la tv con Windows Live Messenger
Per una volta siamo noi italiani ad essere all'avanguardia rispetto al resto del mondo.
Da un team italiano di Microsoft è nata infatti la Messenger TV, un servizio che integra la comunicazione via chat che tutti conoscono con la possibilità di guardare (e condividere) i canali televisivi preferiti.
L'offerta attualmente include una selezione dei migliori programmi di MTV Italia, fra cui Very Victoria e Loveline, ma è già stata annunciate un'altra partnership con Mediaset, che consentirà di visionare Canale5, Italia1 e Rete4.
Previsti inoltre accordi con Sony Bmg, Ansa, Agr, Coming Soon e Sportal.
Se volete provare questo nuovo servizio dovete seguire questi seguire questi 3 semplici passaggi:
- Aprire una finestra di conversazione e cliccare sul pulsante Attività
- Selezionare la voce Messenger TV
- Scegliere il canale ed il video
Buon divertimento!
Il Blu-Ray ha vinto la guerra
Qualche anno fa sono stati presentati al pubblico due formati in competizione fra loro come successore del dvd, caratterizzati ovviamente da maggiori capacità e qualità dell'immagine.
I due formati, Blu-Ray e HD-DVD, sono supportati rispettivamente da due grossi consorzi di imprese. Nel primo caso, il principale promotore è sicuramente Sony, mentre l'altro gruppo vede forti le partecipazioni di Toshiba e Microsoft.
Per quanto riguarda il confronto fra i due tipi di supporto, possiamo dire che HD-DVD costituisce una sorte di evoluzione naturale del dvd e quindi i costi dei lettori e dei masterizzatori è stato sin dall'inizio più contenuto.
Blu-Ray invece è basato su una tecnologia più avanzata (ma anche più costosa) che consente di ottenere capacità di immagazzinamento dati superiori rispetto alla concorrenza.
Come sempre però l'affermarsi di un prodotto non è dovuto esclusivamente alla sua tecnologia, ma soprattutto alla capacità dei produttori di farsi adottare dai consumatori, ed in questo Sony è stata sicuramente più abile.
Innanzitutto la Playstation 3 contiene un lettore Blu-Ray e anzi questo lettore è stato per un discreto periodo di tempo il lettore Blu-Ray più economico sul mercato. Oltre a questo, la Sony è stata in grado di promuovere il formato Blu-Ray come il vero successore del dvd, tanto che moltissimi consumatori non sanno nemmeno dell'esistenza di HD-DVD.
In risposta a ciò, la Microsoft ha messo sul mercato un lettore HD-DVD esterno per la propria consolle X-BOX 360, ma probabilmente si è mossa troppo tardi, e questo accessorio non ha avuto quasi alcun successo.
La battaglia fra Blu-Ray e HD-DVD è durata un bel pò, ma pare che adesso ci sia un vincitore: Toshiba ha deciso di issare bandiera bianca e abbandonare il formato HD-DVD.
La cosa non può che fare felici noi consumatori, visto che un appassionato si trovava costretto a comprare due diversi lettori per poter vedere i film in alta definizione. Di certo non sarà altrettanto felice chi ha già comprato un HD-DVD Player e adesso si trova in casa un costoso (e inutile) soprammobile!
Io per fortuna non avevo ancora fatto la mia scelta proprio per evitare problemi di questo tipo, magari non appena la PS3 cala ulteriormente di prezzo ci faccio un pensierino...
Sorting odd and even numbers in F#
An Italian Microsoft Evangelist posted today a small programming exercise on his blog, presenting the solution with LINQ.
The exercise says (translated from Italian by me):
Given a list of unordered numbers (for instance 1, 7, 9, 2, 3, 4, 3, 4, 2, 3, 4, 5, 2, 0, 9), create a new list with all even numbers first and then all the odd ones.
The proposed solution also goes a little further, showing not only how to split the original list into odd and even numbers, but also putting them in the correct order, thus returning "022244413335799".
The following is the C# code used:
List<int> elenco = new List<int> { 1,7,9, 2, 3, 4, 3, 4, 2, 3, 4, 5, 2, 0, 9 };
var pariEdispari = elenco.OrderBy(s => s % 2 != 0);
var pariEdispariOrdinati = elenco.OrderBy(s => s % 2 != 0).ThenBy(s => s);
foreach (var item in pariEdispariOrdinati)
{
Console.WriteLine(item);
}
And now let's compare it with an F# approach:
#light let numbers = [ 1; 7; 9; 2; 3; 4; 3; 4; 2; 3; 4; 5; 2; 0; 9 ] let result = numbers |> List.sort Int32.compare |> List.partition (fun x -> x % 2 = 0) print_any ((fst result) @ (snd result))
As you can easily see, everything is done at line 4, where we apply twice the pipeline operator (|>).
This operator allows to chain functions, passing the output of one of them to the next one.
The same line could be written as:
List.partition (fun x -> x % 2 = 0) (List.sort Int32.compare numbers)
Line 6 is only used to print the result, but it has to take into account that the output of List.partition is a tuple, so we have to concatenate the two elements that can be retrieved with the fst (first) and snd (second) functions.
The @ operator actually concatenates the two lists.
I'm not sure that this is the best (and most elegant) solution, but I think that it is way ahead than any imperative solution, do you agree with me?
fsharp.it, il nuovo portale su F#
Qualche tempo fa anticipavo la mia intenzione di avviare un nuovo blog più tecnico e adesso quel momento è arrivato!
Ho aperto un portale tematico dedicato ad un tema abbastanza specialistico nel mondo dell'informatica ma che sta acquisendo sempre più popolarità.
Si tratta della programmazione funzionale ed in particolare di F#, il linguaggio basato su questo paradigma sviluppato da Microsoft per contrastare le alternative più diffuse, principalmente Erlang e Haskell.
So che per molti di voi quello che sto scrivendo non ha assolutamente senso, ma se vi occupate di informatica vi consiglio almeno di dare un'occhiata a questo nuovo mondo, magari partendo proprio dagli articoli del portale.
L'indirizzo è www.fsharp.it ed i contenuti sono scritti in lingua inglese, ma questo non può essere un freno per chi lavora nel settore.
Dategli un'occhiata e poi magari lasciate un commento, chissà che un giorno non mi ringrazierete!
let title = "Hello World"
When I was attending the first year of my university course, a teacher of mine used Haskell to teach us the basics of software development.
It was amazing, functional programming makes you think differently about programming.
In the functional paradigm functions are used in their real mathematical sense.
Hence, they are only computation objects and there is no information about state or mutable data.
Functional programming languages exist since more than 50 years ago, LISP is one of them, but they have never been seriously adopted outside the academia.
Now, the computer science world is gradually moving toward functional programming.
There is a lot of hype surrounding Erlang, a functional language originally developed by Ericsson, and in 2007 Microsoft presented F#, which is a multi-paradigm language targeting .Net and largely based on OCaml.
In this blog I'll write down my progresses in learning this language and I hope that you can profit from my experience.
I'll come back to you soon with the first article, if you want in the meanwhile you can start from the links on the right side of the page.
Bye!
Di ritorno dal PHPDay
Ho dovuto puntare la sveglia alle 5 e andare dalla parte opposta del Paese per partecipare al PHPDay, ma ne è valsa sicuramente la pena.
L'evento è stato un grande successo, circa 200 partecipanti, sponsor del calibro di Microsoft, Zend, Yahoo, Codegear e php | architect, e speaker di alto livello, suddivisi in due canali: Developer ed Enterprise.
Tutti i talk del canale Developer sono anche stati filmati e trasmessi in streaming grazie a Ustream.tv, e molti di essi sono disponibili sul sito dell'evento insieme alle slide.
In particolare ci sono stati due talk strepitosi, quello di Jacopo Romei sull'Extreme Programming e quello di Gabriele Lana sul testing delle applicazioni web.
Buona l'idea di organizzare dei Lightning Talks durante le pause, peccato che il tempo fosse poco e comunque la gente ha bisogno di fare delle pause, soprattutto se è sveglia dalle 5 del mattino!
Unica nota negativa della giornata il pranzo al ristorante convenzionato con l'evento, mi sa che la prossima volta bisognerà trovare una soluzione migliore.
A parte questo, non può che renderci felici l'annuncio dell'intenzione di raddoppiare il PHPDay e organizzare un secondo evento prima della fine dell'anno, speriamo bene!



