Jim’s Random Notes

Musings on technology and life

September 25th, 2008

Just say “No” to the bailout

Have you read the text of the Bush Administration’s proposed 700 billion dollar bailout of financial institutions?  If you don’t want to wade through the three-page proposal (although it is written in reasonably clear English), this summary will tell you all you need to know.  (Thanks to David Stafford for the link.)

When that proposal was presented, Congress was given the opportunity to exercise its most important obligation under the Constitution:  to serve as a check on the Executive branch.  Were Congress seriously interested in doing what’s best for the economy, for the taxpayers, and for the country, they would have just said, “No.”  Instead, they view the proposal as a starting position and are taking this opportunity to ingratiate themselves with their constituents and extend government’s control over private lending.  You doubt that?  Consider:

  • Democrats are pushing for legislation that allows bankruptcy judges to rewrite mortgages to “ease the burden” on homeowners who are facing foreclosure.  This contentious issue probably will be dropped in favor of getting a bill passed.
  • Democrats want any proceeds of the bailout to go into a fund designed to pay for housing for poor families.  This is the old shell game.  On one hand, they’re telling us that we’ll “get back” much of that $700 billion when the assets are sold.  The reality is that any proceeds will go into the general fund, which Congress can squander at their whim.
  • Lawmakers on both sides have agreed in principal to limit pay packages for executives whose companies benefit.  This is largely a symbolic move, as executive pay is a drop in the bucket compared to the amount of money we’re discussing.  But it looks good to the voters.  “I voted to limit executive pay!”
  • Absent the “No” that they should give, Congress is right in insisting that it be given more control over the bailout than what the proposal allows.  But I doubt that they’ll exercise restraint.  I fear that they’ll make a serious power grab.  For example, Representative Barney Frank has said: “we’re now the biggest mortgate holder in town, and we can do serious foreclosure avoidance.”  That frightens me, as I think it should frighten anybody.

I’m not convinced that this bailout is at all required.  Were Congress to do the right thing—nothing—markets would take an immediate tumble, rebound a bit, and then financial institutions and others affected would get back to business.  Sure, it’d be a struggle.  But the relatively short-term pain involved will be much less than the long-term pain that this bailout legislation will undoubtedly cause.

Needed or not, I’m certain that it doesn’t have to happen within the next week, as Secretary Paulson and Federal Reserve Chariman Bernanke insist.  I’m always nervous when Congress acts at all, and I get very, very scared whenever Congress rushes through legislation to “address a serious problem.”  Eight years of an administration and a Congress that have both lost all concept of the term “fiscal restraint” has taught me that much.

September 24th, 2008

The Last Sucker Theory

Join me in a little thought experiment.

Seal a 100 dollar bill in an envelope, affix a price tag to the envelope, and write $110 on it.  Then put it up for sale, telling potential buyers that if they spend $110 on this envelope, they can turn around and sell it for more.  Don’t worry about what’s in it.

Somebody buys it, affixes a new price tag that says $125, and sells it to somebody else who also increases the price and turns it over.

This goes on for some time, with each new buyer swapping out the price tag.  Somewhere along the way, somebody gets the bright idea of putting 10 envelopes into a larger, fancier-looking envelope.  Why not make 10 times the profit in a single transaction, right?

And the party goes on.  The fancy envelopes beget pretty printed shoeboxes and the prices go up again.  Nevermind the party poopers screaming, “But what’s in the box?”  Nobody cares what’s in the boxes.  They must be valuable, right?  People keep paying more for them.

One day, the holder of a refrigerator-sized package wrapped in gold paper and sporting all manner of ribbons and bows tries to sell it for $100,000,000, and fails.  The lender who floated him the loan to buy the thing takes it back and decides to sell it at a loss just to get it off the books.

But the lender finds out that he can’t sell it at any price.  A lot of people have been having trouble selling their pretty boxes and envelopes.  Not only that, but lenders have a lot of money tied up in those pretty boxes, meaning they don’t have any money to lend for other purposes.

Desperate, the lenders start trying to sell their assets at ever-lower prices, trying to get something out of them.  But nobody’s buying.  Nobody wants a pretty box that he can’t resell at a higher price.

Finally, the lender finds a buyer who says that he’ll be happy to buy the box, provided he can open it beforehand to see what’s inside.  The lender reluctantly agrees and looks on as the potential buyer opens the box and pulls out 100 pretty shoeboxes.  Inside each shoebox there are 10 fancy envelopes, each of which contains 10 plain white envelopes holding a single hundred dollar bill each.  The lender’s $100,000,000 “asset” is worth $1,000,000.

My dad used that little parable (also known as the last sucker theory or, more commonly, the greater fool theory) to explain the events leading up to the savings and loan crisis in the late 1980s.  It’s equally apt in explaining much of the current financial meltdown, what with the mortgage backed securities that were “backed” by worthless mortgages, investment firms that were leveraging their investments 35-to-1, and all the while knowing that they were just riding the wave—hoping they weren’t the ones holding the box when somebody demanded that it be opened.

