Jeff Duntemann's Contrapositive Diary Rotating Header Image

programming

Odd Lots

  • I had some fairly sophisticated oral microsurgery about ten days ago, and it kind of took the wind out of me. That’s why you’re getting two Odd Lots in a row. I have things to write about long-form but have only recently found the energy to write at all. Promise to get a couple of things out in the next week.
  • Some researchers at UW Madison are suggesting that sleep may exist to help us forget; that is, to trim unnecessary neural connections in order to improve the signal-to-noise ratio in the brain. Fair enough. What I really want to know (and am currently researching) is why the hell we dream. I doubt the answer to that is quite so simple.
  • Ultibo is a fork of FreePascal/Lazarus that creates custom kernel.img files for the Raspberry Pi, allowing direct boot into an embedded application without requiring an underlying OS. I haven’t tried it yet (still waiting on delivery of a few parts for a new RPi 3 setup) but it sounds terrific. Bare metal Pascal? Whoda thunkit?
  • Humana just announced that it is leaving the ACA exchanges after 2017. As I understand it, that will leave a fair number of counties (and some major cities) with no health insurance carriers at all. Zip. Zero. Obamacare, it seems, is in the process of repealing itself.
  • NaNoWriMo has gone all political and shat itself bigtime. You know my opinions of such things: Politics is filth. A number of us are talking about an alternate event held on a different month. November is a horrible month for writing 50,000 words, because Thanksgiving. I’m pushing March, which is good for almost nothing other than containing St. Patrick’s Day. (Thanks to Tom Knighton for the link.)
  • Paris has been gripped by rioting since February 2…and the US media simply refuses to cover it, most likely fearing that it will distract people from the Flynn resignation. Forget fake news. We have fake media.
  • I heard from a DC resident that there was also a smallish riot in Washington DC today, and so far have seen no media coverage on it at all.
  • Cold weather in Italy and Spain have caused vegetable shortages in the UK. Millions of small children who would supposedly never know what snow looked like may now never know what kale looks like. Sounds like a good trade to me.
  • Trader Joe’s now sells a $5 zinfandel in its house Coastal brand, and it’s actually pretty decent. Good nose, strong fruit. Seems a touch thin somehow, but still well worth the price.
  • I don’t know if you’ve ever seen Gahan Wilson’s cartoons in Playboy and National Lampoon, but Pete Albrecht sent me a link to an interview with Wilson that explains why he did certain things the way he did, like his brilliant series called “Nuts” about how the world looks and feels to small children.

Daywander

Drilling U-Channel - 500 Wide.jpg

There’s been an unexpected irruption of normalcy here, while we sail upon the whine-dark seas of modern American life. (I’ve been wanting to use the word “irruption” here, correctly, for some time.) What this means is that I’ve been able to do some of what I want to do, and not merely what my do-it list tells me I have to do. It won’t last, but while it does I’m going to make the most of it.

A number of people have suggested that I write a few short novels to get the size of my list up a little. I wrote Drumlin Circus (53,000 words) in only six weeks, after all. But as I recall, those were very full weeks. So a month or so ago I got an idea for a new short novel, and I’m glad to say I now have 6,300 words down on it; figure 12% or so. It’s whimsical, and whether or not it’s fantasy depends heavily on whether you believe that the collective unconscious is real or not. I’d like to bring it in at between 50,000 and 60,000 words, so don’t expect all-new built-from-scratch universes a la The Cunning Blood. However, I do promise a trademark Jeff Duntemann mayhem-filled action climax.

And a dream repairman. I mean that: A guy who drops into your nightmares and hands you your pants while he gives you directions to calculus class. People who have nightmares love him. The nightmares, well, not so much.

My old writer friend Jim Strickland and I are going to attempt something interesting to keep our productivity up: a chapter challenge. Starting February 1, we’re going to dare each other to get a certain amount of story down in a week, and then exchange that’s week’s worth of story for some quick critique. He’s working on the sequel to Brass & Steel: Inferno and needs a gentle noodge. I need one too, though sometimes what I really need is a two-boot noodge right in the glutes. Neither of us has ever done anything quite like this before. I’ll post reports here as things happen.

