Thursday, August 26, 2004

Swift Boats

I'm not really following the presidential campaigns very closely yet this year. But the stories I've seen on the news recently led me to wonder about something.

Why is it so awful for this group of veterans to question the record of John Kerry, but it's okay for Michael Moore or to question the record of George W Bush?

Wednesday, August 25, 2004

More on ghosting SharePoint Pages

I found a pretty informative article on ghosting and using FrontPage to modify SharePoint pages.

Tuesday, August 24, 2004

Should the Royals have hired Buck Showalter

Texas Rangers: 69-54
KC Royals: 44-78

The Rangers today find themselves 15 games over .500 while the Royals are 34 games below .500. In May of 2002, Royals GM Allard Baird finally and mercifully fired Tony Muser. The choice for the new manager of the Royals was between Buck Showalter and Tony Pena. Showalter, then an analyst on ESPN, openly lobbied for the KC job. Baird chose Pena.

Showalter's resume looked great. 7 years of managerial experience, having built the Diamondbacks from expansion team to the division championship. Yet Baird, citing chemistry and Pena's ability to motivate young players, chose the unproven, rookie manager (following other unproven rookie managers Bob Boone and Tony Muser). The Royals went on to their first 100 loss season.

In 2003, the Royals jumped out to a great start, winning more games than they should have. After those first few weeks of the season, things evened out and though the Royals finished over .500, they didn't play .500 ball the rest of the season. And of course, we all know what's happened in 2004.

So as we look back, the obvious question is this: Should the Royals have hired Showalter instead of Pena? Obviously, there is no way to definitively answer that question. However, I think it is important to compare how the two have done with similar talent.

Showalter has a reputation for being a tough manager, perhaps one who isn't afraid to openly criticize a player or an organization. In Pena's "We Believe" tenure, nary a negative word has come from his mouth. Did Baird choose a "yes man?" Was Baird afraid of what might happen if he had a strong presence in the manager's job?

Of course, the Royals have been decimated by injuries this year (Sweeney, the last standing non-pitcher from the Opening Day roster, is going on the DL today), so it's hard to say what might have been this year. But it is clear that Pena's managing abilities are not up to par. He loves to bunt away precious outs in early innings. He often yanks pitchers who are doing well, while leaving pitchers who are getting killed out there way too long. The relievers never know what role they have. And too often, utility infielders are playing outfield positions.

So Pena's strength is to motivate young players and stress fundamentals. How do you explain Berroa's lapse that led him from his 2003 Rookie of the Year season to his demotion to AA a couple of weeks ago? How do you explain that the Royals have the most errors in the AL? What exactly has Pena done this year that makes one think that he is definitively the person to lead this team?

Meanwhile, Showalter's Rangers are just a game out of the AL Wild Card spot.

Monday, August 23, 2004

The effect of injuries

Ask anybody about the 2004 Royals, and they will surely point to injuries as a major factor in their disappointing season. And, most folks will say that injuries are the result of bad fortune.

But in looking at the Royals' history with injuries, you have to wonder if there's something more to the story.

Pitchers: Royals pitchers have been plagued with arm problems over the years. It seems like every young promising pitcher ends up with arm trouble before they are able to make a contribution to the club. Going from memory, I can think of a few - Jose Rosado, Kyle Snyder, Runelvys Hernandez, Mike Stodolka. Fortunately, the best pitcher of them all, Zack Greinke, has shown no signs of arm trouble... yet.

Rib Problems: What amazes me is the number of rib or oblique muscle injuries. Last year, Carlos Beltran missed the first couple of weeks with an oblique injury. This year, Ken Harvey, Jeremy Affeldt, Nate Field, and Matt Stairs have all had oblique problems.

Back Injuries This one, I think, has more to do with the player and not the trainers. Some players are just more prone to have back problems. This year, Mike Sweeney has missed games off and on (though has avoided the DL) with back problems. And of course, Juan Gonzalez had the mother of all back spasms which knocked him out for the season.

Injuries like Benito Santiago's broken hand (suffered when hit by a pitch) are understandably unavoidable. But the Royals' continued pattern of similar injuries makes one wonder if the medical and training staff needs a serious evaluation.


A lot of folks (including Dan) have been asking why Calvin Pickering has not been called up to the Royals. Pickering is a first baseman/designated hitter type of player who's had a great season at AAA Omaha (1157 OPS, 34HR's).

Unfortanately, the Royals' roster is stuffed with first baseman/designated hitter type players (Sweeney, Harvey, Stairs). When Harvey went on the DL, Pickering finally got his chance in yesterday's game. He responded well to his Royals debut.

