The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Category: Software

General-purpose computers doing something specific

  • Useful Minicom Defaults

    I usually figure this stuff out for each minicom setup; now I can just refer here and get it right the first time.

    Run minicom -s the first time to set the internal configs:

    • Port typically /dev/ttyUSB0 for USB-serial adapter
    • 19200 8N1 for lack of anything smarter
    • No hardware flow control
    • Software flow control
    • Clear modem Init and Reset strings to blank
    • No DCD line
    • Set colors as below

    Your favorite colors will differ; these are Old-Skool:

    • Menu: white on blue
    • Status: black on cyan
    • Terminal: green on black

    Save that as the overall system default.

    Set command-line defaults in ~/.bashrc:

    • -m to use Alt+key rather than Ctrl-A and then the key
    • -c on to see those pretty colors

    Which will look like

    MINICOM='-m -c on'
    export MINICOM
    

    And then it Just Works…

  • OpenOffice 3.2 Graphic File Link Hackage

    OpenOffice normally stores graphic file links relative to the location of the ODT document file. It’s an option at Tools -> Options -> Load/Save -> General, where you check Save URLs relative to file system.

    That generally works well, as long as you keep all the graphics either in the same directory or in a subdirectory, which is our general practice. Note that this doesn’t apply if you embed the image files into the document, which works fine for one-pagers and dies horribly for lengthy graphics-intense documents.

    (Yes, I know OOo is not a page layout program. Sometimes other considerations get in the way. Work with me on this, OK?)

    It’s easy to confuse the program: copy the ODT file somewhere else and, shazam, the links either break or get weird. In a recent case, the links somehow wound up holding the entire path from the root directory through /home, down through an NFS mount, and out to the actual file. Not only was it un-pretty, the links basically didn’t work from any other account on any other machine because you really can’t reach through another user’s account to your files.

    This is tedious, at best, to fix up within OpenOffice, because you can’t do a find-and-replace on the file names.

    So.

    In OOo, click through Tools -> Options -> Load/Save -> General. Uncheck the Size optimization for ODF format option to force the XML file to become human-readable. Otherwise, OO stores everything as one huge line. While you’re there, make sure Save URLs relative to file system is checked.

    Save the file again to get readable XML.

    Create /tmp/work, copy the ODT file therein, apply unzip to it. That extracts the contents, including the all-important  content.xml containing your document’s text & links.

    Edit content.xml with the text editor (not a word processor like OOo!) of your choice. Bulk-change the garbage paths to something meaningful. For example, we had all the images in Tweaked, a subdirectory below the document directory, so the desired file links looked like ../Tweaked/image-file-name.jpg.

    Save the file and stuff it back into the ODT file using zip -vi document.odt content.xml

    That produced some odd error messages that didn’t seem to have any effect:

    	zip warning: undefined bits used in flags = 0x0808: layout-cache
    	zip warning: undefined bits used in flags = 0x0808: content.xml
    	zip warning: undefined bits used in flags = 0x0808: styles.xml
    	zip warning: undefined bits used in flags = 0x0808: Thumbnails/thumbnail.png
    	zip warning: undefined bits used in flags = 0x0808: settings.xml
    	zip warning: undefined bits used in flags = 0x0808: META-INF/manifest.xml
    updating: content.xml
    	zip warning: Local Entry CRC does not match CD: content.xml
    	(in=54496) (out=7765) (deflated 86%)
    total bytes=91294, compressed=17644 -> 81% savings
    

    OOo stores the file timestamps within the ODT file in UTC, confusing the daylights out of zip, which assumes they’re in local time. Being at UTC-4 right now, I couldn’t simply freshen or update a recently created ODT file.

    Copy the modified ODT file back where it came from, make sure the graphic files are where you promised they’d be, and open the document.

    Everything should be just fine.

  • OpenOffice 3.2 Graphics Cache Settings

    The default OpenOffice 3.2 graphics cache is probably large enough for ordinary documents. However, I put together a 9-page illustrated biography for a birthday party last year using (most likely) OOo 3.1 and that file dragged OOo 3.2 to its knees.

    The default cache settings are something like

    • 20 MB
    • 2 MB per object
    • 20 objects

    Crank those to

    • 256 MB
    • 5 MB per object
    • 50 objects

    Much better!

    I’m sure that depends on what you’re doing and how much memory your PC has, but when OOo gets really pokey on a graphics-intensive document, check the cache.

  • Epson R380 Printer: Resetting the Waste Ink Counters

    So a few days after topping off the continuous ink tanks on my Epson R380 printer, we had a series of thunderstorms that prompted me to turn everything off. Upon turning the printer back on, its fancy LCD panel showed a message along the lines of

    Service is required. Contact Epson Customer Service.

    Oddly, it continued to print perfectly with no further complaints. The error message appeared only at power-on, then politely went away when I pressed the OK button.

    Well, that puppy is long out of warranty, even if I wasn’t using a continuous ink system, soooo… what to do? The printer produces absolutely no diagnostic codes other than that error message.

    A bit of searching gave me the Maintenance Manual for that family of printers. That message isn’t among the ones listed.

    Further searching suggests that at least one of the two waste ink pads / tanks is nearly full and that ignoring the problem will cause the printer to shut itself down, lest it dribble ink. The listed messages warn that the printer is approaching the “end of its service life”, which isn’t the message I saw, but it’s close enough.

    The Maintenance Manual suggests that it’ll be cheaper and better to simply buy a new printer, as replacing the waste ink tanks may cost more than the printer is worth. The website points out that providing a customer-replaceable tank would drive up the cost of the printer, because most customers would buy a new printer before filling the tank.

    In order to get to the waste ink tank, you must remove:

    • Paper Support
    • Printer Cover
    • Front Cover
    • Right Housing
    • Left Housing
    • USB Housing
    • Upper Housing
    • Panel Unit
    • EMI Frame

    I can see why it might take a trained tech a few hours to get all that done… and then reassemble in reverse order.

    The Epson website has a link to a program that will reset the waste ink counters for one of the tanks. Downloaded & ran it on the Token Windows Laptop; it tells me there’s no problem.

    Hmmm

    So I ordered an external waste ink tank from the usual eBay supplier. The hardware is grossly overpriced ($20 delivered) for what it is (large tube with sealed endcaps, some tubing & barb fittings, a syringe), but the deal includes links to programs that will reset the counters. I found several of those programs by myself, so it’s not as if you must actually spend money to reset the printer’s counters. I figured this was in the nature of a learning experience.

    Turns out that the programs are provided by parties having, shall we say, long-term interests that may not coincide with mine. To wit, I’d be batshit crazy to run those programs on a PC I cared about.

    [Update: Something like that.]

    The various program files all passed a ClamAV virus scan, but that doesn’t mean anything these days.

    So, during the next hour:

    • Boot System Rescue CD on my oldest Token Windows Laptop
    • Run partimage to back up the Windows partition to another partition
    • Disconnect from the house LAN
    • Reboot in Windows, which evidently hasn’t seen the light of day in about a year
    • Stifle bleating requests for updates
    • Copy the programs from a USB stick, install as needed
    • Reset one of the ink counters (more on this below)
    • Reboot in SRC
    • Restore the partition from the backup

    All that is straightforward and I’ve written about it earlier. Search the blog for more info using the obvious keywords.

    I attempted to restore the drive’s Master Boot Record from the partition backup file, but partimage complained that the drive size in the backed-up MBR did not match the existing drive size, which suggests something tinkered with the drive’s MBR between the backup and the restore.

    Hmmm….

    You might want to do a bit of reading on Boot Sector Viruses at this point. I have no other evidence to suggest that’s what’s going on, other than to remind you that programs need not do only what they say they’ll do.

    Given all that, I figured this was a great time to update the Token Windows Laptop to Xubuntu 10.04, which installed Grub2 in the MBR and wiped away anything placed therein. The box is heavily multi-booted: Dell Diags, XP, Puppy, and now Xubuntu 10.04.

    Without naming names or providing links:

    • The Russian program seems to not include the R380, but it does include others in that family. I elected to not reset the counters using that program.
    • The Chinese program seems to be a bootleg copy of the Official Epson Adjustment Program, although it’s rife with misspellings and grammatical errors. I told it to reset the “Main Pad” counter and give me a dump of the EEPROM.

    The Main Pad had 16008 counts of the maximum 16200, while the Platen Pad had only 3019 of 54513. Those names do not correspond to anything in the Maintenance Manual, but I suspect the Main Pad is the Waste Ink Tray at the head-cleaning station and the Platen Pad is the Waste Ink Pad running across the printer to catch the overspray from borderless prints.

    Resetting the Main Pad counter to zero cleared the error message; the printer is perfectly happy now. I’ll install the external waste ink tank when I clear the workbench after building the next GPS interface for our HTs.

    The program reported 9922 pages printed. Figuring 7 bottles of ink at 250 ml each, that’s 0.18 ml per page. That’s a slight overestimate because the ≈50 ml tanks were just topped off, but it’s close enough. I’m guessing head cleaning consumed much of that ink, as the printer does plenty of that, and the number of pages seems close to half the number of counts.

    Perhaps it performs a cleaning when more than X minutes has elapsed since the previous print job? That would account for the high number of cleanings; most print jobs are a few pages, at most.

    En passant, I found some totally unofficial ink cartridge capacity numbers:

    • Standard T078x: 7 ml @ $13 = $1857 / liter
    • Large T077x: 11 ml @ $20 = $1818 / liter

    [Update: corrected typo from ml to liter]

    Ain’t that impressive? I love the savings they give you with higher-capacity cartridges …

  • How Not To Say Thank You

    Just got a nice thank-you email from the mumble organization after filling out a survey form…

    Thank you for taking the mumble Survey survey. Your input is very valuable to us in designing our program.
    <Delete or replace with a closing such as “Sincerely,”>
    <Delete or replace with an image of a signature>
    <Delete or replace with a text representation of a signature (e.g. “John Smith”), the title corresponding to signature (e.g. “President”), and the site name>

    OK, I appreciate their intent, but … it’s still a bit off-putting.

    Hint: always include yourself on the email list, perhaps as a BCC, when you’re setting up a new bulk response. Sometimes what you see on the proofreading screen isn’t what goes out over the wire.

    And I’m pretty sure that the “Survey survey” was put out by their Department of Redundancy Department…

  • Kmail to Evolution: Converting Maildir to Mbox

    A bit of searching produces this useful PHP routine, which almost worked. Two tweaks got it all the way there:

    • force the correct time zone
    • quote the write-mode parameter in fopen

    The changes, with line numbers in parens (line 347 was line 345 before the first change, OK?):

    76:  // force timezone
    77:  date_default_timezone_set("America/New_York");
    347: $this->mboxhnd = fopen($this->mboxfn,'w');
    

    After that, run the script as directed to convert the entire maildir tree in one fell swoop.

    cp -a /from-wherever/Mail/ /tmp
    cd /tmp
    php maildir2mbox.php Mail
    ll mboxfiles
    

    The output files appear in the mboxfiles directory adjacent to the top-level maildir directory. Don’t use the -e parameter, which would add a .mbox suffix to each file.

    Evolution’s import “feature” is a major pain, as you must import the converted files One. MBOX. File. At. A. Time. Sheesh.

    Rather than that, just slide the whole mboxfiles structure into place. Some case changes were in order for my setup, which may be due to historic considerations:

    • Drafts
    • Inbox
    • Outbox
    • sent-mail -> Sent
    • Spam (will become Junk in Evo)
    • Templates (not that I use any)

    Then put the mboxfiles directory somewhere on the NFS server and fiddle the Evolution directory structure:

    cp -ap mboxfiles /mnt/nfs-place/mail/
    cd ~/.evolution/mail
    mv local local.base
    ln -s /mnt/nfs-place/mail/ local
    

    Evolution will build all its indexes when it first sees the new files, so it’s all good.

  • XFCE vs Evolution vs Gnome Keyring

    So I thought I’d try Evolution, the Gnome email / calendar / messaging Borganism, which can allegedly support maildir files. Installation went swimmingly, but (at least at first glance) it can’t. More on this later.

    Evolution uses the Gnome keyring to store passwords, which is (of course) different from and incompatible with the KDE keyring. The principle seems to be that when you sign on / log in / whatever, the Gnome keyring’s login keyring automagically unlocks, giving Evolution access to the POP3 password used for your ISP. Except that didn’t work; Evolution uses the default keyring, not the login keyring.

    Evolution / Gnome evidently creates a default keyring entry by scraping up a password from somewhere unknown to me. The only way to clear it, at least in XFCE, without installing the entire mumble Gnome desktop, is to simply delete the keyring file… at which point, the keyring manager will ask you for a password and recreate the file.

    rm ~/.gnome2/keyrings/*