A wasted vote?

As convention time approaches, I’m once again wondering how the heck I should cast my vote when election time rolls around this fall. I distrust both major parties, disagree with them on most issues, and don’t believe that they have the good of the country or its citizens in mind.

President Obama is just another politician whose primary interest is power and who will do or say anything to retain power. The same goes for Mitt Romney. One of these two will almost certainly be elected President of the United States come November. I, however, will not be a part of electing either of them. I will not vote for Barack Obama or for Mitt Romney. I don’t know who will receive my vote, simply because I don’t yet know who will be on the ballot. But it won’t be one of those two.

I said that on Facebook yesterday, and somebody asked me, “Why vote for somebody you know has no chance at winning?” In the past, people have said to me, “A vote for a third party candidate is a wasted vote.”

I disagree strongly, and in doing so have had some heated and, to me, amusing discussions. In general, I’ve found that if I express a political opinion that is not aligned with one party or the other, partisans on both sides either dismiss me as a crank or, more frequently, come together to denounce my heresy. Vehemently. Until I point out that they’re actually agreeing on something.

The President is not elected directly by a majority of the popular vote. The workings of the Electoral College are strange, but in principle each state’s electors cast their votes for the candidate who receives the most votes in that state. In Texas, Republicans have won every Presidential election but one since 1968 (the exception being 1976, when no Republican could possibly have been elected–not after the mess Nixon made) by a reasonably large margin. Polls show that Romney will almost certainly carry Texas in this year’s election.

By the “wasted vote” logic expressed above, casting a vote for a Democrat in a majority-Republican state (or for a Republican in a majority-Democrat state) is a wasted vote. For all the good their votes will do this year, Obama supporters in Texas should just stay home.

I distrust party politics, and I distrust those who the parties elect to represent them. For all their superficial differences, both parties have shown that they share the same belief: that people should be subordinate to government. In their collective lust for power, both parties have created a government that is, in practice, the ruler of its people. The parties perpetuate it by framing the political discussion as an “us versus them” issue. You’re a Democrat or you’re a Republican. The other side is evil, immoral, untrustworthy, etc. As long as the American people continue to buy that false dichotomy, we will forever be enslaved by our government.

I don’t believe that it’s an “us versus them” issue. I don’t agree that the electorate is made up of “liberals” and “conservatives” who are at odds on every issue. I find myself siding with liberals on some issues and conservatives on others, and I believe that the majority of the American people are the same. But we are forced to pick sides in elections.

I will have no part of it. I will not cast my vote for a Republican or for a Democrat. I believe that both parties are evil and I will not be forced to choose the lesser of two evils. Whereas it’s true that my single vote won’t change the outcome of the election, by casting my vote I’ve done my civic duty and I can look myself in the mirror on Wednesday morning after the election. In addition, I’ve made it known that at least one person is disgusted with both of the major choices.

Imagine a slightly modified version of Shirley Jackson’s “The Lottery” in which one member of the town is selected by lottery and then the entire town votes on what should be done to that person. The town is dominated by two parties: the Burners who advocate burning at the stake, and the Decapitators. But there’s a small third party, the Freemen, who don’t like the system and advocate setting the person free.

If you were selected in the lottery, how would you cast your vote? Would you vote to be set free, knowing full well that you won’t be, or would you feel more comfortable knowing that you voted for the party that ends up carrying out your execution?

 

 

The smart phone I want

People are often surprised that I don’t have a smart phone. I carry the absolute cheapest (i.e. free) phone that I could get with our calling plan. And I upgrade it about every two years. For free. And I’m pretty happy with that arrangement. Not perfectly happy, but the promise of a smart phone isn’t yet compelling enough for me to spend several hundred dollars on a device and a hundred dollars or more every month for a calling and data plan.

Some of you may recall that I had one of the earliest smart phones. It was kind of nice to check my email when I was out of town. Other than that, I pretty much hated the phone. It was based on the old Palm OS. By default, input was with a stylus using their Graffiti handwriting recognition. I purchased some software that converted the bottom part of the display into a keyboard so that I could tap on the thing rather than trying to teach it how to read my scribbling. I could get maybe 20 words per minute on the thing.

