Author Archives: sgamon

Z-index does not work like you think it does

When you start out in front-end development, you quickly discover z-index. Your intuitive understanding of it will be something like this:

  1. All elements have a default z-index of zero.
  2. Therefore, if I assign a higher number to a specific element, my element can “float” above the others.

This is true surprisingly often – like Newtonian physics. But it’s not the whole story.

The whole story involves stacking context. A woolly subject that you can dive into here.

Or, you can wait until you have z-index problems, then dive in. 😉

Just remember, z-index is more complex than it looks.

 

Dolph Lundgren, my hero

I loved the action movie movement of the 1980s. Long after the genre had shuffled off to direct-to-video and VOD, I continued to support it with my viewing habits and ticket dollars.

Among the Action Heros, Dolph Lundgren grew to be a favorite. Not right away, of course. Back then it was Sly and Arnold, then Van Damme and Segal. Lundgren, let’s face it, is a very limited actor.

But, as the decades passed, it became impossible to ignore the fact that Dolph Lundgren kept himself in great shape. That, in itself, became a super-power. Also, I think, a pathology.

Then, more recently, I noticed that Lundgren was making his own films. I respect that. It’s not easy.

And then, yesterday, I read this interview.

Amazing. I could pull a dozen quotes from it. But I won’t. Suffice it to say, Dolph Lundgren clarified (and simplified) a lot of stuff for me.

And please, don’t think that I am equating Lundgren to me. It’s way more complicated than that. My father, for example, never laid a glove on me.

But I have a huge respect for Dolph Lundgren now.

IE’s automatic Compatibility Mode

The other day, we had a mystery: Some javascript code that has worked on production for a while now stopped working in IE9. The error console complained that the forEach() method did not exist on an array. And yet, IE9 has always supported Array.forEach(). WTF?

We re-wrote that code with regular for loops, and moved on. But today, we saw weird layout problems in IE9. Fiddling around, by accident, I discovered that the pages were rendering in IE7 mode! Off to Google:

It seems that Microsoft “helpfully” renders pages in compatibility mode (IE7) if it thinks the site is in the intranet zone. I don’t know how it decides that a page is in the intranet zone. You can override this behavior in the settings, on an individual basis.

Luckily, there is a special meta tag that IE looks for, and changes the rendering engine accordingly:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

Alternately, you can send a header that does the same thing.

Note that this only applies to a true IE9 install. If you emulate IE9 using IE10 or 11, you will not see the automatic application of compatibility mode. As you can imagine, this only added to the mystery, because I was unable to reproduce the bugs on my laptop. It was only with a borrowed laptop that I discovered IE7 mode.

 

Car Wars as connective tissue

Review, if you will, this wonderful Car Wars retrospective. In the early 80’s it didn’t matter if you spent most weekends on the East Front or the 6th Level of Foozle’s Lair, you occasionally played Car Wars. It was the connective tissue that bound all gamers together. I recall, simultaneously:

  1. never taking this game seriously
  2. buying a bunch of supplements
  3. some great sessions!

Actually, one of the wonderful things about this game is that nobody every got mad. Losing is a high-EQ ability, not commonly found in teenage boys. But all I recall from Car Wars is laughter. No one ever took it seriously enough to get uptight.

 

 

Reduce Friction to Win

14925705107_3ac2376a63_z

Here’s another lesson from basketball, that applies to business (and life). Winning emerges from harmony. That means that high-EI people, who actually try to get along with one another, are critical to any team (or organization).

A post on Bruin Nation, reflecting on the career of coach Larry Brown, says:

I would also point to his ability to reduce the inherent friction between individuals in a team game.  Phil Jackson was a coach who had great insight into how to do this. When constructing a team he would find veterans who could fill certain roles on the team that would not conflict with the stars.  Younger players wanting to prove themselves and  playing for big contracts would– even though more talented than role-player veterans–take shots and touches from the more talented stars, hence leading to a less efficient team.

And I think Brown has those same type of friction-reducing skills.

A day earlier, Ailene Voisin published a column about internal discord in the Sacramento Kings front office. Coach George Karl said:

I think organizations are a little bit like basketball teams,” he said. “They have to play together, work together. Where the responsibilities fall, what the opinions are, behind closed doors we’re allowed to have fights, heated discussions. But Bill Walsh told me when I first started coaching that “‘organizations that aren’t together don’t win.”

And before last night’s Warriors game, coach Steve Kerr said:

I think comedy plays a huge role in sports. You have to have guys who are funny, who keep the locker room loose.

Yes, the universe is sending me a message. I get it.

The photo, “WD-40” is copyright (c) 2014 by Mike Mozart and made available under a Attribution 2.0 license.

Add swap to your Digital Ocean Droplet

I have one of the small droplets on Digital Ocean, which works fine for serving web sites. And also learning about linux.

It turns out that linux does not automatically come with swap space. That’s obviously in keeping with the unix philosophy of:

  1. doing the minimum
  2. assumes you know what you are doing

