The Animal Farm

October 31st, 2008

Question 2

I don’t live in Maryland, but I am close enough (probably only a few miles away) that I get Maryland political stuff on the TV.  While watching The Office last night, I heard this little number that I found to be pretty funny.

Each year, Marylanders spend $400,000,000 on gambling in West Virginia and Pennsylvania.  These dollars go to bettering schools in WV and lowering taxes in PA. Question 2 on the ballot this year allows for the construction of casinos in Maryland to bring our money back. Question 2 will allow for $660,000,000 to be put into schools.

Okay.. 0+$400,000,000 < $660,000,000.  Where did that other money come from?  I understand that maybe if Maryland had gambling in the state that more residents would gamble, gamblers would spend more, and neighboring states might just come to Maryland to gamble, but a quarter of a billion dollars is no insignificant amount of money here.  So this commercial is saying that Maryland plans on putting 165% of the money it is losing into schools.  Yeah.

Also, they just made gambling legal in PA like, 5 years ago, and at least in the Pittsburgh area, nothing is really built yet.


EDIT: Fixed the post to say a quarter of a billion.  Thanks Ricky.
It squeaks when you bang it. That’s what she said.

October 30th, 2008

Nothing < Anonymous Methods < Lambdas

Here’s a bit of sexy syntactic sugar for you.

A long time ago, an eternity as far as C# programmers are concerned, to sort complex structures, you were forced to write a custom comparer. Basically, a class (or method within a class) whose only job was to compare two instances of the structure such that a sorting algorithm could position them appropriately.

Then anonymous methods came along. I’ll preface this by saying that I absolutely disgustingly hate anonymous classes as I found them in Java, and if C# has them I’ll never go ten feet near them. But anonymous methods gave you cute little expressions like this:

[ftf h="100"]
list.Sort(delegate(Structure s1, Structure s2)
{ return; });

Much cleaner than creating a new method just for one simple operation. If you’re going to often be passing your structure to a lot of functions like Sort, creating the comparer might be cleaner than scattering that delegate everywhere, but for a one-off solution, there’s nothing beating it.

I can beat it. Right now.

[ftf h="100"]

What you’re seeing there is a lambda expression, part of C# 3.0. I won’t claim to be an expert in them, but I know I prefer that statement much more than I do creating the anonymous method. I believe they exist in C++’s boost library and have been around in functional languages for a considerably long time.

I’d talk more, but it’s way too loud in this coffee shop, so I need to get out of here.

All hail the Overseer.

October 30th, 2008


Chrono Trigger on the DS (soon).
Secret of Mana on  the Wii (out now).
Star Ocean: The Second Story on the PSP (January 09).
Those are all reasons to make me really happy.  Now I just need to find the time to play the above games, the need to play WoW has lasted much longer than it normally does.  Oh well, at least 2 out of the 3 of those games are on handhelds, nothing like public transportation!

So Kingom Hearts RE: Chain of Memories is a remake of the GBA game?  Seems awesome, shame I have no PS2 since mines just a paperweight right now.  I’ve been meaning to pick up a PSTwo, but I can’t justify rebuying a console I will rarely play due to the fact that I don’t play console games that often.  I used the TV for gaming a LOT more in college.

Brian, do you still have the nasty habit of buying games and never opening them/playing them?
I tried to go to Morgantown last weekend to hang out with Ricky and Matheny, but it turns out it is a bad idea to make plans that involve hanging out with someone and staying at their house without telling that person about the plans when they are made.  Ricky already had a Halloween party to go to Saturday night, the only night I was going to be staying there, so my plans fell through.  I am trying to find a weekend to go (making it a full weekend this time, none of this one-night crap), but my weekends are generally pretty packed.  It appears the eariest one I have free right now is Nov 21st.  Mind you, I am free the previous weekend as well, but WoW:WotLK comes out that weekend, and I’ve made plans with my computer chair, and those plans involve not leaving it all day/night.


“My name is DJ Phalliz and I’m here to say Kill your friends, kill them with a knife”

October 29th, 2008

Why I’ll Be Bankrupt

Reasons why this month and the next will completely deplete my finances:

This month:
Fable 2
Dead Space
Penny Arcade Episode 2
Fallout 3 (excellent)

Gears of War 2
Left 4 Dead
Naruto: The Broken Promise
Sonic Unleashed
The Last Remnant
Chrono Trigger
Kingdom Hearts RE: Chain of Memories (technically Dec 2nd, but I’m counting it)
Tales of Symphonia: Dawn of the new World (maybe)

Note to Zach and Ricky: Fable 2, Gears of War 2, and left 4 Dead all have online co-op.

October 29th, 2008

Merge-friendly XML

Good (text) data formats merge well while in source control. By this, I don’t mean they get along with their peers and share valuable life insights. I mean that when two people have changed a file and one person needs to reconcile his changes with the other person’s, the resolving (or merging) is relatively painless - if possible, automatic.