Even the do-it list has yielded some things that are actually fun, including a bit of metalwork to make an aluminum grating for my particle board shelves to rest on out in the pool shed (against the several times a year when a hard rain gets under the door and soaks the floor) and mounting some Elfa hardware on the opposite shed wall.

Drilling three 8′ pieces of U-channel for the grate took a little finesse in my slightly cramped workshop. The drill press is where it is (close to the center of the space) for a reason. (See the photo at the top of this entry.) The next major project (as time allows) is getting a solid ground for my station and antennas. I have an 8′ ground rod. I need some bentonite, and a post hole digger. After that, le RF deluge…

Dipping Back Into Delphi with List & Label 22

I haven’t done a lot of programming for the last couple of years, and I miss it. Interstate moves and oxygen starvation will do that to you. I’ve converted some of my old Delphi apps to Lazarus, which in truth wasn’t hard and probably can’t be called programming with a straight face. And I have a project that I need to get back to, even if it has to be written in Delphi 7, which is the most recent version that I have. (Turbo Delphi doesn’t count.) I no longer had a publishing company after Delphi 7 appeared, so post-2002 I dropped off their reviewers list. And $1,400 is a little steep for hobby programming–much less $4700 on the high end.

For some years I’ve been poking at the concept of a personal medical database. I’m old now (how did that happen??!?) and I take pills and get bloodwork and monitor various things to make sure none of my component parts are rusting out. I have Word documents full of notes, and scribbles on paper calendars, all of which really need to be pulled together into one searchable and reportable database. Some doctors won’t believe that my blood pressure does not respond to sodium. I have proof. I’ll bet, furthermore, that it will be a lot more convincing if it’s placed in their hands as a professional-looking report.

All of what I’ve done so far has been in Lazarus, and most of that has been small proof-of-concept lashups, none of them newer than 2012. However, a marvelous report generator product has crossed my desk, and I want to give it a shot with my medbase app. The product is List & Label 22, from Combit, a small firm in southern Germany. It has God’s own kitchen sink of features, many of them related to Web programming, which I simply don’t do. However, it has all conventional reporting options I’ve ever heard of well-covered, and it supports all versions of Delphi back to D6. (It supports Visual Studio and many other dev platforms as well.)

It doesn’t support Lazarus, alas. So I’ll be trying it out in D7.

The big win (for me at least) is that L&L 22 provides a report designer in VCL component format that drops on a form and becomes part of your application. This allows end users to design their own reports. Given that my end user is me, I don’t have to worry about end users doing gonzo things. I’ve always liked my software to exist as One Big Chunk (DLL hell, and all that) so this is right up my alley.

I don’t yet know precisely what reports I’ll want, and it may be the case that I won’t know until I actually need one for a specific purpose, like laying out my data indicating that salt is irrelevant to my blood pressure. Having a report designer right there in the app means that I can design the report that I need when I need it, and not try to anticipate every damn thing I’ll ever want while I’m building the program itself.

I should make it very clear here that I don’t dislike modern Delphi. I still love it, but it’s gotten enormously expensive, and the Starter Edition does not include database programming features. My other reason for using Lazarus is that I still intend to write intro-to-programming books using Pascal as the teaching language. Expecting students to pay even $250 for the Delphi Starter Edition is asking a lot, and worse, I intend to teach database work as well as conventional programming.

I’ll have more to say about List & Label as I learn it. Ditto the medical database itself, which is now a set of tables full of test data and a couple of conceptual UIs. Stay tuned.

Gatebox Waifu, and More of the Lotus Machine

Somebody I follow on Twitter (don’t recall who) posted a link to a video about a new product out of Japan called Gatebox. It’s a little round 3-D video display roughly the size and shape of a coffee machine. An anime character lives in the display and has what seem like reasonable conversations with the user. It’s like Siri or Cortana on video, and it stirred some very old memories.

I’ve been thinking about AI since I was in college forty-odd years ago, and many of my earliest SF stories were about strong AI and what might come of it. Given how many stories I’ve written about it, some of you may be surprised that I put strong, human-class AI in the same class as aliens: not impossible, but extremely unlikely. The problems I have with aliens cook down to the Fermi paradox and the Drake equation. Basically, there may well be a single intelligent species (us) or there may be hundreds of millions. There are unlikely to be four, nine, seventeen, or eight hundred fifty four. If there were hundreds of millions, we’d likely have met them by now.