It is easy enough to set up a swapfile. Instructions vary slightly based on your linux flavor. For example, I run centos 6, so these instructions work for me. Google as needed.

After setting up a swapfile, npm installs work flawlessly. Highly recommended.

Translate placeholders with Google Translate widget

The Google Translate widget does not translate placeholder text in form fields. A regrettable oversight. This code corrects that.

Re-setting the mysql root password

DB corruption, or hacking? Either way, I’ve had my WordPress DB wedged twice in the last 3 years.The solution is to reset the root password. Instructions are here, but repeated below:

/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
/etc/init.d/mysql stop
/etc/init.d/mysql start

 

Jim Harbaugh’s last lesson

I was really, really late to the Harbaugh party. He was loopy and successful at Stanford, but I’m not a Stanford alum or fan — I only paid attention when he played USC or UCLA. And the 49ers were bad for so long, I didn’t expect them to bounce up so high just because of a coach. Plus, there was a lockout, which limited my interest in football that first season. And then I wondered if the 49ers weren’t just a little lucky, a flash-in-the-pan.

I finally embraced the Harbaugh 49ers two years ago.  I started reading everything about Harbaugh, and I came to understand that he is a really interesting, unique, effective person. As most great coaches are.

Harbaugh is always teaching us new lessons (which is funny, because Jed York says he wants his next coach to be a “teacher”). We all expected Harbaugh to diva his way to another NFL team, cash in huge, and stick it to York. But that’s not what he did.

Instead, he went back to college coaching. And sure, there are extenuating circumstances. He is coaching his alma mater, a historically famous football school, heir to a legendary coach. And they are paying him an NFL-level salary (although less than he could command on the open market).

Why did he choose that path? I think he came to understand that success is not happiness, and happiness is not counted in championship rings. This is different from Jed York’s (and many other NFL owners) understanding of the world. A few years ago, when Jerry Sloan retired, I wrote this:

Michael Jordan and  Kobe Bryant from the player side, along with Pat Riley on the coaching side, have turned a psychotic need to win into one of the most prized attributes of any coach or player. Jerry Sloan never suffered from that. He wanted to win, and tried very hard to do so. But for Sloan, winning was a by-product of playing your hardest and executing perfectly. If you played hard and executed well, you could walk away from any game with your head held high.

More recently, Carmelo Anthony said this:

You can’t control winning. It’s out of your control. You can control what you do. You can control your work ethic and your mind-set. When it comes down to winning, everything has to be synchronized, from ownership all the way down to the staff. Everything has to be in sync.

I don’t have any quotes handy, but at the beginning of this NBA season, Kobe was asked why he returned, and why he returned with the Lakers. And his answers were a little mysterious, but he talked about “going through the process,” and “honoring the process.” I think Kobe (like Carmelo, and Jerry Sloan, and now Jim Harbaugh) has come to understand that happiness does not come from achievement, it comes from striving for achievement. From hope for future success, not reflection on past success. It’s more important to play to win, than to actually win. Here’s a bit from Harbaugh’s farewell press conference:

-Q: You’ve said playing for a Super Bowl title is the ultimate prize and you don’t have one yet. Is that still a goal for you?

-HARBAUGH: We played for it and that’s the way we look at it. Every time we took the field it’s been a tremendous thrill, one of the great thrills of my life and am forever proud of what we accomplished.

By leaving the NFL, and going to Michigan, Harbaugh is also telling us that love and acceptance and trust are really important. Those are the things that have to be synchronized, as Carmelo says. Those things, and the freedom to pursue happiness, are more important than money or trophies.

 

 

James Garner died

NOTE: this was started last summer. Then noodled on for several months. Then I hit “publish”.) 

James Gamer died last Saturday. He was 86.

I have a ton of affection for Garner, but mostly based on his “Jim Rockford” character. “The Rockford Files” were on in my house every week during it’s initial run. Then every day in re-runs. The Gamon’s were unabashed Rockford fans.

This is a notice, not a lament. Garner did everything I cared about by 1980. I enjoyed his subsequent work, but I don’t get misty-eyed about it.

He was, frankly, an underachiever. Tall, handsome, charming: he should have been the heir to Cary Grant and Rock Hudson. But he wasn’t “actor” enough to escape his true nature. That nature was on display in “Maverick,” “The Great Escape”, and “The Rockford Files.” Garner enjoyed playing the role of the smooth-talking, ethically-flexible, reluctant hero. Rockford, in particular, had a hidden line he would not cross. That’s when he flipped into a hero. Rockford also had an interesting twist on manly pride: You could overpower him in various ways. He accepted that pragmatically. But if you fooled Rockford, he became a relentless foe.

I think Hour of the Gun was Garner’s only effort at a darker role. He fails, in my opinion. But Jason Robards is an outstanding Doc Holiday. And the affection between Garner’s Wyatt Earp and Robards’ Holiday seems authentic.

As usual with old celebrities, I don’t really miss or mourn James Garner. But I’m glad he was around.