The Hobbit Hole

In a hole there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a hobbit-hole, and that means comfort.

6/24/2004

50 First Dates

Filed under: General — bilbo @ 1:15 pm

My wife and I watched this funny, funny movie last night. Drew Barrymore and Adam Sandler make a much more believable screen couple than most.

It’s a bit cruder than the Wedding Singer, but not nearly as crude as Adam Sandler’s other fare. Definitely earned its PG-13, but the laughs were definitely there.

What’s up with the remakes of all the 80′s songs in the movie? Why not use the originals? It grates sometimes to hear your favorite song come out all different.

Speed Chess Study Proves Practice Makes Perfect

Filed under: Games,General,Programming — bilbo @ 1:05 pm

Speed Chess Study Proves Practice Makes Perfect

Very cool article about practice improvements. I suppose this should give me the inspiration to continue on my golf. More likely than not, it makes me keep programming even at home, since I need all the practice I can get.

Dust Settles

Filed under: Programming — bilbo @ 1:00 pm

I have been working on this persistence library for a while now, and I think I’ve finally got it.

To use the object persistence, one needs to inherit from the persistent object and create a serialize method that persists the object (using the dual i/o ^ operator).

In the event that a difference between loading and saving exists, an class needs to create its own read and write operators.

It also needs to make the allow_persistence class a friend.

class sample : public calvin::persistence<std ::string> {
    friend class calvin::allow_persistence;

public:
    sample( std::string& );
    template <typename stream>
    stream& serialize( stream& s, unsigned int version );

    // this isn't strictly necessary, but good practice
    static const unsigned int version = 2;
};

Yes, the namespace for the library is calvin, after Calvin Coolidge, the former (now dead) president.

If you wish to create a versioned class, define an unsigned integer class variable called version. This will override the default one in persistence that is written out when an instance is saved. In the event you do this, you’ll mostly likely want to use the read and write operators rather than a single serialize method to allow for handling of loading instances of different versions.

const unsigned int sample::version = 2;

Not strictly necessary, but always a good idea is the definition of field names for the use of those streams that might require them, such as an XML stream.

fields<sample> = make_fields( "m_member1", "m_member2" ... );

It seems to be en vogue now for C++ to eschew inheritance as a requirement, perhaps rightly so as inheritance can bring ugly overhead (such as virtual tables) to otherwise small classes. On the other hand, inheritance can provide clues as to the intentions of the developer. This is the case of this persistence mix-in class. It adds no overhead to an instance and makes it plain that the class can be persisted.

That should be it for making a class persistent. There are other goodies not explained here yet. That will come soon. I believe I can have the first version of this library complete by the end of the month and posted with an explanatory article by the end of July.

6/20/2004

Father’s Day

Filed under: General — bilbo @ 5:11 pm

I am going to take a small moment and indulge myself on this blog that noone reads. It’s Father’s Day, and I’m a father. I just wanted my kids to know how much I love them. They are a great bunch who make me proud to be a father.

I’m proud of them for several reasons:

  1. they have learned that through practice and hard work they can accomplish what they want or have to
  2. they are so courteous, always asking please and thanking people for things they get
  3. they are just about the most obedient kids you could ask for. I have been surely spoiled as they do what they are asked to do.
  4. they believe in Jesus Christ and seem to have that childlike faith that can make the world a better place

I hope to be a better father to them than my father was to me. My father left when I was about my son’s age, but that doesn’t mean I didn’t have father figures in my life. Both of my grandfathers and most of uncles, especially Pat, were great father figures. In many ways my sense of humor comes from him.

If I had to leave one thing with my kids, it would be the love that I have for them and how much I know that they can do anything they want to.

Back to your normally scheduled programming commentary.