September 15th, 2008

Hurricane Rescue

Almost every year during monsoon season in the Phoenix area, some idiot will drive around a barricade and attempt to cross a flooded low water crossing. In most cases, search and rescue workers are successful in plucking the occupants from the stranded car. Invariably, the driver will claim ignorance, despite signs warning of the danger, barricades across the road, and many years’ experience living in the area. It’s impossible to live in the Phoenix area for any length of time and not know of the dangers inherent in driving through flood waters.

Things got so bad in Arizona that they finally passed what is termed the Stupid Motorist Law which, when translated to simple English, says that a motorist who drives around barricades to enter a flooded stretch of roadway may be charged for the cost of his rescue. I don’t know if the law has actually prevented anybody from trying to drive through a flooded area. It seems to me that if the threat of being swept downriver and drowned doesn’t deter somebody, the prospect of having to pay for rescue won’t raise a red flag either. In any event, I support the law simply because I believe that people should have to pay for their own stupidity–especially when said stupidity puts others’ lives at stake.

As hurricane Ike approached last week, officials in Galveston and other coastal areas urged citizens to evacuate, warning of a possible 25-foot storm surge and “certain death” if they stayed behind. By all reports, most people heeded the warnings and got out before Friday at noon. But somewhere between 100,000 and 150,000 people decided that they knew better, and stayed behind.

I was in the Williamson County Emergency Operations Center from midnight until 6:00 AM on Saturday. The eye of Ike made landfall at about 2:00 AM. The entire time I was at the EOC, I heard reports of 911 calls from people who had elected to stay behind, begging for somebody to come help them. Of course, nobody was going to send rescue workers out in the middle of a hurricane. Those people who elected to stay truly were on their own–just as officials had said they would be.

Today, 48 hours after Ike came roaring through, we’re still in the middle of what Governor Rick Perry is calling the largest search and rescue operation in Texas history. Over 1,500 rescue workers are searching Galveston and surrounding areas for people who are stranded in their houses, still surrounded by floodwaters. So far, every person I’ve seen interviewed after being rescued said pretty much the same thing: “I never thought it would be so bad. I was wrong to stay.” I’ve yet to hear anybody say they didn’t know that the storm was coming, or they didn’t hear the warnings to evacuate.

Those who stayed and survived were very fortunate that the projected 25-foot storm surge never materialized. The estimated 13-foot surge did a very good job of devastating the area. I imagine that nothing would be left had there been twice as much water, and it’s doubtful that any of the holdouts would have survived.

Those who did survive (and we may never know how many got swept away by the storm) are now stranded in the attic or on the roof, with no services, no food or water, and no way to get out except being rescued. It’s unfortunate that Texas doesn’t have a Stupid Homeowner Law that allows us to bill those people for the cost of their rescue. Whereas I fully support a citizen’s right to stay even in the face of “mandatory” evacuations, I also believe that they should bear the consequences, including paying the cost of pulling them out of an area they were advised to evacuate three or four days ago.

Here in the Austin area, Ike had almost no effect. We got a little bit of wind Saturday morning. Some parts of the area might have received some rain. We didn’t get a drop at our place.

August 13th, 2008

The Government Rant

The best thing about our government is that it never ceases to amuse me. It’s also continuously annoying, but I guess you have to take the bad with the good. It’s not the government itself that amuses me so much, but rather the absurd things that our illustrious Congresscritters do and say in an attempt to garner votes. The most amusing (and also the most frustrating) thing is that constituents continue to be taken in. Rather than making an effort to come up with a solution ourselves, we argue over which totally unworkable plan our elected representatives should vote on. This gives the leeches in Washington Congress incredible leeway to do anything, and then spin their positions to best advantage.

Examples abound. Let’s look at some of the more recent.

Dependence on foreign oil

Our country’s dependence on foreign oil has been a major problem since the Arab oil embargo of 1973. In the 35 ensuing years, Congress has put forth all manner of proposals to “fix” the problem. We’ve funded research into solar, geothermal, tidal, and other natural energy sources, provided incentives and subsidies for domestic oil exploration, coal, ethanol, and all manner of questionable energy saving technologies. Today our government has much more control over energy policy than it did in 1973 and yet we’re more dependent on foreign oil than we were back then.

Seven administrations and countless members of Congress have been “doing something about the problem” for 35 years, and the problem has gotten worse. And yet the vast majority of Americans look to Congress and the President for a solution to high gas prices, all the while cheering for or ridiculing the laughably simple minded, short term proposals that are put forth. Our representatives, of course, couldn’t care less. All they have to do is make themselves look good to their own constituents. As long as they can keep the voting public believing that government is the solution, their jobs are secure.

