The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,484 other followers

Archive for August 16th, 2021

UUOC apparently is/was a thing: useless use of cat

Posted by jpluimers on 2021/08/16

A while ago I bumped into UUOC: [WayBack] cat (Unix): Useless use of cat – Wikipedia.

For me the post important reason to choose between cat and a redirect is realising from the above article:

  • input redirection forms allow command to perform random access on the file, whereas the cat examples do not.
  • cat written with UUOC might still be preferred for readability reasons, as reading a piped stream left-to-right might be easier to conceptualize

I ended up at UUOC through [WayBack] bash – Calling multiple commands through xargs – Stack Overflow.

Invoking multiple commands with the same xargs parameter.

The above question also led me to two better solutions for my original xargs problem.

I liked both below solutions.

The first (by [WayBack] ckhan) uses sh as subshell and substitutes the parameter with a readable name.

The second (by [WayBack] shivams) uses a function which gets way more readable code when the command-line gets longer.

[WayBack] shell – xargs : using same argument in multiple commands – Unix & Linux Stack Exchange:

  1. you’ll want to explicitly execute a subshell:
    echo 95 | xargs -n1 -I_percent -- sh -c '[ _percent -ge 95 ] && echo "No Space on disk _percent% full -- remove old backups please"'

    Note also I’m using _percent instead of {} to avoid extra quoting headaches with the shell. It’s not a shell variable; still just an xargs replacement string.

  2. An alternative way, which is more readable, is to define a separate function which contains all your other commands and then call that function with xargs in a sub-shell.Hence, for example:
    myfunc(){
      [ "$1" -ge 95 ] && echo "No Space on disk $1% full -- remove old backups please"
      echo "Another command echoing $1"
    }
    
    export -f myfunc
    
    echo 95 | xargs -n1 -I_percent -- sh -c 'myfunc "_percent"'

–jeroen

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

Mikrotik CCR devices based on NAND memory will eventually die

Posted by jpluimers on 2021/08/16

If you own a Mikrotik CCR device based on NAND memory, then be prepared that it will die.

I had this on a (now discontinued [WayBack] MikroTik Routers and Wireless – Products: CCR1009-8G-1S-1S+PC, superseded by the less functional [WayBack] MikroTik Routers and Wireless – Products: CCR1009-7G-1C-1S+PC, which is also NAND based).

Many more people had this or very similar problems:

It also happens due to bad capacitors on the (also discontinued) [WayBack] MikroTik Routers and Wireless – Products: RB1200:

There have been quite a few NAND related changes to the firmware over the years that have to do with handling corruption:

If you are really lucky (I was not), then it is a bad power supply: [WayBack] bootloop on CCR1036-12g-4s (almost 5 years old) [SOLVED] – MikroTik.

Sometimes you can partially recover using the Console port or NetInstall, but eventually you will trip another part of the faulty NAND storage and it will die again, until it has spent all its lives.

Unlike a cat, those are usually far less than 9 lives.

If you do need to recover, the links might help you:

–jeroen

Posted in Internet, MikroTik, Power User, routers | Leave a Comment »

OCR on documents with Adobe Acrobat XI Standard

Posted by jpluimers on 2021/08/16

Steps to convert PDF to OCR on all pages in Acrobat XI Standard (STD) via [WayBack] PDF to text, how to convert a PDF to text | Adobe Acrobat DC:

  1. Open a PDF file containing a scanned image in Acrobat.
  2. Click on the Edit PDF tool in the right pane. Acrobat automatically applies optical character recognition (OCR) to your document and converts it to a fully editable copy of your PDF.
  3. Choose File > Save As and type a new name for your editable document.

Screenshots:

You can select from many OCR languages:

On pages without bitmap content, you see this message:

Only in Acrobat XI or older

Note that Acrobat XI was the last version where this was possible in the Standard edition.

More recent versions of Acrobat, need the Pro version for OCR:

Read the rest of this entry »

Posted in Adobe, Adobe Acrobat, Fujitsu ScanSnap, Hardware, ix100, Power User, Scanners | Leave a Comment »

 
%d bloggers like this: