Twitter Weekly Updates for 2009-08-30
Posted in Twitter
First watch, 8 bells (12:03 am)
Leave a Comment »
New C++ MySQL Wrapper
Posted in Code
First dog watch, 1 bell (4:53 pm)

I've been writing a replacement C++ wrapper class using the MySQL API. The previous method worked, but was prone to memory overwrites. The syntax is much better now, too. Just include the two header files and:

boost::shared_ptr<MySQL_Server> server = boost::shared_ptr<MySQL_Server>(new MySQL_Server("localhost", "user", "password", "database"));

boost::shared_ptr<Query> = boost::shared_ptr<Query>(new Query(server));

query->setQuery("UPDATE table SET var=val");

if(query->execute()) {
  std::cout << query->getNumberOfAffectedRows();
} else {
  std::cout << query->getError();
}

SELECT query results can be stepped through with the following:

for(unsigned int i=0; i < query->getNumberOfResultRows(); ++i) {
  std::vector<std::string> row = query->getNextRow();
  ...
}

I think I'm going to like this new class a lot more than the old one!

Leave a Comment »
Grammar Implementation
Posted in MUD Development
First watch, 6 bells (11:06 pm)

I just finished writing the get() functionality I mentioned a few days ago. Using Boost::Spirit it was really easy to parse the grammar. It was much more work to actually act on the results of the parsing.

There are nine different ways to use the get command, each with its own grammar rule. Each of the rules gets more programmatically complicated, so the command code itself got pretty long.

I do suspect that the get and put functions will be some of the most complicated to write. I'd say I'm halfway done, but I haven't done enough testing on the get code to really call it "done."

Leave a Comment »
Twitter Weekly Updates for 2009-08-23
Posted in Twitter
First watch, 8 bells (12:03 am)
Leave a Comment »
RiffTrax Plan 9 Broadcast
Posted in Reviews
Morning watch, 5 bells (6:44 am)

Last night Lorien and I, her father, Suzanne (a friend), and Ellie and Taylor all drove to Spokane for the RiffTrax (MST3K) live event. Even though, for the west coast, it wasn't really live—it was delayed-broadcast.

Anyway, it was probably the funniest riffed movie I've seen. The jokes came at a mile a minute, and I laughed more in that short time than I have in the past week.

Jonathan Coulton made a guest appearance and played a couple of his songs: The Future Soon, and RE: Your Brains.

There was also a short film at the beginning: Flying Stewardesses. It was hilarious, and (hopefully) will be available on their website for purchase soon!

2 Comments »
Ponyo
Posted in Reviews
Morning watch, 4 bells (6:18 am)

Last Wednesday night Lorien and I went to see Ponyo at the theatre. It was, like all Miyazaki movies, a great story. I'm just not a big fan of the 80's style animation they always use. The backgrounds are amazingly detailed, stories are inevitably great, but their animation, for me, leaves a lot to be desired. I don't know why they can't step that up like everything else.

Anyway, I saw Ponyo very much as a retelling of Andersen's The Little Mermaid. Last year, when I was in Copenhagen, I took a picture of the famous statue. I also took one of (what I call) The Big Mermaid: check it out here.

It was still a good movie, and if you're a Miyazaki fan I'm sure you've probably already seen it. If not, go, I'm sure you'll like it.

One last thing, though: Was anyone else creeped out by a love story about 5-year olds?

Leave a Comment »
Office Issues
Morning watch, 3 bells (5:31 am)

My server alarm went off this morning at 4:40, but it didn't wake me up—I was already awake from the thunder of an hour previous, and still hadn't gotten back to sleep.

Anyway, I had to come in to make sure things are working fine. And they are. It seems to have been just a hiccup on the ethernet card, the server was only unreachable for a few minutes, but I had to check. Unfortunately, I didn't get the UP signal from my server monitor, just the DOWN signal. I was sure it was a power issue, but I was wrong.

So I'm at work early with about three hours of sleep last night. I can tell it's going to be a spiffy day.

Leave a Comment »
Alas, Poor ChiShan!
Posted in General
Forenoon watch, 4 bells (10:17 am)

When I lived in Taiwan from 1992-1994, I spent my last three months in the mountains above Kaohsiung in the small town of ChiShan, and its neighbor, Meinong.

The typhoon that recently hit Taiwan devastated that poor little town, here's a video I found about it. It talks about the young foreign college students currently serving as missionaries in Taiwan (as I once did), and how they're tirelessly working to help the locals clean up.

My best wishes go out to those people, I hope they recover quickly.

