Happy Birthday Jared
Posted in Warm and Fuzzy
Afternoon watch, 8 bells (4:09 pm)

April 28th was my brother Jared’s birthday. I didn’t call or anything. I’m terrible. I hope his birthday was nice.

Leave a Comment »
Baffling Behavior
Afternoon watch, 5 bells (2:43 pm)

Out the window this morning, we could see the big bulldozer and the steamroller moving and compacting dirt. Now that the dozer has dug a huge pit, it has now proceeded to fill it in. Nobody here has any idea what exactly they are doing out there…

Leave a Comment »
What is it with Turning?
Morning watch, 8 bells (8:25 am)

This post is for that jackhole that I should have hit in my car on the way here. WTF is it with people in turning lanes at stoplights that they think they have the right to turn as long as someone in front of them is turning, no matter what color the light is? This moron had the gall to wave at the trucks in front of him as if to say “they’re turning too slow” when he was the one that went under a red light!

Quit being so damn stupid, people. If your light turns red you have to wait like the rest of us do. This especially applies to yokels in pickups, they seem to have this belief more than other people.

Leave a Comment »
Configurable Prompt
Posted in MUD Development
First dog watch, 3 bells (5:56 pm)

While waiting after hours for some things to finish up, I wrote a new feature into my MUD3 codebase: configurable prompts. The original version was non-changeable. The late version had only static content. The new, shiny version is dynamic and parsed each time it is written out. But don’t take my word for it—have a look yourself:

MUD3 Configurable prompt, small version

1 Comment »
Chinese Mantou
Posted in Recipes
Afternoon watch, 3 bells (1:42 pm)

One thing I really miss from my three years in Taiwan and China is mantou (pronounced mon-toe)—a steamed bread roll. When I lived in Kunming, Yunnan (back in 1997), I worked for a company that owned a hotel, and I got in good enough with the cooks that they let me help make mantou. Here is my authentic, straight-from-China recipe for all the world to enjoy:

Mantou
500 grams flour
1/2 gram baking soda
1/2 gram yeast
80 grams sugar (about 1/2 cup or more, to taste)
1 1/2 to 2 tablespoons margarine
warm water

Mix flour and baking soda together. and make a crater in the center. Put yeast and sugar in the crater, then add water. When thoroughly mixed, start pulling in flour from the sides. If the mixture gets too dry, add more water. Knead the dough until it doesn’t stick to the counter anymore. Cover with a damp cloth and let rise about 10 minutes (if it’s warm enough), or until when poked with a finger it springs back up.

Use a rolling pin to roll the dough flat, add flour if it gets sticky. Roll the mixture until it shines and is slick like marble. (In China they had a pastry rolling machine that you just fed the dough into and it pushed it out between two rollers for you, it saved a lot of work!).

Roll the dough up tightly just like you’re making cinnamon rolls, rolling the entire log to seal the seam. Make the mantou as big as you want, small ones are great for dipping in sweetened condensed milk (a Yunnan favorite), large ones are great to put a fried egg on. With the seam facing down, use a sharp knife to cut quickly straight down to cut each mantou from the dough log. If they are too narrow for their height, they’ll fall over, so don’t be afraid to make them wide. They should have a nice, round appearance. See the Wikipedia entry for mantou for a couple of pictures.

Lay the mantou out on a greased (so they don’t stick) steaming basket (I have metal ones I brought home from China, they’re great). Let them rise uncovered for about 20 minutes or longer depending on your kitchen’s temperature. Make sure the mantou are spread out, they can really rise when they are cooked! If they don’t have enough time to rise, they’ll split and erupt and look untasty. Steam mantou for 7-8 minutes or longer. It’s tough to overcook with steam, but it is possible.

Leave a Comment »
SSH Security
Posted in Tech
Forenoon watch, 6 bells (11:25 am)

There isn’t much you can do against SSH attacks short of having a good password with a very limited set of users that are allowed to connect via SSH. I have a monitor running on my desktop called GKrellM that I have configured to show me the number of SSH connections active, and any time it is non-zero and I’m not doing anything, I tail my messages log and catch the offending IP address and ban it on my firewall. The problem is I may not always be at my desk, and what about those evening attacks I don’t see?

There’s an easy command I run to find these offenders:

bailecearc:/var/log # cat messages | grep "Invalid user .* from" | awk '{print $10;}' | sort -u

My SSH daemon always logs the Invalid user [user] from string in my messages file, the 10th space-delimited entry in that log is the IP address, and the unique sort gets me just one result for each IP address that attempted connection. I’ve done this before on a different Linux distribution and it was basically the same idea, just a different logfile and awk argument.

PS: To take this all one step further, just create a new file called badssh.sh and put this in it:

#!/bin/bash

for ip in `cat /var/log/messages | grep "Invalid user .* from" | awk '{print $10;}' | sort -u` ; do
/sbin/iptables -A INPUT -s $ip -j DROP
/sbin/iptables -A OUTPUT -s $ip -j DROP
done

Then chmod a+x badssh.sh and add it to your crontab once a day or something.

Leave a Comment »
It Didn’t Happen
Posted in General
Morning watch, 7 bells (7:30 am)

If you were curious, I didn’t get the bruise that I got last time. This one’s just a quarter-sized bruise on the inside of my left elbow.

