For A Few Years…

An interesting development in the Buffalo Bills case:  apparently, the lease agreement with Erie County states that the Bills may not be moved until at least 2023.  But at the same time, Toronto might not necessarily be considered a relocation, at least according to the NFL.  But according to the contract agreement?  That’s a trickier case.

Upcoming Events

First, a plug.  The folks at Red Gate have re-published my Tribal SQL chapter as a standalone article.  If you like it, go out and get a copy of the book, as there are a number of excellent authors there.

  • On May 16-18, I will be attending CarolinaCon.  It’s hard to beat $20 for a weekend of security talks.
  • On May 21st, I am going to present to the TriNUG Data SIG on In-Memory OLTP in SQL Server 2014 (AKA, Hekaton).
  • On June 14th, I am going to attend SQL Saturday #299 in Columbus.  I’m not sure yet if I’ll have the opportunity to present there, however.

Over the next few weeks, I plan to start putting up some more technical posts as I look into Hekaton and a couple of other topics.  The big one that I have is an analogy:  F# is to development DBAs what Powershell is to production DBAs.  I want to introduce F# as a set-based functional language which plays very nicely with a SQL Server infrastructure and provides a shallower learning curve than C#.

Also, now that the weather is warming up, it’s time to start hitting the trails and visiting parks.  This means I should be able to start taking more photographs again.

Clone Wars: Upgraded to required viewing for all Star Wars fans

So, Lucasfilm and Disney have ruled on the Expanded Star Wars Universe and… it’s all out. The six films and Clone Wars (which I guess George Lucas had some role in?) are canon, everything else is not.

I’m surprisingly okay with this. I like Mara Jade and Kyle Katarn as much as the next gamer who played the Jedi Knight series, and I’ve even enjoyed some of the books (although I really ought to read more of them). However, I do think this is the right move, as a single unified continuity is key to making Star Wars VII-IX work.

Keeping The Bills In Buffalo

Andre Reed has joined a group dedicated to keeping the Buffalo Bills around.  Jim Kelly is part of an ownership group committed to keeping the Bills in town as well.

I like the idea of a community group trying to keep Buffalo in place.  Even more than that, I would have liked to see the Bills join the Green Bay Packers and become a community-owned team; unfortunately, NFL guidelines prohibit that at present.  If they changed their ruling, I think the town could gather up enough support to keep the Bills in town beyond 2019.

Theory of gaming: Twilight Struggle

When I originally set this up, I had this vision of taking you (virtually) through my games closet, introducing you to the various and sundry games within. It would culminate with Twilight Struggle. Then, I realized a virtual tour of a games closet is very difficult when you don’t have the actual games closet. I don’t even have a closet right now.

So, we’re skipping right to the end and calling it good. If I get some energy/time in a few months, I’ll throw in a couple of extras, but that’s it.

Here is what you need to know about Twilight Struggle: it is the best board game ever devised. Sorry, Chess. Fuck you, Checkers. Monopoly… just go home, Monopoly.

Twilight Struggle is a two player board game about the Cold War. If that sentence doesn’t have you out of your chair and into your car, traveling to the nearest quality gaming establishment to purchase a copy, then I am genuinely mystified. This game is so awesome, so perfect, that the agony of not playing it should overwhelm you. Even purchasing a copy over the internet would be the most profound torture imaginable. (That is how I acquired my copy, and the anticipation nearly caused a kidney to explode. FROM AWESOME.)

Enough hyperbole, for the moment. The concept is simple: one person plays the Soviet Union. The other plays the United States of America. There are four ways to win: drive the other guy entirely out of Europe (the Patton Way); get 20 victory points, triggering an instant victory (the Reagan Way); wait until the end of the game and hope you have more points than the other guy (the Brezhnev Way); or, trick the other person into causing a nuclear war, obliterating the planet, but dying one of fraction of a second later than the other guy (the Stalin Way). Making the Brezhnev Way extra appropriate: if the Soviet Union just makes it to the end of the game, it’s pretty much a moral victory.

Twilight Struggle is primarily card driven, like all great board games. There are dice, and they matter (somewhat), but rarely will a bad die roll or great die roll make a huge difference. It’s about gradations of meaning. It’s about weighing short term risk vs. long term reward. If you sponsor a coup in Israel this turn (a very, very difficult task indeed), that could freeze you out of South East Asia in the mid game. If you focus exclusively on Europe, you could see Asia disappear. If the American player neglects Mexico (which is very easy to do), the Soviets can make trouble in the late game.

