Boost::Spirit 2
Last dog watch, 1 bell (6:34 pm)

Last year I added Boost::Spirit to my MUD project. A few weeks ago I learned that all of the work I had done was deprecated in the new Spirit 2 library. I could still use "Spirit classic," but it is deprecated and may be removed at some point in the future. So I spent some time today figuring out how to convert my grammar rules.

For example, in Spirit classic, I had this rule to handle the most complex rule for my get command. In this case, it handles a command like get 20 items 2 from container 3:

rule6 = int_p[assign_a(mNumberToGet)] >> ' ' >>
			(+alpha_p)[assign_a(mItemToFind)] >> ' ' >>
			int_p[assign_a(mItemNumber)] >> ' ' >>
			str_p("from") >> ' ' >>
			(+alpha_p)[assign_a(mContainerToLookIn)] >> ' ' >>
			int_p[assign_a(mContainerNumber)];

which could be tested by the following code: if(parse(str.c_str(), rule6).full)

Here is the equivalent code in Spirit 2

	std::string::iterator first = str.begin();

	bool r = qi::parse(first, str.end(),
					(
						qi::int_ >> ' '
						>> +(~qi::char_(' ')) >> ' '
						>> qi::int_ 	>> ' '
						>> qi::lit("from") >> ' '
						>> +(~qi::char_(' ')) >> ' '
						>> qi::int_
					),
					mNumberToGet,
					mItemToFind,
					mItemNumber,
					mContainerToLookIn,
					mContainerNumber
	);

	if(r && first == command.end()) {
		return true;
	}

In many ways, the new Spirit 2 library is better, and purports to be much faster as well. The parse function has certainly been made somewhat more convenient. Overall, I'd rather not have had to spend time on this, but the only other option is to lock in with an old version of Boost that may hamper me in the future.

5 Comments »
Twitter Weekly Updates for 2010-05-30
Posted in Twitter
Morning watch, 8 bells (8:03 am)
Leave a Comment »
Sleep Deprived
First dog watch, 1 bell (4:58 pm)

For the last three nights I've had trouble sleeping. Every night I lie awake for hours in a semi-conscious state something like I imagine meditation to be. Last night at 3am I finally got up and took some Tylenol PM hoping that I would sleep some. I woke up at 7. I can only hope that tonight I'll be so tired that I'll fall asleep quickly and sleep all night, though somehow I doubt it'll be that good.

6 Comments »
Twitter Weekly Updates for 2010-05-23
Posted in Twitter
Middle watch, 2 bells (1:03 am)
Leave a Comment »
Texas Roadhouse
Forenoon watch, 4 bells (10:24 am)

Last night we went to the Texas Roadhouse for dinner. Normally I'd link their website, but due to the gratuitous use of Flash I'll leave that to you if you want. TR just opened up a few weeks ago in Coeur d'Alene.

Even with reservations, it took us over an hour to get a table. Be ye warned. But there are barrels of peanuts from which you may graze. They also encourage you to throw the shells on the floor so the busboys have more work. So even where you sit, there may be a layer of peanut shells crunching underfoot. If you have a nut allergy, this is not the place for you.

The bread is great: fresh, hot, and sweet. And it comes with cinnamon butter. Between that and the peanuts, you could probably order a side salad and leave full. I took half of my dinner home in a box. The pulled pork wasn't pulled so much as largely chunked. And the "fall-off-the-bone" ribs did come apart easily, but I've had better. The service was okay, but nothing stellar. They stop every now and then to dance, too. Some kind of weird, kick-the-peanut-shell and clap-your-hands shuffle.

To top it off, they blast country music into your ears the whole time you're there. Overall, it's not a place I'll be going back to, but if you're a beer swilling, truck driving, country music-loving redneck you'll probably love it. I'm none of those and left with a headache.

2 Comments »
Robin Hood
Posted in Reviews
Forenoon watch, 4 bells (10:06 am)

On Monday my wife, brother, and I went out to see the new Robin Hood movie. I was interested in it because Alan Doyle, the lead singer from Great Big Sea is in it. Turns out he's a friend of Russell Crowe, who got him into the part.

The movie was all right. I went in with certain expectations (it is Robin Hood, after all) that were never met. The Sheriff of Nottingham had a very small part. Think of it more like a Robin Hood prequel and you won't be disappointed.

Keep your eyes out for Alan. He's the archer that sings all the time :)

Leave a Comment »
Not Writing Much
Forenoon watch, 3 bells (9:57 am)

I've not been writing much lately, the mild winter has combined with the warm spring to produce unholy amounts of pollen. Even a walk from my car into my office makes me suffer.