Leave a Comment »
Object Nicknames
Posted in MUD Development
First watch, 1 bell (8:42 pm)

I added nicknames to objects last night, and it only took about 5 minutes to do. I know I’m on the right track, programming-wise, when it’s easy to add new features. I think things are organized pretty well, and so far it all runs real good. I think my next objective is deciding how to deal with multiple objects with the same name and how to address them. Perhaps something like look at second stone. I’ve seen other instances where they use 2.stone or stone 2, which I suppose are shorter and quicker to type. I’m still thinking about it though. Perhaps tomorrow I’ll have a new idea…

Leave a Comment »
One Hobby I Don’t Have
First watch, 1 bell (8:37 pm)

If you know me, you know I have a lot of hobbies. One hobby I’m glad I don’t have is making giant Darth Vader balloons to fly around in.

Oh, wait. Maybe I just don’t have the disposable income some people have…

Leave a Comment »
Somebody Had a Busy Day
Posted in Code
First watch, 1 bell (8:31 pm)

Yup, you guessed it, it was me!

Lots going on today, including two trips to Spokane (one only to Liberty Lake, technically), one short trip down S Highway 95 (two of the three trips were for colocated server maintenance).

JM says I shouldn’t be using an enum in my base class to determine what the derived class is (yes, I know it’s redundant), but at the same time, how do I know what class I can downcast to if I don’t know the type? Do you just have a big list and try casting to each one? What about multiple inheritance?

For instance, say I have class Animal and class Quadruped. Say I make a class Cow : public Animal, public Quadruped. Now if I test for a non-NULL pointer for each of those types, they all work, I just have to know that Cow is somehow greater than Animal and Quadruped. But what if I just have a Quadruped, not a Cow? Perhaps I’m missing the boat on the reason for not double-storing the type information, but I have to ask: isn’t it better than a whole bunch of attempts to cast it to something it may or may not be? What if I have 50 or 100 classes to check? Do I really want a giant if clause that attempts to cast to each type? Doesn’t it make more sense, in this case, to use an enum and switch directly to the downcast you know should work? The only real hangup here is if the type information got borked up, then I’d really be toast. But if I’m careful, isn’t this a good way? Anybody?

Leave a Comment »
Downcasting in Boost
Posted in Code
First dog watch, 3 bells (5:32 pm)

I learned something about downcasting in Boost today: You don’t downcast the boost::shared_ptr type, but use the base type instead. For example:

class A {}
class B : public A {}

typedef boost::shared_ptr<A> Aptr;
typedef boost::shared_ptr<B> Bptr;

std::vector<Aptr> alist;

Aptr a = Aptr(new A());
alist.push_back(a);
a = Aptr(new B()); // yes, it's an Aptr to a class B object
alist.push_back(a);

Bptr b = boost::dynamic_pointer_cast<B>(alist[1]);

Where I kept going wrong was in the dynamic_pointer_cast, I was trying to Bptr instead of B, the base class. Once I found that out, everything was shiny.

If you like, grab my boost-cast.cpp file for a more in-depth example.

Leave a Comment »
Bad Veins
Afternoon watch, 2 bells (1:12 pm)

I went to donate blood today, but my veins were bad and wouldn’t let me. I got about half-way through before they gave up. But not before moving the needle around enough to do some damage. My whole inner elbow area is sore now. Perhaps I’ll get another cool bruise

Leave a Comment »
Milestone!
Posted in MUD Development
First watch, 2 bells (9:00 pm)

I just got rooms working! It’s only taken five years to get rooms! Okay, I only have one room, but it’s a start!

Here’s what it looks like (sans color):

jacob@mobilechicken:~> telnet localhost 2600
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hi this is the greeting
What is your name?jacob
Password:asdf
Welcome to the machine
Starting Room
SILd:>look
  This room is rectangular, with a low ceiling. There are no exits, because
the exit code hasn't been written yet. There is a small statue on an old
table in the middle of the room.
Occupants: Jacob is here
Contents: There are items here, but I can't tell you what they are.
Starting Room
SILd:>look statue
The statue is of Grock the Troll, and is most shiny.
Starting Room
SILd:>look table
It has four legs and a top. Some people eat on them.
Starting Room
SILd:>

As you can probably tell, the Contents aren’t working right, but I’ll figure it out. I’ve got a problem with dynamic_casting boost::shared_ptrs.

Leave a Comment »
A Book A Week
Posted in Books
First dog watch, 4 bells (6:18 pm)

Since I started tracking my reading habits online one year ago today, I have read more than a book a week over the past year. Woohoo. Go team Jake.

Leave a Comment »
Flat Tire
Posted in General
First dog watch, 4 bells (6:08 pm)

The other day as I was leaving work I realized (after I drove on it a bit) that my rear passenger-side tire was completely flat. I swapped it out for the spare (chintzy thing that it is) and drove on it all day Friday. Well, not really. I only drove to work, then home because I forgot I had a flat the entire day. So today Lorien and I went out and bought two new tires at Les Schwab. I was going to get some from my brother Jared, but he never called me back yesterday (that would have reminded me I was needing tires, too). The saga is now over, though, and I have two shiny new rear tires to show for my trouble.

Leave a Comment »