Looking for writing-related posts? Check out my new writing blog, www.larrykollar.com!

Sunday, May 19, 2019 1 comment

Fixing supper

The local Kroger recently set up a refrigerated kiosk with “Home Chef” meals. These are boxed meals with two servings, running $17-$20 per box depending on what’s in the box. I’ve seriously been considering setting something up with Hello Fresh, or any of the myriad other players in this space, so I picked up a box to see how things would go. It featured (boneless) pork chops, mashed potatoes, and snap peas. Sounded pretty good, anyway.

Saturday evening, I got the box out and got to work. Now I had expected everything to be mostly ready to go—sure, I’d have to fire up the oven and what-not—but reality smacked me over the head with a raw pork chop. What was in the box was: raw ingredients, and a recipe. I had to string the pea pods, cut up two whole potatoes, put the breading on the pork chops, and cook the sauce. So what this amounted to was, a box of raw ingredients and a recipe card. The card said this was “intermediate” difficulty (gee, that would have been nice to put on the outside of the box), but I didn’t have any trouble putting it together. My technical writer (a/k/a work) side pointed out where the recipe sequence could be improved. The recipe did say to add some stuff like olive oil, salt, and pepper. I substituted NoSalt for the salt, and nothing turned weird colors or exploded.

Except that midway through cooking the potatoes (that I had to dice up myself), I realized I’d forgotten the second spud. In an inspired moment of panic, I cut up Tater#2 and threw it in the microwave for 3 minutes, then chucked it in the pot with the other one. This was the first time in my entire life that I made mashed potatoes from scratch, and in the end it was okay.

So was the rest of it. It actually turned out to be a pretty pleasant meal; we had our dinners, and Charlie sat between us and deconstructed a liverwurst sandwich. (Hey, if he eats the meat before the bread, fine.) The wife isn’t a big fan of snap peas, but Mason will have a side dish when he comes home (he went home with The Boy tonight). She also pointed out that russet taters are white, and you need to peel white potatoes (red potatoes are fine if you include the peels). The recipe card said “cut up the potatoes,” and the picture showed the peels still on, so that’s how I went. I thought the cream sauce that the chops floated on did a fine job of mitigating that bitter taste that comes with russet peels, but what the package provided wasn’t enough to cover them.

The upside is, the recipe card provides the ingredients list… so I can do this again, and improve on things instead of buying the box. Maybe I’ll double the recipe so there’s four servings (which would cover Mason plus some leftovers for work), and double-double the sauce/gravy recipe. Substitute red potatoes for the russets, or peel the russets.

Anyway… if this is what pre-packaged meals offer, I don’t see a lot of value. In the end, I might just mosey over to Publix instead. They provide recipes for meals like this, and give you the list for all the stuff you need (some of which you may already have). No pretense, and (especially) no markup for what amounts to packaging. But it was a valuable experience. Now I know what to do with Panko breadcrumbs, I can smash potatoes with the best of 'em, and maybe I’ll substitute a carrots/onions combo for the snap peas if I make this again. I’m sure it will end up with a lot less sodium than the original.

In the end: three stars. The food was fine, but doing some of the prep work would have been nice. I’m certain the value proposition is heavily weighted in favor of buying the ingredients individually.

What I really need to do is go back to my single days: plan out the meals for the week, figure out what I don’t have, then shop accordingly.

Thursday, May 16, 2019 No comments

Adventures of a #techcomm Geek: Sharp Edges when Rounding

One of the advantages of using a text-based markup grammer for documentation—these days, often XHTML or some other XML, but could be Markdown, Restructured Text, Asciidoc, or even old-sK001 typesetting languages like troff or TeX—is that they’re easy to manipulate with scripts.

There are quite a few general-purpose scripting languages that do a fine job of hunting down and acting on patterns. I’m conversant with Perl, and am learning Python; but when I need to bang something out in a hurry and XML is (mostly) not involved, Awk is how I hammer my nails. Some wags joke Awk is short for “awkward,” and it can be for those who are used to procedural programming. Anyone exposed to event-based programming—where the program or script reacts to incoming events—will find it much more familiar. Actually, “awk” is the initials of the three people who invented it: Aho, Weinberger, Kernighan (yes, that Brian Kernighan, he who also co-invented the C language and was a major player on the team that invented Unix).

