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

Friday, December 17, 2021 No comments

If the Kludge works, use it

Kludge. Jury-rig (or the variant, jerry-rig). Lash-up. Sunshine Engineering (named for Mr. Sunshine, who bodged lots of things together that I had to straighten out later). Whatever you call it, including the racist ones nobody should have used in the first place, it’s (so the dictionary says) “an ill-assorted collection of parts assembled to fulfill a particular purpose.” Sometimes, the kludge is a necessity; a critical piece of equipment failed, deadlines are looming, and there’s no way to run to a nearby store to find what you need.

So… last week, someone called the wife. Her video business, that hasn't had any significant income in two or three years, still has a listing the in the Yellow Pages. “Can you put VHS video onto DVDs?” As she has done that before, she took the gig. Last time, we hooked a VCR into her commercial-grade DV deck and rolled tape. This time… not so much. The deck wouldn’t stay powered up, and wouldn’t open the tray (she was just passing through, but wanted the tape in there to be out so it wouldn’t interfere). She opined the deck got fried by one of the close lightning strikes we’ve had from time to time, and I couldn’t dismiss the possibility. Meanwhile, I was trying to find our cache of RCA-to-BNC adapters. We found plenty of the BNC-in/RCA-out types, but we needed the opposite. Mal-Wart dot commie carries them, but “not sold in stores.” The Mighty Zon could get us some by Thursday… it was Tuesday, and the wife was in DO SOMETHING NOW mode because she wanted to wrap this up by Friday. But with the DV deck apparently fried, there wasn’t any urgency to get the connectors anyway.

Seems to work fine for old VHS tapes
But! As the wife snarled something about taking her client’s tapes back to her, I remembered finding something else when looking for the adapters: my old Canon ZX-80 camcorder. When I say old, I mean I took footage of The Boy’s high school football games, so at least 15 years. Probably more like 17. The imager crapped out on it a long time ago, but I kept it around because I could at least play tapes into a Firewire connection, view on a tiny screen, or a bigger screen if I plugged in the included DV cable. In other words, it could do everything but take video itself. Being a tech writer, I kept the manual with the camcorder. There were lots of functions I never explored, and just in case…

Well, just in case arrived Tuesday night. I went down the table of contents, and found the vindication of my packrat ways on page 84: Converting Analog Signals to Digital Signals (Analog/Digital Converter). In this mode, you:

  • connect a VCR to the camcorder’s DV cable
  • connect a Firewire cable to the Mac
  • start capture on the Mac, play the tape, and relax
Sure, it’s a kludge, but time was tight. We have better camcorders, but I didn’t have time to find the manuals to figure out how to use them as video digitizers. Here, we hit Snag #2 (or is it #3? I lost count quickly): Final Cut Pro wasn’t capturing the video, or even seeing it. Looking at the documentation, I guessed FCP was too snooty to deal with an early-century consumer camcorder. So I tried iMovie, and iMovie told me:

(link to original)

So I guess iMovie is friendlier to the older, not so well-heeled, camcorders of the world. Since FCP has no problem importing iMovie assets, we were on the way.

Or so I thought. Snag (int(rand()*4))+3 came in this afternoon. Wife was again ranting about giving up and taking the tapes back to the client, because she couldn’t burn a DVD. I seem to remember us using Compressor to create MPEG-2 video, then using Toast to burn that, but we couldn’t remember the incantations and she wasn’t inclined to take the extra step. So I started troubleshooting. The DVD Burner app icon started bouncing, so I clicked it. “Couldn’t burn (click here for more information).” Clicking the helpful link told me what the initial “insert dual-layer disc” message should have told me in the first place: the video was too long to fit.

Solution: cut the video to 80 minutes so it fits on a DVD. Splitting video and moving it around is one of FCP’s strong suits, so the wife got to work on it.

As I type (10:30pm Friday evening), she has all the video on the system, and two or three DVDs burned. She’s behind schedule, but has a clear path to completion.