Every thinking American (and, sadly, I’m beginning to believe that the number is falling fast) knows that the solution to our energy problems requires conservation, domestic oil and gas production, development of nuclear plants, exploitation of wind, thermal, solar, and other natural sources, and research into more energy efficient transportation and buildings. We won’t solve anything unless we address all of those areas. And it’s going to take time. Government has proven that it’s incapable of formulating and implementing a workable energy policy. It’s time to get government out of the picture. No more subsidies, incentives, or preferential treatment. Let the market decide.

Tax Rebates

This is one of the dumber things I’ve seen Congress do. And, yes, I realize that both the 2001 and the 2008 rebates were initially proposed by President Bush. That doesn’t relieve Congress of their complicity and their ultimate responsibility. The 2001 rebate was “justified” by a “budget surplus”–a surplus that anybody with a fifth grade education knew was an illusion. This year’s rebate was “justified” by the current economic situation. Congress would have you believe that a windfall of a few hundred dollars (up to $1,200, as I recall) would “stimulate the economy” and soften the recession. Any thinking person could have told you that the result would be a short term spike in consumer spending, followed by a quick return to normal. I can’t prove this yet, but I suspect that it also resulted in people putting down payments on things they can’t afford, figuring they’d find a way to make the monthly payments.

Congress, of course, knew that the tax rebates wouldn’t have an effect on the economy other than to increase the size of the federal debt. But that’s okay. What’s a few billion more dollars compared to the time honored tradition of buying votes? It is an election year, after all. Besides, it made for good press coverage and retail store managers drooled over the prospect of Christmas in July. The rebates seem so popular that Senator Obama proposed a $1,000 rebate to fight energy costs.

The reaction of those receiving the rebates was predictable. Most squandered it like drunken sailors on leave. Those few who know the names of their Congressmen or Senators might have lifted a glass in salute, but most just thanked the government for the handout. That’s what surprises me the most. It’s like having somebody cut your arm off at the shoulder and then thanking him when he returns the forearm and hand. Idiots.

The “mortgage crisis”

This one is fun because there are so many levels of idiocy. Lenders made high-risk loans to people who were demonstrably incapable of paying them back, then sold those loans to a government sponsored enterprise, which ultimately will be bailed out by taxpayers when the original borrowers default.

When borrowing money in good faith, both the lender and the borrower are responsible for ensuring that the money can be paid back. But when the lender is just a middleman who gets paid for making the loan and selling it to somebody else, there is little incentive for him to vigorously check the borrower’s documentation. On the contrary, there is ample incentive for him to be very creative in putting together a loan package, both by making the terms of the loan appear attractive to the borrower and by making the borrower look attractive to the third party who’s buying the loan. Sure, the middleman will eventually be found out, but the short term rewards are incredible.

And when the ultimate buyer is a government sponsored enterprise like Fannie Mae or Freddie Mac, there is almost no oversight. When you have, with government’s blessing, a virtual monopoly on the secondary mortgage market, you know that you’ll get bailed out if things go bad. So where’s the incentive to insist on real documentation for the loans that you buy?

I’m not an economist by any stretch of the imagination. I’m not even a financial analyst. But I’m not an idiot, either. I and many others saw this coming three years ago. Congress ignored the problem at the time, or discounted it as scare mongering. I’ll go out on a limb here and say that most of them probably knew what was coming. But they also knew that there wasn’t anything they could do about it and that bringing it up would be very unpopular. Our elected representitives are many things, but stupid is not one of them.

Now that the real extent of the problem has become apparent, Congress is all over it with one proposal after another. They’re “doing something about the problem.” They know that there are only two possible solutions: either pump money into Fannie Mae and Freddie Mac to keep them afloat, or cut them loose and let people finally endure the consequences of their actions. We know, just by the the nature of elected officials, what their solution will be: another hundred billion dollars or more shelled out to fix a problem that Congress created in the first place. And We the Sheeple just nod our heads and thank Congress for taking care of us once again.

More is better?

All three of the above examples demonstrate extreme incompetence on the part of government. The Congress-proposed solution to those problems, as with all others, is more government regulation. As if making even more and larger bureaus, agencies, and departments will somehow transform government into an intelligent and effective organization. And we let them do it! When will people learn that the cure for a headache is to stop beating your head against the wall?

I used to get upset when I’d think about this stuff. I used to rant and carry on about the proper function of government, and how intrusive government is in our daily lives. But nobody listens. Nobody seems to care. I learned a while back to stop bashing my head against that particular pile of bricks. Now I just laugh and hope that the coming violent overthrow (which will almost certainly happen if government continues on its current path) doesn’t occur until after I’m gone.

August 8th, 2008

Hey, you deleted my files!

