joshbreckman

Google Analytics Followup...

So yesterday afternoon I received an email from Google saying they were incorporating my change into the next release of Google Analytics. The ga.js file always point's to google's servers, so this should fix the problem fairly immediately once the change goes live.

I also want to address the following two "issues" brought up:

Issue #1: Is Microsoft to blame? Is Google to blame? Why did I say "you should know better" to Google?

Of course Microsoft is to blame for the root problem. They made a crummy web browser and this has made every web developer's life difficult ever since.

However, Google encourages webmasters to put a tiny snippet of javascript on the bottom of every single page on their site, which in turn references a centralized javascript file. This one file is referenced on millions of pages! Any change they make to this file affects these pages immediately! (Well... as soon as people's cache runs out)

Call me what you want, but I think this puts the burden on Google to make sure their stuff really works. It's their job to make sure that Google Analytics stays out of everyone's way and doesn't create any new problems on the web. Even if it means working around Microsoft issues. Any changes to ga.js should be tested in every way on every type of page before being pushed live. It simply affects too many pages not to. They should know better.

Issue #2: Apparently I was being sensationalistic and think that I never make mistakes.

Sorry?

I found a fairly serious problem in a javascript file referenced by millions of pages and I got excited about it. I found a solution and wanted to get it to google to get it fixed.

The only reason I know so much about these memory leaks is that I am often fixing them. It's a pain in the neck, but you learn what to look for after a while.

Someday I'll make a mistake. I'll write a sweet-ass blog entry when it happens.

Google, you should know better. I fixed your memory leak for you.

This morning, I got a report of our CEO complaining of a memory leak when he left our website up over the weekend. This is a fairly common occurrence as he is often gone for several days at a time, uses IE7, and has decided that our website must refresh itself every 10 minutes. (We don't have ads on our pages, he just wants it to always be up-to-date on people's computers)

When our page was refreshed, we seemed to lose 100k-900k. Left over a weekend it got up to 200mb+ very easily. Sort of a scary issue.

We investigated, and after some digging figured out that our recent addition of Google Analytics was to blame. Surely Google Analytics, used by thousands upon thousands of websites, couldn't be to blame? Plus it's GOOGLE! Google doesn't make mistakes like that. However, after some quick searches, it became pretty obvious we weren't the only ones to discover this.

After we verified that Google Analytics was really at fault, I tried to dig into the source. They obfuscate/compress the code pretty good, so I ran it through an online javascript beautifier to try and figure out waht is going on.

It didn't help much, so we started looking for some likely culprits. Anything ActiveX related, etc. Most of those things you could turn off, and seemed to have to have no effect our memory leak.

And then I found it. Something that Google should just know. The problem with IE has been very well documented before and should be well understood by any javascript developer working today.

Basically, IE has two sets of memory that get garbage collected: the DOM objects and the javascript objects. Serious problems arise when javascript objects reference DOM objects, or those DOM objects somehow reference a javascript object. This latter scenario is often done via callbacks and anonymous functions. The garbage collector doesn't know what to do, and ends up not collecting something it otherwise should.

What does this have to do with Google Analytics? I found two bits of code that followed this pattern:

if (0 == z || 2 == z) {
    var A = new Image(1, 1);
    A.src = h.Da + l;
    var p = 2 == z ?
    function() {}: x ||
    function() {};
    A.onload = p
}

The key bit here is "A.onload = p". They are using an image as a low-budget AJAX call to report stats up to their server, and are apparently doing something upon completion of that call. The problem is that if not properly cleaned up, that image will keep a reference to the Google Analytics object, and neither will get cleaned up properly.

I changed that bit of code to:

if (0 == z || 2 == z) {
    var A = new Image(1, 1);
    A.src = h.Da + l;
    A.onload = function() 
        { 
            A.onload = null;
            if ((z != 2) && (x != null)) 
                x(); 
        };
}

... and our memory leaks went away.

Why is Kumar running security at the DNC?

weird.

Google has suddenly changed the way you reply to group emails in gmail... and this has caused me some embarassment

Imagine this:

  1. A friend sends 30 people an email saying "Hey, BBQ at my place this weekend?".
  2. You open it up in gmail and click in the reply box.
  3. The full reply window displays itself you and you write your response: "Can't go this weekend - we have a wedding to go to."
  4. Hit send.

Until a couple of weeks ago, this email response would just go to your friend. If you wanted it to go to everyone, you would have to hit "Reply to all" and it would automatically CC everyone.

For some reason, gmail changed this, and it now defaults to "Reply to all". (This can be verified by playing with the "Older version" in gmail)

What's the problem? The problem is that when I accidentally discovered this, I let my friend know that Sara and I were engaged - something I hadn't let anyone else on the email list know. Is it a big deal? No. But it wasn't really how I was planning on letting them know.

I consider clicking the text entry box at the bottom of an email a shortcut, and arbitrarily changing shortcuts in programs to do almost-the-same-thing is very bad.

On the other hand - this is probably the way gmail should have been working from the beginning. The problem is that users get used to one behavior - and if that behavior changes, it should be made VERY clear.

It could have been a lot more embarrassing.

The way "store locators" on the web should be

The standard "store locator" right now does exactly what it advertises: it finds stores. Probably near you. You get a big old list, and if you click one, you can view more information on it. It answers the question, "Where is the nearest X store?"

However, I think if someone really dug into what users really were looking for, I think the question would often be closer to: "Where is the nearest X store that I can get to right now?"

This is a subtle, but big difference.

Let's take the case of Bank of America. Banks are notorious for their strange hours; however each branch usually has one or two days a week that they are open late. Living near Boston, this means that at any given weekday evening at 4:55pm, there is probably one or two bank branches that I can get to before they close. (the ones that are open until 6pm...)

Right now, if I wanted to find that branch, I'd have to use the store locator and sift through every result until I found the one I was looking for. There are plenty that are open til 5pm, but those aren't very helpful to me. I gave them my address - they should be able to tell me the nearest branch that I can reasonably get to before it closes.

uhh... engaged?

So, as of Tuesday night, June 3rd, I'm now engaged.

It was our three year anniversary, and we started out the evening by going out to Blue Ginger in Wellesley for a very nice dinner. My sister Rachel was just married the previous weekend (and I didn't want to step on her toes), and we were about to move into a house that we had just bought together. So it seemed like a pretty good time to do it, but I still wanted her to think it wasn't going to happen. (You have to surprise them, no?)

bug example

Anyway, we had a very nice "regular" anniversary. I waited until she fell asleep, and cleared all of the boxes out of the dining room, found a nice little lamp from the office and set it up on the dining room table, turned on some classical music, put the opened ring case under the light, and left a note that says "You Win".

I made sure every light in the apartment was off except for that little lamp, and climbed into bed. I know Sara pretty well, and knew that light would drive her CRAZY. Immediately she says, "You left the light on..."

"I'm sooo tired, it's fine, just leave it," I replied. I knew this would never fly with her.

She angrily got up (it's way more fun to piss them off right before you make them happy) and went to turn off the light and got the surprise of her life.

She said "yes" :)

New house!

So... we bought a house!

It's a deceptively large 2-bed cape in Arlington, MA. I've put together a comprehensive photo tour.

If photos aren't your thing, you can view my shoddy camera-work (and TERRIBLE portable video camera) and watch a video tour:

Or you can do none of the above. Thoughts/comments/suggestions are always welcome.

big youtube focus-flaw

Due to my silly youtube video, I get a fair amount of youtube messages. When this happens, youtube send me an email which links me to a log in page. I'm supposed to type in my username and password and view the message.

Easy enough, right?

WRONG.

They screwed up their input focus-order somehow. What does this mean? I click "Log In". It asks me to type in my username, which I do. After this, I normally hit "tab", and type in my password. Unfortunately, when you hit tab in the username field, it brings you down to the "email address" field on the sign up form.

What does this mean? This means that if someone is sitting next to me while I'm logging in, and I act like I act on EVERY OTHER LOG IN SCREEN and typing in username, tab, password, enter - that person next to me will see my password in plain-text.

youtube

Well done youtube/google.

I am josh.breckman.com

I'm a 25 year old guy living in Boston. I'm a very opinionated programmer. I also like to make music. I like to pretend I'm good at design/UI stuff, but really am probably just above average (for a programmer).

I have a wonderful girlfriend named Sara, who I often refer to as "the girlfriend". She is an Occupational Therapist, and that probably makes her a much better person than me. Don't ask me what an Occupational Therapist is, because I always get it wrong.

We have a cat named Peanut Butter. He has hair loss problems. And lately bowel movement problems.

the amaaaaazing guitar hero wii hack

So. About 6 months ago I hacked my Guitar Hero for Wii.

It was actually pretty easy to do since the Guitar Hero Guitar just plugs into the extension port of the wiimote. There has already been a lot of "research" on communicating with the wiimote on the computer. All I had to do was start from there, look at how they parsed out the nunchuck extension, and port that to read what the Guitar Hero guitar was doing.

Anyway, it turns out we get all 5 button states (obviously), up strokes and down strokes (separately), and 11 degrees of movement of the whammy bar.

I took this info and fed it into my handy synthesizer as I played and turned it into a sort of instrument. My keyboard has a pretty decent electric guitar sound, so it sounded sort of realistic. I used the wiimote's orientation and the whammy bar to add different "note banks" to let me play more than 5 notes.

I posted this on youtube and got a (mostly) good response from it. Although apparently I'm a fag... and look like Harry Potter... and should buy a real guitar cause that'd be easier. Even though I play real guitar (and you can see them in the video), and have a girlfriend.

Anyway, the video:

A "tutorial" will hopefully be coming soon.

to puzzles

I wrote and recorded a few songs with Sara a while back. They're up on myspace.

I want to write more but seem to be having trouble finishing stuff lately. Sara REALLY wants me to write more.

Hopefully I can/will.

the breckblog project

I know it's been said before, but while designing this blog I really tried to keep it as simple as possible.

Viewing and adding comments should be able to be done in-line (while viewing the main page). On other pages, I always found that when some bit of text suddenly appears and the whole page gets reorganized that I had to re-orient myself before I could continue reading the page. To prevent this I first make room for whatever is going to show up, and then fade it in. It takes about a second or so, but I think it's worth it. Any input/suggestions on this would be great.

Besides the comments, I have a hierarchical set of 'tags', that act as categories, with special cases for the dates.

(On an aside, another benefit of doing the ajax-style comments is that it hopefully will prevent spam-bots from coming and doing their thing. I'm not sure how well the spam-bots simulate javascript, and I'm pretty sure this isn't going to be popular enough for someone to spend the time and figure out what ajax calls I'm making, etc. We'll see.)

firefox for os x opacity bug!

I know this has been documented before, but I just ran into it.

Basically, when you set the opacity on some object on your page, firefox for OS X switches rendering modes - which switches anti-aliasing modes - which causes text that gets redrawn to appear slightly different.

bug example

I ran into this when working on my cool "scroll/fade" effect for showing comments. When the comments would fade in - just in firefox on OS X - the whole page would get redrawn in a different rendering mode and look "different." (screenshot grabbed from mezzoblue.com)

Naturally this sort of sucks. What good is a fancy effect if it causes the whole page to look like crap for 1 second and then look good again?

The generally accepted solution (which I am currently using) is to set all text that could be affected to have 99.9% opacity. This causes it to always use the different rendering mode. Unfortunately, it also causes the web browser to do alpha transparency calculations for almost every item drawn on the page, causing all rendering to take considerably more time. This isn't a problem in most cases, but the "scroll/fade" animation suffers quite a bit.

What a pain in the neck.

UPDATE: I'm just ignoring this problem for now. Firefox 3 is about to come out and that should erase the problem. Mac+Firefox users will upgrade fairly quickly. Ugh.

contact info

Feel free to drop me an email. I'd like to keep the spam to a minimum, so pardon the human-verification: Either address should go to the same place:

joshATSIGNbreckmanDOTcom

or

jbreckmanATSIGNgmailDOTcom

No one understands what programmers do

I just showed a mostly working version of this blog to my girlfriend, who promptly said "you spent all this time working and have nothing to show for it?"

That's when it hit me. She really has no idea what I do. And most people probably don't. Programmers "make computers work".

She saw me working in Photoshop on the design, and really couldn't imagine all of the back-end work that went into getting this site up and running: database access, editing, comments, caching, etc. All she (and probably most people) see is a web page that looks pretty much exactly like what I mocked up in Photoshop.

In fact, I have junk data on the blog now - which she saw - and she perked up and said "oh, you wrote all of this?" She was more impressed by the three long blog entries that I stole than the entire working blog!

Now, I understand that this is probably a good thing. Most people shouldn't know the inner workings of what makes the web go round, but I at least want people to appreciate that for every webpage you look at, there is (typically) a ton of behind-the-scenes work that went into it.

I'm not holding my breath on that one.