I spent an entire day researching ways to effectively make XML data merge-friendly. I learned a good bit about 3-way resolves, various XML data formats, a few peoples’ love lives, various source control systems, and one or two of Perforce’s dirty little tricks. I didn’t - and an observant person is already finishing this sentence in his head - find anything on merge-friendly data. Nothing. I find it hard to believe that in the history of XML, nobody has ever approached this problem.

So I came up with a couple ideas of my own, asked around the office, got a little bit. Vince dropped by and offered some really good suggestions. He asked if I had researched this, and when I said I found nothing, he said that normally in that kind of situation he would make a blog post since there really ought to be something online about the topic.

Well, I have a blog too, and I’m beating him to it. Here we go:

(1)When you open a file and resave it, it should come out exactly the same.
This one should probably be the most obvious, but I’ve had the unpleasantness of working with files that do not comply. Files should not juggle themselves when you’re not looking. If every single line changes when you make a single edit, your file might as well be binary.

(2)Preserve list order.
This goes hand-in-hand with the above, and you’d probably have to actually work to violate this. If you write out a list, read it in in the same order. And then write it out in the same order. If it’s not in alphabetical order, don’t read it in in alphabetical order, or else be sure to preserve the original ordering somewhere so you can write it out exactly the same. The moment you start juggling things, the moment you introduce unnecessary variation which introduces unnecessary merge headaches.

(3)Beware hash tables.
I don’t want to lecture you on how a hash table works, just know this: there’s the good potential that through the course of running your program, items in your hash table might be in completely different positions when serialized via a naive iterate-and-write approach. This complicates things, because, as in #1, items that were never even touched will end up swapped around and juggled, increasing the probability of conflicts. If you can, a better approach may be to sort your data based on the key of your table and write the sorted variety out instead. This ensures that items won’t be rearranging themselves every time you save.

(4)Beware C#’s XMLSerializer.
This doesn’t have to do with data formats explicitly, but it comes into play with the above point and some of the following. You don’t really have a lot of control with C#’s auto-serialization feature, meaning that it’s very hard to change your XML format around for maximum mergeability.

(5)One attribute per line.
Lines like the following look great (I’ll be using [ instead of < to avoid HTML-ifying conflicts):
[img src="your image.awesome" width="5" height="14million"]

And when two people edit that line - even if they edit different attributes - instant conflict! The whole problem can be avoided:
src="your image.awesome"

Now when two people edit different attributes, it’s perfectly safe. This has the added benefit of (potentially) improving your readability; I’m sure you’ve seen a ridiculously long tag stuffed with 15 attributes on a single line and had to scroll along trying to parse out what is where.

(6)Put the close of a beginning tag on the next line.
This one’s borderline, because it really breaks human readability by uglifying everything, but it does have a legitimate use:

Instead of:


Now if new attributes get added by multiple people, no real conflict. Whereas before, that ending ] might’ve been a problem. The reason I’m on the fence is because it’s open to abuse, and it’s hard to make a machine know when to abuse and when not to abuse. Observe:

] [/li] …


(7)Don’t put multiple tags on the same line.
Instead of: [tb][td][td] (or whatever, my HTML is rusty and this is just an example)

That way, if people start nesting things or manipulating the tables in some way, they aren’t all thrashing the same line.

That’s all (for now).
I’m sure there are more, and after a couple more brainstorming sessions maybe we’ll return here, but I think at least 6 out of 7 of those are universally good ideas that can be implemented with zero detriment (and possibly very little legwork). And when your colleagues or your users or you go to do a merge, it will be a smoother process.

I don’t want to set the world on fire.

October 26th, 2008


I had a post a couple days ago about me getting Tortocolis and experiencing the most painful, excruciating neck pain of my life before being drugged up on Valium and Vicodin, Valium having nearly no effect and Vicodin knocking me out. It was a solid three-to-four paragraphs and was damn near literary genius, but WordPress decided my literary stylings were too much for its meager blog engineering and deleted my post. I’m not going to rewrite it or even try to recreate its tone, I’m not even going to delve further into the topic, I just wanted you all to know that I was in a lot of pain and your Get Well Soon cards are past due.

I picked up Dead Space and Fable 2, both highly reviewed and highly interesting, and both mostly sitting around while I do other things. But I have played them enough to talk a little on each, so here goes:

Dead Space is a horror-shooter set in the future. I heard the PC version was panned for its controls, which is pretty accurate; it feels sluggish. Pointing and aiming is not natural, and turning gives me vertigo. If my neck were still in pain, playing would be impossible. Putting that aside, though, it’s a pretty solid game. Definitely scary - definitely scary - and the action is pretty good, and there are puzzles in there that I guess you can call puzzles but are really exercises third graders would feel too smart for. There’s still more playing to be done before I can champion it or revile it, but be sure that once I’m far enough in I will have a radical opinion that doesn’t even teeter near the ‘moderate’ scale.

Fable II might as well be an MMO with a (slightly) deeper story. Right up to the exclamation marks appearing above quest-givers’ heads and the simple combat and the simplistic job systems, it’s a western RPG at heart. It’s still engaging to a point, and the combat is still a bit fun, so I’m going to keep pressing forward with it; hopefully something will show up in there that really compels me. Co-op multiplayer really compels me, so I need to find someone to try that out.