We got a rather strongly worded message the other day from a Webmaster who was threatening legal action because our crawler deleted a bunch of files from his site.  The news that our crawler is capable of deleting files was quite a surprise to us.  Like other crawlers, ours just downloads HTML files, extracts links, and then visits those links.  There is no “delete a file” logic in there.  But if the crawler stumbles upon a link whose action is to delete a file, then visiting that link will indeed delete the file.

Further investigation in this particular case revealed a file management page that includes, among other things, links that have the form:  www.example.com/files/?delete=filename.txt.  Surprisingly enough, clicking on that link deletes the file.  The file management page is not protected by a password, nor is there any kind of confirmation displayed before the file is permanently deleted.

Examining the logs, we saw accesses from other search engine crawlers.  We also learned from the Webmaster that some time back, a kid had “hacked in” to the site and deleted a bunch of files.

I’m a little surprised that anybody would create such a page and not provide any protection.  I’m very surprised to find out that a supposedly professional Web developer would do such a thing and not learn the lesson when a random surfer came in and deleted files.  And I’m shocked that, even after we explained this to the Webmaster, he insists that we can take this as an opportunity to learn from our “mistake” and “fix” the crawler so that it doesn’t happen again.

It’s unfortunate that our crawler visited those links, causing the files to be deleted.  But the mistake was on the part of the person who posted those destructive links.  The crawler was operating exactly as it should.  Exactly, in fact, as every major search engine crawler acts.  It’d be nice if we could imbue the crawler with enough intelligence to “understand” Web pages and know in advance what the effects of clicking a link will be.  But that kind of machine intelligence is far, far in the future.

If you post something on the Web, it will be found, unless you take active measures to protect it.  Posting a destructive link on an unprotected page and then blaming somebody else when the link is clicked by an “unauthorized” person is akin to running out into a busy street and then blaming your injuries on the driver of the bus that hits you.

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.

May 23rd, 2008

Infinite Annoyance

Browsing the remainder table in Half Price Books a few weeks ago, I ran across David Berlinski’s Infinite Ascent: A short history of mathematics. The cover copy looked good, and a quick flip through a few pages was enough to convince me that it was worth the three bucks. At 180 pages, you’d expect it to be a pretty short read, and it might be for some. I found it tough going.

The book focuses on what the author (and others, I gather) considers “the ten most important breakthroughs in mathematics,” giving some biographical information about the people most closely associated with those discoveries, the historical context, and also an explanation of why the breakthroughs are important. At least, that’s how the first five chapters (Number, Proof, Analytic Geometry, The Calculus, and Complex Numbers) went. The next five chapters (Groups, Non-Euclidean Geometry, Sets, Incompleteness, The Present) seemed much less approachable.

I freely admit that some of my difficulty could be that I’m fairly comfortable with the topics discussed in the first five chapters, but with the exception of Sets I have no experience with or more than passing knowledge of the topics discussed in the later chapters. Somehow, though, I get the feeling that the fault is not entirely mine. I didn’t expect to gain a detailed understanding of Gödel’s incompleteness theorems by reading a short chapter, but I had hoped to learn something. Instead, I’m treated to prose like this:

The final cut–the director’s cut–now follows by means of the ventriloquism induced by Gödel numbering. This same formula just seen making an arithmetical statement in that subtle shade of fuchsia now acquires a palette of quite hysterical reds and sobbing violets, those serving to highlight the metamathematical scene presently unfolding, for while Bew(x) says something about the numbers, it also says that

x is a provable formula,

meaning that honey the number x is the number associated under the code with a provable formula, whereupon the director, lost in admiration for his own art, can mutter only that deep down it’s a movie about a movie.

That’s all pretty writing, but by the time I wade through the director’s psychedelic visions I’ve totally lost track of whatever mathematical subject we’re talking about. The first time I read that chapter, I put my lack of understanding down to having read it in bed, just before I fell asleep. The author’s point continues to elude me after a second reading. I learned more by skimming the Wikipedia article linked above than I did trying to puzzle out whatever Berlinski was trying to say.

Flipping through the book again after finishing it, I noticed that the style is pretentious throughout. The book suffers from too many inappropriate and incomprehensible metaphors, too much temporal hopping around in its short biographies, and too many paragraphs that jump off the page screaming, “Look, Ma, at how pretty I can write!” Like the director in the excerpt above, Berlinski seems lost in admiration of his own writing.

All in all, I’d say you’d be much better off reading Wikipedia articles about mathematics than trying to decipher the word splatter that Berlinski is trying to pass off as intelligent writing in Infinite Ascent. Not only is Wikipedia free, but you’ll learn a lot more and you won’t be tempted to track down the author and smack him upside the head for killing trees and wasting your time with his drivel.

Sometimes there’s a very good reason for a book to be on the remainder table.

April 9th, 2008

HashSet Limitations

