Charlie finds a fawn

Charlie found another fawn on our walk this morning. This is the neighbor’s fence, just across the street from our place.

Tuesday, he found one out by the compost pile in the back yard. I didn’t have him on the leash that time, although I was walking around the yard with him. When I looked around and saw his tail wagging, I went around the compost bin to see what he was up to. He was sniffing, licking, and prodding at a fawn that was lying there. I pulled Charlie away before he decided that it would be a tasty mid-morning snack.

Charlie’s good at finding these fawns in our yard. Years ago, he found one by the garage door.

It occurs to me that this is the first time I’ve uploaded a picture from my phone. I’ve taken a few shots in the past, but always forgot to upload them.

Zero turn radius lawn mower

My lawn tractor died a couple of weeks ago. Engine ran out of oil and seized up. No, I didn’t forget to add oil. A seal broke while I was mowing, oil leaked out, and … no more engine. The thing lasted almost 17 years, so I’m not¬†terribly upset. I certainly got my money’s worth from that piece of equipment.

I considered buying a new engine for the old mower, but it just doesn’t make sense. For what it would cost to replace ¬†the engine and make a few other repairs that I’ve been putting off, I could buy a new mower with a larger engine and wider deck. The old mower is definitely being retired.

I’ve been looking at those zero-turn mowers for a few years, but there was no way I was going to buy one while I still had a perfectly good mower. But when the old mower died, I started looking again. The cost, though, is a big hurdle. The cost of a ZTR is approximately double that of a traditional lawn tractor with comparable features. For example, a lawn tractor comparable to mine is about $1,100 brand new. A ZTR with the same deck width will go for about $2300. Ouch.

Our neighbors offered to let me borrow the ZTR they bought a few years ago. Yesterday I walked over and got it.

Understand, our lot is about 1.75 acres. Most of that is grass, and there are many obstacles to mow around. With my old Craftsman mower, it would take me a minimum of three hours just to mow. Four hours if I skipped a week and the grass was long. That didn’t include trimming with the weed whacker or the little push mower. Doing a good job on our lawn is a five hour time commitment. At least, that’s what I thought.

It took me about five minutes to get accustomed to operating the ZTR. It took another ten minutes or so to realize that I didn’t want to use the ZTR the same way I used the old lawn tractor. The ZTR is so much more maneuverable that I can get into places I couldn’t with the old tractor. And I don’t have to do those silly 270 degree turns when mowing an irregular patch. With the ZTR, I can just … turn. In addition, it’s easy to adjust the speed of the ZTR: just push harder on the handles. With my old tractor, I had to change gears.

The combination of more maneuverability, adjustable speed, and a much stronger engine completely changed the way I mowed the lawn. Navigating around obstacles is almost a non-issue. I can trim closer to trees without continually shifting gears or making wide turn-arounds. The result is that there’s no need for trimming with the push mower. I’ll still need the weed whacker for a few places, but now near as much as before. Oh, and the increased cutting width (50″ as opposed to 42″) means fewer trips around the yard.

I mowed the entire lawn, which hadn’t been mowed in three weeks, in an hour and a half. The ZTR’s more powerful engine had no trouble with the longer grass. In all, I was able to do a better job in literally half the time it would have taken me with the lawn tractor. I’m sold.

There are a few drawbacks to the ZTR. First, you can’t get as many attachments. Many lawn and garden tractors have available attachments like grass catchers, tillers, and even front-end loaders. With the exception of a grass catcher on a few models, those attachments just aren’t available for the ZTRs. The ZTR is a mower, and it’s exceptionally good at that task. It is not a general-purpose lawn tractor.

Another drawback is pulling a trailer. The ZTR can easily pull my little trailer, but I’ll have to be careful not to turn too sharply. And backing up with a ZTR is rather difficult. It’s easy enough to back in a straight line, but turning while backing will require a lot of practice. Backing with an attached trailer would be a big mistake.

Finally, operating a ZTR requires a bit more concentration than operating a traditional lawn tractor. At least, I thought so. For sure, you can’t take one hand off the controls to scratch your nose like you would if you had a steering wheel. Removing one hand means that you start going in circles.

The ZTR is expensive, no doubt. But with it I can do a better job in less time. And considering how long I expect to keep the machine, the difference in price just isn’t a big issue. Not if my weekly five hour ordeal becomes a two hour job.

Don’t depend on what you don’t control

Let’s say that you have a particular task in your program that is executed as the result of an external signal, but you don’t want the task to execute more often than once per second. This is different from a periodic task that you want to execute once per second. This one, you don’t want to execute unless the external signal is received. Your first cut of the function might look like this:

// The last time a signal was processed
// Initialized to DateTime.MinValue so the first signal received
// will not be lost
DateTime LastSignalTime = DateTime.MinValue;

// Lock object to prevent re-entrancy
object SignalLock = new object();

// Minimum time between invocations
static readonly TimeSpan MinimumTime = TimeSpan.FromSeconds(1.0);

