Log in

No account? Create an account

Previous 10 | Next 10

Aug. 9th, 2008

Geopolitical distraction

Nothing more distracting than the big boys re-starting the cold war.

Aug. 6th, 2008

Double spacing is an abomination


Jul. 24th, 2008

"The Botany of desire" by Michael Pollan

This book is a very interesting cultural perspective on agriculture.

The main thesis is a perspective shift: from our illusion of dominance over nature, to co-evolutionary relationship.

The classical example of co-evolution is the interdependence between the bee and flower. By definition co-evolution are mutually beneficial making the question of who is dominating or taking advantage of the other meaningless.

The author explore the reason of our perspective of dominance and distance toward nature using the classical dichotomy between Dionysus and Apollo. Apollo having the upper hand in our culture thanks to Christianity successful battle against Paganism.

This story is narrated around four different desire and an associated plant

Sweetness/The Apple

This story follow the food step of John Chapman aka Johnny Appleseed during Europe colonization of America.
We learn that apples are extremely heterozygous, that is an apple tree will share little resemblance to its parents. Therefore apples are very rarely sweet and fit for consumption. All the apples in a supermarket come from grafts, they are clone of each others.
So if not for their sweetness why were apple tree such a land mark of America colonization? Because it was easy to produce alcohol from them and this often was often a much more sanitary drink than water.

Even if cider was considered cultural acceptable by the puritans it still ended up as a target of the temperance movement with public calls to cut down the trees.

Apple as healthy and delicious fruit is just a relatively recent PR coup of the industry to make the fruit acceptable again.

Beauty/The Tulip
After pages on the aesthetic values of flower (factoid only African culture do not value the beauty of flower, probably because they are too busy trying to find food). The author give an account of the first speculative bubble. The mechanism of which are still very relevant today. Will we ever learn form our mistake?


Explore the motivation for the war on drugs and describe the associated loss of civil liberty.
Also speculate on the cultural and litterer influence of cannabis and other drugs as mutating agents for ideas.

Control/The potato

Examine the strong cultural and political opposition to the introduction of such a wonderful staple food in Europe illustrating again the struggle between Apollo and Dionysus.
Then the author narrate the Irish famine a perfect illustration of a Mathusaliam economic disaster. The principal cause of the famine, the monoculture of potatoes is also the greatest sin of modern agriculture.

This part of the book give account of modern agriculture practices. In particular the clean field method, where the land is regularly dosed with all kind of chemical to make sure that only the desired crop can survive.
After spreading some chemicals called "Monitor" the farmers do not go in the field for four of five days even if the sprinkler system is broken and threaten to ruin the lot. Just to prevent aesthetically unpleasant, but harmless brown spot due to aphids.

The most striking part is the account of the industrial farm, which after disregarding organic agriculture as unable to feed the world, admit that he does not eat his own potatoes and himself prefer to eat organic.

The last part is devoted to genetically modified food, its dangers and unknowns. It explain the principle of "substantial equivalence", that is mixing an approved gene or chemical with an harmless plant does not require any testing or labeling before being commercialized. No research on genetic instability. Thanks lobby, thanks congress.

You will learn this precious pearl. GMO are not considered food and therefore are not under the umbrella of the FDA, they are instead classified as pesticide and as such are regulated by the EPA ! Bonne appetit.

Jul. 18th, 2008

Google Code Jam : Qualification round.

I managed to successfully qualify for the next round. I decided to use Haskell because I was already into it after the icfp contest.

Pb A: Saving the Universe
I started with a backtracking algorithm, simple clean worked well on the test. But on the first input: memory explosion !!!

So I first blamed my Haskell skills and look for memory leak. I also tried more sophisticated optimization with marginal result.

Then it hit me, it was not my implementation or my poor understanding of Haskell, it was simply the wrong approach. Sure I was getting correct results but in O(2^n).
I look at the problem again and there was an obvious and easier dynamic programing approach. All the sudden my problem became O(n).

Pb B: Train Timetable

This one was suspiciously easy. I coded a greedy algorithm in minutes and spend an hour trying to find a fault in my reasoning and implementation. Trying to find degenerated cases and counter argument. It simply seemed to simple.

I guess it was.

Pb C: Fly Swatter

A geometric problem: after gathering the needed formula I was figuring out all the corner cases and I thought there were just to many of then (4 to be exact ...). I wondered if there might be a simpler approach. Let see, integrating weird shapes ... Monte Carlo !!!

Haskell is used in a lot of trading firm, they must do stochastic simulation with it. So I should be able too.

After figuring the in and out of random generation in Haskell, I have a very elegant solution. That converge sloooowlyyy. Again I blame my understanding of Haskell. Decide against parallelizing the code since a twice as fast version of something that is very slow is still slow. Try Python not faster.

Back to solution one, but sadly I was out of time ..

Jul. 16th, 2008

ICFP 2008 Postmortem

The ICFP Programming Contest is one of my favorite contest. Sadly in the past few years I was not able to compete live. But this year the old team was back ! With Pierre in New York and motivated, we were able to have kick some martians' butts.

ICFP was always for us a reason to learn a new programming language. The first time was OCaml, two weeks before we choose the language and do our homework, but nothing beat getting your hand dirty with a short deadline to learn.

This years we decided to use Haskell (our team was named LazyMonkeys).
I am already pretty decent at it but it was a first for Pierre. Who by the way did a pretty good job. It was funny to see him use OCaml idioms like let in instead of the favored where, but I was never found of where too since it remove the ability to read the code top to bottom.