Version 3.5 of the .NET runtime class library introduced the HashSet generic collection type. HashSet represents a set of values that you can quickly query to determine if a value exists in the set, or enumerate to list all of the items in the set. You can also perform standard set operations: union, intersection, determine subset or superset, etc. HashSet is a very handy thing to have. Simulating the same functionality in prior versions of .NET was very difficult.

I’ve made heavy use of HashSet in my code since it was introduced, and I’ve been very happy with its performance. Until today. Today I ran into a limitation that makes HashSet (and the generic Dictionary collection type, as well) useless for moderately large data sets. It’s a memory limitation, and how many items you can store in the HashSet depends on how large your key is.

I’ve mentioned before that the .NET runtime has a 2 gigabyte limit on the size of a single object. Even in the 64-bit version, you can’t make a single allocation that’s larger than 2 gigabytes. I’ve bumped into that limitation a few times in the past, but have been able to work around them by restructuring some things. I thought I was safe with the HashSet, though. Even with an 8-byte key, I figured I should be able to store on the order of 250 million items. I found out today that the number is quite a bit lower: a little less than 50 million. 47,995,853 to be exact. After I figured out what was causing my problem, I verified it with this program:

static void Main(string[] args)
{
    HashSet<long> bighash = new HashSet<long>();
    for (long i = 0; i < 50000000; ++i)
    {
        if ((i % 100000) == 0)
        {
            Console.Write("r{0:N0}", i);
        }
        bighash.Add(i);
    }
    Console.WriteLine();
    Console.Write("Press Enter");
    Console.ReadLine();
}

The program throws OutOfMemoryException when it tries to add the 47,995,853rd (or perhaps the 47,995,854th) item, because it’s increasing the capacity of an internal data structure and that data structure exceeds 2 gigabytes.

If I reduce the size of the key to 4 bytes (a .NET long is 8 bytes), then I can add just a little less than 100 million items before hitting the limit. Let’s think about that a little bit.

50 million keys of 8 bytes each should take up about 400 megabytes. 100 million keys of 4 bytes each should take up about 400 megabytes. I realize that there’s some overhead in a hash table to deal with collisions, but five times is excessive! I can’t imagine a hash table implementation that has an overhead of five times the total key size. And yet, that’s what we have in .NET.

It’s bad enough in today’s world, where a machine with 16 gigabytes of RAM can be had for under $2,000, that we have to deal with the 2-gigabyte-per-object limitation in .NET. But to have the runtime library’s implementation of a critical data structure squander memory in this way is too much.

Any workaround is very painful. We’ll have to write our own hash table implementation that allocates unmanaged memory and mucks around with pointers in unsafe code. We’re old C programmers, so that’s not beyond our capabilities. But it sure makes me wonder why I selected .NET for this project. In the process, we’re going to lose a lot of the functionality of Dictionary and of HashSet.

I can’t be the only one running up against these kinds of limitations. 10 years ago, a data set of 100 million items may have been considered large. Today 100 million is, at best, moderately large. There are plenty of applications that work with billions of items and today’s computers have the capacity to store them all in RAM. We damned well should be able to index them in RAM using modern tools.

I hope the .NET team is working on a solution to the 2-gigabyte limit, and I’d strongly suggest that they take a very close look at their hash table implementation.

March 31st, 2008

How effective are red light cameras?

MSNBC posted an article about red light cameras, describing how many cities are taking them down. Why? Because the cameras are too effective: people learn where the cameras are and stop running the red lights. According to the article, the city of Dallas recently turned off a quarter of its red light cameras because it couldn’t justify the cost of running them. Other cities have had similar experiences.

Not surprisingly, the cameras’ effectiveness at reducing accidents is inconclusive. According to a study released in 2005 by the Federal Highway Administration, intersections with red light cameras get about 15% more rear-end crashes than they would have without the cameras. It seems as though drivers know that the cameras are there and will brake aggressively to avoid running the light. However, the study also reports a 25% decrease in T-bone crashes, with about 16% fewer injuries. Overall, the study reports no appreciable difference in the number of accidents, and an almost 5% decrease in injuries.

All told, the FHA study concluded that red light cameras give, at best, a “modest aggregate crash-cost benefit.”

And then there are opponents’ claims that, even if the cameras provided a huge safety benefit, that still doesn’t justify the systematic violation of drivers’ constitutional rights. I tend to lean towards this belief myself.

However, it’s rather amusing that cities are finding it increasingly difficult to justify the cost of red light cameras because drivers are running fewer red lights. One wonders if, were the cameras provided a demonstrable safety benefit, whether cities would continue operating them at a loss. It’s probably a good thing for city public relations that the negligible safety benefit means that they can turn the cameras off without a loud public outcry.

February 25th, 2008

I can’t serve you ’cause you’re too fat

I’ve ranted a few times over the years about people trying to hold fast food establishments liable for making them fat. I thought that craziness had faded after Super Size Me disappeared from public consciousness. And it mostly has.

