Detect text on image using tess4j library on linux

Detect text on image using tess4j library on linux

Tesseract OCR library is the best way to detect text on image. Let's start with Java spring boot project.



- Step 1: Download template spring boot project on: https://github.com/habogay/spring-boot-gcp

- Step 2: Install tesseract otc:

sudo apt-get install tesseract-ocr

  - Step 3: create environment in tool (I use eclipse): TESSDATA_PREFIX=/usr/share/tesseract-ocr/tessdata/

- Step 4: Use Tesseract: 

String rs="";

ITesseract tess = new Tesseract();

 try {

    // Specify trained data folder

    // tess.setDatapath("./tessdata");

    // Specify detected language 

    tess.setLanguage("eng");

    File img = new File("/home/habogay/Desktop/lh.png");

    rs = tess.doOCR(img);

    model.addAttribute("rs", rs);

    System.out.println(rs);

  } catch (Exception e) {

        System.out.println(e.getMessage());

  }


source code: https://github.com/habogay/fb-controller

Done :d

Running on Docker-Compose

Running on Docker-Compose

 Today, i will share you how to create and run Docker-Compose.


First, do you know about Docker-Compose :D. 

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

In this application, use the Flask framework and maintain a hit counter in Redis. 

Configuring Apache Maven for use with GitHub Packages

You can configure Apache Maven to publish packages to GitHub Packages and to use packages stored on GitHub Packages as dependencies in a Java project.

It solves to return the data type in micro service model when call the others services.


You can follow by steps:

* Build

- Step 1: Authenticating to GitHub Packages

You use a personal access token with the appropriate scopes to publish and install packages in GitHub Packages.

- Step 2: create new file or edit file (if it exist) setting.xml

Note: 

+ Ubuntu/Linux: vim ~/.m2/settings.xml

+ Win: path:\Users\user\.m2\setting.xml (c:\Users\JVMD\.m2\settings.xml)

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
          <id>yourPackage1</id>
          <name>GitHub OWNER Package1 Maven Packages</name>
          <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>your username in github</username>
      <password>your personal access token</password>
    </server>
  </servers>
</settings>

- Step 3: Publishing a package

In your project, edit pom.xml file. 

<distributionManagement>
   <repository>
     <id>yourPackage1</id>
     <name>GitHub OWNER Package1 Maven Packages</name>
     <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
   </repository>
</distributionManagement>

- Step 4: deploy

mvn deploy

* Installing a package:

- Step 1: go to your project and edit pom.xlm file

<dependencies>
  <dependency>
    <groupId>com.example</groupId>
    <artifactId>test</artifactId>
  </dependency>
</dependencies>

- Step 2: run

mvn install

Reffer: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-apache-maven-for-use-with-github-packages#authenticating-with-a-personal-access-token

Done. It's simple.

Install, Use and Demo the project for Spring Boot Docker using Google Cloud Build service

* Introduction Docker

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Fastest way to create smart contract erc20

Today, I will share with you how to create smart contract erc20.

So, what is the erc20? 
An ERC20 token is a blockchain-based asset with similar functionality to bitcoin, ether, and bitcoin cash: it can hold value and be sent and received. ERC20 is an official protocol for proposing improvements to the Ethereum (ETH) network. ERC stands for Ethereum Request for Comment, and 20 is the proposal identifier. This is a common standard for creating tokens on the Ethereum blockchain.

Let's start.

Up and Running Spring Boot Project in 28 seconds

Up and Running Spring Boot Project in 28 seconds

Prerequisites:

- Jdk 8+
- Maven or maven wrapper
- Mac: brew install maven
- Linux: sudo apt install maven
mvn clean package spring-boot:run
http://localhost:8080/