The contest was very interesting with unusually clear and short instructions, I did not even print them. You can read all about how you had to help a poor rover find his way home on Mars while avoiding the Martians here. It also had a nice range of possible progress from a simple steering solution to a more complex strategy.

At first we kind of doubted of our choice since we had to do real time analysis of a telemetry feed and I seriously consider switching to Erlang. But there is good threading support in Haskell so we stayed with it.

Our solution :

We have a very simple one based on fuzzy steering. With a thread managing the network, one for the motion planning and a last one for visualization.

We lost a lot of time on the network part. The task recommended to disable Nagle’s algorithm which was only possible with the more advanced Network.Socket. The issue that gave me a lot of grief was that on the OS X 10.5 when doing a gethost on localhost the first answer is a IPv6 address. Network.Socket does not seem to be able to manage IPv6 so it was difficult to debug the issue.

We used OpenGL for displaying our robot activities :
ICFP 2008
It was very helpful in detecting logical errors.

Summary, what we did wrong:
  • Did not have a comprehensive test bed to be able to measure our progress. Would have been very useful at the end when we try to tune our parameters.
  • Did not create a trigonometric/geometric module early enough
  • Discover that Aquamacs new version is way cooler that Emacs.app and spending 2 hours updating my .emacs

What we did right:
  • Create a SVN in advance
  • Build the OpenGL display, the one offered by the server was good enough for the first day but when we added more complex comportment we need more visual info.
  • Choose a robust solution
  • Made good use of Haskell laziness

Jul. 10th, 2008

NSA Cryptologic Museum

I am a big crypto nerd. I read David Kahn's "The Codebreakers" when I was young. After opening Cryptonomicon my classes attendance dropped for a few day. It used to be a dream of me to be cryptanalist. I even had a little moment of glory when I broke an algorithm that one of my graduate teacher presented as a possible thesis project in just one night.

It was very exciting to be able to see and PLAY with an Enigma.

My over excitement may have freak out K a bit but there was so many interesting machine to see !!!
Like the famous Bombe :


I was also able to add some very good picture to my collection of "Me and Super Computer".

Jul. 5th, 2008

Arrived in Chicago !

K got a job for the Obama presidential campaign. So we packed all our belongings in oversized truck and left DC.


The road trip was pretty mellow. We were looking for more weird museum and adventure parks. Sadly we only crossed a few at a late hour.

We made good use of K's ipod. We listen to Randy Pausch's Last Lecture and tear up a bit. We also had a large stack of podcast and we were able to catch up on some This American Life (K even agreed to listen to Stack Overflow).


Jul. 1st, 2008

WALL-E and "The Moon Is a Harsh Mistress"

WALL-E is an instant classic. In part because it is cleverly overflowing with references, from the obvious 2001 to the classics Pixar. Finding all of them will probably fill endless discussions with friends and many pages of student's papers.

One in particular really touch me.

!!! Spoiler Alert !!!

Back on earth after EVE fix WALL-E the adorable little machine loose is personality. This immediately reminded me of Robert Heinlein's "The Moon Is a Harsh Mistress". I read it probably when I was 10 or 12 during the period of time where I devoured all of Asimov's books and other SF classics.
It contained a lot of new and interesting ideas for me at the time: the sentient AI, the organization of the underground rebels, the libertarians ideas and more is coming back to me as I am writing this.

The end really affected me because, unlike WALL-E, Mike does not recover is sentience.

I was so sad that I rewrote the end.

Jun. 27th, 2008

"The Algorithm Design Manual" by Steve Skiena

"Don't reinvent the wheel, just realign it."
Anthony J. D'Angelo

It is difficult in programming not to reinvent the wheel and I can see two reason for that:

First, because you can! (and it is more fun!)
It is surely desirable as a learning exercise since algorithms should never be magic black boxes, but in real life this is an extremely bad idea.
Even implementing a seemingly simple algorithm is full of little corners and non obvious degenerate cases. For example, a careful inspection of the algorithms in any textbook never fails to reveal a lot of mistakes (computer algebra humhum).
We all think that we are exceptional programmers but this is simply hubris. People unsure of their abilities do probably a better job because they are going to be very suspicious of their own work. Every piece of code should be considered guilty, even with good unit tests. If the code was automatically derived from a formal specification you should be extra suspicious of the specification.

The second reason: you do not know about similar problems that have been solved (or at least extensively investigated). Or you fail to find an interpretation of your problem in terms of a well known one. (Your best shot is usually to try to map it to a graph problem.)

Sadly, this book does not teach you humility but it is a very good resource for the second problem. It is composed of two major parts.

The first half goes over some general principles like linear programming and backtracking. The techniques are illustrated by engaging little war stories. Big-O notation and NP completeness proofs are also reviewed.

The second is a catalog of data structures and algorithms divided into relevant categories. No actual algorithm is given but instead a reference to possible algorithms with their respective trade offs. Each section has an illustration that makes browsing through the book in search of inspiration very convenient.
Reading the catalog I could not stop thinking that a wiki would be a perfect home for such materials.

The book does a very good job at exposing a large quantity of techniques and how to combine and adapt them to solve your problems.

If you have never been exposed to those ideas before it is probably a bad place to start, but if you need to refresh your memory and fill some gaps the materials are very appropriate.

The negatives :

- a lot of errors for a second edition, but there is an errata on the author's web page.
- references to existing implementation is dated and by consequence useless.

This text book would be an excellent read after a first course on algorithms and a valuable addition to every programmer's book shelf.

I love xkcd

Previous 10 | Next 10