Skip to main content

Basic object detection in python using OpenCv and Numpy - by Dustbiin

5 String utilities methods - Dustbiin

1) Check mobile number is valid or not

 public boolean isValidMobile( final String inMobile )
    {
        Pattern pattern = Pattern.compile( "[6-9][0-9]{9}" );
        Matcher matcher = pattern.matcher( inMobile );
        if ( matcher.matches() )
        {
            return true;
        }
        else
        {
            return false;
        }
    }

2) Check PIN code is valid or not

  public boolean isValidPinCode( final String inStr )
    {
        final String str = inStr.trim();
        final String rule = "[0-9]{6}$";
        final Pattern pattern = Pattern.compile( rule );
        final Matcher matcher = pattern.matcher( str );
        if ( matcher.matches() )
            return true;
        else
            return false;
    }

3) Array to string with separator by comma

public String arrayToStringWithComma( String str[] )
    {
        String processedString = "";
        processedString = Arrays.toString( str ).replace( "[", "" ).replace( "]", "" ).replace( " ", "" );
        processedString = "," + processedString + ",";
        return processedString;
    }

4) Remove unused element from start and end of the string

public String removeCommaStartEnd( String str, String element )
    {
        if ( !str.equal("") && !element.equal("") )
        {
            str = StringUtils.removeStart( str, "," );
            str = StringUtils.removeEnd( str, "," );
            str.replace( " ", "" );
        }
        return str;
    }

5) String to Array

public String[] commaStringToArray( String str, String sepatator )
    {
        if ( !str.equal("") && !element.equal("") )
        {
             str = StringUtils.removeStart( str, sepatator);
             str = StringUtils.removeEnd( str, sepatator );
             str = str.replace( " "+sepatator+"" );
             System.out.println( "string is:" + str );
             String str2[] = str.split( sepatator);
             return str2;
        }
    }


Comments

Popular posts from this blog

Custom cell color in Excel Apache POI - By Dustbiin

Create custom color for cell background by using java color class Create custom color- XSSFWorkbook workBook = new XSSFWorkbook (); IndexedColorMap colorMap = workbook.getStylesSource().getIndexedColors(); Font tableHeadOneFontStyle = workbook.createFont();  tableHeadOneFontStyle.setBold( true ); tableHeadOneFontStyle.setColor( IndexedColors.BLACK.getIndex() ); XSSFCellStyle tableHeaderOneColOneStyle = workbook.createCellStyle(); tableHeaderOneColOneStyle.setFont( tableHeadOneFontStyle ); tableHeaderOneColOneStyle.setFillForegroundColor( new XSSFColor( new java.awt.Color( 255, 231, 153 ), colorMap ) ); tableHeaderOneColOneStyle.setFillPattern( FillPatternType.SOLID_FOREGROUND ); tableHeaderOneColOneStyle = setLeftRightBorderColor( tableHeaderOneColOneStyle ); tableHeaderOneColOneStyle = alignCenter( tableHeaderOneColOneStyle );

Create design by connecting dot's using opencv and numpy - by Dustbiin

Create basic design by using connecting dot's using your mouse- I have been create this by using mouse event check out the code below- use Python, OpenCv , NumPy import numpy as np import cv2 def click_event(event , x , y , flags , param): if event == cv2.EVENT_LBUTTONDOWN: print(x , " , " , y) font = cv2.FONT_HERSHEY_SIMPLEX strXY = str(x) + ' , ' + str(y) # cv2.putText(img,strXY, (x, y), font, .1, (255, 255, 0), 2) cv2.circle(img , (x , y) , 3 , ( 0 , 0 , 255 ) , - 1 ) points.append((x , y)) if len(points) >= 2 : cv2.circle(img , points[- 1 ] , 3 , ( 0 , 0 , 255 ) , - 1 ) # cv2.putText(img,strXY, points[-1], font, .1, (255, 255, 0), 2) cv2.line(img , points[- 2 ] , points[- 1 ] , ( 0 , 0 , 255 ) , 1 ) cv2.imshow( "Image" , img) points = [] img = np.zeros(( 512 , 512 , 3 )) cv2.imshow( "Image" , img) cv2.setMouseCallback( 'Image' ...

Best Pdf Viewer/Reader for Linux/Ubuntu 20.04 - by Dustbiin

PDF viewer and editor for Ubuntu operating system. In now days lot's of PDF reader/viewer available for Ubuntu and they are also Open source, But if you want a software which is also useful for the advance thing like- Display PDFs with high fidelity Annotate & Markup PDFs Fill & Save Forms Render Digital Signatures & Layers Advanced User Interface Advanced Print & Search Options Document Storage Integrations DocuSign© Integration If you want a PDF reader which has all these feature then you can use QOPPA SOFTWARE PDF studio. PDF Studio Viewer ™ is a cross-platform PDF reader that is reliable and easy to use. PDF Studio Viewer can annotate PDF documents and fill interactive forms. For more editing features, Qoppa Software publishes PDF Studio Standard and Pro editions. Download Link- click hear Look like-