George V. Reilly's Technical Blog

May 2006 - Posts

Not Much on My Mind Right Now

I have two blogs, my personal blog and my technical blog. The technical blog is a small subset of the personal blog containing posts that are more likely to be of interest to the techie audience at weblogs.asp.net.

Lately, the comments in one post at weblogs.asp.net have been repeatedly spammed with sad little gems like the following:

If you click the links above, you'll find that I'm not the only one who's getting this treatment. The spams are clearly generated by a bot, which is generating links to an enormous variety of randomly chosen sites, with no obvious commonality.

Surprisingly, I can find very few discussions of this particular phenomenon, save Nihilist spam and Best Comment Spam Ever. It seems to have been the catalyst triggering PocketNow: Requiring Registration [to Post].

My personal blog is running dasBlog, which has a CAPTCHA implementation, as well as some other anti-spam features. So far, I haven't had a spam problem there, but perhaps I'm just flying under the spammers' radar.

Brian Goldfarb recently sent mail to all the bloggers at weblogs.asp.net, detailing forthcoming changes and improvements (sorry, can't find a public post). There was no specific mention of dealing with comment spam, alas.

I found the SixApart Guide to Comment Spam to be useful, if wordy and Movable Type-centric. They agree with Scott Mitchell on the Worth(lessness) of CAPTCHAs. And this summary of the problem of Comment Spam ain't bad.

Fog is my Copilot

I mentioned last week that my parents have no aptitude for computers.

My father emailed me with a list of computer woes; notably, he was getting messages about no firewall. There was no way I was going to get to the bottom of the issue just by email or talking to him on the phone. It's 5,000 miles from Seattle to Dublin, so I can't drop by to take a look at the computer in person--much as my parents would like to have me visit.

I had tried using the built-in Windows Remote Assistance to troubleshoot issues on their laptop a couple of years ago, while they were on a protracted stay in Cape Town. I had solved the problem, but that had been fairly painful for me. The primary problem was the horrible sluggishness of the connection: they were on a slow dialup connection and the latency is something fierce. Another problem was the fragility of my control: if I dismissed a dialog by hitting Escape, I stopped controlling the remote desktop, and as a longtime vi user, I have certain deeply ingrained reflexes that are hard to overcome.

I decided to try out Joel Spolsky's Copilot. The Copilot service builds on TightVNC. The helper and the person being helped both make outbound connections to a Copilot server, which proxies the virtual session, neatly avoiding all kinds of NAT issues that can arise when you try to make a direct connection through a firewall. It's also supposedly easy to configure, requiring only a visit to the Copilot website and typing in an email address or a 12-digit number, before downloading a half-megabyte executable. It wasn't too painful to talk my father through making the connection, though the first time that he did it, he "lost" the binary and had to download it again. We initially tried the two-minute trial version, but that wasn't nearly enough time to do anything, so I shelled out the $10 for a day pass.

In Dublin, as in Cape Town, he dials up to the Internet on a 56K modem, and that once again proved to be the primary source of pain for me. It seemed a little less sluggish than I remembered Remote Assistance being, but I wasn't about to subject myself to trying that out too. The experience varied between tolerable and infuriating, but there's only so much that can be done at a little over 3Kbps.

The second reason the experience was so painful was that I ended up needing to repair the eTrust installation, and to download a full set of antivirus signatures, and I simply couldn't do it. The eTrust FTP site kept dropping the connection, and the full signature package takes over 20 minutes to download. I blame the FTP server, as I was VPN'd in to his laptop the whole time, so his Internet connection was obviously working. I eventually gave up at 4AM PDT, in utter frustration.

Verdict. Copilot works fairly well, although it can be painful over a dialup connection. I would have killed for a file-transfer facility so that I could send files directly between his computer and mine. $10 for a day pass isn't cheap, but he gets to pay it in future! I use Terminal Server and Virtual PC regularly: both of them provide ways to press all of the Windows keys (Terminal Server, Virtual PC); Copilot doesn't.

0xFF...FF / 10 == 0x19...99

A few weeks ago, I wrote a C++ routine to parse decimal numbers using the overflow detection principles of SafeInt. I couldn't find anything in the libraries that actually did a good job of checking for overflow.

Briefly, to see if unsigned values A+B overflow, check if (A > MAX_UINT - B). Similarly, A*B will overflow if (A > MAX_UINT / B).

// Convert a string to an unsigned. Returns 'true' iff conversion is legitimate. bool StringToUnsigned( const string& str,
unsigned& rUint)
{
rUint = 0;

if (str.empty())
return false;

for (unsigned i = 0; i < str.length(); ++i)
{
if (!isdigit(str[i]))
return false;

// Check for numeric overflow. if (rUint > numeric_limits<unsigned>::max() / 10)
return false;
rUint *= 10;

unsigned d = str[i] - '0';
if (rUint > numeric_limits<unsigned>::max() - d)
return false;
rUint += d;
}

return true;
}

