Saturday, April 29, 2006 

I've just spent an hour working through the tutorials for Google SketchUp. It's a free 3D modeling tool. Pretty slick and easy to use.

I worked on 3D graphics and user interaction when I was a Master's student at Brown in the early 90s. What we had then wasn't bad, but the SketchUp UI is easier to use and more functional, and it runs on a regular PC instead of a high-end Unix workstation.

I can see myself using SketchUp to model woodworking projects.

posted on Saturday, April 29, 2006 10:42:33 PM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Friday, April 28, 2006 

I'm writing some C++ code at the moment, after months of C#. I'm trying to be very Test First, writing Red tests, then making them turn Green.

I'm also using CppUnit for the first time. It's not as easy as NUnit. You can't just declare your test method with an attribute, you have to declare the test method in a header file, place it inside a macro, and then have the test implementation in a .cpp file. And there's no nunit-gui. I'm using a post-build step to run the tests, which makes it fairly pain free.

There was one internal method that I didn't have an explicit test for, although I had tests for methods that called it. The main obstacle was that I didn't have a simple way to check the result, as the method returned a vector of objects. I didn't want to have to construct another vector of expected results.

Then it came to me: I could wrap the vector in a class and write a ToString() method for it (as well as a ToString() for the contained objects), and compare that to a string constant:

 RateList result = creative.GetRates();
CPPUNIT_ASSERT(result.ToString() == "100_4x3:100_16x9|200_16x9|400_4x3:400_16x9");

In retrospect, it should have been obvious. I already have ToString() methods for many of my other objects, and I'm using CPPUNIT_ASSERT(actual.ToString() == expected) in many of my unit tests. The extra step of writing ToString() for the collection blocked my thinking.

posted on Saturday, April 29, 2006 3:22:21 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Sunday, April 23, 2006 

Vim and DasBlog, two open source projects that I'm associated with, have both switched over to using the Subversion source code control system in the last week. In both cases, the prolonged problems with anonymous CVS access at SourceForge proved the final straw. And I provided the impetus, by bringing up the need for a change on the vim-dev and dasblogce-developers mailing lists. I take no credit for doing the work, however, as that was done by others.

(Vim's primary repository continues to be CVS, with Subversion acting as a mirror for anonymous access. Bram didn't want to change over until after Vim 7 ships.)

Earlier this year, we switched over to Subversion at work, after years of using Visual SourceSafe. It was a huge improvement. Having to use VSS was a big shock to my system, after years of using Source Depot at Microsoft. Transactional checkins are really nice and I've grown to like TortoiseSVN as a front-end to Subversion.

posted on Monday, April 24, 2006 3:24:51 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Saturday, April 22, 2006 

I've ported Vim to Win64. Native binaries for AMD64 can be found on my Vim page.

In the end, it wasn't all that hard. Last weekend, I fixed approximately 400 warnings that were thrown up by the x86_amd64 cross compiler. Most of them were due to the widening of size_t (especially the value returned from strlen()) and ptrdiff_t to 64 bits. Several years ago, I went through a similar exercise in fixing these warnings for Vim6, but I never finished the port.

This week, I scrounged access to an AMD64 box at work. Today, I turned on the /Wp64 flag, which found several new, subtler problems, where pointers where being truncated to __int32s or conversely __int32s were being widened to pointers. Judicious introduction of (the equivalent of) (INT_PTR) casts fixed most of those.

At that point, I tried running the binary. It refused to start! After a few detours, I had WinDbg installed, and ran gvim under WinDbg. That showed that the error was 14001 (ERROR_SXS_CANT_GEN_ACTCTX, "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.") The event log showed nothing.

After more investigation, I found a WinSxS manifest for the Windows Common Controls:

 

processorArchitecture="X86"
version="6.2.0.0"
type="win32"
name="Vim"
/>
Vi Improved - A Text Editor


type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="X86"
/>



Once the two instances of processorArchitecture="X86" were set to processorArchitecture="AMD64", Vim started working without a hitch. Despite my naïve expectations, none of the other fields in the comctl32 assembly needed to be changed.

posted on Saturday, April 22, 2006 7:55:29 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [1]
Tuesday, April 18, 2006 

One of my favorite shows is back on the TiVo. Barbecue University is Steven Raichlen's show about all kinds of grilling and barbecue techniques and recipes.

I love this recipe for Afghan Game Hens, although I always substitute chicken(s) for the game hens. This recipe convinced me to buy a rotisserie. It's been a huge hit whenever I've served it up. It's not the easiest meal to prepare, so I don't do it often. Note: I cook the marinaded onions in a pan and serve them with the chicken. Yum!

Beer Can Chicken, on the other hand, is very easy. It also works well in the oven. Last year, I found a stand which holds the beer can; it's far more stable than propping the chicken just on the can and the leg tips.

posted on Wednesday, April 19, 2006 6:35:53 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Monday, April 17, 2006 

