Attack of the Spambots?

Geek Drivel is suddenly ridiculously popular with would-be blog spammers. I’m told that my primary defenses have blocked more than 400 automated spam messages in the last week, and maybe a dozen have gotten past them — all caught by my secondary defenses, I’m happy to say.

I’m not sure what prompted this sudden surge of interest, but the spammers are welcome to give up at any time.

Taming MSVC’s Intellisense

Microsoft Visual C++ 2005 (i.e. v8) is a decent compiler, with a decent IDE. But there’s one “feature” that I dislike passionately: Intellisense.

The idea behind it is a good one: that the IDE scans your source code every so often and figures out how certain things will be compiled so that it can tell you about parts of it when you ask — the type of a variable, the parameters to a function call, the members of a class, etcetera. And it works very well… on smaller projects, anyway.

On larger ones, like Project Badger, those every-so-often scans become productivity-sucking nightmares. During a scan, the IDE sucks up all of the CPU power of the machine, and it can take several minutes to complete. On my machine, the user interface becomes practically unusable during that time. And it scans fairly often… whenever you start up the IDE, whenever you switch from one project to another, or from one configuration to another (like debug to release), and sometimes with no apparent provocation at all.

I’ve tried to find a way to disable it before, using the oft-recommended method of renaming a DLL. It doesn’t work. It might eliminate some of the scans, but the thing still scans way too often. Yesterday, after I’d had to switch my project from release to debug (and suffer through a scan) once too often, I decided to check into it again.

Lo and behold, I found a solution!

In a nutshell: with the IDE closed, replace the *.NCB file in your project directory with a zero-byte file, and make it read-only. (You may also have to copy that read-only file to your temporary directory; I did so, but I don’t know whether it’s necessary.) The IDE will complain about it when it starts up, and offer to fix the “problem;” don’t let it. Without write-access to that file, the IDE won’t even try to scan, ever!

Of course, you won’t have access to Intellisense features on that project. But I usually find them superfluous anyway, and definitely not worth the time-cost in terms of productivity — I can look up the things that I might use it for myself and save all that unproductive scanning time.

Life is good again. 🙂

Amusing Spam

Spam messages are rarely amusing enough for me to post anymore, but this one takes the cake:

