On overflow errors

I was asked to create a simplified shortest-path generator.
"Simplified" meaning, in this case, "On every step go from the current point to the nearest unvisited point", which is, fortunately, just O(n^2), not NP-hard.

Now, the sample data I was given consists of 13312 points, spread out in a circle of radius ~45000. I spent a little time determining that attempting to calculate Euclidean distances between any two points could result in a 32-bit integer overflow, so I very carefully used 64-bit integers (uint64), as follows:
uint64 distsquared;
uint deltax = abs(point[j].x - point[i].x), deltay = abs(point[j].y - point[i].y);
if(((uint64(deltax))*deltax + (uint64(deltay))*deltay) < distsquared){
    distsquared = deltax*deltax + deltay*deltay;
    /* Other stuff */
Anyone spotted the problem there yet?

I didn't, until I trimmed the data-set down to only ~5k points, and pinned down the exactly which point caused the "nearest" algorithm to skip to the other side of the disk, and watched exactly what happened.

If you are still looking for the bug, quit reading until you give up.

The bug? At that point, the square of the distance from the current point to the next point was then about 4.30 billion. Unsigned 32-bit integer overflow happens at about 4.29 billion. And that fifth statement is missing the all-important casts to make it 64-bit multiplication and addition, instead of 32-bit. So, instead of assigning 4.3 billion, it helpfully assigned 10 million. And things proceeded to go downhill from there.

Does anyone have a DWIM module[0] I can borrow? And no, not interested in ACME::DWIM or Parrot::DWIM.[1] Those are for Perl, which doesn't help me much here.

[0] You're on the Internet; look it up!
[1] You're on the Internet; loo^H^H^Hyou're better off not knowing.

On 10-mbit ethernet cards and WinXP

They don't mix.

OK, so I don't have anything particularly substantial to back me up. What I do have is a computer that had Windows ME installed and was working just fine. Then its owner installed WinXP. And the ethernet card quit.
Correction. Reproduced. And then both cards quit.
Yes. Under WinME, there was one working ethernet card. Under WinXP, there were two different cards. With only one Ethernet port between them. And neither of them worked.
No matter how much anyone insisted that there was only one ethernet port, XP was completely convinced that there were most definitely two ethernet cards.

So, I get paged to fix things.

The apparent problem is that the computer is not getting a DHCP lease. First, I assume it's a network problem. Because that's one of the router's standard failure modes. Bouncing the router didn't fix the problem, so I went on to other things. The first was starting my packet sniffer and sniffing for DHCP packets. --- There weren't any. So I look at the blinkenlights. And I discover that the blinkenlight that should be on isn't. Therefore, it must be a cable problem. I plug both ends of the cable into the switch to test the cable, and ... the blinkenlights turn on.
This leaves only one possible problem. The ethernet card must have died.
Yes, I know. Having hardware die exactly when you install a new OS. Quite a coincidence, isn't it?
For some reason that I can't remember now, I rebooted the computer. Maybe I pulled one of the other PCI cards? Anyway, as the computer started up, I noticed: "Hey! The blinkenlight is ... ... ... *was* on." At this point I became rather curious.
Off goes my computer, out comes its ethernet card, and into the other computer it goes. Boot, and once the drivers are installed, my 10/100 ethernet card works. I go to Windows Update and Google. Neither of them knows about new drivers for either of the two old cards.
To prove to myself it's a driver problem, I inserted an Ubuntu LiveCD and boot off it. My idea was that I could then say "Your card won't work under XP, but it will work under Linux; and you can use that instead, at least until you have time to order a new ethernet card." Of course, in keeping with everything else that's been happening, the CD is corrupt. So I burn a new one. The new one is corrupt too. In the same place, no less. A little peeved at myself for not having done this earlier, I checked the MD5 sum of the CD image. And discovered that the checksum is correct. At this point, I decided that the world hates me and it is time to admit defeat.[0]
I returned the computer to its owner, she acquired a 10/100 ethernet card, and I installed it, turned the computer on, and babysat it while it installed the drivers and commenced working.

The other "ethernet card" turned out to be a modem, BTW. As in one of those things you plug a telephone line into.
Permission to shoot whoever thought that it was a good idea to provide drivers that made XP think a modem was a ethernet card? Please?

[0] I have ordered pressed CDs now. I didn't want to do so; I thought I was perfectly capable of burning my own CDs, but obviously I'm not.

On csrss and eelbwx

Some of you may recognize the second word in that subject line.

In this case, though, it's *NOT* the Microsoft client/server run-time subsystem; rather it's a rather nasty piece of malware, that puts itself in %SystemRoot%\system32\eelbwx.

Its effects are to:
1) Watch for and kill-off/disable all instances of any active firewall or anti-virus, and the same for regedit.
2) Block all outgoing going connections to ports 443 and 1863; possibly others too.
3) Block, via entries in the HOSTS file, access to all common AV download and update sites (avast, symantec, grisoft, mcafee, &c.)

So far, I have managed to keep it from respawning and restarting by manually deleting it in Safe Mode and denying everyone Full Control to eelbwx[0]. A reboot proved the at which point I discovered that it spewed its startup entries in HKLM/Software/Microsoft/Windows NT/CurrentVersion/Windows. Those were removed, and the hosts file was repaired, removing effects 1 and 3, but #2 is persisting. I don't feel like reinstating access to eelbwx; that feels entirely too much like "Why try your luck?"