Leave a Comment »
Happy Blogiversary To Me!
Posted in General
Forenoon watch, 6 bells (11:00 am)

I started this blog six years ago today, and it's hard to believe I've been able to keep up with it, but I'm still here, still blogging. I believe tacos are in order. TO THE TACO VAULT!

Leave a Comment »
Programmatical Grammar
Posted in MUD Development
First watch, 6 bells (11:15 pm)

I've been working on implementing boost::spirit in my MUD to parse complicated grammar. Once I figured out how the library worked, it wasn't difficult to add to my existing codebase. The complicated part comes from actually using the results of the grammar. Take the get command, for instance. Now that I have an easy-to-use grammar system, I can make it as complicated as I want. I currently support the following types of get commands:

I had to define a search order, too. If a player is carrying a container, and a similarly-named container also exists in the player's current room, the player can only manipulate the one in their inventory, and would have to first pick up container, then take items from it. I could work out a way to combine the inventories of the player and their location, but I'm not sure I want to go that far. Honestly, the way I've coded things it's not too difficult, but I'm more worried about perception of items and the confusion combining them all could potentially cause.

In any case, the get command is growing in complexity by orders of magnitude right now, and it's almost too much to keep in my head. I'm going to have to go through and refactor it before I've even finished writing it.

Here's a code example of one of my rules:

// 'get 20 items from container 2' grammar
rule5a = boost::spirit::int_p[boost::spirit::assign_a(mNumberToGet)] >> ' ' >>
	(+boost::spirit::alpha_p)[boost::spirit::assign_a(mItemToFind)] >> ' ' >>
	boost::spirit::str_p("from") >> ' ' >>
	(+boost::spirit::alpha_p)[boost::spirit::assign_a(mContainerToLookIn)] >> ' ' >>
	boost::spirit::int_p[boost::spirit::assign_a(mContainerNumber)];

Which reminds me, since this class (the get command) is a shared pointer, I have to lock up the volatile bits in a mutex so multiple threads play nice together.

Leave a Comment »
Cisco Firewall Issues
Posted in Tech
Afternoon watch, 3 bells (1:35 pm)

I've been working with my boss for quite a while on a router issue. We've spent hours on the phone with Cisco technicians trying to get this issue solved, and today it finally happened. The solution was deceptively simple, but I guess you need to get the right technician.

Our issue was this: a firewall was configured on a Cisco 881W router with NAT translation to pass Microsoft VPN traffic in to a VPN server on the inside of the firewall (port 1723). The problem is it never worked. The solution required GRE (which we knew), but finding a tech with the right qualifications to tell us exactly what to do was a right pain. We found if the firewall was shut off, then the VPN connection worked, so we knew there was an issue somewhere on the firewall itself.

Well, to make a long story short, here are the missing bits:

access-list 120 permit gre any any

class-map type inspect match-all GRE
   match access-group 120

policy-map type inspect NATOut-to-In
   class type inspect GRE
      pass

The number of the access list isn't important, as long as it isn't already used. The traffic has to be passed through via the policy map because it cannot be inspected. The NATOut-to-In is the rule for the firewall that handles outside to inside traffic. I don't know what yours may be named, but it should be something like that.

Leave a Comment »
Say Cheese!
Posted in General
Afternoon watch, 2 bells (1:28 pm)

Today I cracked open my 100th Anniversary Wheel of Tillamook Vintage White Extra Sharp cheese. I had some of it on my sandwich and it was awesome!

It's a little crumbly, but hey, it's 3 years old! The taste is magnificent. If you like sharp cheese, anyway. Can't wait to make a cheese sammich with it…

You can get your own here.

Leave a Comment »
Twitter Weekly Updates for 2009-08-16
Posted in Twitter
First watch, 8 bells (12:03 am)
Leave a Comment »
Office Prank Time
Posted in General
First watch, 4 bells (10:01 pm)

We pulled an awesome "prank" at the office today. I'll have some pictures soon, didn't take any today though. For now, let's just call it Extreme Makeover Cubicle Edition.

Leave a Comment »
Back At Home
Posted in General
Morning watch, 7 bells (7:53 am)

We got home from Portland Thursday night, the drive back up was uneventful. It was a good vacation, and it was nice to spend time with so much family. I also got a lot of work done on my MUD, which, if you follow me via Twitter, you know about. For the record, numerous features were added, including full YAML support via the yaml-cpp library. I also have a functioning weather system that shifts across the map according to wind speed (6 speeds) and direction (16 different directions). I got several months' worth of work done in a week and a half, it was great!

On a side note, I also now own an oscilloscope.

Leave a Comment »