With AI, the problem is insufficient humility to admit that we have no idea how human intelligence works at the neuronal level, and hence can’t model it. If we can’t model it we can’t emulate it. Lots of people are doing good work in the field, especially IBM (with Watson) and IPSoft, which has an impressive AI called Amelia. (Watch the videos, and look past her so-so animation. Animation isn’t the issue here.) Scratchbuilt AIs like Amelia can do some impressive things. What I don’t think they can do is be considered even remotely human.

Why not? Human intelligence is scary. AI as we know it today isn’t nearly scary enough. You want scary? Let me show you another chunkette of The Lotus Machine, from later in the novel of AI that I began in 1983 and abandoned a few years later. Corum finds the Lotus Machine, and learns pretty quickly that pissing off virtual redheads is not a good idea, especially redheads whose hive minds ran at four gigahertz inside a quarter billion jiminies.


From The Lotus Machine by Jeff Duntemann (November 1983)

Corum tapped the silver samovar on his window credenza into a demitasse, and stared at the wall beyond the empty tridiac stage. So here’s where the interesting stuff starts. The crystal had been in the slot for several minutes, and the creature within had full control of the stage. Pouting? Frightened?

“Go in there and take a look around, Rags.”

“Roger,” Ragpicker replied, and a long pulse of infrared tickled the stage’s transducer.

At once, the air over the stage pulsed white and cleared. Life-size, the image of a woman floated over the stage, feet slack and toes pointed downward like the ascending Virgin. She was wrapped in pale blue gauze that hung from her hips and elbows in folds that billowed in a nonexistent wind. Her hair hung waist-long, fiery red in loose curls. One hand rested on one full hip. The other hand gripped the neck of a pitiful manikin the size of a child’s doll. The manikin, dressed in rags, was squirming and beating on the very white hand that was obviously tightening about its neck.

“He bit me, Corum. I don’t care for that.” The woman-image brought up her other hand and wrung the manikin’s neck. “We don’t need a go-between.” That said, she flung the limp figure violently in Corum’s direction. The manikin-image vanished as soon as it passed over the edge of the stage, but Corum ducked nonetheless. Corum stood, marveling. He took a sip from his demitasse, then hurled it through the image above the stage. The little cup shattered against the wall and fell in shards to the carpeting. A brown stain trickled toward the floor. The woman smiled. Not a twitch. “No thanks, Corum my love. Coffee darkens the skin.”

“I never gave the Lotus Machine a persona.”

The woman shrugged. “So I had to invent one. Call me Cassandra. Shall I predict your future?”

“Sure.”

“You will become one with me, and we will re-make the world in our image.”

Corum shivered. “No thanks.”

She laughed. “It wasn’t an invitation. It was a prophecy.”

Odd Lots

Odd Lots

Using Ancient Software Under Win7

I had a need to print out a few calendar pages today, and after thinking about it for a second, I realized that there was a calendar program of some sort on a pile of ancient CDs in the closet that I had not yet dumped. I had actually thrown out a lot of CDs already because they failed to run under Win7, including a few things that I had sorely missed at upgrade time, like the software that came with two of my three scanners. (Thanks to God and all the fates that there is a VueScan X64 that understands both scanners.)

I dug in a box and there it was: Broderbund’s Calendar Creator 7, copyright 1999. It indicated that the software was for Win9x and NT4. I never remember installing it, and honestly don’t recall how it came to me. I have accepted dead or dying computers from other people who had no idea where to take them and didn’t want to just put them out on the curb. Some of these machines came with cardboard boxes full of odd and often broken stuff, with an alluvial layer of software CDs on the bottom. I’m guessing that this was one of them.

So hey, wotthehell: I popped it into my Core 2 Duo/Win7 lab machine, fully expecting it to fail to either install, run, or both. It installed. And it ran.

Once.

However, during its first run it actually created a calendar for me, and printed several pages as a test. I edited the page layout a litle bit and printed the three months that I needed. Then I closed the program and went on to other things. A couple of hours later I realized I needed one more month, but when I tried to run it again, it croaked.