While debugging this code, I noticed something interesting. 0xFFFFFFFF divided by ten (0xA) is 0x19999999. This pattern holds for smaller and larger sequences of 0xFF...FF too: 0xFF/10 = 0x19; 0xFFFF/10 = 0x1999; and so on.

I'm not sure how to prove this, but I can prove the closely related result: 0x19...99 * 10 = 0xFF...FA:

 10 * N         = 8 * N  +  2 * N
10 * 0x19...99 = 8 * 0x19...99 + 2 * 0x19...99

0x199...99 = %0001 1001 1001 ... 1001 1001

10 * 0x19...99 = %1100 1100 1100 ... 1100 1000
+ %0011 0011 0011 ... 0011 0010
= %1111 1111 1111 ... 1111 1010

A mildly curious result of no value, but it amused me.

Writing Clearly

I sometimes joke that I must be adopted because my parents have no aptitude for computers. I could make a similar joke about writing. Many of my immediate family, despite decent educations, seem to be incapable of writing a simple English sentence, much less a coherent paragraph.

One relative writes emails that are bereft of punctuation: neither a comma nor a full stop (period) is to be found. Capital letters occur, but too randomly for my liking. And everything is linked into one paragraph, no matter how long or disjointed. Yet, I've received adequately punctuated handwritten letters and postcards from him. I attribute his email slovenliness to a combination of laziness and hunt-and-peck typing. Whatever the cause, it reflects poorly on him.

John Scalzi has some Writing Tips for Non-Writers Who Don't Want to Work at Writing. Here's the summary:

  1. Speak what you write ... If what you're writing is hard to speak, what makes you think it's going to be easy to read? It won't be. ...

  2. Punctuate, damn you: For God's sake, is it really so hard to know where to put a comma? ...

  3. With sentences, shorter is better than longer.

  4. Learn to friggin' spell.

  5. Don't use words you don't really know.

  6. Grammar matters, but not as much as anal grammar Nazis think it does.

  7. Front-load your point.

  8. Try to write well every single time you write.

  9. Read people who write well.

  10. When in doubt, simplify.

  11. Speak what you write.

Go read the whole thing.

I found some useful links in the comments that follow Scalzi's Tips:

And here's a few tips of my own:

  • One thought per paragraph. Run-on paragraphs offend me and annoy me. If a paragraph has more than four sentences, it's probably too long.

  • Pick up something that was written by a competent writer who you enjoy and analyze a page. Why did they choose to break sentences where they did? Why are the commas placed where they are? Do the paragraph breaks make sense? What about the word choice? Did it clearly and succinctly convey their ideas, their tone? (Hell, just analyze this post.)

  • Think before you write. Before you dive in headlong, what is it you're trying to convey? This doesn't have to take you very long. A few seconds before a short email is enough.

  • Reread what you wrote, before you send it off. Revising mistakes is so easy on a computer that you have no excuse for not bothering.

This isn't enough to turn you into a professional writer, but it will make a marked improvement in what you write.

Vim 7.0 is out

More than two years in the making, Vim 7.0 is finally out!

(Vim is Vi IMproved, an enormously enhanced version of the classic Unix editor, vi.)

The main features of the 7.0 release are:

  • Spell checking

  • Omni-completion (Intellisense-like)

  • Tabbed pages

  • VimL script language now supports Lists and Dictionaries

I'm going to take credit for some minor features of Vim 7:

WikiPedia summarizes the history of Vim. This enabled me to pinpoint when I first became a contributor to Vim, back in December 1995. I cleaned up the original, rather buggy port of Vim 3.0 to NT, and posted it to the comp.editors newsgroup. Bram invited me to merge my changes into Vim 4.0, which was then under development, and I became the owner of Win32 Vim for the next couple of years.

More Posts