Having written about AASM in the past, first on Chaining state transitions with Acts As State Machine (aasm), and then again in Conditional state transitions with AASM, I thought I had AASM down rather pat.
However, when I tried adding a callback to the aasm_event, I ran into trouble. Quite simply, the callback never worked. Here's the first code:
Notice that the callback registration is in the aasm_event code block. It seemed reasonable that this would be part of the transition. When I determined that this was not working, I had a colleague review the code and we ended up both scratching our heads.
So, I cracked open the library and poked around. I saw the successful aasm_state call displaying the callback registration in the options portion of the method, but the options of the aasm_event were blank. Hmm!
Here are the method definitions for your edification:
aasm_state(name, options={})
aasm_event(name, options = {}, &block)
Well, it was pretty clear how to fix the problem; move the callback registration after the name argument and before the block. Here's the corrected code:
That's it! Have fun.
Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts
Friday, November 13, 2009
Saturday, February 14, 2009
Fixing a Mortise and Tenon Joint
The mortise and tenon joint is a strong and reliable way to keep two pieces of wood together. The Stokke Tripp Trapp chair uses them to keep the angled side pieces connected to the foot pieces. All of our kids have used Tripp Trapps, or similar, chairs from the time they could sit up right long enough to eat (and were interested in solid food). From toddler through third grade or so, the chairs brought every one to the table without high chair trays and other barriers.

I remembered something my dad, a dentist, did when he was fitting a new bridge or cap onto a patient. He had these nifty pieces of red and blue paper and he would have the patient bite down of the paper. Where red or blue was left was where the new tooth was too high and needed to be ground down. I needed something similar; some way of marking the mortise so that I could see where material needed to be removed.



However, as the kids got older, that mortise and tenon joint would loosen on each chair. Inevitably, I would have to disassemble the chair, glue up that joint and clamp it together.
Well, now we don't need most of those chairs and so we're passing them along. One of the chairs has a pretty loose joint so I bring it down to my shop. I pull the foot plate off and take a look. Well, now, I had already glued up this puppy quite a few years ago and remembered it well.
It was the first time that I had seen a tenon that broke off such that part of the tenon remained inside the mortise. I don't find it a problem to fix a split piece of wood. All those funny cracks and angles are extra surface area with which to make good contact between the two pieces. Frankly, I was rather surprised that it had failed again. All that extra wear from folks much older than 8 years old using the chair took its toll and the chair needed to be re-glued. I rasped off (most) of the old glue, filled it up and jammed the pieces back together.
After the glue set, I put the chair together and noticed that it wobbled pretty badly. That glue job stank. The foot board, which has the tenon, wasn't even close to fitting to the vertical with the mortise. The whole thing needed to be pulled apart and redone. Back down to the shop.
It took some time and care to chip away the glue and carefully loosen the joint.
Now I took a close look at that joint. I fit the pieces together and measured a 3/16" gap. Oh boy, that's a big gap.
I scraped off more old glue, rasped off a bit of wood that had swollen and tried again. Nope. I repeated the process for quite a while. I got the gap down to 1/16", but no matter what I tried, I wasn't getting a flush joint. This time, though, I was determined to get a flush joint.
Somehow I needed to figure out why the tenon wasn't going flush into the mortise. There were doubtlessly high spots on both mortise and tenon that were keeping things apart.
I remembered something my dad, a dentist, did when he was fitting a new bridge or cap onto a patient. He had these nifty pieces of red and blue paper and he would have the patient bite down of the paper. Where red or blue was left was where the new tooth was too high and needed to be ground down. I needed something similar; some way of marking the mortise so that I could see where material needed to be removed.
I took out my shop pencil and generously colored the tenon. Then, I pushed it back into the mortise and tapped it into place. The picture below shows the tenon covered with graphite where I first thought the problem may have been. I later covered the entire tenon with graphite.
Sure enough, when I pulled the pieces apart, inside the mortise and rubbed away from the tenon were the areas that were making contact. In the picture to the left, you can see the dark marks where the graphite was rubbed off the tenon onto the mortise. I got out my dremel and rifling files and got to work.
It took a few repeats to find all the offending surfaces and then so smooth everything down to nice finishes. I would take out the tenon, cover it with graphite from the pencil, tap it into place, pull it out and look for the marks. Then, using dremel, rasps and sand paper, work down the offending area. I worked the both the mortise and the tenon in alternating turns so that I wouldn't introduce too much of a gap. I would rather repeat the process a few times than have a joint with too much space. No matter how much glue I would then use, the joint would never be satisfactory.
After I repeated the process a half dozen times or so, I was satisfied with the way the two pieces fit together. It looks like the way it belonged and should have been in the first place. The final joint is on the right. Nice and tight. I cleaned off all the graphite and used Gorilla Glue to fasten everything permenantly and bound the foot board to the riser with to band clamps, one along the bottom of the foot and the other making a right angle with the riser.
Now that will be a nice joint that will take full advantage of the structural strength of the tight mortise and tenon joint and will let the next users of the chair raise their kids on it.
Tuesday, October 17, 2006
Samsung ML-1430 Won't Feed Paper
My printer had stopped feeding paper reliably a while ago. This had reduced me to manually pushing each sheet of paper into the machine until the roller caught it. Which, in turn, often resulted in many expletives directed towards said printer.
All in all I like the Samsung ML-1430, which has been discontinued. It was pretty inexpensive, the toner cartridges aren't too bad considering I really have gotten thousands of pages (at Staples, which has a wicked good customer loyalty program, IMHO).
However, after only two years, there is this feed problem. I found the answer in an Amazon posting (thank you brs for posting this). Here is the solution from there:
BTW, brs on Amazon also provided a repair part number: JC72-00109A. However, searching on Samsung for this part yielded nothing. I suspect this is due to the machine being discontinued.
Have fun!
All in all I like the Samsung ML-1430, which has been discontinued. It was pretty inexpensive, the toner cartridges aren't too bad considering I really have gotten thousands of pages (at Staples, which has a wicked good customer loyalty program, IMHO).
However, after only two years, there is this feed problem. I found the answer in an Amazon posting (thank you brs for posting this). Here is the solution from there:
- You need to rotate the rubber band on the feeder roll to a fresh surface. Start by turning off the printer, disconnecting it from power & data feed.
- Remove the two screws from the back panel and press the small tabs to pull the back panel off.
- Open the front of the machine and remove the two screws that hold the top panel in place. Take note of how the sheet feeder sits in this assembly. The sheet feeder is not screwed in, but rather held in by the other pieces.
- Remove the toner cartridge and set aside.
- There are four screws that go through the metal plate now visible at the top. Leave the wires connected and remove these screws. Take note that there is a grounding cable that needs to be reconnected.
- You need to remove that top assembly, so take note of how the roller fits into the black tie rod that actually turns the roller. I found that lifting the unit up and sliding it to the right (as viewed from the back) disconnected the roller from the tie rod.
- Remove one screw from the roller pickup assembly and disassemble the roller.
- Note that one side of the rubber band is shinier than the other. This is the problem. Carefully work the rubber band off, rotate it 180 degrees and slide it back on to the roller.
- Reassemble and test
BTW, brs on Amazon also provided a repair part number: JC72-00109A. However, searching on Samsung for this part yielded nothing. I suspect this is due to the machine being discontinued.
Have fun!
Subscribe to:
Posts (Atom)