But 20 WPM is about 1/4 my normal typing speed. Not only that, I had to look at the keyboard while I was typing. And notes couldn’t be very long. And on and on and on. As a simple list manager, the device was excellent. Anything more involved was beyond the phone’s capabilities.

I’ve seen mobile devices come and go since then. I had high hopes for Microsoft’s tablet back in 2002, but that didn’t go anywhere. Phones kept getting better. The iPhone and its Android clones are quite impressive. So are the iPad and its Android clones. But they all have what, to me, is a fatal flaw: they’re consumption devices. As production devices, they mostly suck.

Among other things, I’m a writer. I’m not a great writer, but I scribble a lot. I’m forever taking notes, jotting things down, sitting at the computer exploring some idea or other. My drives are full of notes, sketches, attempts at fiction, outlines for think pieces, rants, and all manner of other scribblings. When I’m at home, I’m as likely to be writing something as reading. And that doesn’t even count the writing I do for work: emails, computer programs, documentation, and articles.

So the first time somebody put an iPad in my hands, the first thing I tried to do was post a blog entry. So much for that idea. It’s possible, but painful. I can’t imagine trying to do that with an iPhone or similar.  I’ve come to the conclusion that nobody makes the mobile device I want. And I really don’t understand why. But then, people tend to think that our ideas are obviously good.

If I can find a smart phone with the following features, I’ll upgrade. So far, I haven’t seen anything that even comes close.

  1. The ability to connect to my home computer through USB, or share data via USB thumb drives.
  2. Network access to shared drives or NAS devices on my local network would be nice, but not essential.
  3. Ability to connect a full-sized keyboard. I’m liking those roll-up keyboards.
  4. Ability to connect a decent-sized video display. I really like the new rollable displays, although I suspect that those aren’t affordable yet. It should be reasonably easy to find a display unit that I could use for this.
  5. A camera with which I can take a picture and save it to my computer. Having to transmit pictures to “the cloud” is idiotic. Why can’t I transfer them directly to my computer?

I seriously doubt that Apple has or will make a device that meets these requirements. Is there an Android device that has those capabilities?  I’d buy one if I can get the peripheral devices. It would be the perfect mobile device: small enough and powerful enough for everyday carrying around, and flexible enough so that I could actually use it for productive work. That would be worth having.

Until I can use my mobile device to produce content, I’ll stick with my basic phone. I’ve yet to see a compelling reason to change.

 

I need a new computer

I’m looking to buy or build a new development machine. My current machine is a Dell 490 case with an Intel Core 2 Quad processor running at 2.4 GHz. 16 GB of RAM and two 750 GB hard drives. I have a second machine (Core 2 Quad at 2.0 GHz, 16 GB RAM, two 500 GB drives). Together, the systems make for a pretty reasonable development environment, but they’re starting to show their age. The machines can’t easily be upgraded with newer technologies (USB 3.0, SATA 3.0, etc.). Worse, those machines are noisy.

I should be able to replace both of those machines with a single machine, and not lose any required functionality. I figure if I can load it up with a fast processor (perhaps two quad-core processors), 64 GB of RAM, and two 2-terabyte drives, I’ll be in good shape. With two video cards and monitors, I can easily have two virtual machines running concurrently. With four monitors (a possibility), the system should rock!

My number one requirement is that the system be quiet. I realize that there will be some noise. That’s unavoidable. But these 490s are crazy loud. I don’t really notice how loud until I turn the machines off and am amazed by the quiet.

I’ve seen Jeff Atwood’s most recent Building a PC blog (from a year ago), and he has some good suggestions. His needs and mine often differ, though. In particular, he thinks that 24 GB of RAM is overkill. Some of the stuff I do will eat 24 GB with no trouble. I have programs that can make good use of 64 GB or more.

One other thing I’d really like is an SSD to hold my boot partition as well as a “scratchpad” area that I can use for large data-intensive tasks. A 128 GB SSD is quite reasonable: from $150 to $250. 512 GB will go double that, but might be worthwhile.