I would have shrugged and tossed it, except that it did run once, launched by the installer as soon as the installer had finished with it. Hmmm. Since installers have to have admin permissions to do their jobs, this made a certain amount of sense, and suggested that if I could run the app as admin, it should work. I gave it admin permissions. It worked.

The 16-bit colors look a little weird, but it runs full-screen at 1600 X 1200 with only one glitch: Print preview doesn’t quite reflect reality. Screens that big didn’t exist in 1999, so I can forgive it that much. It did the job I needed, didn’t cost anything, and as best I can tell didn’t mess anything else up. (That’s not universal, and it’s why I always install things first on a lab machine or a VM. At least do a restore point before you install weird stuff like this.)

If you ever find yourself in this situation, here’s how you run old software as admin:

  1. Right-click the shortcut to get the context menu.
  2. Select Properties.
  3. On the Shortcut Properties dialog, select the Shortcut tab.
  4. Click the Advanced button.
  5. Check the “Run as administrator” checkbox.
  6. Click OK.

Keep in mind that not all ancient software will be this cooperative. A lot of old stuff won’t run at all, or even install. However, it’s useful to try running it as admin before you flip the CD into the trash.

I may still go looking for a modern calendar program. However, it was a good memory jogger, and made me acknowledge that whoever wrote that thing did a very good job of anticipating the future. This is not universal programmer behavior, trust me, and I am not exempt: A DOS program listing utility I wrote in Turbo Pascal in 1985 or so would run in a DOS box in NT4 and Win2K…but after 1999 passed into history, it labeled the printouts as occurring in the year 19100. So it goes.

Review: Junk Box Arduino

Junkbox Arduino Cover - 500 Wide.jpg

Junk Box Arduino appeared earlier this summer from Jim Strickland, and I’ve been dipping into it gradually as time allows. In case you’re TL’DRing on me, I’ll give you the money quote: This is in fact the Assembly Language Step-By-Step of Arduino-based electronic tinkering. I’m a good test case: I’m passionate about electronics (some of you have seen my junkbox, which now fills one smallish garage and our repurposed tack house) and I have an Arduino board on my Heathkit ET-3200 logic breadboard box. Decades ago I did some modest embedded work with the RCA COSMAC CPU line, the most important of which was my robot, Cosmo Klein. Before that I did a lot of things with CMOS and TTL, using Don Lancaster’s books as guides.

Jim’s book is how you begin with Arduino if you have some grasp of computing (as most people do these days) but not electronics. And the book is the polar opposite of academic electronics texts with lots of equations but few photos and nothing at all in terms of bench smarts. The grit and grime of practical electronics is everywhere here: This is the first electonics book I’ve ever seen with warnings like jumper cables wear out. They do, and trying to troubleshoot a visually intact but electrically open jumper is a circle of Hell that I’ve visited more than once, in both digital and RF electronics.

Junk Box Arduino goes all the way down to the (literal) metal, and explains how to build an Arduino-compatible circuit right on a broadboard block. You don’t buy a Cestino board; Cestino (which is Italian for “recycle bin”) isn’t a board, but rather an original design from Jim that you wire up yourself out of loose parts, including an ATmega 1284P CPU chip and a 20 MHz can oscillator. Building the Cestino is in fact the first electronics lesson in the book, with Ohm’s Law looming large. The second lesson is building your own in-system programmer (ISP) so you can program the ATmega chip’s bootloader yourself. No, this isn’t a waste of time. Once you build your own ISP you will know how an ISP works, and teaching you how things work is Jim’s mission throughout the book.

The projects run from the simple and obvious (but still necessary) things like flashing an LED all the way up to highly sophisticated circuits like an ATA disk device reader, a Flash programmer, and even a Z80 CPU lashup that teaches how CPUs and memory work by letting the Cestino control the Z80 and allowing us to look at registers and memory while the Z80 executes slowly or pauses in its tracks. Along the way Jim explains assembly and machine language, object-oriented programming, transistor operation, serial communication, and much else.

Which leads to my only real complaint about the book, which has nothing to do with the writing and may be an old-guy thing: The type is fairly small and there is a great deal of material on the pages. This is really a 600-page book laid out in 400 pages, and I understand why with the sanguine clarity that comes of bloodying your own fingers (which I have) trying to get unit costs on books down.

