Tips, JournalAugust 31, 2009 10:48 am

When we went to Key West the last week of June, I packed following the OneBag.com One-Page Checklist.

When we got back, I jotted down the items I wish I had brought along.

  • tea bags (mainly because my mother came along)
  • bug spray — it’s on the checklist, but I didn’t pack it since we hadn’t needed it for Key West summers before
  • aloe gel for sunburn
  • a bike lock for the double stroller
  • a small package of salad dressing — it’s hard to find allergy-friendly salad dressing, and a small amount from home would have been tastier
  • a very small packet of oil — I’ve got these at home, and it would have helped the pan!
  • headphones for iPod to listen on the plane

The irony of that last item is that I packed headphones for the next trip two weeks later, and didn’t have any chance to use them: either the kids required too much attention, or I was so exhausted I just wanted to doze.

Most of these items are specific to the travel companions (tea for mother, bike lock for stroller for kids) or to the location (bug spray and aloe for tropical climate, cooking supplies for small kitchen), so I’d have to say the One Bag checklist was great overall!

Health, DietAugust 25, 2009 12:59 pm

I’ve seen a number of variations on Fish Oil versus Flax Seed Oil, and I think the most best answer is to use whichever one (or neither, or algae) suits you best. However, looking at this metabolic pathway chart, I agree that

fish oil is a superior source of omega-3’s since it is already in an active form upon ingestion.

In fact, that metabolic chart explains both of these “contradictory” results: ALA is the left side with all of the inflammatory agents (hmm, needs COX2 inhibitors), while flax is upper right (fish lower right) with the anti-inflammatory agents.

Pregnancy, Tips, Journal, HealthAugust 23, 2009 10:25 pm

About two weeks ago, during a rare bout of heartburn (I had it once as a kid for overeating, as an adverse reaction to naproxen, and during most of both pregnancies), I wondered why I had such fond, rosy memories of my pregnancies. I mean, morning sickness kicked in before the fourth week, before the positive pregnancy test even, subsided around the 20th week, and kicked back in once I was really large. Add in the unaccustomed bulk and the every-movement-is-arerobic-exercise from week 24 on, and it’s no picnic. I figured it out, though. I relished the free license to be selfish about taking care of myself. Of course I have to eat this, it’s the healthiest choice on the menu that doesn’t make my stomach churn at the thought. Time to get ready for bed now so that I have time to do my static flexibility stretches to keep me from aching. No, it’s not breakfast time yet, I have to do my strength training first!

Post-partum, the rules change to keep the baby happy.

But since I noticed what I liked, I’m making more time for exercise. (I’ve always preferred healthier food, although I was falling off the wagon for sweet snacks more often before I noticed this.) I like it. I think I’ll go stretch now and enjoy my own oasis of luxurious, self-indulgent exercise. I’ve done this routine before bed so many times, I can’t stop yawning for the last third of my static stretches. Great way to take care of myself. I’m headed for the floor!

Journal, HealthAugust 22, 2009 9:14 pm

I have a reasonable diet (I love salad!), but as I mentioned yesterday, I love my prenatal multivitamins too. Since I probably get most of my trace minerals in my diet, I prefer that my multivitamin is low in vitamins with accessible toxicity (Vitamin A, I’m looking at you) and low in the heavy metal sort of trace minerals (selenium linked to infertility). I don’t like B vitamins from GNC because most of those have thousands of percents over the USRDA, and that sounds like overkill in the unhealthy direction to me. Once again, my “current” brand of prenatals went unavailable, so I’ve been trying other brands that meet my desire not to do over-do certain items while still bumping up the B’s.

The first one I tried was a pretty traditional women’s multivitamin. It lacked the slightly higher levels of B vitamins, but there weren’t any prenatals at the store. Back to sprue (especially about 30 minutes to an hour after I drink a cola), back to the search. The next one I tried is OneADay Energy, although I wouldn’t've bought it if I had noticed then that it has caffeine. (Most of the others that were high on some B vitamins were low on B6 and B12. Which would be one way to test which one helps me!) Although I drank tea for years, coffee gives me sweats and shakes, so “contains the caffeine of about 1 cup of coffee” isn’t reassuring. It’s even higher on those B vitamins than prenatal multivitamins, so I might alternate days with the standard women’s. New discovery! With those B vitamins generally at 200% (but not an unacceptable 6000%), my weight seems to be stabilizing! I was having annoying cyclic weight gain, a little loss, then back to the gain grind. How much I ate didn’t seem to affect the cyclic pattern much (so why starve).