Subject: Hegihten the qulaity of your ereictons with Soft (ialis.

Biggest_bIowout_sale of \/aIium in our onIine pharmacy

Sorry guys, but SpamBayes wasn’t fooled. You’ll have to do better than misspelled words and ASCII art to get past it.

Busy, Busy, Busy…

There was no entry yesterday because I was deep in a programming project. Very deep… I was up and at it at 8am, and other than a few very short breaks, kept going until 3am this morning. And that’s on top of about six hours on it the day before.

Around 1995, I started writing what’s known as a “multiple-precision integer arithmetic” package. In plain English, that’s a library of functions that can handle very, very large numbers — on the order of thousands of decimal digits, far more than the number types built into general-purpose computers can handle. There are at least half a dozen others available, but I wanted to write my own (not only to sidestep licensing issues, but also because it’s fun 🙂 ). The first versions were crude, and the interface is still fairly ugly, but I’ve been improving it sporadically ever since.

One of the things I’ve used it for is to build a public-key encryption system for one of my programs. It worked, though not quickly. But now I needed the ability to generate large prime numbers as quickly as possible, and the current version just wasn’t cutting it.

There were a few general speed improvements I could use that hadn’t been available when I wrote the earlier versions. Some of the algorithms I used in it, such as the one for division, were quick hacks that I threw together and just never replaced. Others I just hadn’t had the time to implement yet. And there were some speed-improving ones that I’d heard about but had never mastered.

One of those last is the Montgomery reduction, an algorithm that greatly speeds up certain math operations by eliminating the division steps. It’s an extremely elegant piece of work, but I’d never been able to figure it out because most of the descriptions on the ‘net seem to lack a few important details. For example, every one of them describes the actual “reduction” function in great detail, so I wrote it, thinking it would be an important part of the algorithm — turns out that that function is never needed. And testing the functions required doing a preparatory conversion step before it and a “deconversion” step afterwards to get the real result — but the details of those steps are almost impossible to find, I figured them out by trial and error once I understood what the algorithm was doing. (For the curious: to convert to Montgomery form, multiply the number by your R value, then take the modulus; to convert back, multiply the number by the modular inverse of R and take the modulus.) I learned a lot, and it was fun, but it was also a vigorous workout for my patience.

When I wrote the original version, the largest single-precision integer (the kind built into the computer, and the building block of every multi-precision integer package) was only 32 bits wide. Modern computers can handle much larger integers, up to 128 bits wide in some cases. Using larger integers means needing fewer steps for the same result, improving the speed of all multi-precision operations, so I wanted to take full advantage of them. I’d written the original code so that it could, in theory, handle any such type changes by simply altering a single line. But when I did that, just about everything broke. It took several hours, and more patience, to carefully step through the operations, figure out which ones weren’t working and why, and fix them all.

The last step was increasing the number of trial divisions. As a preliminary step to identifying prime numbers, I’d been trial-dividing candidate numbers by all the prime numbers below 100, which I’d figured out and hard-coded into the program. But according to Bruce Schneier’s Applied Cryptography, it was most efficient to trial-divide by all the prime numbers below 2,000, so I implemented the sieve of Eratosthenes to identify them, caching them so that the sieve only needed to be used once in any particular run.

The result of all that work: locating a particular prime number took 275 seconds (four minutes and thirty-five seconds) with the old code. The new code required only ten seconds! That’s nearly thirty times faster, and well within the time that I needed.

There’s still plenty of room to improve the library, like putting in the proper division algorithm, but it’ll do for now. 🙂

Microsoft Finally Got The Memo

I’ve dealt a lot with software piracy issues, primarily with Project Badger (detecting and preventing piracy is one of its primary purposes). And I didn’t have to learn the hard way that you have to be very careful before calling any user a pirate, or allowing your software to do so — paying customers don’t like being accused of theft. If there’s any chance at all that you could be wrong about it, you have to give the customer the benefit of the doubt.

For some reason, Microsoft did have to learn that the hard way. Their first antipiracy attempt, three or four years ago, was secretly installed onto systems disguised as an “important security update.” And it “caught” far too many of their legitimate, paying customers, baldly and unapologetically calling them thieves. It was clumsy and heavy-handed, too — it essentially made the system unusable until the “caught” person called Microsoft to correct the problem. Even if you didn’t experience it yourself, it’s easy to see how that could royally piss people off.

But by the sound of it, they’ve fixed all of those problems. They’re going out of their way to be open and honest about the process now; the false-detection problems seem to be fixed; and when it does think that it has caught someone, it allows the system to continue working as normal, simply informing the user of the problem.

I still don’t particularly like Windows, but it’s easier to deal with it now.

Decisions, Decisions…

One of the repeating items on my to-do list is cleaning off my office desk. It’s something I committed to recently, to try to keep my working area tidy; so long as I keep on top of it every few days, it only takes a few minutes each time. But I’d found myself putting it off for several days, and yesterday I decided to figure out why.

It didn’t take much detective work. We’ve moved most of our stuff into the new place now, but we’re still unpacking and organizing it all, and a lot of things don’t have places to go yet. One of those things was presently-unused computer cables and parts, which comprised the majority of the items on my desk.

Once I determined what to do with them, it was child’s play to clean off the desk. Total elapsed time: less than five minutes, including the time needed to set up the place.

Why is this worthy of a blog post? Because it’s a common productivity trap: you repeatedly procrastinate on something because you don’t know something about it, when it would only take a few minutes of thinking or research to figure it out. It’s easy to do once you realize that that’s the problem, but it can take some time to achieve that realization.

To reiterate the mantra of productivity:

  1. Identify your goal and determine the measurable outcome that embodies it;
  2. identify the next physical step toward that outcome that’s small enough to accomplish;
  3. execute that step;
  4. repeat steps 2 through 4 until the goal is achieved.

Or, in the oversimplified words of the shoe company Nike (named after the Greek goddess of victory): just do it. 🙂

The Terrorists Are Winning

Want proof? Read this. Every time the US government reacts in fear, doing a little more damage to the Constitutional rights of the people, the terrorists have won another battle.

If they manage to get another Bush Jr into office, the erosion will pick up its pace again. Destination: Fascist America. And if you think I’m being as reactionary as the Republicans are, re-read this. They’ve got a road map to it, and they seem to be taking each step as quickly as they think they can get away with it.

I used to think that Americans were too smart to let that sort of thing happen, but now I wonder.

“Electrosensitives tortured by a radio tower that had been switched off for six weeks”

I try to keep an open mind on most subjects, but I’ve been skeptical of “electrosensitives” ever since I heard of them. While it’s possible that some people can sense some forms of electromagnetic radiation that most of us can’t, the only way I can see that such an ability could cause the problems that they claim to have is by psychosomatic means. And their demands that everyone around them revert to the 1800s is simply ludicrous. This article just bolsters that opinion.

(Hm… it seems that general science agrees too.)