I've seen this happen randomly before, in other scripts that I've written. For example, if you go to my JavaScript Search and Highlight page and click any of the buttons and press 'Enter' to accept the dialog box default over and over as fast as you can, you'll sometimes get the crash on IE. It never crashes Mozilla, and the script isn't getting any errors, so I generally just chalk it up to an Internet Explorer bug and cross my fingers that no one will ever intentionally try to break the page like that.
When I've run into this in the past, I've spent a lot of time searching Google and Yahoo and various forums to see if anyone has any insight, but I've always come up blank. I decided to try again, and after a lot of different searches I think I finally found a lead.
First, I found a reference to an Internet Explorer memory leak. The people at webreference.com noticed a memory problem with their script, found a Microsoft technote about it, and said that despite the fact that it was supposed to be fixed somewhere in the IE5 codestream, it still exists. They even provide some code to reproduce the issue (which becomes apparent if you run the script over and over with Task Manager running). They also mention that their solution was to dereference all of their JavaScript DOM objects (setting them to null) when the user leaves the page.
I tested that out on my pages, and found that I wasn't really getting any increases in memory allocation, and I wasn't really using very many DOM objects (directly) in my code, so I pretty much ruled that one out. After a while I came across a reference to another Microsoft technote entitled BUG: Internet Explorer Stops Responding When You Dynamically Insert Table That Contains [Input Type="Button"], which begins with this information:
Internet Explorer generates an access violation and stops responding (crashes) when you dynamically insert a table that contains the following<input type="button">
into a Web page by updating the innerHTML of a div.
This behavior can occur if a mouse event is pending and you wipe out the control that initiated the mouse event before the mouse event returns.
Yup, that's almost exactly what I'm doing. In all the scripts where this is a problem, I'm rewriting all or part of the page using innerHTML, and in all these scripts the button that's calling the innerHTML rewrite is inside of the area that I'm rewriting. And it makes sense that this could cause problems, really. The object that's spawning an event is getting destroyed before the event is complete.
I played around with window.event.cancelBubble=true
for a while, but that never seemed to completely fix the problem, so I think I'm going to try to place the button outside of the refreshed area and see if that helps. I also need to check to see how backwards-compatible the <button> element is, because that may be an easier solution in the end.
I was amazed that I had never seen that technote in all my searches (it shows a Last Reviewed date of over a year ago), until I realized that it doesn't come up in a search on search.microsoft.com for "javascript crash" or even "innerHTML crash". Seems like the magic search string is "innerHTML access violation". Ah, of course...
A ship sailing by at sunset
The sun going down over Sunset Key
What he really wants to be is a rock star, though. I love this quote:
"I hope to prove myself and others wrong in singing some day. Of course, in the beginning, people will say, that's just "hairboy" singing."
Yup, that's probably what they'll say...
Just like last year, here are some of my favorite topics from the past 12 months:
Thanks as always for stopping by. I'll catch you on the flip side.
However, part of the story was going to involve the line from Catch-22 where Appleby can't see the flies in his eyes because he's got flies in his eyes. And I realized that some of my readers wouldn't get the reference, because even though lots of people have some basic understanding of what "Catch-22" refers to, many people probably haven't read the book.
So, for reasons of cultural literacy, I decided to put the relevant part of the story on my site. You can now read exactly what Catch-22 means here.
To add a little weirdness to the day, as one of the bands of Tropical Storm Bonnie passed by, we could see two tornados in the distance (maybe they was just funnels, but it sure looked "tornadic" from where we were sitting). Then I went back to my office, and outside my window was snow! That's right, snow. At first I thought it was hail, but it was white and flakey and blowing around...definitely snow-like. That lasted for about 2 minutes, and then the torrential downpour moved in.
Now I'm home, just waiting for the weather. I think the bad stuff is supposed to hit around 2 AM, so it might be a restless night. At least we're not evacuated, though.
If you need a little more time to test the workstations in your environment, Microsoft has provided instructions for Temporarily Disabling Delivery of Windows XP Service Pack 2 Through Windows Update and Automatic Updates. You never know when that might come in handy. It only works until December, though.
To help you along, there's a lot of information about planning your SP2 "deployment" on the SP2 Resource Site.
From New York Newsday: Men In Pink
I have a feeling I'll be sitting this one out, much like I did the first time it happened in the late 80's. Of course, what's really going to noodle me later is: was this really a trend before I blogged about it, or did all the hip Italian designers who read my blog pick up on it after they read it here...?
;-)
If I get some time I'll clean up a few more routines I found, just in case they might be useful.
I've got plenty of CSV file processing examples in my toolkit, so I can piece together some old code to get something working pretty quickly. However, I was wondering if I should convert the CSV file to XML first, and then reuse the XML parsing class that I'm using for the other file. That would add some overhead on the front end, but it might make things more consistent overall.
Just in case I go in that direction, I shuffled some old functions around this weekend and wrote a helper class. You can download it and take a look in this latest tip: Convert CSV Files To XML. It's a LotusScript class that reads a CSV file and writes its contents to a new XML file. You can specify certain parameters like the delimiter character (usually a comma, but sometimes a tab), the XML encoding for the output file, etc. It also properly handles quoted strings with embedded delimiter characters and linefeeds. See the code for details.
I did this in LotusScript because it's easier to debug a LotusScript agent than a Java agent. You should be able to easily convert this to Java if you need to. It also uses some ND6-specific functions that you'll need to replace if you want to use this in R5 or earlier.
Disclaimer: I was not the originator of this picture (as much as I'd like to take credit for it). It's from Volker's LotusWars wiki page. Click the picture to go there.
Me: Did they get anything good?
Wife: There's some candy in here. Sweet tarts, candy sticks...
Me: Candy sticks? What are those?
Wife: You know, those little white sticks of candy that look like chalk. When you were a kid you used to pretend they were cigarettes?
Me: Actually, I think they were candy cigarettes when we were kids.
Funny how times change. Heck, in 30 years they probably won't be called "candy sticks" anymore either. They'll just be called "sticks". Just like how "Sugar Frosted Flakes" became "Frosted Flakes", and "Sugar Smacks" became "Smacks".
Even the really old Cheerios ads (before my time, but I've seen them in magazines) used to have a little boy running and jumping and zipping around a room, with the slogan "He's feeling his Cheerios". These days that's right out. Soon they'll be advertising breakfast cereals that actually sedate your kids -- "Sluggies: the cereal that slows 'em down".