Sunday, August 12, 2012

I'm reading Seven Languages in Seven weeks. It's a great book to discover different kind of languages. I went through Ruby, Io, Prolog, Scala and Erlang. So far, Prolog has been the most puzzling of all. For example, the map coloring sample. The author shows how to colorize several states of the United States, without assigning the same color to adjacent states. I finally got the point after noticing that all states names begin with an uppercase letter. Aaaaaaahhhh ! Colors will be assigned to each state (a state is just a variable), and prolog will go through all combinations of colors, returning true only if all combinations in the coloring query return true. Although it was obvious in the food example, food_type(What, meat), for some reason it was not so obvious in the map coloring example...

On the contrary, I'm very interested in Erlang. One of the exercises is to tell in which state a Tic-Tac-Toe board is. Did X win ? Did O win ? No winner yet ? No more moves ? This is the solution I came up with, after several refactoring passes. I like the way we can interact with lists and tuples.

I bought two albums on iTunes last weekend. All my songs stopped after about one minute of play. I searched for similar problems on the net, and it appears that a lot of people are annoyed with this too. I found different recovery methods, but none of them worked for me. The most common recovery method was to remove the files and redownload them from iTunes. I removed the files, went to my purchase history on iTunes and redownloaded the whole album.

Unfortunately, the songs were still cut at approximately the same place...
What solved my problem was not to redownload the whole album at once, but to redownload each song one by one. Yes, it's annoying, but at least the songs were finally playing properly up to the end. Let's hope that iTunes is going to be fixed soon.