Mon, 27 Jan 2014


— SjG @ 9:25 am

Coffee shop, West Los Angeles.

Angry Guy: You can’t pass a law to take away people’s guns and claim it’s to make things safer. The only thing that stops a bad guy with a gun is a good guy with a gun.

Other Angry Guy: Yes, that’s why we’re passing a law to only take away the bad guys’ guns.

AG: How do you know who the bad guys are? It’s not that simple!

OAG: Exactly! So let’s discuss the topic like adults, and drop the kindergartener’s vocabulary of good guys and bad guys.

AG: Don’t insult me, you arrogant son of a bitch!

OAG: Then raise the fucking discourse to an adult level.

AG: I’m not going to sit here and argue with a goddamn communist!

Fri, 10 Jan 2014

Page loading twice … but why?

— SjG @ 11:15 am

Oh, what a journey of discovery, and what a diet of red herring.

I’m developing some pages in Yii, and noticed that — in Firefox — pages containing CGridViews were actually loading twice. The pages seemed to flicker on load, and in my server logs, I’d see two requests. I went down a lot of dark and twisty alleys trying to figure out what was wrong with my Ajax calls, to no avail. Turning off Javascript did solve the problem, so, of course, I was focused on finding a Javascript bug.

When searching for others experiencing the same problem, I found this posting. “Curious,” thought I.

I tried re-arranging the HTML layout, and damn me twice if putting the character encoding declaration earlier in the file doesn’t fix the problem.

The CGridView red herring comes from more Javascript includes being injected in the header on pages that use CGridViews. So that makes sense.

I’m still puzzled why disabling Javascript in the browser makes any difference. It does not change the location of the character encoding declaration in the file. Maybe it’s a Firefox- or Firebug- specific “feature.”

I have to admit being surprised that the spec dictates the encoding be declared in the first 1024 bytes (or 512 bytes before the 2011 version of the HTML 5 spec). I’m even more surprised that a browser would actually re-submit the request to load the page in the case where the page was out of spec. Redraw? Sure! Reload? That’s just crazy.