Every time I run my dishwasher I've seen water leaking out from beneath it, so I took it out yesterday after work to examine it. Except for the connection to the hot water (under the sink) everything looks fine. I ran it through a cycle while empty to see if I could find where the leak comes from and it didn't leak at all! Now I'm really confused. The time previous it leaked a gallon (I'm not exaggerating) on to the floor. I suspect there is an issue with the hot water hookup, but didn't see near so much water leak out this time. I'm going to run it again tonight if I have time. My in-laws' computer is acting up again.

Leave a Comment »
The Day of the Triffids
Posted in General
Forenoon watch, 2 bells (9:00 am)

I started watching The Day of the Triffids last night (the 1981 BBC TV version). I get the feeling this is another one of those "the book is way better" stories, but it definitely has its good points. It's creepy in an apocalyptic sort of way. It's only a miniseries, so I'll be done soon. I'll let you know how it goes.

1 Comment »
Twitter Weekly Updates for 2010-05-16
Posted in Twitter
Middle watch, 2 bells (1:03 am)
Leave a Comment »
Twitter Weekly Updates for 2010-05-09
Posted in Twitter
Middle watch, 2 bells (1:03 am)
Leave a Comment »
What a Great Day
Posted in Travel
First watch, 2 bells (9:08 pm)

We had a blast today, and I don't know when I'll be back to having a regular Internet connection so I'll fill you in on tomorrow's plans.

In the morning, we're going to go on a whale-watching cruise out of Depoe Bay. Then we're going to meander up the coast and check out some tidepools, then hit the Tillamook Cheese Factory. Oh yeah. Because we're all about the cheddar. Then we'll be on our way back to Portland.

I took some fantastic pictures of the animals this morning at the Safari Park. I don't have a good way to sort and edit them until I get home though, so you'll just have to wait.

I think we walked at least four miles on beaches today, too. My feet are killing me. Fortunately, we brought our Wellies and didn't get any sand in our shoes. They also let us go in to the water a ways, which is why we like them.

Leave a Comment »
Greetings from the Ocean
Posted in Travel
Morning watch, 7 bells (7:49 am)

Waking up and hearing the ocean is a wonderful thing. I'm sitting in our suite in a Best Western in Bandon Oregon (Inn at Face Rock). We left Eugene (okay, technically Creswell but I don't expect you to know where that is) yesterday at about 5pm. We drove the back roads to Florence and decided to turn south instead of north this time.I'm glad we did. Our first idea was to stop in Coos Bay, but it wasn't much of a destination, so we kept going. We ended up stopping here in Bandon. It's not much of a town, at least what I saw of it last night, but it's nice. I've been having spotty cell service all along the coast (no surprise there), but the Best Western has free Wifi (w00t!).

When we checked in we found out that the receptionist was from Idaho and when we mentioned today is our anniversary she upgraded us from the normal room to the honeymoon suite! And sweet it is. Not only does it have a fantastic view of the ocean, it also has a fireplace and a jacuzzi tub big enough for at least three people. The bathroom (the one with the shower, there are two bathrooms in this suite!) is tiled with Italian stone, it's gorgeous stuff.

We had dinner at Bandon Bill's Seafood Grill, and (as usual) I had the fish and chips. They were above my par for fish and chips, though not the best I've ever had—that honor still resides with England, and more specifically a chip shop in Bath. We sat and at and watched the sun set over the beach. Then we walked down to the beach, but it was windy and cold. The tide was coming in so we took that as a cue.

The bed is firm, as I like it, but has a pillow top that feels extra soft. I don't think I so much as rolled over all night. Now I'm kicking back and listening to the ocean, plus a few cars that pass by. It is lightly raining now, but I won't let that spoil my wonderful morning. After breakfast, we'll leave the "westernmost Best Western in the continental US" and head over to the West Coast Game Safari Park for a Walking Safari. We had no idea there was such a thing on the Oregon coast! It's also a "Petting Park" and they have the cutest leopard cubs on their front page, go see it!

Afterwards, the plan is to head back north until we want to stop again. This is the life. Once we hit Tillamook we'll turn towards Portland but I don't know if that'll be today.

Leave a Comment »
Vacation Time!
Posted in Travel
Morning watch, 6 bells (7:21 am)

This week Lorien and I are going on a mini-vacation. We're leaving home and driving to Portland, which is perhaps our most common "vacation" spot. But we won't stop there! We'll visit my grandparents near Eugene, and drive up the coast to try to have the most relaxing time possible. Sushi will be consumed, and places will be visited. Our plans include the Tillamook Cheese Factory and Bob's Red Mill. I think we might even get roped in to babysitting. Woot! Oops, I think I got a little too excited for that last bit.

Leave a Comment »
Twitter Weekly Updates for 2010-05-02
Posted in Twitter
Middle watch, 2 bells (1:03 am)
Leave a Comment »