Posts from Monday, July 25th, 2005

Help Wanted: IE/Win Script Weirdness

Published 13 years, 4 months ago

Okay, JavaScript / DOM scripting gurus, I need your help.  Explorer for Windows is completely baffling me and hopefully one of you out there can determine what’s making it act so peculiar.  To see the problems, go to the debug version of HYDEsim in IE/Win and compare the the results to those in Firefox.

Problem #1 is that the rounding function I wrote doesn’t seem to be working right (though this could be an effect of VirtualPC).  Here’s the function:

function round(x,dp) {
	var rt = Math.pow(10,dp);
	return Math.round(x*rt) / rt;

That’s it.  All it’s supposed to do is round off a number to the given number of decimal points.  Thus, var test = round(3.1415926539,3) should return 3.142.  In IE/Win, instead of the expected 0.71, I’m getting results like 0.7100000000000001.  Huh?  Where the heck did that come from?  Is this fallout from that Intel rounding bug everyone was smirking about five years ago, or what?

Problem #2 is perhaps more obvious: the Great Big Circles on the map.  I’m creating the GIcon objects correctly, passing in the height and width of each one.  The top left corner placement is correct for each marker.  They just haven’t been resized in any way at all, and so are being drawn at their inherent 1000-by-1000 size.  Is this a breakdown in IE/Win, the Google Maps API, or something else?  I tried passing pre-rounded values and it didn’t seem to help.  Am I stuck here, or is there a solution?

Many thanks for any help you can provide.

HYDEsim Update

Published 13 years, 4 months ago

I’ve updated HYDEsim to include a key explaining the various overpressure effects—it’s at the bottom of the page—as well as to use generally improved code, having discovered the joys of for (var x in y).

I’ve also been pounding my head against the Google Maps API as I try to figure out how to read and set the map type correctly, so I can include the map type in the link parameters.  What’s in the documentation seems wildly different from what I’m getting.  When I query map.getCurrentMapType(), for example, I don’t get a type, I get a whole array of stuff that looks insanely cool and useful but is all apparently undefined and therefore useless.

On an even less happy note, the tool has completely broken in IE/Win.  Given the lack of anything resembling a useful JavaScript console in Explorer, I have no idea what’s happening, or why.  Sorry about that, IE users.  It works fine in Firefox and Safari.  If someone figures out the problem, let me know in a comment.

In the meantime, here are some approximations of a few famous historical high-yield explosions:

And, just for extra fun, here are two fictional explosions.

That last one assumes I got the yield right, which I may not have, since I don’t own the book and haven’t read since it came out in hardcover.  If I remembered incorrectly, let me know what the actual yield was (not the incorrect yield that was first estimated, but the correct one that came later in the book) and I’ll correct the link.  Thanks.

Update: thanks to assistance from some helpful folks and some fun hacking around IE/Win’s flaws, the tool is back to working in IE/Win.  Yay.

Why I Blog

Published 13 years, 4 months ago

Molly asks why we blog.  I don’t know why you blog, but I know why I blog.  Therefore, it’s time to blog about blogging.  (Not nearly so brilliantly as did Shelley, I admit.)

Though I still detest the word “blog”.  I’m not too keen on the chronoillogical order of posting, either, but that’s a whole other barrel of fish.

My journal here is a way of communicating, which is one of the most powerful drives humans possess.  Just about everything I’ve done professionally has had, at its core, the intent of making it easier for people to communicate.  Back at CWRU, for example, I wrote a series of HTML tutorials in order to help lower the barrier to publishing information online.  For me, started life as a way to connect with readers of my then-forthcoming O’Reilly book, as well as with folks who were already familiar with my work in CSS.  Posts were mostly technical or book-related at first.  Over time, I started to mix more of myself and my personal view of the world into the site.

Like Molly, I’ve gotten negative feedback here and there.  Some people have attacked me for views I’ve expressed; others berated me for wasting their time with non-technical posts; a few even insulted and belittled me for daring to not precisely meet their expectations.  I did eventually set up separate technical and personal syndication feeds, along with a combined feed, although most of the reason I did it was so that my non-technical friends could keep up with the site, not the other way around.  I find it slightly depressing that the technical feed is one of the most popular URLs on the site.  Apparently, many of my readers are only interested in what I can teach them, and not in who I am.

In that light, it might seem foolish to continue putting time and energy into personal posts,  but I am steadfast in my conviction that suppressing the personal side of the site would be far  more foolish.  I can summarize why I believe this with a single incident.

Early this year, I posted a personal entry about communicating with Carolyn via sign language.  Soon after, I got e-mail from a reader—a name many of you would recognize, as it happens—thanking me for that post.

His son, you see, does not speak, and never has.  The son is more than old enough to be verbal, and is in all other ways mentally normal and healthy.  He has simply never started to talk.  It had never occurred to the correspondent that sign language might be an option for communication.  Learning that Kat and I had successfully taught sign language to Carolyn, a child less than half his son’s age, was a revelation for him.  It was, potentially, a truly life-changing moment for his entire family.

That is why I will never stop posting my thoughts, sharing my views, and trying to connect with readers on a personal level.  That is why the occasional complaints or flames that I’m too personal or too facile or too arrogant or too liberal or too whatever just roll off my back, as interesting and injurious to me as last month’s weather report.  And that is why I think the people who only read technical posts, here or on any site, are doing themselves a grave disservice.  They’re closing themselves off to more than they can possibly know.