Tesseract OCR: ParamsModel::Incomplete line

Using Tesseract OCR for some automation tasks, I stumbled upon the following issue:

Creating OCR Image #1/4 with maximally 97 lines from line 1 to 97
ParamsModel::Incomplete line
ParamsModel::Incomplete line
ParamsModel::Incomplete line
ParamsModel::Incomplete line
ParamsModel::Incomplete line ConvNL

As it turns out, this is caused by using a wrong version of tesseract models / „Tessdata“. You can find the official „Tessdata“ files on GitHub. As I installed Tesseract on macOS via Homebrew, I ended up with version 3.05.01 of Tesseract. Therefore I had to use an older version of the trained models. As stated in the project’s README, you can find those via the 3.04.00 tag (README says branch, but that is wrong):

Get language data files for Tesseract 3.04 or 3.05 from the 3.04 tree.

E.g. for the german model, you would end up with the following download link:

https://github.com/tesseract-ocr/tessdata/raw/3.04.00/deu.traineddata

CocoaPods can’t reach GitHub

Running CocoaPods on “old” versions of OS X / macOS might lead to some weird behaviour – namely CocoaPods telling you that GitHub might be down:

$ pod repo update --verbose

Updating spec repo `master`
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down

/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.3.1/lib/cocoapods-core/github.rb:105:in `rescue in modified_since_commit'
[...]

The error message does not only sound insane, it is actually completely misleading. The issue seems to be caused by a failing request to GitHub. Originating from a failed TLS handshake (as it happens quite often with the older Ruby 2.0.0 version). More recent versions of Ruby don’t have a problem with communicating via SSL. Using a more recent Ruby version does in fact circumvent the issue:

brew install ruby
sudo gem install cocoapods

Depending on your system, you might need to forcefully “overwrite” the Ruby installation using brew link:

brew link --overwrite ruby

Further references

Installing Delve on OS X / macOS fails

While trying to debug Go scripts with Visual Studio, I stumbled upon issues configuring Delve on macOS. Delve is a full featured debugging tool for the Go programming language and Visual Studio Code seems to make us of it. Unfortunately the installation might not be as straightforward as described in the official installation documentation. The Brew installation fails while / after generating certificates:

==> Installing delve from go-delve/delve
==> Downloading https://github.com/derekparker/delve/archive/v1.0.0-rc.2.tar.gz
Already downloaded: /Users/beematik/Library/Caches/Homebrew/delve-1.0.0-rc.2.tar.gz
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
==> Generating dlv-cert
==> openssl req -new -newkey rsa:2048 -x509 -days 3650 -nodes -config dlv-cert.cfg -extensions codesign_reqext -batch -out dlv-cert.c
==> [SUDO] Installing dlv-cert as root
==> sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dlv-cert.cer
Last 15 lines from /Users/[...]/Library/Logs/Homebrew/delve/02.sudo:
2017-12-31 11:52:35 +0100

sudo
security
add-trusted-cert
-d
-r
trustRoot
-k
/Library/Keychains/System.keychain
dlv-cert.cer


If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/go-delve/homebrew-delve/issues

These open issues may also help:
Upgrade to delve fails https://github.com/go-delve/homebrew-delve/issues/20

Whatever the reason of this issue might be, there is a suitable workaround available:

cd $HOME/Library/Caches/Homebrew
tar xf delve-*.gz
cd delve-*
sh scripts/gencert.sh
# Type in your sudo password
brew install go-delve/delve/delve

References

  • https://github.com/derekparker/delve/blob/master/Documentation/installation/osx/install.md
  • https://github.com/go-delve/homebrew-delve/issues/19#issuecomment-330442033

Affected System

  • OS X El Capitan 10.11.6
  • Homebrew 1.4.1
  • Delve 1.0.0-rc.2

Building OpenCL on macOS: CL/cl.h not found

Compiling a third party project on macOS, I stumbled upon the following compilation error after running make:

Scanning dependencies of target[...]
[ 33%] Building CXX object CMakeFiles/[...].dir/main.cpp.o
In file included from /Users/[...]/main.cpp:11:
/Users/[...]/CLCalculator.h:14:10: fatal error: 'CL/cl.h' file not found
#include <CL/cl.h>
         ^
1 error generated.
make[2]: *** [CMakeFiles/[...].dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/[...].dir/all] Error 2
make: *** [all] Error 2

Unfortunately the application was originally not intended for macOS / OS X platforms. There are quite some examples of similar encounters in the vastness of the internet. But… there is a simple way to make your the respective code cross-plattform and compatible with macOS / OS X:

#if defined(__APPLE__) || defined(__MACOSX)
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif

Just replace the #include <CL/cl.h> statement with the snippet above and run make again – great…