Pickering went 2 for 3 with 2 HR's and 6 RBI's and 1 walk (one HR was a grand slam). In one game, Pickering provided the kind of offensive fire power the Royals were expecting from guys like Juan Gonzalez this year.

If Pickering continues to hit, it may make sense to trade Harvey when he returns from the DL. He's an "all star" that another team may find valuable.

Friday, August 20, 2004

I rebuilt this wiring harness to fix the vertical hum problem. Of course, now the game keeps resetting every 20 minutes or so... Posted by Hello

Clyde the Bud Bottle is ready for football season! Posted by Hello

Pac Man always seems to have its back off... Posted by Hello

The Theatre of Magic is working great! Posted by Hello

Wednesday, August 18, 2004

All Star Baseball

I've read about various table top baseball simulation games like Strat-O-Matic, but I have never played one. I got home from work yesterday and found Cadaco's All Star Baseball, Hall of Fame Edition in my living room. The babysitter who watched my kids this summer bought it for Joey for his birthday. I'm sure she didn't realize that she was buying a true American classic.

Joey and I played it last night, and what a joy it is. The Hall of Fame edition includes player discs for several Hall of Famers (Reggie Jackson, Harmon Killebrew, Willie Stargell, Enos Slaughter, Jim Palmer, and many more). We scored the game using an old baseball scorebook we had laying around.

First, each player selects his team and batting order. You play the game by slipping the player's disc into the spinner and spinning it. The numbers around the edge of the disc represent the outcome of the at-bat. The spacing of the numbers is determined by the player's lifetime statistics. For example, a pitcher might have a large space for strike out while Reggie Jackson would have a wider than average space for home run. If the spin results in a ground ball, fly ball, or single, the defesive player can spin to determine the outcome of the play (runners advance, double play, safe on error, etc). An additional strategy disc is included for hit and run, stealing, etc.

Even with Whitey Ford and Jim Palmer pitching, our game ended with a score of 11-10, with my home team getting one run in the bottom of the 9th to eek out the victory.

We both enjoyed the game, and we look forward to finding (or making) additional player discs for it.

Tuesday, August 17, 2004

Unearned Runs

Interesting article on unearned runs. In it, Keith Scherer takes the unearned run argument and applies it to the recent Red Sox trade sending Nomar to the Cubs. Baseball Prospectus says that unearned runs should count against the pitcher, since a good pitcher should be able to prevent that runner from getting around to score.

King of the Soldering Iron

About a year ago, we finished our basement to create a home theatre. One of the nice features of our new space is the addition of a couple of arcade games. We have a Theatre of Magic Pinball machine and an old classic PacMan machine.

Little did I know what I was getting into with these machines. I'll start with PacMan.

The screen went dead. The game would play, I know this because I could hear it through the speaker, but the screen was completely dark. I tried picking up another monitor on eBay and installing it, but had the same problem. So I gave in and called a local arcade repair specialist who came out to look at it. Turns out both monitors had blown capacitors. He installed a "cap kit" and it was good as new. A couple of weeks later, I was playing the game when my son accidentally kicked a Nerf ball that hit the cord where it plugged into the wall. The game went completely dead. No lights, no nothing.

I figured it was a blown fuse, so I replaced all the fuses I could see. No luck. I tinkered around with it for a while, and a friend finally lifted a piece of paper to reveal two more fuses that I hadn't seen. $2.00 later, we were back in business. The problem then was a "hum bar." That is where the screen has a wave that floats across it, right to left. It also hums loudly through the speaker. I did some internet research and learned that the wiring harness used to plug into the main board is typically weak and usually fails after a few years. I bought a new plug, and rewired all 52 (or so) wires into the new plug. I plugged everything back in, and we now have a beautiful, perfectly played PacMan machine. Except now, the machine resets every so often (20 minutes or so). So high scores disappear (it can't remember anything after a reboot). Jeez.... what next???

The pinball machine has been a little more steady. The first issue had to do with it becoming confused about how many balls were in play. It would keep kicking balls into the shooting lane even during play. This was simply a loose connector below the playfield. The next problem came when one flipper quit working. In this case, a wire had come loose, so a little solder made it all better.

The biggie was when the lights in the back box (the big display above the playfield) when out. A fuse, I figured - no big deal. I opened up the case to find a white molex plug completely burned through. Wow, black and cripsy. I've since discovered that this is pretty common on Williams/Bally pinballs of that era. The manufacturer didn't use heavy enough pins and wires to run all those light bulbs. Leaving the machine on 24/7 at full brightness will cause this plug to burn out after a while.