If the kludge works, use it… at least until you get a more elegant solution in hand. We’ll look into replacing the DV deck—looks like we might find something that works for around $400—and if she’s going to start back on her video work, it will pay for itself soon enough. Then, maybe, we can look at modernizing the intake end of things (i.e., the commercial-grade camcorders that are at least as old as that ZX-80). As I understand it, a lot of the newest models skip the tape drive and go directly to a SD card with some enormous amount of capacity. If that’s true, importing would mean sticking the SD card into the back of the iMac and copying the file. At that point, who needs a DV deck?

Tuesday, December 07, 2021 No comments

Computer-Aided Weeding

A couple weeks ago, I finally decided to start pulling in all the notes I’d saved up from Evernote and Google Keep into Logseq. I started with Evernote, just because.

First, I had to update the Evernote app on my iMac, so I could actually access my stuff. That should tell you how long it’s been since I actively used it.

After exporting, I used a utility called Yarle to convert the notes in each notebook to Markdown.

Now the hard part: deciding what I wanted to keep, and what to toss. The even harder part: cleaning up the sloppy mess that were most of those individual pages. There were over 400. Cleaning them up in Logseq was do-able, but slow. Lots of repeated stuff. This wasn’t a job for an outliner, it was a job for a high-powered text editor like Vim or Atom.

Unlike Vim, Atom sports a sidebar that displays all the files in the directory, and its regular expression parser recognizes newlines. So I could find blank strings using the expression ^- *\n (which means, “look for a line starting with a dash, followed by zero or more spaces, then a new line”) and get rid of them.

But the even bigger time-saver: realizing a lot of those entries were long outdated (some dated back to 2013) and deleting them. By the time I was done with that pass, I had 109 “keepers” left. From there, it was a matter of applying search and replace to fix common issues.

So with 3/4 of the pages deleted, and much of the boilerplate stuff from the remaining pages deleted as well (I just need the content, the source, and some info about the author). That means my assets folder has 4852 items in it, and most of them were no longer being linked to.

Now… am I going to make 4852 passes through my pages, by hand, to see if a pic can be deleted?

The shell (aka Terminal) is my machine gun for blasting a job like this.

# assume we're in the assets directory

mkdir -p ../assets_removed

for i in *; do

  grep -q "$i" ../pages/* || mv "$i" ../assets_removed


Let’s pick this apart, for those who need it.

The first line is just a comment. An important one, all the same. You need to be in your Logseq database’s assets directory for this to work correctly. BAD THINGS will happen otherwise! One of the nice things about using MacOS: if I eff something up, I can pull it out of the Time Machine backup and try again.

Next, we make a directory called assets_removed at the same level as the assets directory. Just in case we make a mistake, you know. The -p option is there to make the script shrug and move on if the directory already exists (if we’ve been here before, for example).

The third and fifth lines begin and end a loop, going through each of those >4800 graphic files.

Inside the loop, we search for the file name in the pages. The -q option is exactly what you want for a script like this; it returns success if grep finds the string and failure otherwise. The || (two vertical bars) means “execute the next part if it fails” (in this case, fails to find the file name)… and the next part moves the unused file to the assets_removed directory.

And I ended up with 255 files (out of nearly 5000) that were actually being used. The other ones are out of the way, and can be safely deleted once I verify that none of them are needed.

[UPDATE: After stepping through the pages again, I found 18 “false negatives” that had to be dragged back into the assets folder. That’s why you move them out of the way, instead of just nuking them.]

It took about a minute to grind through the assets directory, and a couple of minutes to set up the script, but that beats the heck out of hours (or days) doing it by hand! I’m fond of saying, I’m lazy enough to get the computer to do my work for me. It doesn’t always pay off this big, but it does pay off.

Off to get the Google Keep notes…


Related Posts Plugin for WordPress, Blogger...