Jay McGavren's Journal

2008-04-28

Java: log.debug(“Found chain ‘” + chain + “’ for property ‘” + propertyCode + “’”); Ruby: @log.debug “Found chain ‘#{chain}’ for property ‘#{property_code}’”

Those few extra characters may not seem like much, but they actually reduce the amount and detail of log statements I put in the code. They’re painful to type, and worse, painful to read.

Logging is fast taking a place next to unit testing in my essential toolbox. Anything that important needs to be as painless as possible.

Read more...
2008-04-27

After some frenzied coding last night and this afternoon...

…EnvironmentServer and EnvironmentClient are much more fleshed out:

spec_doc.html

The failed examples are supposed to throw exceptions; not sure why the test is failing because of it. Some Googling on RSpec should take care of that.

Read more...
2008-04-26

Here's a game I'd play...

Wiimote and nunchuk attachment required. (I haven’t used either extensively, so I may be assuming they’re more capable than they are…)

Each control represents one of your arms, which you can position/wave wherever you like. Press a trigger to close a fist on that arm, release it to open the fist. Contact an object with a closed fist to punch it. Close a fist while in contact with an object to grab it and wave it around. Open a fist while holding an object to release it/throw it.

“Object”, by the way, can be a chair, gun, enemy, or whatever else. “Wave it around” can mean use it as a shield, toss it into an enemy, or throw it off a rooftop. This can lead to lovely mechanics like picking up an enemy, smacking him a few times with the chair in your other hand, using him as a human shield against a few bullets, and finally tossing him headlong into the guy that’s firing at you.

Ah, gets my adrenaline pumping just thinking about it. Substitute robots for people if you don’t want an M rating.

Read more...
2008-04-24

ur doin it wrong

humorous pictures
see more crazy cat pics

Read more...
2008-04-23

So it goes like this...

Environment1 EnvironmentServer observes Environment1 Environment2 EnvironmentClient observes Environment2 Add Object1 to Environment1 Environment1 notifies EnvironmentServer of new Object1 EnvironmentServer sends Object1 to EnvironmentClient EnvironmentClient adds Object1 to Environment2 Environment2 notifies EnvironmentClient of new Object1 EnvironmentClient sends Object1 to EnvironmentServer

Screeeeee… Hold the phone. I just created a loop of object additions there.

The problem is that Environments are set up to notify their observers whenever an object is added, even if it came from that observer.

What I need is an entirely different model. Something that monitors the difference between two Environments, and then does the needed steps to synchronize them. Like a diff or an rsync or something.

I need to draw some diagrams or browse some source code or something, ‘cause an elegant solution eludes me.

Read more...