I rebuilt the plug, and fired it up to find only half of the lights working. After doing some continuity tests using my multi-meter, I determined that the back of the circuit board had broken contact when the plug burned up. I unplugged the board and pulled it out, and sure enough, the solder on that pin had gotten so hot, it melted and lost contact.

I've never done any kind of soldering on a board before, so I was quite nervous. I've only soldered wires to make connections, and usually I do a pretty poor job of that. I dabbled just a small amount of solder on the back side of the board to restore the connection to the pin. I then tested it with my multi-meter and all looked good. I plugged the board back into the machine and fired it up. YES! All lights are burning brightly!!!

Now, how to avoid that burning problem again... These pinball machines have an extensive menu for controlling all aspects of the machine. I set it to "dim" after 2 minutes of idle time, and I set the "dim" setting to its dimmest. So now, after 2 minutes, the lights all dim which will hopefully pass less current through that plug, preventing the burning problem. I could also replace all of those bulbs will a similar bulb that burns less brightly. At any rate, I was very proud of my soldering skills to fix that bad connection.

Now, back to that PacMan reset problem........

I feel like an idiot

Sometimes you can bang your head against a problem for minutes, hours, days, even weeks. And, as it turns out, the solution is really quite simple.

I've been trying to build a custom web part for a client that would simply iterate all areas of a SharePoint Portal and look for items that require Approval (they have a status of Pending). The part would then display these items to the user so they can approve the item in one place, as opposed to navigating all over the portal looking for and approving items.

I was having trouble because there are two types of content that we were interested in - Portal Listings and Document Libraries. With SharePoint, the Portal product and the standard WSS (Windows SharePoint Services) are very closely integrated, yet very different when coding against their object models. Portal Listings are only available when looking at the Portal object Area. Document Libraries are only available when looking at the WSS object Web.

To get to the Portal Listings, I tried getting a reference to the Home Area and looping through its Areas collection. The Areas collection contains Area objects that represent sibling areas. This didn't seem to give me access to all the areas and sub-areas that had been created on our Portal.

I also had to use AllWebs to gain access to all the Web objects in our Portal to get to the Document Libraries. This just didn't seem right to me.

I played around with this for days, and finally had my epiphany. I remembered some code that Jon Box had written for our Atomic.NET class. It showed using recursion to iterate a control tree of an ASPX Page.

Recursion!!!! Jeez! It's such an elementary concept. And I never considered it. So, now my code is much simpler, and it iterates everything area of the portal and looks at every list. It's perfect!

Here's a skeleton example of the code:
Private Sub iterateAllAreas(ByVal thisArea As Area, ByVal output As HtmlTextWriter)
'Display the Portal Listings of this Area
OutputListing(thisArea.Listings, thisArea, output)

'Areas can give you a Web object using its Web property
Dim thisWeb As SPWeb = thisArea.Web
Dim lists As SPListCollection = thisWeb.Lists
lists.ListsForCurrentUser = True
lists.IncludeRootFolder = True
For Each list As SPList In lists
If (list.BaseTemplate = SPListTemplateType.DocumentLibrary) Then
Dim docLib As SPDocumentLibrary = CType(list, SPDocumentLibrary)
'Make sure this list allows for Approvals
'And make sure this user has permissions to approve items in this list
If docLib.EnableModeration And docLib.Permissions.DoesUserHavePermissions(SPRights.ManageLists) Then
OutputDocLibItems(docLib, Replace(thisArea.Path, ":", "/"), output)
End If
End If
'Recursively call this procedure for all areas and sub-areas
For Each subArea As Area In thisArea.Areas
iterateAllAreas(subArea, output)
End Sub

You will notice that when iterating Document Libraries, I am setting the IncludeRootFolder property to true. This is because in the OutputDocLibItems procedure, I am similarly recursively calling that procedure in order to iterate all of the subfolders of the document library. Otherwise, it would ignore all items in any subfolders that the users may have created in the doc lib.

Wednesday, August 11, 2004

Royals Report

Great Royals update by Dan Fox.

I agree with Dan on Dee Brown. Earlier, I was all for letting Brown play to show us what he can do. Now, it's obvious that Brown and the Royals need to part ways.

Rob & Rany point out that the manager should be held accountable for this mess. In KC, it's in very poor taste to slam the beloved Tony Pena. After all, this is the manager who brought the Royals back to respectability last year, and whose smiling face is on every billboard, ticket, and program associated with the Royals.

I'm not sure what happened at the beginning of last year, but the Royals got off to a great start and rode that wave through the end of the season. But, since that hot start, the Royals are playing below .500. Did Pena just have a lucky 3 weeks?