Over at FireDogLake, they've put together an impressive (and depressing) series on the "racist freak show" that constitutes so many right-wing blogs.

Enlightening, if distasteful.

posted on Tuesday, April 18, 2006 6:53:10 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]

I'm a lot happier in my U.S. congressman, Jim McDermott, than I am in my senators, Patty Murray and Maria Cantwell. (Especially Cantwell.)

Jim has been a strong progressive voice in Congress for years. His early opposition to the Iraq War led to him being dubbed 'Baghdad Jim' by infuriated Republicans. He was one of the first national politicians to support Howard Dean's bid for the presidency. He had a big role in Fahrenheit 9/11. And he reads the role of Leopold Bloom for the Wild Geese Players of Seattle's readings of Ulysses.

For a decade, Jim has been fighting a legal battle for freedom of speech. Recently, the appeals court ruled against him, leaving him with a $700,000 legal bill.

One Seattle activist is organizing a theatrical benefit for Jim McDermott. More background on Boehner v. McDermott at the preceding link and at McDermottForCongress.com.

Send money at the McDermott Legal Expense Trust.

posted on Tuesday, April 18, 2006 6:44:48 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Sunday, April 16, 2006 

Via Win Tech Off Topic, an amazing collection of Rube Goldberg devices from a Japanese children's TV show. 13 minutes.

It reminds me of the famous Honda 'Cog' Ad, which can be viewed here.

posted on Sunday, April 16, 2006 10:08:14 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Monday, April 10, 2006 

It's no secret that Bush is appallingly vacuous and incoherent whenever he has to answer a question that he hasn't been prepped for. Here are a few excerpts from his recent appearance at Johns Hopkins University:

The Presidency Is No Place for a Smart person

We're a influential nation, and so, therefore, many problems come to the Oval Office. And you don't know what those problems are going to be, which then argues for having smart people around. That's why you ought to serve in government if you're not going to be the President. You have a chance to influence policy by giving good recommendations to the President.

Return of Complete, Blithering Nonsense

I appreciate that very much. I wasn't kidding -- I was going to -- I pick up the phone and say, Mr. Secretary, I've got an interesting question. This is what delegation -- I don't mean to be dodging the question, although it's kind of convenient in this case, but never -- I really will -- I'm going to call the Secretary and say you brought up a very valid question, and what are we doing about it? That's how I work. I'm -- thanks.

What's An "Integral"?

Economic development provides hope. And so, you bet. It's an integral of our policy.

Too Many Talking Points For One Tiny Brain

I think we need to be -- understand that we're a nation of immigrants, that we ought to be compassionate about this debate and provide a -- obviously, we've got to secure the border and enforce the law.

Wouldn't it be nice if we had a president who could speak in coherent sentences.

More at Your President Speaks.

posted on Tuesday, April 11, 2006 4:55:13 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Saturday, April 08, 2006 

Vim vs. Visual Studio

I've been an obsessive vi user for more than 20 years. Vi keystrokes are indelibly burned into my muscle memory. When I have to use Notepad or Word or Visual Studio, I feel crippled. I have to work harder to do simple things; I have to type too many chords with Alt and Ctrl; I have to take my hands off the home keys to use the cursor keys and the mouse.

In the mid-90s, I adopted Vim (Vi IMproved) to the point where I became a significant contributor, writing a big chunk of the Win32 code.

While I was at Microsoft, I hardly ever used Visual Studio. I edited my C/C++ code with Vim, I compiled and linked it with the NT Build Environment and I debugged it with WinDbg/ntsd/kd. I was hardly alone in this. In the Windows division, your code has to build with the NT build environment, and the Windows debuggers are much better supported than the Visual Studio debugger for developing the OS.

Now that I'm programming in C#, using the Visual Studio IDE makes a lot more sense. VS's IntelliSense for C# is much richer than Vim7's Omni completion, especially when coupled with ReSharper, and VS is the debugger of choice for managed code. I've been spending a fair amount of time in the VS IDE, especially when pair programming, but I've also been switching back to Vim a lot. When I'm struggling with unfamiliar code, VS's IntelliSense is a great comfort; when I'm moving a lot of text around, Vim suits me far better.

ViEmu

Earlier this week, by way of its graphical Vim cheat sheet, I found an interesting compromise. ViEmu is a vi/Vim emulator for VS 2003 and VS 2005.

ViEmu implements most of the vi keystrokes and many of the Vim extended keystrokes, right inside the Visual Studio IDE. It uses the native VS IntelliSense in place of Vim's completion functions. ViEmu even implements some of the more common Ex command line, including most of the :%s regular expression substitutions. The author, who seems to be known only as JNG, is responsive. Within 24 hours of my reporting some missing keystrokes, he had implemented them in a new minor release.

It does not, however, support VimL, the Vim extension language, so if you have an extensive suite of Vim plugins, as I do, they're not going to work in ViEmu.