Don’t let that stop you. The book is a helluva deal for $35 ($22 on Amazon.) It’s one of a bare handful of technical books that I wish I had published back when I was still a publisher. If you have any hopes of making an Arduino control anything electronic, this is a must-have. Highly recommended.

It’s Here: Learning Computer Architecture with Raspberry Pi

RPiBookCover-500Wide.jpg

I had just tossed a salmon filet on the barbie yesterday evening when the UPS man rang the doorbell. There it was: an author case of a book I signed in 2013, finished in early 2014, and have been waiting for ever since. I confess there were times I approached despair and thought the publisher might cancel it, but the concept had legs, and (more important than legs) Eben Upton was behind it.

It’s not all my own work. My co-authors include Ralph Roberts, Tim Mamtora, Ben Everard, and Eben himself. I wrote Chapters 2-7, which entailed about 100,000 words and 90 hand-drawn technical figures. (My chapters come to about 300 pages out of the book’s 507.) Eben wrote a few thousand additional words in my chapters on things that I don’t know well, like compiler internals. (I’m sure he contributed to other chapters too.)

The publisher hasn’t done an especially good job positioning the book, and it’s already being reviewed badly by people who thought it was something other than what it is. So let me position it for you.

Learning Computer Architecture with Raspberry Pi is an introduction to computer architecture for senior high students, and bright junior high students. It’s not a university-level treatment, though it might have application in community colleges. Like the Raspberry Pi itself, it was designed to be affordable to young people, and so it’s not 1,000 pages long. The cover price is $30 (exactly, no .95s or .99s!) and you can get it on Amazon for the inexpensive if peculiar sum of $18.07. It’s not a standalone manual for the board, nor programming the board, nor learning any given language or operating system. It’s about what all the pieces are, and how they work together.

This is important. Today’s young people are digital natives, in that there were cheap desktop computers, lots of them, since before they were born. Kids who are interested in computers have studied and experimented with those parts of the computer that interest them. This is the sort of learning that trips up autodidacts, since it runs very deep in places, but is shot full of holes, some of them huge. The way to fill those holes is to take a survey course, and that’s precisely what this book is for. The course syllabus itself may not exist yet, but I have a hunch that a lot of educators in a lot of places are already hard at work on curricula using the book as the primary text.

People who have read my other books will recognize the approach I took in these chapters: Start at Square One, at the absolute beginning, and tell readers up front that they can skip a chapter if they discover early on that they’re already familiar with the material. Chapter 2 is titled “Recapping Computing,” which goes back to the idea of “a box that follows a plan,” and continues from there. Some people will skip that chapter. Many won’t. A few may be annoyed that it exists at all. (There’s no pleasing some people.) Once you get past Chapter 2, each chapter is much more focused, and covers a specific continent on the larger world of computing:

2: Recapping Computing

3: Electronic Memory

4: ARM Processors and Systems-on-a-Chip

5: Programming

6: Non-Volatile Storage

7: Networking

Chapters 8-12 were written by others, and provide a Raspberry-Pi specific slant on things, especially graphics and I/O. I had not seen those chapters until yesterday, so I can’t say a whole lot more about them just yet. A cursory glance suggests that you won’t be disappointed.

That’s pretty much the story. I had something additional in mind that I didn’t talk about while I was writing my chunk of the book back in 2013: homeschooling. I wanted the treatment to be so clear and comprehensible that parents could use the book in a homeschool environment. I think I succeeded, but I won’t know until I hear from a few homeschoolers. Sooner or later, that’ll happen.

I needed a book like this back in 1970, but of course, it didn’t exist. Computers themselves were mysterious, and the computer gatekeepers seemed to like it that way. Not me. Nothing should stand between people who want to learn and what they want to learn. Nothing. If my lifetime mission as a nonfiction writer could be stated in just a few words, that would be it. I loathe elitism, credentialism, and exclusive-club-ism. I learned stuff, I wrote books about it, and now you can learn it too. If you haven’t started learning about computers yet, well, this is a pretty good time to start. And forgive me for saying so, but this is a pretty good book to start with.

Go for it!

Odd Lots