And then a friend sent me a link to House Bill 282, introduced in the Mississippi Legislature. The title:

AN ACT TO PROHIBIT CERTAIN FOOD ESTABLISHMENTS FROM SERVING FOOD TO ANY PERSON WHO IS OBESE, BASED ON CRITERIA PRESCRIBED BY THE STATE DEPARTMENT OF HEALTH; TO DIRECT THE DEPARTMENT TO PREPARE WRITTEN MATERIALS THAT DESCRIBE AND EXPLAIN THE CRITERIA FOR DETERMINING WHETHER A PERSON IS OBESE AND TO PROVIDE THOSE MATERIALS TO THE FOOD ESTABLISHMENTS; TO DIRECT THE DEPARTMENT TO MONITOR THE FOOD ESTABLISHMENTS FOR COMPLIANCE WITH THE PROVISIONS OF THIS ACT; AND FOR RELATED PURPOSES.

Full text (pdf). Full text (text).

Maybe I should get a patent on that fictional Body Mass Index calculator thing hooked to the cash register (see the linked rant, above). They’d definitely need something like that if they want to use objective criteria to determine if somebody is obese.

We’re fortunate that this bill was killed in committee, but I’m very disappointed that the thing was actually written and submitted to the Legislature. Imagine if it were passed: “I’m sorry, Sir, but according to State Law, you’re too fat to eat here.” Somehow, I just can’t see that happening. I hope I’m right this time.

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.

January 23rd, 2008

OK or Cancel?

I decided to cancel the email message I was composing, and my mail program responded with this confirmation dialog box. I actually read it twice and then pressed the Cancel button as an experiment. Pressing Cancel cancels the Cancel operation. OK completes the Cancel operation.

Is it any wonder that people find computers confusing?

Is there anybody who finds OK and Cancel on this dialog less confusing or more informative than Yes and No options?

I’ll ask again: What idiot decided that Yes and No responses to a question should be replaced by OK and Cancel?

December 6th, 2007

Can I really ignore that warning?

When you build 64-bit .NET applications with Visual Studio, the Assembly Linker issues warning messages of the form:

Assembly mscorlib.dll targets a different processor.

It will issue that warning for each of the .NET runtime assemblies that your project references. The warning occurs because the linker checks the 32-bit runtime assemblies for type information, and since you’re building a 64-bit assembly, there’s a mismatch. The documentation says that it’s safe to ignore this warning because all of the .NET assemblies are guaranteed to have the same external interface, regardless of the CPU for which they are compiled. Specifically, the documentation says:

All x86-specific common language runtime (CLR) assemblies have 64-bit counterparts (every CLR assembly will exist on all platforms). Therefore, you can safely ignore CS1607 for CLR assemblies.

And that does appear to be the case. There is no conflict when you run the application.

I contend, however, that this is a bug in the tool. Why? Because it is a spurious warning that I can’t safely eliminate. And why can’t I safely eliminate it? I’m so glad you asked.

I can eliminate the warning. All I have to do is go into the project properties and add ‘1607′ to the list of warnings I want disabled. Goodbye, warning. But doing that eliminates all occurrences of the warning in the project. If I just happen to have a conflict within my own solution (i.e. trying to link my 64-bit project with a 32-bit assembly that I created), I won’t see the warning. And I’ll get a rude shock when I deploy and try to run the resulting application.

In addition, Visual Studio 2008 will issue the same warning number (CS1607) if the AssemblyVersionInfo attribute in your AssemblyInfo.cs file is not in the recommended format. That in itself is a spurious warning in my opinion, and one that I’d love to disable. Except that if I disable it, I also disable the processor mismatch warning.

You might wonder why I even worry about it, if the warnings are ignorable. There are two reasons. First, when a solution I’m building in Visual Studio issues warnings, I have to examine each warning to make sure that I can safely ignore it. Some of my solutions have more than 20 different projects–tools and dependent assemblies. If each one issues a warning about every referenced CLR assembly targeting a different processor, I have almost 50 warnings to wade through for each build. The risk of missing a real warning in that mess of useless messages is very high.

More importantly, we’re trying to put together an automated build system. In automated builds, warnings should be treated as errors. Otherwise you have to write some kind of post-processing filter that can examine the tool output to determine whether the warnings are meaningful. Doing so introduces yet another uncertainty into the process: the correctness of the post-processing tool and any configuration file that controls it.

So I’m left with no good solution. Whether I enable or disable the the spurious warnings, there’s a very real possibility of missing an important warning. I could understand this bug existing in Visual Studio 2005, but the development team has had more than two years to work out a solution. There is no excuse for the bug remaining in Visual Studio 2008 and the latest version of the .NET tools. Rather than fixing it, they made the problem worse by overloading the warning number. That’s unforgivable.

