Monday, April 28, 2014

Cat tree

Our two cats love sitting by the windows and looking outside.  This is a problem however, since they're only about 18" tall when sitting up and our windows aren't that low.  Generally we've been keeping a stool in front of the big front window and another by a back window and keep the shades open some for them.
A while back the missus and I looked at buying a cat tree for them but decided that $60 or $100 seemed crazy.  This was before I'd built my awesome workbench, but I said "Hey, I could build one of those once I build that workbench!"

For about $60 (cheaper if I could have gotten a cheaper carpet remnant) and a borrowed staple gun, I made this awesome cat tree.  The bottom level has a tennis ball in a box for the cats to hunt (they haven't quite figured it out yet).  There's a middle level just big enough for one cat if they want to be alone but still looking out the window.  The top, or sun deck as I call it, it big enough for them both to lay out and look outside all day.  One post has sisal rope that goes high enough for them to stretch up to and another has a second type of carpet for a different texture.  Of course, there's also a dangley feather toy hanging for them to play with.

They seem to like it.

Tuesday, April 22, 2014

Passover Short-takes


I wrote this a week ago (Tuesday, April 15, the first day of Passover) but didn't get around to publishing it because apparently Passover's become a busy holiday of party hopping for eight nights.

Vegetarian Passover Offering

It sounds like a joke, but I discovered yesterday that instead of putting a bone on the Seder plate (representing the sacrificial lamb), some vegetarians use a beet because it is as red as blood.  Other’s use a sweet potato instead as a substitute sacrificial yam.

Exodus from Work

My drive home from work yesterday reminded me of the Israelites exodus from Egypt.  I was trying to get home as quickly as possible, but traffic kept opening up then slowing down again.  It was like Pharaoh saying “You can leave, no you can’t, yes you can, no you can’t.”  Finally traffic parted in front of my like before Moses at the Red Sea and I hightailed it through there as fast as my 4-cylinder Altima could take me as if Pharaoh and his army were coming up behind me.  I made it through and traffic crashed (figuratively) closed behind me, sealing my enemy traffic behind me and leaving me to wander across I-80 to my home, my Sinai, to pick up my wife.


If we had only one seder yesterday but not a second one: diyanu.
If we had two seders yesterday but the second one ended before midnight: diyanu.
If the second seder had ended before midnight but we didn’t have to work today: diyanu.
If we had to work today but weren’t hosting another seder tonight: diyanu.
If we were hosting a seder tonight but didn’t have to work tomorrow: diyanu.
If we had to work tomorrow but didn’t have plans every night the rest of the week: diyanu.
If we had plans the rest of the week but my birthday wasn’t in the middle of it all: diyanu.
If my birthday was in the middle of it all but I got to have cake: diyanu.
If I got to have cake: diyanu diyanu diyanu.

Wednesday, April 2, 2014

Adding sysouts to external classes in Eclipse

Yesterday, I was debugging through some unpleasant code (man, I was like 40 minutes deep into debugging some recursive reflection) and was getting really irritated with tweaking my conditional breakpoint so I could see the value of something right before it blew up.  The problem, as suggested by the title of this post, was that the code wasn't mine - it was a 3rd party jar (the struts2-json-plugin jar, not to name names).
I wanted to add a sysout, but I didn't have access to change the code.  Finally I googled, and in December 2011, Jonas Helming answered my problem.

Put a sysout in a conditional breakpoint.  And then return false, so the breakpoint never breaks.

Also of course, instead of return false, you can do whatever normal conditional breakpointing you'd like.

Even cooler, through this I discovered the code was blowing up when trying to access a non-public field.  So while later today I will come up with a test case to demonstrate the problem and find a real solution, etc. etc, in the meantime, I added field.setAccessible(true);.  Boom, reflection issue resolved.  Printout, resolved.  As long as I run my code in debug for the time being, it works with no action on my part.

This kind of reminds me of AOP, in the sense that code's getting executed and you don't see where from.  But it fits - debug statements are an aspect of programming that shouldn't be in your code.  At least because this is in your IDE, it guarantees the magic doesn't end up in production code.

Maybe this isn't new to you.  I mean, I learned it from another blog that says it got it from other blogs, but I wanted to share my new trick.  Hopefully it's helpful to you.


The Project

Last month I had a much-needed few days off, so I decided to finally build myself a workbench.  This has been a project I've been wanting to work on for around a year now, and I'm thrilled with how it turned out.  Let's just say it's as good as I hoped, but way better than I expected. :)

My design came from a combination of my dad sending me some pictures and measurements of his workbench along with lots of Googling pictures and design plans, along with a health dose of "it's just a frame with some boards, right?".  I'm not planning on making any fine furniture or anything like that; it's more of just a solid project table that can take a beating, not worry about getting messed up, or maybe make some more neat things (like an improved boat table).

I didn't get a picture* of the pile of wood, but I was the guy loading $100 of lumber into the back of my Nissan Altima.  Always a good feeling.

Without a workbench to create this on, the first cut was a little difficult.  As I progressed and had more and more of a bench to work on, it got increasingly easier.  Until of course it was almost complete, I had started loading tools on it, and had to flip it over to add a forgotten brace to the bottom.

The Process

Basically, it's a 2x4 frame with 4x4's for the legs.  Making sure to stagger the screws into the legs so they didn't hit each other was the hardest part so far.  It was pretty cool when all of a sudden I had the frame of the bench standing.

I screwed on some more 2x4's about 18" off the floor (I can't remember how high off-hand, but I know a debating with myself on exact hight; I think it involved the height of a can of paint) as supports for a shelf.  Cut some 2x6's to length, measure and cut out notches to fit around the legs, and screw the boards to the lower frame to make a shelf for tools.  Bam!  Why'd I do the shelf first?  Practice before getting to the main work surface.

The top was basically the same process as the shelf, but even easier without having to cut notches.  I used a 2x8 for the very front to give myself a bit of an extra overhang for clamping things to, and there's overhangs on both ends too.  Right about the time I finished screwing it all down, I remembered that I forgot to leave space between the boards for expansion.  I'm really hoping that doesn't come back to bite me.

This was about when my wife got home, and since I like to cook and had the week off, I'd promised dinner.  I'm quite the Renaissance Man.  Build workbench; take a shower, grill salmon.

The next day, I flipped the bench over and added some extra supports I'd forgotten about.  Two additional ones width-wise for the top and one for the shelf.  Getting these just right after the fact was a little tricky, but I managed.  Flip it back right-side up and drive in a dozen more screws to attach the surfaces solidly to the new supports.

I rechecked it was still level.  It was now flat enough for my purposes.  And I dropped some scrap lumber on it and it seemed to take the beating just fine.

The Finishing Details

I'd bought a decent vice at an estate sale a year ago in anticipation of building this.  Feeling that the section of bench this gets bolted to needed a little extra oomph, I attached some scrap board under the corner of the bench and bolted the vice through that.  It's going nowhere.

I sanded down all the edges and gave the surface a quick pass to make it a little smoother.  I thought about using a finish/stain/paint/etc, but decided to keep it natural.  I read somewhere the best finish for a workbench is (to paraphrase): a lifetime of nicks for errants saws and drills; splotches of paint, glue, and stain; and undecipherable diagrams and measurements.

I ran a piece of adhesive measuring tape lengthwide and widthwise so there's always an available ruler.

There's a surge protector mounted on the side for the power tools, and I hung a plug-in shop light from the ceiling.

* Sadly, a few days after building this my phone's memory card went belly up, so the couple pictures I took during the process are kaput. :(