Search This Blog

Wednesday, February 26, 2020

Pytesseract Read a image and labeled or Rename as filename

import cv2
import os
import pytesseract
    from PIL import Image
except ImportError:
    import Image

pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'

#for x in range (1,1000): 
#    img_cv = cv2.imread(r'D:/Temp/Captcha/program/'+ str(x) + '.png')

folderpath = "D:/Temp/Captcha/program/"
for filename in os.listdir(folderpath):   
    img_cv = cv2.imread(r'D:/Temp/Captcha/program/'+ filename )
    # By default OpenCV stores images in BGR format and since pytesseract assumes RGB format,
    # we need to convert from BGR to RGB format/mode:
    img_rgb = cv2.cvtColor(img_cv, cv2.COLOR_BGR2RGB)
    imagetext = pytesseract.image_to_string(img_rgb)
    print (imagetext)
    # OR
    #img_rgb = Image.frombytes('RGB', img_cv.shape[:2], img_cv, 'raw', 'BGR', 0, 0)
    #imagetext = pytesseract.image_to_string(img_rgb)
    #print (imagetext)
    src =folderpath+ filename
    dst =folderpath+ imagetext + ".png"
    os.rename(src, dst)

save filenmae other than - Note: to avoid pytesseract.image_to_string not found error

AttributeError: module 'pytesseract' has no attribute 'image_to_string'

may be your python file name itself "pytesseract,py"

kindly rename it to new name like


Python - Download Captcha Images

import requests
import os
from random import randint

for x in range(100, 1000):
    url = ""
    payload = {}
    headers= {}
    response = requests.request("GET", url, headers=headers, data = payload)
    url = ""
    payload = {}
    response = requests.request("GET", url, cookies=response.cookies)
    f_ext = x
    f_name = 'D:/Temp/Captcha/{}.png'.format(f_ext)
    with open(f_name, 'wb') as f:
    print("Iteration : " + str(x) )

print( "Done !")

Tuesday, February 18, 2020

Joomla ERROR: The archive file is corrupt, truncated or archive parts

Open configuration.php

public $tmp_path = '../tmp';
public $tmp_path = 'tmp';

TO [add slash only]
public $tmp_path = '/tmp';

How to disable warning in Joomla - Continue to Continue 2

Go to Administrator->System menu -> Global Configuration -> Server -> Error reporting -> NONE


Open configuration.php

public $error_reporting = 'none';


fasterxml jackson ObjectMapper produces JSON string with '=' and not ':'

Produces [key=value]
new ObjectMapper ().writerWithDefaultPrettyPrinter ().writeValueAsString ( responseVO.toString() )

Produces {"key":"value"}
new ObjectMapper ().writerWithDefaultPrettyPrinter ().writeValueAsString ( responseVO )

Note : Dont convert toString and pass taht to writeValueAsString ()

Thursday, February 13, 2020

How to Disable WordPress PHP Error Warning Messages - XMAPP


Remove those lines 
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

Paste these lines
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

Tuesday, February 11, 2020

Joomla - You are not authorised to view this resource

1. Basically we are not using the latest version of PHP and Joomla
2. So please download the latest version from joomla 3.9.x
3. Install XAMPP latest in your local 
4. Go to xmapp/htdocs folder,
5. Extract the latest joomla into htdocs [for ex: infovijaysite ]
6. Open it in browser http://localhost/infovijaysite
7. Joomla installation page will come. setup with the new database
8. Remove the installation folder

9. Now check the latest database with your old database. 
    9.1 you can see additionally 10+ tables are newly added in latest joomla version.
    9.2 you can see some of the columns like client_id, package_id, asset_id in few tables. 
    9.3 truncate drv_sessions table  [_session] table.
    9.4 check few table, values also changed from the old to new. possible change that too. I have taken that only table dump from new and replaced with old if the rows are same or more/less.
    9.5 verify each old table columns with new table columns. if any thing added, please add the same in your old database itself. 
    9.6  Keep remember, add those columns in the same table in your old DB and also create those 10+ tables in old DB. 

10. change the old DB name in configuration.php under your folder [ex: infovijaysite ]. 
11. ctrl+f5 or clear cache and refresh your site [point 6].

I have done the same for ma own site, please visit -

Note: But the menu may be looks diff than your old style. but your site is reborn. 

Sunday, February 2, 2020

Java Beanshell - Checkstyle NewlineAtEndOfFile File does not end with a newline. - checkstyle-suppressions.xml ignore lineseparator

Solution 1:

1. Add this line inside tag



    "-//Puppy Crawl//DTD Suppressions 1.1//EN"


Solution 2:

Eclipse ..Window >> Preferences >> Checkstyle >> Select the configuration file >>

Click on "Properties" button >> Uncheck the Protect Checkstyle Configuration file.

Click on "Configure" button >> search for "New Line At End Of File" >> Uncheck the checkbox which you see next to New Line At End Of File.

Hit Counter

View My Stats