Posts

How to create user in oracle

How to create user in ORACLE? Login with system admin in sqlplus Step 1 :  C:\Users\atul>sqlplus SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 1 14:42:56 2018 Copyright (c) 1982, 2014, Oracle.  All rights reserved. Enter user-name: sys as sysdba Enter password: Execute following commands Step 2 : CREATE USER ap2010 IDENTIFIED BY ap2010 DEFAULT TABLESPACE "SYSTEM" TEMPORARY TABLESPACE "TEMP" PROFILE DEFAULT; GRANT CONNECT TO ap2010 ; GRANT RESOURCE TO ap2010 ; GRANT CREATE VIEW TO ap2010 ; GRANT UNLIMITED TABLESPACE TO ap2010 ;

Count files inside a folder or drive

File file = new File("u://"); int count = countFilesInDirectory(file); ilesInDirectory(file);  System.out.println("count" + count); public static  int  countFilesInDirectory ( File directory ) {        int  count =  0 ;        for  ( File file : directory.listFiles ()) {            if  ( file.isFile ()) {                count++;            }            if  ( file.isDirectory ()) {                count += countFilesInDirectory ( file ) ;            }        }        return  count;    }

Static Gotcha in java

class PreTesting {     static void doSomething()     {         System.out.println("Method in parent class");     } } public class Testing extends PreTesting {     static void doSomething()     {             System.out.println("Method in child  class");     }     public static void main(String args[]) throws Exception {       PreTesting preTesting =  new Testing();       preTesting.doSomething();   } } //outout is : Method in parent class

String Reverse in java

import org.apache.commons.lang.StringUtils; public class Testing {   public static void main(String[] args) { String words = "I am walking"; System.out.println("Letter Reverse : " + StringUtils.reverse(words)); System.out.println("Words Reverse " + StringUtils.reverseDelimited(words, ' ')); } }

Converting Strings to int and int to String

//Integer to String String a = String.valueOf(2);   //String to integer int i = Integer.parseInt(a); n

update the class in the JAR

jar uf c:\ CodeReview .jar com\pmd\rules\ NameRule .class

array to list conversion

List list = Arrays.asList(array);