If this were my computer, Windows would have been reinstalled some time ago, but it isn't, so I have to try and clean it the correct way, instead of the easy way.

Effects #2 does not appear in Safe Mode with Networking, so some things (like updating AVG Free) can happen. Others (like Windows Update) cannot, because they require unsafe mode only things.

[0] *nix equivalent:
# chown root:root eelbwx
# chmod 0 eelbwx

On Weather

The National Weather Service says:

Today...Snow in the afternoon. Snow accumulation around 3 inches. Highs in the mid 20s. East winds 5 to 10 mph. Chance of snow 100 percent.
Tonight...Snow in the evening...Then chance of snow after midnight. Snow accumulation around 3 inches. Total snow accumulation around 6 inches. Lows around 14. Southeast winds up to 10 mph shifting to the west after midnight. Chance of snow 80 percent.

Six inches of snow on the ground tomorrow. Provided I don't have to actually go anywhere, I'll be great. I've tried the road-bike-on-powder thing before. It doesn't always work very well.

Hmm... I know I've seen road tires for a mountian bike (2+ inch tire); I wonder if the other way around exists.

On cooperative stores and behaving bicycles.

That innertube that blew at the valve stem was returned to the store today, for a free replacement, and I purchased another one so I'd have a spare[0]. I installed one of the tubes, and everything seems to be behaving. I also practically soaked my chain in WD-40, since I had the rear wheel off, and it (the chain, not the wheel) usually needs oiling, especially during the winter.

Can anyone explain why is it *always* the rear wheel that has problems? The last time I had to do anything with my front wheel was on the bike trip back in August.

[0] It's a whole lot more pleasant to bike to the bike store to get parts, so I keep at least one spare brake cable, shift cable, and innertube on hand at all times.

On shininess and misbehaving bicycles.

I just *had* to share that little bit of shininess.

In other news, I discovered yesterday that my rear tire was quite low.
So, I took the tube out, inspected it, found nothing, put it back in, pumped it up, and BOOM!!!
So, I took it out, got out my spare tube, put it in, pumped it up, and POP!! SSSSSssssssssss......

The former was your standard blowout, including the blow-the-tire-out-of-the-rim part.[0] The latter was the result of having a hole materialize in the valve stem, of all places. And I'm not in the habit of keeping two spare tubes.

Dale was *NOT* a happy camper. (Still isn't, actually.)

[0] As far as I could/can tell, the tire is undamaged.

On Drop Ceilings

Several of the rooms here at Aldersgate have those things. They're great for hiding cables and other unsightliness, without actually cutting into the ceiling, but...

They're called "drop ceilings" for a reason. Because they do. Sometimes as much as six inches. Then people come knocking on Dale's door and asking him to "take a look at"[0] the dropped ceiling.

As far as I know, the ceiling hasn't dropped again, but I'm not going to break into someone else's room just to check.

[0] A not uncommon mispronunciation of the word "fix".

On Blinkenlichten

OT: I like the sound of "blinkenlichten" better than that of the official term, "blinkenlights", and the former is the original form anyway, so I'm going to use it.

I'm trying mightily not to end up in my corner whimpering again.

I just moved 11 of my blinkenlichten out of my room, and the remaining 9 down where I can't see them. I didn't realize they were so important to the atmosphere of my room. It's disconcerting not to have those nice pretty blinkenlichten flickering at me while I sit here.

"Blinkenlichten" comes from an old joke sign in broken German that ends "relaxen und watchen das blinkenlichten". In my case, that last line apparently holds quite true, even though their only use is to tell me what I have to reset when things break.

On John Hancocks and expressions

And, four hours later, and less than 38 hours after I placed my order, I've affixed my John Hancock to that pad the UPS driver carries and I have the stuff is in my hot little hands.


Quit looking at me like that. I know my hands are usually cold and are not exactly little. It's an just an expression, OK?

On Mail

Pardon me; I need to plug a certain mail-order website briefly. Specifically Provantage.

I went there to order some network equipment yesterday. (Admittedly, 0:36 yesterday, but that's still yesterday.)
In that list of things was a 25 foot ethernet cable for $5, including shipping. Which is about *half* the price I paid last time I bought such a cable (from a brick-and-mortar store). Their other prices manage similar feats, though not usually so substantial a difference.[0]
I mentioned when I ordered it for a reason. I paid for ground shipping. Which is supposed to be 3-5 day. Now, less than 34 hours later, UPS reports that it is "out for delivery". This is standard when ordering from Provantage. You can pay for next-day or two-day shipping, but why bother? You get it anyway.

In the "Extremely logical things" department, we recently received a piece of junk mail. This is not usually news. Getting ten or more in a single day would be news, but not just one. But this is extremely special junk mail.
1) It arrived in a hand-addressed envelope,
2) It was addressed to "Aldersgate Student house", and
3) It was advertising in-home care as an alternative to a nursing home.
In case the "Student" in #2 didn't make it obvious, we're mostly in our twenties.

[0] How do they get their low prices? Their return policy. Make sure you know what you want before ordering; the usual rule is return accepted only if it's unopened or dead-on-arrival (DOA). Some products can be returned only if DOA.