An American Coach In London

My daughters are both playing soccer this year. I played when I was younger, coached my brother’s team a couple of times, and refereed. Ref’ing in South Florida was the only time in my life I ever felt threatened physically. They used to cuss at us in Spanish. And I was only a line judge!

When I saw this, though, I cracked up. There are some classic lines in these four minutes of fun.

Assume

hisAndHer

I thought this was quite funny. My wife laughed, too, and said she definitely had this experience once or twice early in our relationship until she remembered it wasn’t her.

Given that, though, what is wrong with this woman? Can’t she just ask what’s wrong with him? I had a teacher in college who would write ASSUME on the white board, underline ASS, U, ME and say, “Assume makes an ass out of you and me.”

That goes double for this one.

(via Scripting News)

Barnes & Noble Shoots Itself In The Foot

In this GigaOm article on Barnes and Nobles flip-flopping “strategy,” Laura Hazard Owen writes the following:

“I’m just a little confused,” Coyote Capital analyst Rick Schottenfeld said. “By my estimation, we’ve lost almost a billion five in the Nook business since inception. And it’s really masking the underlying value of the bookstores…It seems obvious that this Nook business is dragging down the value of the bookstores, and I think shareholders would like to realize some of the value…At some point, are shareholders going to get relief?”

I’m not about to sit here and tell you I know what B&N should do with their existing business. I don’t follow the book business and, frankly, I buy everything online and most everything in digital format now. But I do know one thing: I wouldn’t use a Nook if Barnes and Noble gave it to me. It’s not because it isn’t a fine device, well built and does what it is supposed to do. For all I know it does.

When I decided to move to digital I understood distinctly that the decision I made would impact me for years. All of my content would be in that format. I basically had five choices: Sony’s ebook readers, Apple’s iBooks, Amazon’s Kindle, Kobo or Nook. I picked Kindle for three reasons: 1) I see them supporting ebooks the longest with the widest selection; 2) I wanted the e-ink devices for leisure reading; and 3) Amazon offers the most reader apps on the most devices. This combination overcame my hesitancy around the proprietary .mobi format. [1]

Because of Barnes and Nobles’ struggles, I didn’t even consider the Nook.

[1] I use Calibre to convert between formats.

(via M.G. Seigler.)

If Steve Ballmer Ran Apple

Interesting analysis on Steve Ballmer’s Microsoft by Ben Thompson, who left there a few months ago. I particularly found this paragraph interesting:

In the consumer market, it’s the immeasurables that matter. It’s the ability to surprise and delight, and create evangelists. It’s about creating something that developers demand access to, and that consumers implicity trust. The consumer market is about everything you can’t measure, everything Microsoft’s legion of mini-Ballmer’s can’t see and will never appreciate.

I can’t help but wonder when this happened? I can only assume Microsoft changed after Ballmer took over. All of the Microsoft business and process books I read in my younger days (back when I read a lot of those books) all seemed to indicate a Microsoft that wasn’t particularly focused on metrics. In fact, Bill Gates seemed to be every bit the demanding leader with his fingers in every pie as Steve Jobs is described. Maybe this is really a story of what happens when founders leave their companies. Most don’t survive, at least not in the high-flying state they were with the founder.

It also was a company back then that seemed to be as strong with consumers as it was with enterprises. Everyone I knew who had a computer in their house had a Windows computer. Now, it seems, everyone has a Mac at home. When did that happen? And what made that happen? Was it a coolness factor? The iPod? Better computer systems? It also seems that the virus epidemic was a big factor in this as well.

Finally, I can’t help but wonder if Microsoft’s struggles are also a parable on the risks of putting sales people in charge: an extreme focus on money, exactly the thing most of us technologists seem to care the least about.

Controlling Content Editable

I’m burned out. I busted my rear end last week writing a piece of code that has been a major problem for us. Equals uses a web technology called content editable. In short it allows a developer to segment a section of a web page and say that the user can type there. It is similar to a text area but content editable allows for rich text editing (bold, lists, headlines, etc).

The concept of content editable is amazing but there are a couple of major problems with it:

  1. The standards are different across browsers. How returns are treated, for example, is completely different on WebKit (Safari and Chrome) than IE than Firefox. I haven’t even tried it on Opera and other browsers.
  2. The cursor is a foreign thing to most browsers. Except for text areas and text fields, we were never really meant to be able to see a cursor on an HTML page.

We had to make a number of very difficult decisions here and have to admit that one of the reasons Equals is taking longer than we anticipated is simply because we ended up re-writing most of the way the note is handled. Equals relies heavily on every line having an appropriate container, whether that is a div, a p, or a header tag.

When we started out we thought we would write our code to control the cursor and then would modify the content editable area as we went along. But what we found is that controlling the cursor is very difficult. Since controlling the cursor isn’t well supported [1], making sure it always does the thing we want it to do is dangerous. We had all kinds of weird behavior.

Furthermore, the original code we wrote for this is the first Javascript code we had written. What a horrible way to get our feet wet! Upon further study, it became clear that there was a better way to write this portion of Equals, one that would be much more stable, much more portable, and allow us to do things in the future we couldn’t fathom doing today with the original code.

So a few weeks ago we decided to re-write it. The goal was to generally let content editable do what it wants and then adjust after the fact. We also moved more HTML out of the content editable area, which will stabilize the content and make it easier for us to handle stuff like copy and other across-document functions.

We also found that how we start the HTML within the content editable area makes a big difference on how the browser forms its HTML. It will repeat that first line for every return key if set up correctly. Firefox, though, prefers <p><br></p>, Safari and Chrome prefer <div><br></div>, and IE prefers <div></div> without the break. It also matters when this is set. Firefox and IE don’t seem to care, but Safari and Chrome require page load.

Once I figured this out, other pieces fell into place and typing notes became routine. It all just worked. I took 750 lines of code and reduced it to 150 lines of code. I even was able to handle cut and copy correctly.

Until a user pasted something into the content editable area. Then all hell broke loose. And that’s why I’m burned out.

Last week I wrote 150 lines of code, all of it dealing with the process of pasting [2]. The problem with paste is that it pastes whatever it has in its paste memory buffer, whether that is well-formed HTML or not. Again, I didn’t want to control the contents of the paste. So I let the content editable do what it wants and then, after the fact, go through the entire document and clean it up [3].

The edge cases are ridiculous on this one and I have only tested it in Safari so far, but the code feels fairly solid. It handled a plethora of variations and bizarre behaviors. And if it does end up working out, I have a nice function we can call if an Equals note does get out of whack for any reason. Here’s hoping the code stands and I don’t have to patch it further. This 150 lines could be spaghetti code really really easily.

[1] If you need to deal with cursor stuff, I highly recommend Rangy. We still use it some but not as much as we did in the first revision.

[2] And undo and redo, technically, although I consider both of those a side-benefit of fixing paste.

[3] I thought of alternatives like pasting into a hidden text area, cleaning up the code, then moving it into the content editable area. That may still be an option if my way fails completely in the end. But that required me to control the paste process, and that is something I wasn’t comfortable with having control over in all browsers.