On Sigmund Freud

I’ve been a beneficiary of psychoanalysis in two different periods of my life. The first, short and fundamental in helping me completely change my profession at the age of 27. The second, longer and still ongoing, helps me in a myriad of ways and led me to read a fair amount of psychology books.

In the title I make sure to specify which Freud I’m writing about because my life has been affected by at least three members of his family: himself and his grandsons Clement and Lucian. Clement wrote a children’s book called Grimble which taught me self-reliance. And Lucian, a great painter, taught me what looking can really mean.

Sigmund has seen times in which he was more fashionable than today. And it wouldn’t be surprising if Lucian becomes the name most associated with the family in a couple of centuries, given how great a painter he was and the fact that ideas flow and are co-opted much more easily than works of art.

Reading Sigmund’s works has no substitute in terms of getting in touch with what a truly transformative mind is able to do. One immediately forgets all the pop-culture clichês about him and is struck by his intellectual honesty: a writer who continuously hyperlinks the ideas he uses to their sources, weaving the web that was his place and time, and which he came to symbolize. At the same time, he is very diligent when it comes to laying out the limits of his knowledge, and often wonders in print how long it will be before his ideas will be superseded by better ones. Many have been, and many have not.

Even after over a century and the tremendous influence he exerted on western culture, it’s fascinating to learn about the interaction between the unconscious and our lives, and also about the many modules in our brain, which can only be dealt with in their own terms. Contemporary neurology confirms and expands on those themes, opening avenues of improvement for individuals and society.

If only by helping people give their mental lives a framework for self-understanding, Sigmund Freud is a worthy read. His masterful writing ensures it all feels like a vacation, if a scary one at times. His writings on technique can be helpful to any field, with much that is counterintuitive and he dealt with and incorporated into his practice. I still think, however, that The Interpretation of Dreams is a good starter, if only because he explains why we dream so often that we are still in school.

React.js, Facebook JS SDK and a costly little mistake

Last week I spent much more time than I ever wanted implementing Facebook login in React.js.

As it often turns out to be, one mistake cost me about 10 hours net of investigation, and if you don’t have time to read further, here’s what was wrong: I had added all my <script> tags inside <body> in the html, and then used <body> as the element to replace when rendering my main React component.

That was it. But what about that mistake is making me stop and write about it?

First: my app worked perfectly for a long time just as it was. Weeks. In the beginning of the project I was switching back and forth between two different build systems, and when I decided on one I must have copied the main React component and nothing pointed out an error.

Second: Facebook login kind of worked perfectly in localhost. The only strange thing I noticed was that, as I loaded the js sdk into the html, the most important sdk method, FB.init, was never found.

Since I am no React master at this point and Facebook provides no documentation on how to integrate FB login to React, even though they’re all made by FB, I had many possibilities to investigate. And lo and behold, by moving the FB.init call to the React component inside componentDidMount, everything about the login worked in localhost.

When it came to the staging environment, however, things got weird. My app would not get the login status on load, but on clicking the login button, the modal dialog would open. Sometimes the window would come up blank, sometimes it would prompt for login and then never close, and many other different outcomes.

Since most recent blog posts on Facebook login deal with difficulties with OAuth settings, my investigation went that way, and there it stayed for a long time. No warning or error message ever gave me the slightest clue as to what I was doing wrong.

Thus a mistake that arguably should have made my app break on the very first run ended up taking many hundreds of runs before the bug was caught.


Follow up:
React 0.14 warns against this.