The most geekish discovery EVER :-)

There is a not-very-documented feature in MacOS 10.9 that I just stumbled upon.

If you save a text file in SMILES format, Mac will show the correct image, scalable, in preview.
SMILES screen shot!
This is a very simple text file. It’s the shorthand for the chemical structure of DDT, and its sole content is


which is the Simplified Molecular-Input Line Entry System, or SMILES, abbreviation.

It doesn’t make that the icon of the file, just next to it you can see the BBEdit document for a really large molecule (which also renders) that I copied from the Wikipedia entry on SMILES.

Now, I’m nowhere near geek enough to dig into the UNIX guts and find the function call. But it’s pretty cool.

Cameras Save Lives!

The rioting this week in Ferguson, MO, has deeper roots than I want to explore right now. But the spark, the August 9 shooting of a black teenager, Michael Brown, by a white cop, Darren Wilson, is something that happens all too often.

The real story is murky at best. Maybe the confrontation was violent in two directions. Maybe Brown was running away when the first shots were fired, maybe he was charging the cop or maybe he was bowing his head in surrender or pain.
There are many reports of what exactly happened between Mr. Brown and Officer Wilson.

What we do know is that the cop involved was not wearing a body camera. A report from the Police Foundation says there’s a strong calming effect of body cameras:

“The findings suggest more than a 50% reduction in the total number of incidents of use-of-force compared to control-conditions, and nearly ten times more citizens’ complaints in the 12-months prior to the experiment.”

Why? Two reasons: because cops are less likely to overuse force when they are being recorded; and because arrestees, when confronted with video evidence, often retract their complaints.

This has been analyzed in the New York Times and National Public Radio, even before Ferguson.

The cameras cost some money, of course, and the data needs secure, third-party storage. One such storage site is The ability to use body-cam data in court requires chain of custody and security from tampering, which isn’t free. But that cost must be balanced against the liability costs saved from citizen-police complaints, and the potential savings in court costs if arrested people are confronted with immediate evidence that could influence their willingness to plea-bargain.

And the economic cost is trivial compared to the potential value of improving relations between police and the communities they are supposed to be protecting and serving. Cameras aren’t magic, and problems – especially racial tensions – won’t fade immediately. But isn’t preventing another Ferguson, another Rodney King, another Amadou Diallo, worth something?

Fixing things

This evening, I fixed a box fan that was at least 20 years old. Heck, it was so old… “how old was it?” …It was so old, it was sold by K-Mart… And made in Chicago, not China!

The problem was that the blades turned only very slowly when it was on High and not at all on Low. So the first thing to check was whether the blades spin freely. Not very.

It wasn’t a difficult job: take out 16 screws to remove the front and back grids, vacuum out a lot of dust (and apparently my daughter had already vacuumed out a lot), and take out the motor. When I took out the motor, I noticed a small opening, with a lip, just above the shaft. Hey, I thought, that looks like a place to add some oil. So I wend down to the basement workshop, grabbed the 3-in-1 oil (and another beer), and oiled that sucker. Yay, some improvement. I couldn’t pull the plastic fan blades off the front, but I saw there was another hole in the hub of the plastic. It was at an awkward angle for a set screw, so I figured it was maybe for oiling the front part of the shaft. I dribbled a bit more 3-in-1 in there, hey presto, it’s pretty free now. Then, spin it by hand a bit to distribute the oil and add a little more.
Plug it in, fire it up, and it works fine. Yay, triumph. Reassemble the 16 screws for the grids and put away the tools. Really the most annoying part was discovering that the nuts on the motor mount were 11/32, when I had originally grabbed a 3/8 and a 5/16 nut driver. Metric is good, people!

Which is all by way of introducing tonight’s topic: Fixing. Or more precisely, understanding a basic level of how the material objects in your life work, and what to do if they malfunction.

A couple weeks ago, I went to visit my sister in Fort Wayne. One task I tried there was to fix a dripping faucet in their upstairs bathroom, which was vintage 1940s post-war colored porcelain. Well, I began composing a blog post about that but it got very boring, even for this egocentric writer. The tl;dr on that is: Four or five trips to the hardware store, and it still dripped. But at least I fixed the drain. Plus I disturbed the sediment in their hot-water heater enough to cause a bad drip from the pressure relief valve, which happened right before we had to go back home.
However, it struck me just how separated from mundane physical reality a lot of people are. It was a fairly straightforward problem, but you’d think it was Albus Dumbledore swearing away under the sink, not chemprofdave.

Important update!
I neglected to link to Bonnie’s depiction of that weekend… She’s the pro writer of the family.

