Jim’s Random Notes

Musings on technology and life

July 24th, 2008

Is that code really from Sun?

I updated my Java runtime the other day, and now every time I open a new tab in Internet Explorer, I get this message box:

It looks like somebody at Sun forgot to sign their update agent.  At least, I think this control came from Sun.  But there’s no way to be sure, is there?  Do I blindly assume that this really is from Sun and that they made a mistake in generating the build, or do I do the prudent thing and permanently disallow it?

In a security conscious world, there’s no excuse for a major player like Sun to have released something with this error.  One wonders, if an obvious bug like this makes it through their quality control, what other less obvious nasties are lurking in the code.

To heck with it.  If Sun wants to push their software on me, they’ll have to get it right.  I’m going to disallow the update agent.  If I ever need to update my Java runtime, I guess I’ll just have to do it manually.

July 14th, 2008

Going Too Far Back

The other day I intended to close a Remote Desktop window and instead hit the Close button (the X on the right of the window’s caption bar) on the console window running our data broker. Nothing like an abnormal exit to bring the whole house of cards tumbling down.

So I went looking for a way to prevent that particular problem from occurring again. Disabling the Close button is pretty easy. In fact, there are at least two ways to do it. Neither is ideal.

The Close button is on the window’s system menu. You can get a handle to the system menu by calling the GetSystemMenu Windows API function. In addition to the buttons on the window’s caption bar, this menu also contains the menu items you see if you click on the box at the left of the window:

Given a handle to the system menu, you have (at least) two choices:

  1. Call EnableMenuItem to disable the caption bar’s Close button.
  2. Call DeleteMenu to remove the Close item from the menu. Doing so will also disable the Close button on the caption bar.

The second option looks like the best, because it prevents me from hitting the Close button, and also prevents me from inadvertently clicking the Close menu item when I’m going for Edit. The C# code for the second option looks like this:

[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetConsoleWindow();

[DllImport("user32")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

[DllImport("user32")]
private static extern bool DeleteMenu(IntPtr hMenu, uint uPosition, uint uFlags);

private const int MF_BYPOSITION = 0x0400;

static void Main(string[] args)
{
    // Get the console window handle
    IntPtr winHandle = GetConsoleWindow();

    // Get the system menu
    IntPtr hmenu = GetSystemMenu(winHandle, false);

    // Delete the Close item from the menu
    DeleteMenu(hmenu, 6, MF_BYPOSITION);

    // rest of program follows
}

That works well, as you can see from this screen shot:

But there’s a problem. To restore the menu when your program is done, you’re supposed to call GetSystemMenu and pass true for the second parameter, telling it to restore the menu, like this:

GetSystemMenu(winHandle, true);

The result is probably not what you expect:

The system didn’t revert to the previous menu, but rather to the default system menu–the one created for every window. The Edit, Defaults, and Properties items that cmd.exe adds to the menu are gone.

Since I can’t reliably restore the menu after deleting an item, I figured I’d call EnableMenuItem to disable the Close item. Unfortunately, that doesn’t appear to be possible. At least, I haven’t been able to make it work. Since I often need the Edit menu item even after the program exits, I’m going with the first option and hoping that I don’t hit the Close menu item by mistake when going for the Edit menu while the program is running.

An aside: we have the term “fat finger” to describe hitting the wrong key on the keyboard. Is there a similar expression for making a mistake with the mouse? I suppose “mis-mouse” would do, but it doesn’t have quite the same ring to it as “fat finger.”

June 6th, 2008

Internet Explorer clipboard protection is broken

This morning I copied a URL from the browser to the clipboard and then tried to paste it into the email message I was writing in another browser window. Internet Explorer popped up this confirmation box:

I wouldn’t mind so much if it showed this box one time. But it shows the box for every new email I try to paste stuff to.

There are two things that annoy me about this confirmation box. The first is that the default button is “Don’t allow”. Obviously, somebody has a much higher opinion of the threat posed by indiscriminate clipboard pasting than I do. I just don’t agree that IE should be holding my hand here and trying to dissuade me from pasting data into an email. The default should be “Allow access”. For dang sure, I should be able to change the default. Better yet, I’d like to just turn the silly notification off. Does Windows have a, “Yes, I know what I’m doing” mode?

Worse, this confirmation box is broken for keyboard users. I’m pretty keyboard-centric, especially when I’m writing. I don’t need to remove my fingers from the keyboard in order to copy a URL from one browser window (or tab) to another. Alt+Tab, Ctrl+D, Ctrl+C, Alt+Tab, Ctrl+V. Done. When this confirmation box pops up, it changes “Done” into:

  1. “What the heck?”
  2. Press Enter before fully realizing that I just prevented myself from pasting into the email.
  3. Copy the draft email to the clipboard.
  4. Open Notepad.
  5. Paste the draft into Notepad.
  6. Close the draft email.
  7. Open a new email message or reply.
  8. Paste the draft back into the new email.
  9. Go find the URL I wanted to paste, and copy it to the clipboard.
  10. Attempt to paste the URL into the email.
  11. Read confirmation box and press the left arrow button to highlight the “Allow access” button.
  12. Nothing happens.
  13. Press the right arrow.
  14. Press Enter.

Whoever coded up this particular confirmation box got his arrow keys backwards.

I guess I am more secure with this new setup. It’s so painful that I’ll stop trying to paste things into my emails.

I understand that security is an issue, and to some extent IE has to protect users from themselves. But this is broken. Horribly. At minimum, the confirmation should have a link or checkbox that lets me turn the message off for pages that I identify. Like the “new email” page that I use dozens of times a day.

February 19th, 2008

Take back the desktop!

I know, I’ve dipped into this well before. But this bears repeating.

At some point in the 30 years or so that I’ve been working with computers, we’ve lost sight of the most important fact: computers are supposed to be tools that serve us. All too often these days, I feel like I’m the one serving the computer. At other times, the computer reminds me of an over-eager employee who comes running to the office after completing every minor task, enthusiastically telling me how impressed I should be that he managed to find and actually work the photocopier.

You know what I’m talking about. When was the last time you spent an entire day not being annoyed by some pop-up message that Windows or some application program decided was important enough to interrupt whatever you’re working on? The last time I spent such a day was when I went on vacation and didn’t have access to a computer. If I’m working on the computer, I’m subjected to a never-ending barrage of pop-up messages and sounds that amount to little more than, “Hey! Look at me!”, and do nothing but interrupt my train of thought and annoy me.

You want examples? Oh, I have plenty:

  • The Firefox Web browser will automatically download updates and then pop up a message box asking if I want to restart.
  • When new Windows updates become available, Windows displays one of those notification balloons down near my task bar.
  • If I tell Windows Update to download and install updates, all too often when it’s done it pops up a message box asking if I want to reboot.
  • I minimize Windows Media Player to my task bar. Whenever it starts a new song, Media Player displays a little information box for a few seconds: “Look what I’m playing now!”
  • The default configuration of Yahoo Messenger will pop up a message window in the middle of the screen when somebody sends me a message.
  • If somebody else takes control of a machine that I have in Windows Remote Desktop, Remote Desktop pops up a message box telling me that my desktop session has ended.
  • Norton Antivirus (which I don’t use any more) would forever be displaying mostly meaningless notifications at the bottom of the screen.
  • Email clients can play sounds or flash the screen when you receive mail. In some programs, such actions are enabled by default.
  • If you’re running a program under Visual Studio and the program hits a breakpoint, Visual Studio will bring itself to the front, regardless of what you’re working on.

I know, some of you are wondering what I’m complaining about. Let me give you an example of why I get annoyed. If I happen to be typing (an activity that occupies a large part of my day) when one of those pop-ups grabs the keyboard focus, whatever I’m typing will end up in the new window. This is not good. I’ve actually re-booted the computer accidentally because I was typing while looking out the window when the “Reboot now?” confirmation box appeared.

Let me repeat that. I suffered a very annoying interruption and lost some important work because somebody decided that their program was more important than whatever I was working on at the time. That’s unforgiveable.

Let’s be clear about this one: a program should never grab the keyboard focus from the window that I’ve selected. I can’t think of a single instance in which I want some random program to pop up in front of my text editor and start swallowing what I’m typing. There is no excuse for such rude behavior. Designers who create such things should be shot, right along with any programmers who have the poor sense to actually implement the designs.

I’m slightly more forgiving of the ostensibly innocuous notifications that pop up in balloons all over the place, but not much more. It’s nice that programs keep me informed of what they’re doing: security updates are available, new updates were downloaded, a friend messaged me, there are unused icons on my desktop, etc. But most of those things just aren’t important, with the exception of a text message from my friend, none are important right now. Those messages should be placed in a notification queue that I can check at a time of my own choosing. If it requires immediate attention (like my friend messaging me), it should display a message on the corner of the screen to get my attention, but under no circumstances should it grab my keyboard focus.

Like many other people, the work I do requires intense concentration. Most people require a certain amount of time (five to 30 minutes, typically) to “get into the groove” where they’re concentrating deeply and able to be productive. Any interruption will snap them out of that groove, and it takes time to get back into it. So a “brief interruption” can cost 30 minutes in lost productivity. Is it any wonder I get annoyed by all the crap that Windows and other programs throw at me?

To the designers and programmers responsible for these atrocities: The desktop is my workspace, dang it. Popping your idiotic message on top of it and stealing my keyboard focus is akin to throwing a rotting fish in the middle of my desk. It disrupts my work, makes a mess of things, stinks the whole place up, and ticks me off.

And don’t tell me, “You can turn those notifications off if you want.” That’s exactly the wrong attitude. The default configuration should be to leave me in charge of my desktop. I should have the option of turning those notifications on if I want them. I shouldn’t be forced to go hunting through your overly complicated user interface options dialog box to figure out how to teach your program its place on my desktop.

If, like me, you’re tired of being interrupted by inconsequential messages and having your keyboard focus stolen by rude programs, I suggest you start filing bug reports against the offending applications. That includes Windows, Visual Studio, and any other program that takes the attitude that its status messages are more important than your work. Filing those bug reports is the only way we can get software developers to re-think their attitudes and build software that does its job without nattering at us.

May 9th, 2007

Norton AntiVirus

I’d never used anti-virus software on my personal computer until I bought this notebook two years ago. I’d never had trouble with worms, viruses, trojans, or other malware, but people I trust and respect convinced me that I was just lucky–that things could get through my Linksys firewall, Windows firewall, and infect my machine. So I picked up a copy of Norton Antivirus at Fry’s and installed it.

I was planning to renew online this year, but I was at Fry’s the other day and noticed something interesting: Norton AntiVirus, 3-user license, on sale for $49.99. And there’s a $50.00 mail-in rebate! So if I buy that and mail in the rebate form, I end up getting the software for about $4.25 (the sales tax). Such a deal!

Symantec did a very good job with the install program, except for one thing. It does a preliminary system scan and then needs to reboot. Here’s the notification:

Who edits this stuff? First it was Apple’s idiotic insistence that users shouldn’t have to answer “Yes” or “No.” That gave us prompts with questions and two buttons: “OK” and “Cancel.” Now we have the opposite problem: “Yes” and “No” options with no question. It is to cry.

I installed Norton on Monday night. Last night I was doing some writing on the machine and it was terribly slow. I opened Task Manager and found that a program, appsvc32.exe, was consistently chewing up from 60 to 100 percent of the processor time. A quick search online reveals that appsvc32.exe is part of Norton AntiVirus, and that this is a known problem. The following seems to solve the problem while Symantec figures out how to fix it properly:

  1. Bring up the Norton Protection Center.
  2. Click on the Norton AntiVirus tab.
  3. Click on the Settings bar to expand the settings menu.
  4. Click on Auto-Protect, and then the Configure button that pops up.
  5. On the left side of the dialog box that pops up, click on the General Settings link.
  6. Clear the “Scan active programs and start-up files” checkbox, as shown here.
March 19th, 2007

Is there a question here somewhere?

I uninstalled the Nero InCD program today while I was cleaning up my Windows machine. The uninstall program told me, before I confirmed that I wanted to remove the program, that I would have to reboot in order to complete the task. Fine. Except that when it was done uninstalling, it displayed this message box.

Would it have been so difficult for them to add a line that says, “Would you like to restart now?”

|