void SignalReceived(SomeObject dataObject)
{
    if (!Monitor.TryEnter(SignalLock))
    {
        // Currently processing. Exit.
        return;
    }
    try
    {
        if ((DateTime.Now - LastSignalTime) < MinimumTime)
        {
            // Already processed within the last second.
            return;
        }
        // ...
        // do processing here
        // ...
        // And then save the last signal time.
        LastSignalTime = DateTime.Now;
    }
    finally
    {
        Monitor.Exit(SignalLock);
    }
}

That looks reasonable. I covered all the bases, protecting the processing with a Monitor to prevent re-entrant use, and checking the time to ensure that I don’t process a signal more often than once per second.

There’s only one problem. The program assumes that DateTime.Now will increase by one second for every wall clock second. This code does not take into account Daylight Saving Time changes, changes caused by updating with an NTP service, or the user resetting the clock. If one of those events occurs, things fall apart.

For example, when we set the clocks ahead in the spring, this code could process twice in a very short period of time. Imagine that you processed a signal at 01:59:59.800. 200 milliseconds later, the time will be 03:00:00.000. Your code would then process another signal, even though less than one second has passed.

It’s worse when the time is set back in the fall. Say you process a signal at 01:59:59.100. 900 milliseconds after that, the time is changed to 01:00:00.000, and it will be another hour before the code does any more processing.

You can avoid those DST errors by using DateTime.UtcNow in place of DateTime.Now, but that won’t solve the problem that occurs with NTP or user-initiated time changes.

The problem here is that your code is depending on the system clock, which the program doesn’t control. The clock can change at any time, and if you depend on it for critical processing you’re going to be sorry.

You can remove that dependency by using a Stopwatch, which measures elapsed time independent of the system clock. In the code below, I initialize a Stopwatch when the program starts. I’ve modified the logic slightly to save a NextSignalTime, which represents the time when another signal can be processed.

// The amount of time elapsed since the program started
static readonly Stopwatch ProgramTimer = Stopwatch.StartNew();

// The next time a signal can be processed.
TimeSpan NextSignalTime = TimeSpan.Zero;

// Lock object to prevent re-entrancy
object SignalLock = new object();

// Minimum time between invocations
static readonly TimeSpan MinimumTime = TimeSpan.FromSeconds(1.0);

void SignalReceived(SomeObject dataObject)
{
    if (!Monitor.TryEnter(SignalLock))
    {
        // Currently processing. Exit.
        return;
    }
    try
    {
        if (ProgramTimer.Elapsed < NextSignalTime)
        {
            // Already processed within the last second.
            return;
        }
        // ...
        // do processing here
        // ...
        // And then save the next signal time.
        NextSignalTime = ProgramTimer.Elapsed + MinimumTime;
    }
    finally
    {
        Monitor.Exit(SignalLock);
    }
}

This code can’t be affected by system time changes because it doesn’t depend on the system time.

You don’t control the system clock. Don’t depend on it for measuring elapsed time. It’s fine to depend on it to tell you what time of day it is. If the user changes his clock, that’s his problem. But you can’t be at the mercy of the system clock if you want accurate elapsed time measurements.

New mesquite spoon

I’d go crazy if all I carved was those little birds. I’m up to 40 different types of wood now, and am still on track to make 100 by the end of the year.

I wanted to make a spoon a few weeks back, and ended up carving this one. Then I got involved in other things. I found this almost done spoon on my desk over the weekend and took the time to sand and finish it.


Click on the pictures to get a larger image.

The spoon is carved from a piece of mesquite that I trimmed from one of my trees last year. I cut out the rough shape on the bandsaw, shaped the handle and bowl with the Foredom power carver. I started to use the Foredom to hollow out the bowl, but the only hollowing bit I had at the time is very small and not very aggressive. So I clamped the spoon in my vise and took a gouge to the bowl.

The spoon is right at 12 inches long. The bowl is 3 inches long and 2.5 inches wide. It’s about 3/4 inch deep at the back.

As you can see, there are several largish cracks. I filled those with two part epoxy and then sanded them. There was also a much larger worm hole on the handle (the discolored part in the first picture) that I filled with epoxy. Next time I’ll think about doing some kind of inlay there. Perhaps some crushed turquoise.

I usually use an oil and wax finish on my spoons because I like simple finishes. But there were enough little cracks in this piece of wood that I thought I’d go with something else. I used Salad Bowl Finish, which is a pretty popular finish for wooden utensils. It’s durable and food safe. But a pain in the neck to apply. You have to apply it, wait 12 hours, sand, and repeat. They recommend at least three coats, which is what I applied. I think I’ll go with two coats the next time I use this stuff. And I might have to sand a little better between coats.

I like that the finish doesn’t darken the wood like the oil finishes I’ve used. But I don’t much like the shiny look. I think next time I’ll try melting some beeswax. I know of some people who use that to great effect.

Still, I like the spoon. I hope Debra gets good use from it.

Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.