Much of what makes 20th century America (not necessarily 21st, mind you) is pretty simple stuff if you take a little time to learn about it. The mechanical components of your house, and most of your appliances, are more or less understandable. Engineering is not easy, but figuring out what engineers have done can be easy. Many years ago, Dad was grousing about how we’ve become a disposable society, where someone might trash a stove because one burner knob has failed. It’s easier now, with web stores, to get replacement parts. But how many people actually bother? A little time fixing that fan saved a $15-20 replacement, and the externalities of waste disposal. And the fixing time was no more than a trip to the store would have been.

Take a few minutes to trace your water supply from where it enters your house, to the hot water heater, and through the pipes to the various taps. Then look at your electrical box, again following the wires from where they enter your house to the fuse box or breaker panel, and off to the various switches and outlets. Do the same for your furnace and (if you have one) central air ducts. If anything looks corroded, or even significantly different from nearby areas, get help or try to figure it out.

If you want a money-saving tip, try this: Find your hot water heater. At the bottom, there will be a tap to which you can attach a garden hose. Run the hose over to your basement floor drain – it’s probably in the laundry area. At the top of the water heater, there will be two pipes connected. One will be warm (hot out), the other cold for intake. There will be a valve on the cold water pipe.

Close the cold water inlet valve, connect the hose from the bottom faucet to your floor drain, and open the tap. Let the whole hot water heater flush out and down the floor drain. Close the lower tap and open the top tap to refill it. Flush again to remove more sediment. If you live in an area with even moderately hard water, you probably are getting build-up in your tank that will cost you more energy to heat the water, decrease the amount of hot water you have available, and even cause early failure of the system. That was (part of) the problem at my sister’s, and it could save you a chunk of change.

Get to know the material things that surround you. Understanding your world is different than when we were in the horse-drawn plow era, but it’s not impossible. And it can give you great satisfaction to conquer that #&#%^ dripping faucet.

Conversion from Word – (mostly) Solved!

Simplest method I’ve been able to find:

  1. Open Word file, select & copy material.
  2. Go to the demo page for CKEditor,
  3. Click the “Paste From Word” button and paste the content.
  4. Click the “Source” button in CKEditor
  5. Copy HTML source code
  6. Paste into an HTML document. I’m using Flux and RapidWeaver for that.

Amazingly, my images seem to have come through as well. There’s no horrible excess of <span> or <div> tags, no font specifications, none of that cruft. so I can add those in later to make it more meaningful. The headings and basic markup are there, nothing else.

Here it is in the “saved-from-word” HTML:

<p class=MsoNormal>&nbsp;</p>
<p class=MsoListParagraph style='text-indent:-.25in'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span>What bond breaks in the first step? </p>
<p class=MsoListParagraph style='text-indent:-.25in'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span>In the second step, one bond breaks and two bonds form. Which are they? </p>
<p class=MsoListParagraph style='text-indent:-.25in'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;
</span>Compare the relative energies of the reactants (t-BuCl + B<sup>-</sup>);
the intermediates (t-Bu<sup>+</sup>, Cl<sup>-</sup>, and B<sup>-</sup>); and
the products (2-methylpropene, Cl<sup>-</sup>, and HB). </p>

And the same material done from the above method:

 <li>What bond breaks in the first step?</li>
 <li>In the second step, one bond breaks and two bonds form. Which are they?</li>
 <li>Compare the relative energies of the reactants (t-BuCl + B-); the intermediates (t-Bu+, Cl-, and B-); and the products (2-methylpropene, Cl-, and HB).</li>

So I lose the superscript tags for the ions, but the list format is done properly with tags and the whole code is much more readable.  It’s a very worthy trade-off.

The images are still saved with very generic names, so I will have to come up with some kind of system for naming them properly and keeping them sorted.
(from Word)

 <p class=MsoNormal><img width=266 height=62 id="_x0000_i1027"

and from CKEdit:

<p><img src="file://localhost/Users/dave/Library/Caches/TemporaryItems/msoclip/0clip_image006.png" style="height:62px; width:266px; " ></p>

