Posts Tagged ‘resolutions’

h1

My checklist for debugging insurmountable issues

June 21, 2014

I listen to the Amp Hour podcast. Last week, they were talking about ways engineers fail and about checklists as a way to be more disciplined in avoiding preventable errors.

I try to learn from my mistakes so I do have a checklist of sorts when I reach the “it’s all broken and never, ever going to work again” stage of debugging. Of course, when I get to that point, the symptoms are usually different. Still, some parts of the path are relatively common.

1. Having you tried turning it off and back on again?

It is a joke, a very well seasoned joke. But it is only funny because it is so horribly true. This isn’t a good way to debug a horrible problem but it does provide the circumstances the problem happens under. I often start from scratch to reproduce issues because there is often a clue in the process. So, turning it off and back on again is a way to make sure that I start from a well-understood starting point.

The next questions:

Really? Are you sure?

But these are going to follow most of these checklist questions. As embedded system get more complicated, it is pretty easy to turn a part of the system off but not all of it. I don’t usually go from no-power-to-my-desk, I almost always start with my computer on. But sometimes, turning off all power is necessary (including restarting the debugger).

2. Does it have power?

This is different than the previous in that the “it” refers to all the things that may be broken: the processor, the debugger, the sensor or actuator, the level shifters, everything. This step usually requires a voltmeter (and is related to #5).

3. Is it running the code you think it is?

I sometimes have two or three code bases. If my development environment is pointed to the wrong one, I could easily be compiling over here but loading the image from over there. Or possibly, if the load process is difficult, I may think I’ve loaded the code and somehow missed a step.

I’m working on a big system now, a monitor of another system. When I compile the code, it goes through four machines before it gets to where I can try it out. The possibility that I typed cp instead of scp (or forgot the ending colon!), well, let’s just say it happens more often than I’d like.

This is the reason to have build numbers. But if you are really, really sure it is running the code you think, change something about the output and reload. Make sure you see the change.

4. Did you read the boot and debug output?

I write error logging features and always want a serial debug output. I love power on self tests. However, once the system is working, I stop looking at them. But sometimes, if a cable has loosened or hardware has failed, the system will tell me. But only if I am listening.

5. If it used to work, what changed?

Nothing changed, of course. It just stopped working. My minor code change could not possibly have caused something so catastrophic.

I’ve heard that. I’ve said it. That doesn’t make it true.

If nothing changed, then run the old code. If it fails, well, that’s interesting now, isn’t it? If it succeeds, well then, stop saying nothing changed, something obviously did.

This does require frequent commit to version control, to get back to a last-known-good image. But you were doing that anyway, right? And then you can binary search to determine where the error crept in.

Note that if the code change doesn’t explain it, compare the map files (even the binaries). Realizing that something crossed a boundary may give you inside. Oh, also, the makefile (or project file) may have changed: optimizations can have big ramifications.

6. Is there anything interesting in the map file?

Like many embedded engineers, I find the map file to be a bit of an illegible mess. Happily, I’m not afraid of them anymore. There is an amazing amount of information in the map file. And it provides a different perspective on the code, sometimes it will jog my memory.

7. Can you prove it is hardware?

Of course, at this point, it probably is. But you know hardware engineers, they can be feeble. They need proof. So what kind of proof can you offer? How can you break it down to show it cannot possibly be the software?

Seriously, I have had the privilege of working with some phenomenal hardware engineers. It is seldom hardware (but not never). The process of proving it is hardware is a good part of debugging. Plus, if you can make the difficult error repeatable for the hardware engineer, they’ll probably take you to lunch for making their jobs easier.

8. Can you explain the problem to another engineer?

When I tutored intro to CS, I asked people to explain their problem to a teddy bear outside my office before explaining them to me. I usually listened in. However, at least 50% of the people thanked the bear and left without talking to me. Ok, probably only 20% thanked the bear but most walked away because they never actually needed my help. They needed to get their thoughts in order, to explain it to themselves.

I do that now, talk to myself. Sometimes I try to explain it to a trusted colleague (or a junior engineer) in email, trying to figure out what questions they would ask me so the explanations is really good.  Occasionally, I even send the email after all that, if I still can’t figure out the problem.

9. Did you use the single line if again?

When I saw Apple’s goto Fail bug, I completely understood.  I avoid unbraced if statements because one month, I tallied up my most common coding mistakes and found that unbraced if statements caused a disproportionate number of my bugs. I vowed never to use them again.  Since this is a known failure point on my part, it makes my checklist.

 

h1

Unsweetened

July 6, 2013

Every week this year I have a resolution, something to make me healthier, happier, or more productive. A friend mentioned that Jefferson did something similar through his whole life, focusing on one virtue for a fortnight before moving on to another, cycling through thirteen of them. I’m trying out all sorts, opening up myself to different ideas.

My resolution for the last 3.5 weeks is “no sugar”. And by that, I mean no sugar, no sugar substitutes, no honey, no maple syrup, no fruit juice (*), no dried fruit, no agave syrup, no sorbitol, no xylitol (which is poisonous to dogs!), nothing sweeter than fruit, eaten as fruit.

I’m hoping to get control of my sweet tooth, reset it to a different level so I don’t crave FROSTING levels of sweetness. My goal was to make it 4 weeks. I don’t think I’ll have a problem with it though it has been both easier and harder than I thought.

I consciously made an exception for alcohol; I have been drinking wine and sake. And I had one fruit juice cocktail (that was yummy but tasted way too sweet though it did an excellent job of delivering rum to my overtired system). There were a two other intentional exceptions: cough drops and calcium chews. There were two sweetened foods that I repeated even knowing they were sweetened: teriyaki sauce that didn’t end up on the side of my salmon and grape juice sweetened blueberries encrusting the Trader Joe’s goat cheese (rationalization: this was so good, killed sweet cravings, and I was already drinking grape juice).

I have been reading labels, put back potato chips, salad dressing, bread, (veggie) deli met, and frozen vegetable packages that had sugar (or other sweetener) as an ingredient. I came to the conclusion that sugar is lurking everywhere. I ordered dishes in restaurants that had the least likelihood of being spiked (except for salmon teriyaki).

We cleaned the house of ice cream, cookies, popsicles, and sweetened crackers. We talked about how we’d keep the house sugar-free for the foreseeable future (ideally forever) and limit our sugar intake to outside the house. But that plan would start after my 4 week long no-sugar plan. Even so, merely talking about it led to me daydreaming of going to the bakery, getting an icing shot (yes, our bakery has little cups of their excellent frosting available for purchase), and just doing the hit of sugar, right there, on the street.

The minute-to-minute implementation of being unsweetened wasn’t that difficult. Snacking on potato chips or bread and butter or string cheese sticks, there are always foods to eat (I didn’t lose any weight). Yogurt was tough, though after a 2 minute wait frozen fruit + plain yogurt leads to cold fruit covered in frozen yogurt. Actually, the latest technology for frozen berries without ice crystals has been wonderful, I’ve eaten a lot of still frozen fruit. That got me though the heat wave we had.

Breakfast was the hardest meal. I usually eat protein bars (I usually want to work with I wake up; making a nice breakfast gets in the way of me melding with my computer). I thought oatmeal and cream of wheat were a lost cause but when I went savory (adding sundried tomatoes and parmesan and a bit of butter), those were surprisingly yummy. Once I got oatmeal and cream of wheat working, I’d mix those up with the uberfast hunk of baguette and microwaved veggie sausage. I really didn’t have trouble finding good food to eat.

It was the daydreams and cravings that nearly killed me. Upon hearing my resolution, three people told me that they’d heard about a study that showed sugar was as addictive as crack. Two of them were eating dessert in front of me as they said this.

The worst time I had was at a birthday party. The social pressure of sharing cake is one thing, the vision of my husband scarfing up the moist cake and frosting (!!!!) haunted me for days. (Just writing about that, my mouth is all watery.) He ate maybe three bites but, still, to do it in front me… (never mind that everyone else there had a plate of cake, he gets all the blame).

I had a dream one night that I ate a bite of that cake. I could taste it. And since I’d broken my resolution, I woke up thinking I might as well have pancakes and maple syrup for breakfast. Lots of syrup.

If I felt about alcohol the way I feel about sugar, I think I would be an alcoholic. I’m embarrassed at how much time I spend plotting to get sweets and the many, varied forms that I want to consume. It is dumb and annoying, making me feel less in control of my life. Really annoying. Really embarrassing.

Like the resolution to eat whole grains, I’m happy I chose this as a resolution. It has given me a new bar for living as I want to live. It has made me comfortable with turning down sweets in social situations, enough that I think I could do it in the future. Keeping the house sweet-free is obviously the way to go (why didn’t we do this before?).

And yet, I’m still very much looking forward to this resolution ending and what I’m going to have for breakfast on Wednesday morning.

Taken in the salad section of a deli in a Flagstaff.

Taken in the salad section of a deli in a Flagstaff.

h1

A new week, a new resolution

March 24, 2013

I don’t normally do New Year’s resolutions. However, I did this year so here is my quarterly report.

Oh, but I didn’t exactly do a normal resolution. Instead, my plan is to have different resolution each week. Each resolution lasts Wednesday to Wednesday and should take 15-60 minutes of daily activity or thought. The goal overall is to try new things, see which better-for-me habits are easy to incorporate into my life and which ones are too difficult to maintain.

Week 1: Health: 10,000 steps and some time on the exercise. Success. Most days did more than five miles on the bike, only one day did I not want to bike at all.

Week 2: Happiness: more quality snuggling time with my husband. Mixed. It was nice but it require being in sync though it did keep us more in sync for a week or two after.

Week 3: Health: every day have one meal with a whole grain as a main component. Success. The whole grains made me feel a little better in general, more balanced sugar-wise. I found lots of whole grain things that I like, including plain old oatmeal packets, an easy meal I’d forgotten about. This resolution was a really, really good one and even 9 weeks later, most days I have something whole grain because I like how it makes me feel more full.

Week 4: Social: spend at least one hour a day talking to someone who is not my husband. Success but exhausting. Victims: house guest Nate (two days), She’s Geeky various people (three days), Ingo (birthday), and Jen + Alissa (on the embedded systems panel).

Week 5: Health: sixty minutes of at-least-slightly sweaty exercise. It’s funny, I think I usually mange 30-45 minutes of exercise (almost) everyday so I didn’t think this would be a big deal. However, I had one of Those Weeks and just failed at this one. Too much work, too much crankiness, too much “does this activity count?”. I’ll need to have more specificity in the future.

Week 6: Health: a different breakfast every day. My morning meal is exceedingly monotonous: a high protein food bar with low glycemic index and about 190 calories. What other breakfasts can keep me going until 11am without needing a snack? The goal was to keep the calorie intake around 200. This one was more interesting than I expected, changing up my morning patterns as well as my breakfast.

Week 7: Health: 10 miles on the exerbike, no reading fiction books until after getting on bike. I often bike 10 miles but I’d gotten out of the habit and I’d been lazing away hours reading junk. So, getting back in the habit of a late afternoon bike helped both of these issues.

Week 8: Health and Social: dual resolutions: to drink 8oz of water before each meal and to go out after dark each night. Having two resolutions watered it all down so I don’t think I get credit for successfully completing either one. The water one I just forgot about and getting up halfway through a meal to pound a glass of water was silly. As for going out, I just didn’t have things to do each night and didn’t have enough oomph to make stuff up.

Week 9: Health: Count calories. Not trying to reduce calories (though counting them has that effect anyway).

Week 10: Health: Count calories and exercise, making sure the total falls under the (generous) guideline given by the counting program. Still gathering a baseline.

Week 11: Health: Eat a rainbow everyday. After two weeks of counting calories, I wanted to con myself into continuing. I decided to try the school-children challenge of eating a food from each color group each day (red, orange, yellow/white, green, blue/purple). This one I stopped because it was stupid: if I want carrots and snap peas with lunch then fennel with orange wedges for dinner, eating blueberries instead (or in addition to) is dumb. Plus, I don’t really like blueberries and I couldn’t bring myself to count wine as a purple fruit. Plus, plus, I don’t need ways to eat *more* food. So I failed this resolution intentionally.

Week 12: Diet: No bread. After a few Sundays of bread-induced coma due to the amazing, spectacular, phenomenal bread from Manresa’s bread stand at Campbell’s farmer’s market, I realized I have a problem. (Still counting calories.) The resolution was really “no bread as a major component of a meal” which meant I could have a piece of bread but no bread-and-olive-oil meals, no sandwiches, and (horrors) no pizza. However, I’m mid-way through and I suspect “no bread” entirely is fine. I do miss it though.

Other resolutions I might try:

  • Brush teeth after every meal/snack
  • Eat fruit/vegetable 20 minutes before any snacking
  • An hour of house or garden work every day
  • Bike ten miles and take a walk each day
  • No alcohol or no caffeine
  • No tv before 9pm
  • No non-fiction reading
  • Blog post every day
  • Cook main component of one meal each day from a cookbook (C to help choose recipes)
  • Artistic endeavor for an hour a day
  • 30 min/day updating all career related things with current info: linked in update, resume update, google self, speaker’s wikis, etc.
  • Write a program in numPy everyday
  • Get up and shower and dress everyday, as though I have a real job
  • Do something nice for someone
  • Write a novel proposal every day
  • Spend 1 hour/day working on book promotion
  • 10% decrease in calories (using newly calculated baseline from weeks 9-12).

What else? What thing to try might make a big difference in my happiness and health?