Pena will keep his job throughout the end of this season, but any GM with sense would surely evaluate the manager closely this off season. Given Allard Baird's continued loyalty to the awful Tony Muser, I'm sure Pena will be the manager in 2005, but I'm not sure he deserves to be.

Tuesday, August 10, 2004

Brutal Baseball

It's been no secret that the Royals have been AWFUL this season. Though I never thought it could get worse, it did. The last two nights in a row, the Royals held a lead going into the top of the ninth inning. They then gave both games away on poor defense, poor pitching, errors. It's been absolutely sad.

The team "captain," Mike Sweeney last night finally showed some of his true feelings about the team. Quoted in this morning's KC Star: "“We've definitely hit rock bottom,” Sweeney said. “This is a joke. It's Aug. 9, and we've got 39 wins. It's terrible. We're playing horrible baseball.

“We're not pitching, hitting or playing defense. Nothing. We're not running the bases right. We're playing brutal baseball in all aspects of the game.”"

"“I know we've got some young guys here who are inexperienced,” Sweeney said, “but 39 wins in the middle of August is unacceptable. All aspects of our game are horrible right now.

“It has nothing to do with the manager or the coaches. It has everything to do with us. We're not getting the job done; get us out of here.”"

Strong comments. Given the number of players on the current roster who have made their MLB debut this season, errors and some sloppy play is to be expected. But it hasn't gotten worse since they started playing the kids. Even with a roster full of veterans, the team played terrible baseball.

What started as such a promising season has turned into a nightmare. And I don't see it getting much better for a few years, given the lack of talent in the Royals' farm system.

Iterating SharePoint Portal

The client I'm working with would like to have a place where users can see a list of all items that have been submitted and are awaiting approval. These items could be documents in Document Libraries, or perhaps Area Listings. My thought was to create a web part that a user could place on their "My Site" that could iterate all areas of the Portal, and then iterate all lists within each area looking for items that are pending.

It turns out this is much more difficult than it should be. First, look at Listings, you have to reference each area as a Microsoft.SharePoint.Portal.SiteData.Area object. The Area object will give you access to the Listings on the area and you can see items that are Pending. I used code that referenced the Home area, then iterated its Areas collection, like so:

'Get the area GUID for the Home Area
Dim objCurrentAreaGuid As Guid = Microsoft.SharePoint.Portal.SiteData.AreaManager.GetSystemAreaGuid(PortalContext.Current, SystemArea.Home)
'Get an area object for Home
Dim objArea As Area = AreaManager.GetArea(PortalContext.Current, objCurrentAreaGuid)

'Iterate all listings on Home and count Pending Items
Dim areaLists As AreaListingCollection = objArea.Listings
For Each areaList As AreaListing In areaLists
'if the item is pending, output it
If areaList.Status = ListingStatus.Pending Then
'Output the List Item info
End If
'Check all other System Portal Areas (Topics, Sites, etc)
For Each objSiblingArea As Area In objArea.Areas
For Each areaList As AreaListing In objSiblingArea.Listings
If areaList.Status = ListingStatus.Pending Then
'Output the List Item info
End If

The problem is that this only works on the "system" areas (News, Site Directory, Topics) and not on user created areas. User created areas are represented as webs, so a separate loop needs to be done to iterate those, like so:

Dim allSites As SPWebCollection = ParentWeb.GetSubwebsForCurrentUser()
For Each subWeb As SPWeb In allSites
Dim lists As SPListCollection = subWeb.Lists
lists.ListsForCurrentUser = True
For Each list As SPList In lists
If (list.BaseTemplate = SPListTemplateType.DocumentLibrary) Then
Dim docLib As SPDocumentLibrary = CType(list, SPDocumentLibrary)
If doclib.EnableModeration And doclib.Permissions.DoesUserHavePermissions(SPRights.ManageLists) Then
For Each doclibitem As SPListItem In docLibItems
If doclibitem.ModerationInformation.Status = SPModerationStatusType.Pending Then
Dim thisFile As SPFile = doclibitem.File
'output info about this item
End If
End If
End If

Now the problem is that the SPWeb object doesn't give access the listings. I can look at the Document Libraries and other types of lists, but not Portal Listings.

The areas to have Portal Listings in them, but they are not (as far as I can find) accessible as a Portal Area object. So how can I look at the listings? I don't know!

One other thing that I found was that using this code:
Dim allSites As SPWebCollection = ParentWeb.AllWebs()

Will not work if the user is not an Administrator. I searched forever and found this:
Dim allSites As SPWebCollection = ParentWeb.GetSubwebsForCurrentUser()

Which works great. I'm "this" close to getting a great web part built, but have hit a road block here....