This was so easy that I downloaded the ckeditor library, from their website (, made my own local page following their tutorial. Now, the only annoying bit is fixing the images from their location in a temp folder to a meaningful location in the web site directory.

Converting complex docs to decent HTML ain’t easy.

It’s well known (to anybody who has tried it) that Microsoft Word’s “save as HTML” or “save as web page” command generates a crap-ton of stuff that is intended to make the file act as a stand-alone, editable document that is identical when re-opened. And converting these to decent HTML is an odious chore, not easily done.
Especially if there are images.I have a huge amount of Word files, with Chemdraw images in them, that I’m trying to convert to web pages.
One link I found, at this blog, suggested that viewing the document in Gmail’s previewer might help. Now, since that blog post is over three years old, I am not surprised that things have changed.
In fact, the HTML of a Google Doc is just as horrible.

Saving Word to Rich Text isn’t much better. You lose all the images.

One of the first tasks I’m going to learn is a workflow to convert all my class worksheets to web pages. This is a pain in the patoot, but it’s gotta happen somehow, sometime. I’d like to be able to keep the images, at least some of them. Others may get replaced with interactive bits later, but just getting the basic stuff into HTML is Job 1.

A program called RapidWeaver allows simple editing and I can drag images into it from Word. But the code is just as icky.
There are word to RTF to HTML converters out there, and they sacrifice images. I have a few programs like TextWrangler too, which can do some.

But it’s going to take a bit of work just to figure out a decent flow.

Why can’t those dips at MS just save your document with a style sheet? Grr….
Continue reading

testing the new bluetooth keyboard

i just got a new bluetooth keyboard for the iPad. it seems to work easily. Pairing was no problem, it feels much nicer to type on a mechanical keyboard than on the ipad screen, plus with the external keyboard I have that much more screen space.

it was a great deal, $30 and free shipping for an $80 item, the Zagg Flex keyboard and case-stand.

it has a flexible case for the keyboard that folds to make a stand. That, i am not using yet, but just the detachable keyboard is pretty good. Nice to have the arrow keys (sorely missing from ipad built-in), plus the traditional row with numbers and punctuation, without having to tap a selection key. The size is a little smaller than a standard keyboard, but for this hunt-and-peck typist it’s fine. a touch-typist might find it to small.
I also like that it’s not built into an ipad sleeve but can be used separately. that means, if I wanted to , I could even pair it with an iphone or a laptop…

The tactile keys make a bit of noise when typing, but less than those of my office pc keyboard.

It’s a keeper.

Not ready for Hillary?

For a while, now, there have been speculations and prognostications about whether Hillary Clinton will run for the presidency in 2016. The PAC “Ready For Hillary” was founded for the express purpose of persuading her to run. Its first public appearance? Less than a week after the 2012 re-election of Obama. (Facebook page- joined November 10, 2012)

If we look back to 2008, there was also a sense of inevitability – probably carefully cultivated – about HC being the Democratic nominee. Then that other guy showed up.

At the time, I had mixed feelings. I figured Obama was inexperienced as a first-term senator, and that he could benefit from waiting a cycle or two. But I didn’t like Clinton’s employing the personal negatives that she had so decried when they were used against her husband. And I wasn’t willing to accept the “inevitability” narrative. And I worried that the Clinton name, and her femaleness, would cause the right wing to oppose her with venomous bitterness without regard for policy ideas.

Okay, so that last worry happened anyway…

But here’s why I’m still not ready for Hillary.

First of all, I think speculation that started more than three years before the Iowa caucuses is a little early. Can we wait and see how the 2014 midterm elections play out?

Second, I want to see real competition. Having the 800-pound gorilla of politics in the race could crowd out other candidates. And I don’t even know who they are yet!

Third, I’d like to see at least one of those candidates be a truly progressive candidate, one who will work hard for the poor and stand up to Wall Street. I’m pretty sure that “standing up to Wall Street” isn’t a top priority for an HRC presidency. And she isn’t really a progressive.

I started this draft in November 2013. Never got much past the Elizabeth Warren commentary from the New Republic, above. But then I saw this morning that she is still playing coy.

Come on. “I am considering it, but I’m not committed one way or another, yet.” Is that too much to say? How about, “I’d like to see a vigorous and robust primary campaign, in which many Democratic candidates put forth their visions for the future of this country.” Or “Ask me after the November midterms, and I’ll be ready to answer you then.”

Or even, “Yeah, I’m going to run. Bring it!” At least that way we’d have a couple years for potential primary opponents to consider if they wanted to support her or mount their own challenge. And the barrage of negativity from Fox News would be, at the very least, old news by the time voters really start paying attention. If she’s worried that that the inevitable attacks might drop popularity ratings, then why not give herself time to claw back?

So, I’m ready to see who else is out there. Not that I don’t support her. I hope she’d be tougher in working with a republican-controlled House than Obama was. Senator, Secretary of State, and of course one of the more experienced White House hands. I think Hillary is ready, but I’m not, quite, yet. Let’s watch some debates, see some retail politics, and have a competition instead of a coronation.