Extra B vitamins beyond prenatal multivitamin levels, and (#1) I’m back to being in control of my weight and I like to be in charge of my own destiny, and (#2) for the first time in absolutely years, I’m not facing afternoon doldrums with a severe urge to snack on something sweet! Wow! I can probably learn to live with caffeine for that, but I notice that the OneADay Teen mixtures look similar but without the caffeine. In fact, the only amount I disagree with on those is the Chromium since it can affect appetite too. I think I like the Teen Boy formula best because it’s lower in iron and some weeks I average 3x USRDA for iron … I don’t need to take an iron supplement unless I like brittle hair and nails. I even think the RDI for iron is high since, at least for blood hemoglobin, the elemental iron is usually recycled into new hemoglobin: it’s a fairly closed cycle for iron in hemoglobin, not much loss. I think iron loss is 20 mg for childbirth, and most other times much lower than that … so I don’t think I need it. I do remember what anemia feels like (that lethargy, particularly in my elbows: my elbows felt weak) and I would know to take moderate levels of iron.

I really like that the US RDI tables are available online because these tables include the suggested upper limit too. There you can see that while the RDI for sodium is 1500 mg (a big drop from the old USRDA values), the suggested upper limit is 2300 mg! I think the old USRDA for sodium was 3500 mg. Yeah. So the suggested limit works out to about 3/4 teaspoon of salt … per day. Since fruits and veggies contain some natural sodium, it’s possible to get enough sodium with very little, if any, added salt.

So I used to think that prenatal multivitamins were the gold standard to balance my body, but I learn new things all the time. This time it seems to be that even a little bit more of those B vitamins is a better thing.

Code 9:10 pm

Hmm, remote input-output with Expect sounds exactly like where I’ll be next week with expect scripts. However, the whole expect buffer concept doesn’t sit well with me. I can tell it’s powerful, once you grok it, but I’m not there and I doubt I need to get there: I’m good with sed and awk. I understand that the expect buffer holds both sides of the “conversation” without regard for local and remote, and that $expect_out(buffer) contains everything since the last match, but even so, I’m not able to get expect to filter just the way I want to view. On the other hand, I just splatted the whole output to sed and I’m done.

Seductive power tools, these sed and awk. And despite what my co-workers think, I’m not even all that good with them … but I know how to look up 80% of what I need from sed1line and awk1line.txt, and I glean the rest from Google or from scripts I’ve already written. (Every once in a while, I’m really clever. The other days, I just refer back to what I did then.) Most of it is actually knowing regular expressions from studying man regexp in my youth. Now I’d probably just use txt2regex instead.

Journal, HealthAugust 21, 2009 11:48 pm

I try to tell my girlfriends these.

  • Prenatal vitamins can cure a weekly+ bout of sprue without the suffering of a diagnosis of IBS. I thought I was headed for IBS myself, but prenatal vitamins fixed that when a regular multivitamin didn’t. This has worked for me and for two friends who are also professional women with stressful jobs. I note that prenatal vitamins are slightly higher in B vitamins, and I know research studies have shown that stress interferes with the absorption of some B vitamins. So my theory is that stress is blocking some vitamin B absorption (not sure which one or ones) causing the bouts of sprue, but prenatal multivitamins shore up your levels of B. (Yes, IBS is real, but for some women there could be a simple, effective solution. Note that a sample size of three women plus a heuristic argument does not make for good science. No harm in trying either!)
  • Your menstrual cycle could be two days shorter without tampons. I heard this at a women’s health seminar. I went to be moral support for a friend so she would go, and it wasn’t the touchy-feely blather I was afraid of. The speaker cited research studies, although I haven’t been able to find them. So I’ll just say my sample size is one plus hearsay of research, but I don’t miss those two days one bit.
  • Talc, although it comes in powder form, is still a rock. Talc in the panties has been causally linked to increased infections. If you really want to powder, use a cornstarch one unless you have a yeast infection. Cornstarch is from corn, a food item. Yeast can eat it and thrive. So no powder is best, but the occasional puff of cornstarch baby powder is fine.

These are non-obvious tips that can make life better. Share!

Tips, Troubleshooting, Unix, CodeAugust 14, 2009 9:33 am

A good place to start my workday of Expect scripting: The 8 most common errors:

  1. Have you mis-spelt a variable name?
  2. Have you mis-spelt a command name?
  3. Have you used a $ when setting a variable, or left one off when using the contents of a variable?
  4. Do your brackets balance?
  5. Have you left spaces in the right places?
  6. Have you added a new line in the middle of a command and forgotten the \ on the end of all lines except the last?
  7. Do you need \ protection on anything?
  8. Have you got () {} or [] mixed up?

I’ll keep those in mind.

Macintosh, Tips, Journal, CodeAugust 13, 2009 2:40 pm

When my USB thumb drive died, and then its brand new replacement followed it, I looked for an online alternative. I picked Syncplicity because I liked the screen shots: I knew exactly what I would see as a user. I used it to access live copies of my most-used files on both my work and home MacBook Pros. Well, Syncplicity decided to drop Mac support cold at the end of last month. I finally got around to uninstalling it, which was a pain because the directions disappeared out from under me.

If you need ‘em, those directions are:

1. Shut Syncplicity down
2. Delete /Applications/Syncplicity.app
3. Delete /Library/Contextual Menu Items/SyncpCMPlugin.plugin
4. Delete ~/Library/Application Support/Syncplicity
5. Restart your Mac

My first thought while reading those directions was:

1. osascript -e "tell application \"Syncplicity\" to quit"
2. rm -rf /Applications/Syncplicity.app
3. sudo rm -rf /Library/Contextual\ Menu\ Items/SyncpCMPlugin.plugin
4. rm -rf ~/Library/Application\ Support/Syncplicity
5. osascript -e "tell application \"Finder\" to restart"

so I decided to script it. Since the first and last steps were AppleScript commands, I dabbled around and came up with an AppleScript application to uninstall Syncplicity for the Mac (download).

For alternatives, I picked Dropbox (SugarSync is similar), but if you lean towards backups too then Mozy, iDrive, and rsync.net are also strong contenders.

The last step, after making sure all my files are current and local, is to cancel my account at Syncplicity. Time to move on!

Macintosh, Tips, CodeAugust 11, 2009 3:31 pm

From the inimitable Daring Fireball, how to see if an application is running with AppleScript:

tell application \"System Events\"
    count (every process whose name is \"BBEdit\")
end tell

I modified that into tell application "System Events" to set syncpRunning to count (every process whose name is "Syncplicity") for my purposes.

Macintosh, Journal, Code 12:38 pm

AppleScript sounds great: it’s a high-level language, and the code, done right, can be quite human-readable. That’s also the problem … there are so many cases where “to” and “of” both work, and then you run into a case where it matters. Frustrating! That makes me long for a less-flexible language; if there’s only one way to issue the command, look it up, use it, and you’re done. Or try to figure out where and why AppleScript is so slippery …

Anyway, yesterday’s quest was to identify special folders, like the Applications folder, without assuming /Applications.

Most of the names of special folders are listed in the AppleScript Language Guide: Commands Reference. Yay! However, some special folders aren’t there. You can find that longer list in AppleScript 1-2-3. For instance, I used this line of AppleScript
set removePlugin to (the path to "cmnu" as string) & "SyncpCMPlugin.plugin" as alias
where the path to "cmnu" gives me the path to the user’s Contextual Menu Items folder. That’s not as readable as I’d like my AppleScript, but there’s no human-readable version of the 4-letter code.

Today’s challenge is to discover if the Trash is empty or not with AppleScript; I’m not going to cheat and use shell.

I’ve tried
set trashItems to the count of every item in the trash
set number_of_items to (count (every item of the trash))
set tryThis to count of items in trash

and they don’t work.

Oh yeah, here’s what I mean about AppleScript being a slippery dog, and natural language failing.

These lines work:
tell application "Finder" to set trashList to (items of trash)
tell application "Finder" to open (the path to the trash folder as alias)

These lines do not work:
tell application “Finder” to set trashList to (items of trash folder) with Can't get every item of trash folder.
tell application “Finder” to open the trash

Since Unix is so good at text manipulation, I find that aspect of AppleScript frustrating, and the Working with Text AppleScript reference useful.

OK, so I have solved today’s AppleScript frustration to see if the Trash is empty or full.

set trashList to {""}
set trashFiles to {""}
tell application "Finder" to set trashList to (the items of the trash)
tell application "Finder" to set trashFiles to the name of the items in the trash
set old_delimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set display_trashFiles to trashFiles as string
set trashCount to the count of trashFiles
if (trashFiles is {}) then
display dialog "There are no items in the Trash." buttons {"OK"} default button 1 with title "Trash Empty" with icon note
else
display dialog "There are items in the Trash." buttons {"OK"} default button "OK" with title "Trash Not Empty" with icon caution
end if
if trashCount > 1 then
display dialog "There are " & trashCount & " items in the Trash." & return & "list: " & (trashFiles as string) buttons {"OK"} default button "OK" with title "Trash Full" with icon stop
else if trashCount = 1 then
display dialog "There is " & trashCount & " item in the Trash." & return & "list: " & display_trashFiles buttons {"OK"} default button "OK" with title "Trash Full" with icon caution
else
display dialog "Empty, " & trashCount & " items in the Trash." & return & "list: " & display_trashFiles
end if
set AppleScript's text item delimiters to old_delimiters

tell application "Finder"
display dialog "What would you like to do?" buttons {"Empty Trash", "View Trash", "OK"} default button "Empty Trash" with icon note
if button returned of result is "Empty Trash" then
empty trash
else if button returned of result is "View Trash" then
open the (path to the trash folder as alias)
end if
end tell

That was harder than I expected, but now it’s done.