Author: admin

  • PHP configure: error: xml2-config not found. Please check your libxml2 installation.

    On Ubuntu:

    sudo apt-get install libxml2-dev

    On CentOS/RHEL:

    sudo yum install libxml2-devel

  • composer error /usr/bin/env: php: No such file or directory

    Error when running composer:
    composer
    /usr/bin/env: php: No such file or directory

    Probably, php-cli is not installed. Try:
    Centos:
    yum install php5-cli
    Ubuntu:
    sudo apt-get install php5-cli

    More probably, php5-cli is installed but not found in $PATH. Find out where is the php/bin folder and try:
    export PATH=”$PATH:/path/to/php/bin”

  • Tsung 3900- fatal: expected_entity_reference_semicolon 2764- fatal: error_scanning_entity_ref

    Error when running load test with tsung:

    3900- fatal: expected_entity_reference_semicolon
    2764- fatal: error_scanning_entity_ref
    Config Error, aborting ! {fatal,
    {error_scanning_entity_ref,
    {file,”tsung.xml”},
    {line,100},
    {col,80}}}

    Solution: Tsung does not like & and always seeks for & amp;
    Replace & with & amp; in any URL/input data in the xml file

  • Error installing SQL Server Database Engine Services Instance Features: Wait on the Database Engine recovery handle failed

    Error when install MS MSQL:
    Error installing SQL Server Database Engine Services Instance Features
    Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.

    Solution:
    When you come to Server Configuration Screen, Change the Account Name of Database Engine Service to NT AUTHORITY\NETWORK SERVICE and continue installation and it will successfully install all components without any error.

  • Vagrant locks each machine for access by only one process at a time

    When aborting vagrant up command, the ruby process in Windows may not be killed, causing other further vagrant command failed with the error ‘Vagrant locks each machine for access by only one process at a time’

    Solution: Open Task Manager, find all ‘ruby.exe’ under Process Tab and kill them.

  • /bin/bash^M: bad interpreter: No such file or directory

    When copying a shell script from Windows to Linux and execute it:

    /bin/bash^M: bad interpreter: No such file or directory

    Solution: Remove \r:

    sed -i ‘s/\r//’ scrip_file.sh

  • tesseract Unable to load unicharset file /usr/share/tesseract/tessdata/eng.unicharset

    Cause: the package for English language is missing.

    On Centos:

    sudo yum install tesseract-en

    On Ubuntu:

    sudo apt-get install tesseract-ocr-eng

  • tesseract check_legal_image_size:Error:Only 1,2,4,5,6,8 bpp are supported:16

    Error:

    tesseract test.tif output.txt
    Tesseract Open Source OCR Engine
    check_legal_image_size:Error:Only 1,2,4,5,6,8 bpp are supported:16

    Cause: tif image bits/sample value not in 1,2,4,5,6,8 or tif image is transparent with alpha value (Extra Samples: 1<unassoc-alpha>):

    tiffinfo  test.tif
      TIFF Directory at offset 0x7b6 (1974)
      Image Width: 145 Image Length: 39
      Resolution: 72, 72 (unitless)
      Bits/Sample: 8
      Compression Scheme: AdobeDeflate
      Photometric Interpretation: min-is-black
      Extra Samples: 1<unassoc-alpha>
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 2
      Rows/Strip: 39
      Planar Configuration: single image plane
      DocumentName: a.tif
      Software: ImageMagick 6.2.8 05/07/12 Q16
      Predictor: horizontal differencing 2 (0x2)

    Solution: convert tif to acceptable bit sample and remove alpha value:

    convert test.tif -background white -alpha remove -flatten -alpha off test.tif

    or convert to jpg and reconvert to tif again should remove alpha:

    convert test.tif test.jpg
    convert test.jpg test.tif

     

     

  • tesseract name_to_image_type:Error:Unrecognized image type

    Error:

    tesseract test.png output.txt
    Tesseract Open Source OCR Engine
    name_to_image_type:Error:Unrecognized image type:test.png
    IMAGE::read_header:Error:Can’t read this image type:test.png
    tesseract:Error:Read of file failed:test.png

    Cause: You are using tesseract version <=2.0.4

    Solution:

    1. convert png to tif:

    convert test.png -background white -alpha remove -flatten -alpha off test.tif

    2. Upgrade teeseract to latest version

     

     

     

  • Bash script to compare two files

    #!/bin/sh
    echo ‘Check Gemfile…’;
    if diff path/file1 path/file2 >/dev/null ; then
    echo ‘Same’;
    else
    echo ‘Different’;
    fi