“Inserted Left Margin” Browser Bug in IE 6 and 7

November 25th, 2009

I found a weird IE 6 and IE 7 CSS bug a few weeks ago at work. I forget the exact way I found the solution (in other words, it was probably dumb luck), but I haven’t found it described anywhere else on the web. I call it the “inserted left margin” bug for lack of a better name.

This is a problem with IE 6 and IE 7, but not with IE 8 or Firefox.

The problem is that setting the width style for a tag to a non-auto value will create a left margin in that tag for (and only for) input tags. This “inserted left margin” will be equal in size to the sum of all the left margins in the containing tags. Reread those two sentences to get an idea of how obscure and weird this bug is. :)

For example, consider this HTML:

<div id=’A’ style=’margin-left: 20px; border: red solid 3px;’>
<div id=’B’ style=’margin-left: 30px; border: blue solid 3px;’>
<div style=’width: 200px;‘>
<input type=’button’ value=’Hello’/>
</div>
</div>
</div>

In Firefox, this will render normally:

However, in IE 6 or IE 7, a left margin will be inserted. The margin is 50 pixels wide (the sum of the left margins of the containing divs, 20 and 30 pixels):

(more…)

Book Review: “Out of Our Heads: Why You Are Not Your Brain, and Other Lessons from the Biology of Consciousness” by Alva Noe

November 11th, 2009

Interesting, but ultimately disappointing and unconvincing. (2 out of 5 stars)

Noe avoids mystical explanations and the supernatural. He doesn’t put forth souls or the vague appeals to quantum mechanics that are the hallmarks of new age quackery. And while he skates close, he doesn’t present consciousness as just merely a postmodern social construction. “Out of Our Heads” is grounded in this sense.

Consciousness, Noe states, is not a something that takes place in the brain like digestion takes place in the stomach. And it is more than just the sum of its parts, just as a performing dancer is more than just muscles. But as poetic as Noe gets, his arguments are full of discrepancies and far from compelling. His biggest mistake is that you can easily replace his use of the words “environment” or “body” with “the brain’s sensory input” and all his anecdotes and scientific appeals are just as valid and consistent. (more…)

Lessons Learned from Writing a Technical Book to Teach Programming

November 2nd, 2009

From 2008 to 2009, I wrote a book called “Invent Your Own Computer Games with Python” ( http://inventwithpython.com ) which guides young adults and complete beginners through learning how to program in the Python language. I’ve just completed the second edition of the book, which has been an exhausting amount of work. Looking back over it, I realized that it could have been a much less exhausting experience if I had made some simple preparations.

I’ve decided to write up this post on the lessons learned and the best practices for writing a technical book that aims to teach programming. This post will help me organize my thoughts so that I’m more prepared for my own future writing, but the practical tips can help others who aspire to write a book as well. (more…)