There are other things that’d be nice to have, but my basic requirements are:

  • Quiet case.
  • Quad core or possibly dual quad core (unless somebody has an 8-core processor).
  • Minimum 32 GB of RAM. Preferably 64 GB.
  • Space for four SATA drives, plus DVD.
  • Space for two dual video cards (total of 4 monitors).

I don’t know yet what that’s going to run me, but price isn’t all that important. I sit in front of these machines for 12 hours a day. If I can build one that saves me time and makes my work more enjoyable, then it’ll pay for itself pretty quickly.

Suggestions welcome.

Virtualizing

I’ve come to the point where I have to install some virtual machines on my computer in order to do my work. “No problem,” I thought, “I’ll just download Hyper-V and go.”

Dream on.

You see, I’m running Windows 7 Ultimate. Hyper-V only runs on Windows Server 2008. That’s crazy. I can’t imagine why Microsoft can’t release a version of Hyper-V for Windows 7.

I can either re-image my machine with Windows Server, or I can buy VMWare Workstation. Or I suppose I could re-image my machine with Ubuntu Linux, install VMWare Workstation, and do all of my Windows work in virtual machines. The real choice, though, is whether I want to spend the time re-imaging my machine. VMWare Workstation is only $200. Considering the time and trouble involved in re-imaging a machine, I’m thinking that VMWare is the way to go.

On a related note, I ran across Microsoft’s Windows XP Mode download. What a well done package. A quick download (well, if 500 megabytes is “quick”), a no-hassle install, and I have a 32-bit version of Windows XP running in a virtual machine, with full access to my Windows 7 drives. It’s great for running those few 16-bit applications that I’ve been too lazy to port or to find 32-bit versions of. Highly recommended.

That XP Mode package is a brilliant piece of work, but Virtual PC (the virtualizer that XP Mode runs on) is 32-bit only. I need 64-bit, which Hyper-V supports, but Hyper-V isn’t available for Windows 7.

It confuses me sometimes how Microsoft can be so customer focused in some ways, and totally clueless to their customers’ needs in others.

Hundred Birds Update

I’ve used most of my carving time this past six months working on my Hundred Birds Project. As of Friday, I’ve finished birds from 50 different types of wood. When I started the project in December, I gave myself until the end of this year to finish. So I’m right on schedule.

It’s becoming more difficult to find new types of wood. Even getting to 50 was a bit difficult, and I couldn’t have done it without help from several people who sent me wood. And of course I and Debra purchased a few exotic woods that we wanted to see birds made from. I have in the garage six or eight types of wood that I haven’t yet carved, but when those are gone I’ll be looking for wood. I could go buy more exotics, but I’d rather get different types of wood from people around the country.

As an incentive to potential participants, I’m offering to carve a bird ornament for you if you send me a type of wood that I don’t yet have. If you’d like to help out, contact me privately: jim AT mischel.com.

I cut the birds from a block that’s 2″ x 2″ x 4.5″ long. If you have a tree limb that you want to send, it has to be at least 3″ in diameter for me to get a useful bird from it. I prefer older, seasoned wood that’s already dry. But if you have a fresh (green) limb, I’ll take it. Just seal the ends with wax or paint (oil based paint is best, but latex paint or even spray paint will work)  before you send it. That will slow the moisture loss and limit or prevent cracking.

Below are some wood suggestions. If you have one of these types of wood, or any wood that isn’t listed in the bird index (see the link above), I’m almost certainly interested.

Magnolia
Giant Sequoia
California Redwood
Holly
Texas Ebony
Redbud
Red Oak
Yellow Pine
Aspen
Birch
Manzanita
Boxelder
Elderberry
Sourwood
Dogwood
Black Ironwood (southern Florida)
Olive
Blue Spruce
Plum
Willow
Fig (my fig tree died and there weren’t any large enough pieces)

Again, those are just suggestions. If you have any of those woods or something else I haven’t seen, please let me know.

 

 

Confusing error message

In order to set the heart rate training zones on my Garmin Edge 500 bicycling computer, I have to set the zones on my Garmin Connect account and then send the zones to the device. Garmin Connect lets me set zones for the default, for running, and for bicycling. I only use the device for bicycling, so I ignored the other two and set the three heart rate zones that I use for bicycling. Then I clicked the “Send to device” link, and got this error message:

Your device can only accept 5 HR zones.

I found that odd. “Perhaps,” I thought, “it can only accept five total.” So I deleted the default and running HR zones. Again with the error message. It took me a while to realize that the message was saying that I had to have exactly five zones for each of the activities.

Forget for the moment the idiocy of creating software that can’t deal with fewer than the maximum number of zones. Forget also the idiocy of not fixing that in one of their many firmware updates. They could have at least provided a more explicit error message such as, “Your device requires you to enter exactly five HR zones.”

Why is it that hardware manufacturers have such a difficult time with software?

 

Use extension methods judiciously

Extension methods are an interesting bit of compiler trickery that lets you “add” methods to classes that are sealed or to classes and interfaces for which you don’t have the source. From the programmer’s perspective, creating an extension method is “just like” adding an instance method.

For example, suppose you have a method that checks a string to see if it’s a palindrome:

public static class StringTools
{
    public static bool IsPalindrome(string s)
    {
        int i = 0;
        int j = s.Length-1;
        while (i < j)
        {
            if (s[i] != s[j])
                return false;
            ++i;
            --j;
        }
        return true;
    }
}

You can then determine if any string is a palindrome by passing the string to the IsPalindrome method:

string foo = Console.ReadLine();
bool pal = StringTools.IsPalindrome(foo);

And then you find yourself in a fit of object-oriented pique thinking, “but IsPalindrome should be a method of the String class!” And you rant for an hour about inconsiderate runtime library designers who make your life more difficult by sealing classes and preventing you from extending things as you’d like.

And then you discover extension methods, and your life is changed. With but a minor change, you have an instance method! All you have to do is change the method declaration:

    public static bool IsPalindrome(this string s)

And now you can write:

string foo = Console.ReadLine();
bool pal = foo.IsPalindrome();

Reveling in your newfound power, you go through your entire code base, converting every utility function to an extension method. You end up with all kinds of interesting things. For example, why call TimeSpan.FromSeconds(10) when you can easily create an extension method on the int type, giving you Timespan bar = 10.Seconds();? Yay!

Please, for the sake of the poor programmer who will follow you (including yourself, six months from now), do not give in to this temptation.

An extension method is nothing but a bit of compiler trickery. The addition of the this modifier in the parameter declaration just tells the compiler that it can perform a simple substitution. When the compiler sees foo.IsPalindrome(), it looks in the string class to see if there is an IsPalindrome method. If there isn’t, the compiler then checks its symbol table to see if there is an extension method somewhere called IsPalindrome that takes a single String parameter. If there is, then the compiler generates code to call it. The generated code will be exactly what you wrote before: StringTools.IsPalindrome(foo).

The only thing you gain from using extension methods in the way I described above is a little bit of expressiveness. That’s all. And it comes at a great cost. Using extension methods makes your code easier to read, but more difficult to understand. When somebody who’s unfamiliar with your code sees foo.IsPalindrome(), the first reaction will be something like, “WTF? I thought foo was a String. There’s no String.IsPalindrome method!.”

It gets worse if you create silly things like 10.Seconds() to turn a number into a TimeSpan. Seeing that, I would expect there to be extension methods for hours, minutes, milliseconds, and days. And I would expect there to be similar extension methods for the other numeric types. After all, if I want twelve and a half seconds, I shouldn’t have to write 12500.Millseconds(). I should be able to write 12.5.Seconds(). But, really, why duplicate effort? There already exist conversion functions: TimeSpan.FromSeconds, etc. Better to use them.

I’ve seen all too many code bases filled with extension methods that are there only because some programmer thought it was a cool thing to turn his incomplete utility function library into a hodgepodge of extension methods. When asked, the culprit has no good reason for doing it and if pressed, most will admit that it was a mistake.

The C# team added extension methods primarily to support LINQ–to provide a default implementation for an interface method. When used for that purpose, extension methods are appropriate. I find it unfortunate that the language team didn’t limit their use to that particular case, because all other uses of extension methods, in my opinion, cause more problems than they solve.

Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.