It is not a war game. Wars are fought entirely in the abstract, via die rolls. That’s one die roll a piece (although sometimes you can reroll if you’re the attacker). You don’t even see armies on the map; it’s even more abstract at simulating combat than Diplomacy. You do not decide what size your army is. It’s all about politics, diplomacy, and covert actions.

The game is purposefully unbalanced; it leans heavy Soviet in the early game, slightly Soviet in the mid game, then heavy US in the end game. It does via the cards, the number of which are dedicated for each side, and the effects of the cards. However, this does not mean that the Soviets win every time; far from it. It does mean that the longer the game runs, the more difficult it becomes for the Soviets. In fact, the late game so rarely happens, that the creators of the game actually included a “late game scenario” that starts you in 1970, roughly.

Most remarkably of all, setup is relatively quick. The pace is fast (fast enough that you will, every once in a great while, lose track of whose turn it is. This is especially common when the person designated to pay attention to turns does not do so.) If you actually played a game from 1947 to 1991 (which has never happened for me), it might take you three hours. The first game will probably take you about that long; the rules are relatively clear — what is less clear is the optimal strategy and the potential card combinations. Again, this is a very good thing: if you’re thinking about how to win instead of how to play, the game designer did their job.

I will not insult you by recommending this game. I will instead, berate you mercilessly until you either buy the game or somebody takes my place. The Khrushchev Way.

 

Accessing The INSERTED And DELETED Pseudo-Tables In A Trigger’s CATCH Block

At work recently, we had a scenario come up in which we wanted to figure out which specific values are causing a trigger to roll back execution of a stored procedure.  I decided to put together a test case to see if I could still access the DELETED pseudo-table from within a trigger’s CATCH block.  It turns out that you can.

CREATE TABLE [Test]
(
	Id INT,
	Val CHAR(5)
);

INSERT into [dbo].[Test]
(
	Id,
	Val
)
VALUES (1, 'aaaaa'), (2, 'bbbbb'), (3, 'ccccc'), (4, 'ddddd');

CREATE TRIGGER tr_test on [Test]
after update
AS
BEGIN
	BEGIN TRY
		IF EXISTS(SELECT * FROM DELETED WHERE Id = 5)
		BEGIN
			THROW 50000, 'Ayup', 1;
		END
	END try
	BEGIN catch
		SELECT
			*
		FROM DELETED;
	END catch
END
GO

--This first run should NOT result in any errors.
UPDATE dbo.Test
SET
	Id = Id + 4;

--This second run SHOULD result in an error, showing us 4 records.
UPDATE dbo.Test
SET
	Id = Id + 4;

TRUNCATE TABLE Test;
DROP TABLE Test;

The trick here is that if you manually issue a ROLLBACK statement inside your CATCH block, you need to do it after collecting the information you need from the DELETED and INSERTED psuedo-tables, as those get cleared out upon rollback. If you insert those records into a variable (either a table variable or a regular variable using something like FOR XML PATH to concatenate the results), you can continue to use them in the CATCH block after you roll back your statement. That way, you can log the error without having that log roll back.

Harang And Santana

Alex Remington discusses Aaron Harang and Ervin Santana’s resurgences with Atlanta.  For Harang, it’s all about getting rid of a changeup and curveball, focusing on his three best pitches.  For Santana, it’s about using the changeup more.  Both of them have been lucky so far, and clearly neither will carry a sub-1 ERA through the rest of the season.

Based solely on these descriptions and what I’ve seen so far this year, I’d say that Santana has a better chance of holding on.  Santana has a more recent history of success and better fundamentals, and adding the changeup makes him more dangerous.  For Harang, you can definitely ride smoke and mirrors for a while, but an extreme flyball pitcher in an Atlanta summer will give up home; combine that with his high walk rate and you have a good chance of regression.

Fortunately, the Braves should be able to ride Harang as long as they can, and once he starts tailing off, Mike Minor and Gavin Floyd will be able to slide into the rotation, meaning that Harang becomes a luxury rather than a necessity.