All in all, I'm favorably impressed with ViEmu. It provides much of the muscle memory experience of Vim inside of Visual Studio. Technically, it can't have been easy to impose such a radically different input model on VS or to emulate Vim and Ex fairly faithfully.

Vim has always been free (actually charityware), but JNG charges for ViEmu. Right now, I'm in the 30-day trial period, but I fully expect that I'll pay for a license before the trial is up.

VisVim

Vim comes with a Visual Studio add-in called VisVim, which is based on another add-in called VisEmacs. It allows VS5 and VS6 to use Vim as the default editor, albeit externally to the IDE: Vim continues to run in its own window.

A few weeks ago, Bram asked me if I could get VisVim to compile with VS 2003. I tried, but I was unable. Necessary headers are no longer included with VS 2003 or VS 2005. No doubt this is because the Add-In architecture changed radically with the introduction of Visual Studio .NET.

Work is underway, albeit very slowly, to create VisEmacs.NET. At some point, it may be worth creating a merger of VisVim and VisEmacs.NET.

End Notes

viWord allows you to use vi keybindings in Microsoft Word. It's not nearly as full featured as ViEmu and I found that I didn't like it enough to keep it around.

This post was, of course, composed in Vim. I wrote it in lightly marked-up plain text and converted it to HTML with VST, Vim reStructured Text. Blogging with VST will be the topic of a future post.

To fully take advantage of Vim7's Omni completion, you need a patched version of Exuberant Ctags. I've made a Win32 binary available.

posted on Sunday, April 09, 2006 3:47:22 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]

Here's (left) a video of Chris Bliss doing a pretty amazing juggling routine to the accompaniment of the Beatle's Once There Was a Way.

And here's (right) a video of Jason Garfield doing the same routine with five balls instead of three.

(Each video is about 4.5 minutes long.)

posted on Saturday, April 08, 2006 11:13:36 PM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Friday, April 07, 2006 

In The Media's Chance at Redemption, Russ Baker ably takes the MSM to task:

When, oh when, will the U.S. “mainstream media” finally stop hemming and hawing, parsing and understating? When will they simply go for the jugular to confirm what any thoughtful American has already learned from “less reputable” but increasingly relevant alternative information sources: that from the beginning of the Bush administration, invading Iraq has always been as much an article of faith for the president as, well, promoting faith over reason?

... 

The Times report was full of throat-clearing and arcane notations that, while the memo had previously been reported, it had never been as fully reported, or that a particular passage had thus far eluded widespread scrutiny. And, indeed, the article did contribute new insights. But a careful reading of the Times piece turns up numerous opportunities where reporters could have offered—and, more importantly, still can offer—more context and thereby lead readers to the dark heart of the matter. To wit, the Times could not quite summon the courage for a sufficiently bold lead. It began:

In the weeks before the United States-led invasion of Iraq, as the United States and Britain pressed for a second United Nations resolution condemning Iraq, President Bush's public ultimatum to Saddam Hussein was blunt: Disarm or face war.

But behind closed doors, the president was certain that war was inevitable.

Even though the overall thrust of the article was that Bush and Blair were hell-bent on invading Iraq, with or without justification, there was that second sentence summarizing, blandly, that “the president was certain that war was inevitable.” This is soft-pedaling in the extreme. Bush wasn’t certain war was inevitable—he wanted to make it inevitable.

The article certainly makes that clear, describing all manner of shockers—from Bush musing about painting a U.S. reconnaissance plane in U.N. colors and deliberately drawing Iraqi fire as a casus belli, to the possibility of bringing out an Iraqi defector who would assert that WMDs existed even while Bush tacitly admitted they likely did not.

This pussyfooting, the burying of the lead, does a disservice to readers. News organizations like the Times abetted the march to war through their unquestioning acceptance of highly debatable administration assertions, and, in the specific case of the Times, its tolerance of the rampaging cowboy reportage of its correspondent Judith Miller.

... 

Looking backward, virtually everyone now agrees that the media did not ask the right questions, or enough questions, as the war drums telegraphed impending conflict. Well, that was then. But now, major mysteries still beg for resolution: including, most fundamentally, how George W. Bush convinced the bulk of his fellow Americans, including some of the brightest lights of our society, to support such an ill-conceived war.

Any journalist with a nose for news ought to be all fired up these days. It’s rare that we hacks are offered so many chances to show what we are made of—or to make up for errors of omission and commission that will otherwise haunt us in perpetuity.

posted on Friday, April 07, 2006 11:12:36 PM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]
Monday, April 03, 2006 

More on the Talabaptist front. In yesterday's Washinton Post, Kevin Phillips on How the GOP Became God's Own Party.

posted on Monday, April 03, 2006 8:17:44 PM (Pacific Daylight Time, UTC-07:00) 
#    Comments [0]