November 30th, 2007

Violating the Terms of Service

The other night I was experimenting with Microsoft’s Live Search, trying to write a program that would submit a search query and get back the results. Somewhere in my wanderings I ran across the “format=xml” option, that tells search to return the results in an XML format. For example:

http://search.live.com/results.aspx?q=jim+mischel&format=xml

Notice the copyright message:

Copyright © 2007 Microsoft. All rights reserved. These XML results may not be used, reproduced or transmitted in any manner or for any purpose other than rendering Live Search results within the corresponding Live Search stylesheet and Live Search web page. All other use of these results requires express written permission from Microsoft Corporation. By accessing this web page or using these results in any manner whatsoever, you agree to be bound by the foregoing restrictions.

Maybe I’m missing something, but it seems to me that by displaying those results in my Web browser in XML format, I’m in violation of the restrictions. I can’t think of any other way to interpret that copyright message.

Which brings me to the question: Why would Microsoft make those XML search results available at all if they don’t want people to use them?

By the way, the “approved” method of accessing Live Search programmatically is through the Live Search API. Check out the Windows Live Developer Center and Windows Live SDK for more information. At some point I’ll have to cover those in my .NET Reference Guide.

September 5th, 2007

Improper Use of Exceptions

The .NET Framework’s ReaderWriterLock class API is broken. How? It uses exceptions where it should use return values. Consider the AcquireReaderLock method, which you call with a timeout value. If the timeout expires before the lock is acquired, the method throws an exception. This is nuts. The use of exceptions here makes for some very ugly code. Consider, for example, code that waits five seconds for a reader lock:

try
{
    MyLock.AcquireReaderLock(5000);
    // do processing here
}
catch (ApplicationException)
{
    // unable to acquire lock.
}

A temporarily unavailable resource is not an exceptional condition. It’s quite common for a resource to be locked a little longer than normal. Whoever designed the Monitor class understood that. Monitor has a TryEnter method that accepts a timeout value and returns a Boolean value: True means that it acquired the lock, and False means that the timeout expired and it didn’t acquire the lock. If whoever designed the ReaderWriterLock interface had studied Monitor, perhaps we would have a TryAcquireReaderLock method that would make for much more reasonable code:

if (!MyLock.TryAcquireReaderLock(5000))
{
    // do processing here
}
else
{
    // unable to acquire lock.
}

Exceptions are meant for exceptional conditions. Using an exception to indicate a normal failure is totally inappropriate. I can think of no rational reason why AcquireReaderLock or AcquireWriterLock should ever throw an exception.

September 2nd, 2007

Helpful (not) error message

I’m installing Windows 2000 on a machine here at home to do some testing. Windows 2000 is great for this kind of thing, although I’m finding that certain things aren’t supported on it anymore. New versions of DirectX, for example, don’t support Windows 2000. Nor, then will .NET 3.0 be supported on Windows 2000 because Windows Presentation Foundation requires the latest DirectX. (At least, I think it does.)

In any case, I was installing DirectX 8 earlier and it came up with a very helpful error message: “DirectX setup could not locate a required directory.” Yep, that’s all. No telling what directory it couldn’t locate. That’d make too much sense. Of course the user should be able to figure out what directory the setup program is looking for.

It turns that I had deleted my Temp directory (\Documents and Settings\User Name\Local Settings\Temp) because some other install vomited all over the directory and I thought it’d be easier to just delete the directory. Other software creates Temp if it doesn’t exist, right? Wrong. And then they don’t tell you where the problem lies.

I love this stuff.

July 25th, 2007

Hypocrisy? In Congress?

Am I the only one who recognizes the hypocrisy in these “withdraw the troops” bills that continue to be introduced in Congress? I’ll grant that our involvement in Iraq has become an untenable situation, but anybody with brains (and, as much as I distrust our Congresscritters, I don’t for a minute think they’re stupid) knows that pulling our troops out any time soon will cause way more problems than it’ll solve. Whether or not going in was a good idea is a different issue entirely, and one I might discuss at some point.

In any case, those who introduce or support the troop pullout bills (or riders on other bills) know that the bills won’t pass. They’re counting on it. The war has become increasingly unpopular with the American people, so supporting an anti-war bill scores points with the constituents. Even better, it makes those who oppose the bill look bad. “He voted to keep the troops in Iraq!”

The absolute worst thing that could happen, as far as the troop withdrawal supporters are concerned, would be for one of those bills to pass. Then they’d actually have to bring the troops home, or come up with some lame excuse as to why they can’t do it. That would make them look bad. It’s not likely to happen, though. They can keep introducing bills that are fatally flawed, knowing full well that the bill won’t pass, and bask in the admiration of the constituents who are too blind to see what’s really happening.

July 23rd, 2007

Magnetic Conditioning of your Wine

