Debugging ‘Multiple-step operation generated errors’ errors in VB6 and SQL 2005

I just blogged about CSFBL moving to its new server. All was going well, until I tried to kick off the sim engine, a big part of which is written in Visual Basic 6.0 (cringe, I know, but who has time to rewrite legacy code?).

The sim engine is implemented as a DLL which gets invoked via COM. This part works fine; the DLL is activated, properties are sent to it, and it runs… then crashes, with the following obscure error:

Error Number: -2147217887
Description: Multiple-step operation generated errors. Check each status value.

I searched, and searched… nothing. I recompiled, and checked settings… nothing. I prayed, and finally found this post: http://www.developersdex.com/sql/message.asp?p=581&r=4737805

Continue reading

CSFBL find a new home

Nearly four years ago, on September 16, 2004, CSFBL – the Computer Simulated Fantasy Baseball League (the greatest web-based multiplayer baseball simulation ever made, in my opinion, despite the long name) was migrated to what was (at the time) a hot new server. Performance was spectacular, and things stayed rather well… for a while…

Fast forward to 2008. CSFBL was crumbling under its own weight — and popularity. A game that was originally designed to handle a few hundred users now had thousands. More users meant more teams; more teams meant more games simulated; more games simulated meant more server utilization… The 3+ year old server, once handling the every-three-hour simulation in an hour and a half, took four or more hours to get it done. People were frustrated; I was frustrated. Something had to change.

Continue reading

(Not) The Greenest Show on Earth

Today’s Wall Street Journal has an article, The Greenest Show on Earth: Democrats Gear Up for Denver, which highlights the attempts at the Democratic National Convention to run “the greenest convention in the history of the planet” (at least, at bequest of Denver’s mayor, John Hickenlooper).

Read through the article and you see how difficult it is to focus on green, renewable, carbon-free, Union labor for everything.

More interesting are the points the article didn’t make…

Continue reading

How to save multiple messages to disk in Thunderbird

I had a bunch of messages in Thunderbird which I wanted to give to a coworker. I didn’t want to forward 60 messages, so I figured I’d save them as .eml files.

Unfortunately, Thunderbird only lets you save to file one message at a time. Who wants to File/SaveAs/File/OK sixty times? Not me.

Fortunately there’s a great little extension called ImportExportTools. After installing it, I went to File / Save Selected Messages / EML Format and watched it do what I didn’t want to do, sixty times.

I won’t mention all the other export and import features. Just get it and install it if you use Thunderbird. You will use it at some point.

Google AdSense ViewComponent for MonoRail

Like many, I use Google AdSense to host ads on my web sites. Including the ad code typically requires you to paste a block a block of JavaScript onto the page. I don’t mind injecting the JavaScript, but I wanted to come up with a better way.

The solution I came up with was a quick MonoRail ViewComponent, AdUnit. It has a simple purpose: to render a block of code for an ad unit of a given size.

The first task was to create an enum which represented all the possible ad unit sizes, based on what’s offered by Google. Continue reading

Separating SQL script files generated by Microsoft SQL (by type)

There’s one great feature in SQL: the “Generate Scripts” command. Unfortunately, it has one limitation: the default filenames of scripts look something like this:

dbo.fnc_PlayerValue.UserDefinedFunction.sql
dbo.UserSelect.StoredProcedure.sql

I’d much prefer the filenames to match the object name, without the owner (‘dbo’) or object type. In other words, I’d prefer the above two files to look like this:

UserDefinedFunction\fnc_PlayerValue.sql
StoredProcedure\UserSelect.sql

How do we get from point A to point B without a lot of manual file copies and renames? We use the FOR command!

First, create a subdirectory for each object type (Table, StoredProcedure, UserDefinedFunction, View, Schema, Trigger, and User), then run the following from a command prompt.

for %i in (*.User.sql) do for /f "delims=., tokens=1-3" %j in ("%i") do move %i %k\%j.%l
for %i in (*.Schema.sql) do for /f "delims=., tokens=1-3" %j in ("%i") do move %i %k\%j.%l
for %i in (*.Trigger.sql) do for /f "delims=., tokens=1-3" %j in ("%i") do move %i %k\%j.%l
for %i in (*.sql) do for /f "delims=., tokens=1-4" %j in ("%i") do move %i %l\%k.%m

The command above will look for each file with a *.sql extension in the current directory. For each of those files, it copies it to a directory based on the type of file, and ensures the new file only includes the object name and the .sql extension. So much cleaner now!

Note that this will not work if any folder in the full path to the SQL files has a period in it!

Updated 2009.11.10 to support Trigger, User, and Schema scripts.

A bug in Microsoft Word’s Insert Hyperlink feature

Try this in Microsoft Word 2007:

  1. Open a new document.
  2. Type the following: http:// some.domain.com
    Note that there’s a space after the two forward slashes and before the domain name.
  3. Select the text you just typed, and press Control-K (the shortcut key to Insert Hyperlink).
  4. Note that nothing happens.
  5. Go to the Insert ribbon and click the Hyperlink button (essentially the same thing as #3 above).
  6. Note that nothing happens.
  7. Edit the text you previously typed, removing the space after the two forward slashes, so the text looks like this: http://some.domain.com
  8. Select the text you just edited (all of it), and press Control-K.
  9. Note that you now see the Insert Hyperlink dialog.

Apparently, Word is trying to verify your URL before opening the Insert Hyperlink dialog, and aborting when it runs into the problem with the incorrectly formatted URL. The good thing is that Word doesn’t crash outright. The bad thing is that it shouldn’t work this way.