October 25th, 2008


1) Questionable Content is a webcomic that has pulled me in, I’ve read all of the back-comics in about a week, and am not current. I really enjoyed the comic when I had 100+ more to go, but now that I get one little page a day, I get anxious.

2) Every time Peter Petrelli is going to do something awesome with his abilites and appears to be finally being a badass, he gets stopped.  It seems Peter can only be a badass if the world doesn’t get saved.  Think about it, both future, scarred Peters are badasses, why can’t present Peter catch a break?

3) The last episode of Heroes was actually really good.  Let’s hope Arthur does cool stuff and isn’t one dimensional.

4) WotLK in less than 3 weeks! Woot!


Actually, it’s more like a physicist giving long-division lessons to a ten-year-old.

October 20th, 2008

Ludwig, RIP

Now my drumsticks broke. There is a portion of me that thinks perhaps divine gods don’t want me spreading my beats to the general populace. It’s the same portion that thinks people are following me at night and that most blog posts are secretly directed toward me, and thus I’m inclined to believe there’s some truth to the thought.

While thinking of ways to develop my procedural texture generator, I think I’ve thought of a fairly good way to create a robust node diagram component. Basically, you mark up your data (similar to the way data must be marked up for a Property Grid), and tag the data’s list of connections with special markups to support automatic data-binding. If most of the markups are kept in-line with the Property Grid’s markups, you can bind individual data nodes to a property grid for free, although obviously I’ll need some special tags for connections, children, and the like. The node diagram is augmented by an XML file that acts as a stylesheet. For example, it’s very feasible that you’ll want certain classes represented by a certain shape in the diagram, or you’ll want background images for some of the diagram components but not others. No stylesheet would be required - there can always be a reasonable default - but it would allow a greater level of flexibility without sacrificing any real generality. Using C#’s RTTI and Reflection, a lot of this data and graphical binding can be done according to the class type and what’s contained in it. The bulk of the work here is getting the diagram drawing working properly (and automatically laying out diagrams that are started from a base data binding). It’s a non-insignificant undertaking; more work than I’d anticipated before getting to my texture generation proper, but I think it’s a worthwhile problem.

Also, F You [B]Ski’s. Your sign clearly says that you’re open until 3 AM, which according to my clock is not 10 PM.

The suits took issue with every brave, authority-questioning page of our Meet the Sandvich script–specifically that there were supposed “similarities” between it and the 1987 action film Predator, and more specifically that it was word for word the 1987 action film Predator.
–Valve Writing Staff

October 17th, 2008


The ride on my electronic drum kit broke. This is a pretty big loss for me. I’m going to bury it in the backyard, in a private funeral consisting only of close friends and family. I don’t know if I can purchase a new one, but I’d better be able. I like the ride, in a kind of perverse, borderline inappropriate fashion that special government agencies are built to protect people from. I guess I should’ve seen this coming, though. The kit was only around $450, which is to other drumsets what my ‘93 Ford Tempo is to a modern car.

I recently watched seasons 1 & 2 of Jericho (the entirety of the series). I was pretty pleased. It blends small-town-banding-together-to-face-adversity and top-secret-crazy-conspiracy well, avoiding the mistake of asking so many questions that the answers can’t possibly be executed effectively. Also, it has Megan from Weeds, who I guess must either be really deaf or typecast into a very narrow role, but at any rate is awesome. And it’s by CBS? What’s up with that? I didn’t even know they made decent shows.

How does it feel to make history?

October 8th, 2008

Gone Away

Rock Band 2 has Offspring’s Gone Away, which is sublime.

So I agree and disagree with Zach regarding Heroes. I like how the show’s progressing, which is the key difference. I do agree that Sylar’s appeal is starting to dampen. I liked him more when he was just evil, and explaining his behavior via a ‘hunger’ associated with his power seems like a cop-out. Since day 1, though, Heroes has always had the sub-episode format. They’re going a little crazy with the time travel, but then, I’ve always thought time travel stories should’ve stopped at Back to the Future. It would be nice if characters aside from Noah had motivation beyond visions in a dream/painting. And do some of these futures seem to conflict each other without intervention changing them? Whatever. At any rate, most of the future sub-plots are at least interesting, which is more than I could say about Hiro’s 5-episode romp in the past.

I found a really nice Dock Panel Suite for C# that allows very - almost criminally - easy docking controls. It’s open source, but has a non-restrictive (that is, not the ugly GPL) license. It will help me add a little extra polish to my current GUI-heavy project. Now I wonder if there’s a Rollout component lying around somewhere.

Grabbed the XSI Mod Tool last night. As far as I can tell, it has most of the features of XSI aside from a few listed restrictions. Such as no models over 640000 triangles. Which isn’t really a problem, since I don’t see anything I make having near that much detail. It also has components to directly export to an XNA project and custom loaders for XNA; haven’t had time to try those out, but if they support all of XSI’s features, it will be a fairly easy entry-point for getting animated models in an XNA program. Wonder if it does hardware skinning…

Do you ever hear it clicking?