Over the weekend I visited a place called Water 2 Wine, where you can make your own wine. They help you make your wine, handle the fermentation for you, and even assist in designing custom labels. It’s cheaper than buying the wine in a liquor store, but much more expensive than making it yourself in your own home. If you have the equipment, that is. In any case, you can make good wine for about half the price you’d pay for an equivalent bottle in the store.

One of the options they give is to “condition” your wine with a magnet. The idea is that you set your wine bottle on this magnetic coaster thing, put the special cork in it, and let it set for 30 minutes. The magnet supposedly “ages” the wine two years in half an hour. The people at the store will tell you that it works great.

After leaving Water 2 Wine, I went to the homebrew store to get ingredients for another batch of beer (a juniper rye that I brewed up last night). There I noticed that they were selling The Perfect Sommelier–one of those wine coaster things. I asked the guy at the store if it really worked, because it sounds like a bunch of bullshit to me. He assured me that it really works, and that he’d give me my money back if I tried it and didn’t agree.

There’s really no reason for me to try the silly thing. Plenty of reviews of this and other devices have convinced me that these magnetic “conditioners” are just scams. There is no scientific evidence to support the claims that these people make. And yet people fall for this crap all the time. It’s like “high quality” speaker cables or putting things under pyramids. It’s a bunch of crap couched in vague pseudo-scientific mumbo-jumbo designed to fool uninformed people into parting with their money. Don’t fall for it.

July 10th, 2007

Too Much Memory

More memory is a good thing, right? Not necessarily. I upgraded my machine last week from four gigabytes of RAM to six (I’m waiting for the replacement two gigabytes to make it eight). Now TextPad won’t load a one-gigabyte file. It used to, back when I only had four gigs of memory. But not now. The error it gives is kind of funny: “Disk full while trying to read .”

I don’t know for sure, but I strongly suspect that the error has to do with the way that TextPad checks for available memory. It’s probably calling the Windows API function that returns the amount of memory as a 64-bit quantity. Since TextPad is a 32-bit application, it just checks the lower 32 bits of the returned result, and assumes that I only have two gigabytes of memory. Oops. I’ll bet that it’ll load the file for me no problem once I have the full eight gigabytes.

But I’m looking for a new editor. And I’d really like a text file viewer. I find it hard to believe that there aren’t file viewers and editors that intelligently handle large files. They all seem to insist on loading the entire file into memory before allowing me to do anything. This is asinine. WordStar could operate on larger-than-memory files 25 years ago. There’s no reason why today’s software shouldn’t be able to do the same.

If you know of a good text editor or text file viewer that can work with very large–multi-gigabyte–files that are larger than available memory, please let me know. And please don’t tell me “move to Linux.” That’s not currently an option, and if the GNU tools for Windows that I’ve downloaded are any indication, they suffer from the same problems.

May 29th, 2007

MySQL Server has gone away

I got an error message from MySQL last week that said, “The MySQL server has gone away.” I thought it an odd message, but since I was changing settings, configuring a driver, and experimenting with my program, I figured that my fiddling had somehow caused me to execute a query against a closed connection. So I ignored the error and went about my business. Since the error didn’t crop up again, I forgot all about it.

The error came back yesterday and camped on my front door. A quick search of the MySQL Reference Manual revealed the topic MySQL server has gone away in an appendix. Here are some of the things that can cause this error message:

  • The server timed out and closed the connection.
  • Attempting to to execute a query against a closed connection.
  • You don’t have sufficient privileges to execute the query.
  • The server, the TCP connection, the Windows client, or something else timed out.
  • Sending a query that is too large.
  • Attempting to execute an incorrect query.
  • You have mismatched server and client versions.
  • Attempting to use the same connection from multiple threads.
  • A blocked port on the firewall.
  • A bug in the server.

Helpful, isn’t it? For all the good it does me in locating the problem, the message might just as well have said, “Something bad happened.” I spent an inordinate amount of time checking timeout values and permissions, checking my query for validity, verifying client versions, making sure that my multi-threaded program wasn’t trying to re-use a connection, and finally writing diagnostic code to check the length of my queries against the maximum allowed length. That was the problem, by the way: a very large query.

This is asinine. Why couldn’t MySQL tell me the exact error message? It looks to me like some lazy programmer decided to save himself time at my (and others’) expense.

On a related note, the MySQL ODBC driver for Windows is a huge disappointment. First, there’s no 64-bit version, forcing me to make my data broker a 32-bit program. I’d be more understanding if this was 2005, but 64-bit versions of Windows have been out for at least two years. Isn’t it about time somebody upgraded that ODBC driver?

The ODBC driver also has a very nasty UTF-8 bug that is being ignored by the developers.

I’ve heard good things about MySQL, but I’m not yet favorably impressed. I can’t argue with the price, though, and for all the headaches it does seem reliable. I haven’t lost any data. Yet?