Instead of events, Awk reacts to patterns. A pattern can be a plain string, a variable value, a regular expression, or combinations. Other cool things about Awk:
  • Variables have whichever type is most appropriate to the current operation. For example, your script might read the string “12.345,” assign it to x, then you can use a statement like print x + 4 and you’ll get 16.345.
  • The language reference (at least for the original Awk) fits comfortably in a manpage, running just over 3 pages when printed. Even the 2nd edition “official” reference is only 7 pages long.
  • It’s a required feature in most modern Unix specifications. That means you’ll always have some version of Awk on an operating system that has some pretensions to be “Unix-like” unless it’s a stripped, embedded system. On the other hand, even BusyBox-based systems include a version of Awk. Basically, that means Awk is everywhere except maybe your phone. Maybe.
If your operating system is that Microsoft thing, you can download a version of Awk for it. If you install the ISH app, you can even have it on an iPhone.

Now what am I going to do with it?

Okay. I told you all that to tell you this.

I’m working on something that extracts text from a PDF file, and formats it according to rules that use information such as margin, indent, and font. It requires an intermediate step that transforms the PDF into a simple (but very large) XML file, marking pages, blocks, lines, and individual characters.

“But wait a minute!” you say. “I thought Awk only worked on text files. How does it parse XML?”

Like many useful utilities first released in the 1970s, Awk has been enhanced, rewritten, re-implemented from scratch, extended, and yet it still resembles its ancestral beginnings. The GNU version of Awk (commonly referred to as gawk) has an extensions library and extensions for the most commonly-processed textual formats, including CSV (still beta) and XML. In fact, the XML extension is important enough that gawk has a special incantation called xmlgawk that automatically loads the XML extension.

The neat thing about xmlgawk, at least the default way of using it, is that it has a very Awk-like way of parsing XML files—it provides patterns for matching beginnings of elements, character data, and ends of elements (and a lot more). This is basically a SAX parser. If you don’t need to keep the entire XML file in memory, it’s a very efficient way to work with XML files.

So. In most cases, I only need the left margin of a block (paragraph). Sometimes, I need the lowest extent of that block as well, to throw out headers and footers. I need to check the difference between the first and second line (horizontally), and possibly act upon it.

In the document I used for testing, list items (like bullets) have a first line indent of –18 points. “Cool,” I said. “I can use that to flag list items.”

All well and good, except that it only worked about 10% of the time. I started inserting debugging strings, trying to figure out what was going on, and bloating the output beyond usefulness. Finally, I decided to print the actual difference between the first and second lines in a paragraph, which should have been zero. What I found told me what the problem was.

    diff=1.24003e-18

In other words, the difference (between integer and floating point numbers) was so miniscule as to matter only to a computer. Thus, instead of doing a direct comparison, I took the difference and compared that to a number large enough to notice but small enough to ignore—1/10000 point.

And hey presto! The script behaved the way it should!

It’s a good thing I’ve been doing this at home—that means I can soon share it with you. Ironically, it turns out that we might need it at the workplace, which gives me a guilt-free opportunity to beta-test it.

Wednesday, May 15, 2019 No comments

The Dresser Purge

In the brief two years I was on my own, I concluded 15 changes of clothes was the ideal number. It let me do laundry every two weeks, with one extra pair just in case I had to postpone laundry day.

Clothes accumulate, like everything else, and these days I have a lot more than 15 changes. And somehow, laundry day is twice a week—actually, that makes sense. Four people in FAR Manor means four times the laundry, right?

After the Great Closet Purge, I started putting out of season clothes in a storage bin I kept in the closet, to relieve pressure on the bulging dresser. This worked for a while.

De-bulging the dresser
But the warm weather got to Sector 706 couple weeks ago, and I got the bin out to swap stuff around. Being about 35 pounds lighter than last year, I tried on shorts… and if I could pull them off without undoing them, and half of them fit the description, they began the purge pile. Then I tried shorts that wintered over in the dresser (because the bin was crammed full). All in all, I shed eight pairs of shorts, including one that still had tags on it. There were also eight pairs of swimsuits between the bin and dresser… where did they all come from? I decided three pairs was plenty, and added the rest to the purge pile. I got the now-too-big pants out of the closet and tossed them on.

Then came the T-shirts. I weeded them out, and finally the purge filled a large garbage bag. Except for the three remaining swimsuits, my bottom dresser drawer was empty and the other drawers had headroom. And there was plenty of room for the winter clothes in the bin. But I think the shirts in my closet have decompressed, because now it feels as packed as before. I should probably weed them out again; if I lose a few more pounds, I might be able to go from XL to L.

I still have way more than 15 changes of clothes. Even with more frequent laundry, I probably don’t need to cut down to 8 or 10, though.

LinkWithin

Related Posts Plugin for WordPress, Blogger...