Browsed by
Month: November 2013

SFTP command in unix

SFTP command in unix

SFTP command in unix [plain gutter=”false”] sftp –password=”PASSWORD” “USERNAME”@”SERVER_IPADDRESS_OR_NAME” [/plain] Note: Username, Password and Server_Ipaddress_or_Name should not be given within double quotes. Eg: [plain gutter=”false”] sftp –password=pass1234 jdUser@ngdeveloper.com [/plain] 795 total views, no views today

795 total views, no views today

SFTP in Java Sample Working Program

SFTP in Java Sample Working Program

SFTP File Upload in Java: FTP can be done with Apache Commons and commons-logging jar. If you want to do SFTP you need the below jars, Required Jars: [plain gutter=”false”] 1. commons-logging-1.1.1.jar 2. commons-vfs2-2.0 (or) commons-vfs-1.0 (try vfs2.0 jar first, if any unexpected exception then try with vfs1.0.jar) 3. jsch-0.1.50 (First check without this jar, if any unexpected exceptions then add this jar also and try) [/plain] SFTP File Upload Program: import java.io.File; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.Selectors; import…

Read More Read More

1,017 total views, 1 views today

Unable to initialize threads: cannot find class java/lang/Thread

Unable to initialize threads: cannot find class java/lang/Thread

Unable to initialize threads: cannot find class java/lang/Thread: Cause: [sociallocker] 1. If you have set wrong CLASSPATH,PATH or JAVA_HOME then you will get this error. 2. Ensure only one version of jdk installed, may be sometime this issue occur if more than one jdk installed. 3. Ensure the wrong CLASSPATH, PATH and JAVA_HOME or unset. [/sociallocker] How to set PATH ? Java Path Set Java Path Set Recommended Java Books: 1,377 total views, 2 views today

1,377 total views, 2 views today

String Equals in PHP with Example

String Equals in PHP with Example

PHP Program 1: $str1 = "Java"; $str2 = "JAVA"; if (strcasecmp($str1, $str2) == 0) { echo "Both are Equal"; }else{ echo "Both are Not Equal"; } Output: [plain gutter=”false”] Both are Equal [/plain] See the below program, we are giving the flipkart with space and without space so we are getting “both are not equal”. But if you equal the same to 1 then you will get “both are equal”. With space and without space strings are not equal: $str1…

Read More Read More

1,672 total views, 2 views today

Difference Between to_char and to_date with example

Difference Between to_char and to_date with example

to_char: to_char converts a date to string. Query: Select to_char(sysdate) from dual; Output: 25-NOV-13 Query: Select to_char(sysdate,’DD-MM-YYYY’) from dual; Output: 25-11-2013 to_date: to_date converts a string to date. Query: Select to_date(sysdate) from dual; Output: 25-NOV-13 Query: Select to_date(sysdate,’DD-MM-YYYY’) from dual; Output: 25-NOV-13 950 total views, no views today

950 total views, no views today

Palindrome in Java Example

Palindrome in Java Example

Palindrome: Logic: Given Number/String should be equal with the Reversed of the given Number/String. Eg: 101 – Palindrome Number (Given and Reverse of the given is equal (101 and 101 only)). 100 – Not a Palindrome Number (Given is 100 and Reverse of the given is 001, both are not equal, so its not a palindrome Number). Level – Palindrome String. (Given and Reverse of the given is equal (Level and leveL)). Link – Not a Palindrome String. (Given is…

Read More Read More

919 total views, no views today

Printing All Possible Combinations of a 3 Digit Number Java Program

Printing All Possible Combinations of a 3 Digit Number Java Program

Printing All Possible Combinations of a 3 Digit Number Java Program: Logic: We have to write 3 for loops and need to ensure all three for loops variable does not have same value. Then we can take and print the input array with the three for loop variables to get all different possibles. Program: package in.javadomain; public class PossibleCombinations { public static void main(String[] args) { int[] input = { 1, 4, 3 }; for (int x = 0; x…

Read More Read More

14,462 total views, 8 views today

Java Program to Change Case of a Character/String

Java Program to Change Case of a Character/String

Displaying Opposite Character:  Logic: First we should have to find the given case, for this you can use Character.isLowerCase(given character) or Character.isUpperCase(given character). Once you know the given character then you can change to opposite character using Character.toLowerCase(given input) or Character.toUpperCase(given input). Program: [This program converts to opposite case – Character] package in.javadomain; public class ChangeToOppositeCharacter { public static void main(String[] args) { Character c = 'd'; if (Character.isLowerCase(c)) { System.out.println("Given Case : " + c); System.out.println("Opposite Case : "…

Read More Read More

2,650 total views, 3 views today

Prime Number or Not in Java Program

Prime Number or Not in Java Program

Prime Number or Not in Java Program: Logic: The number should not be divisible except its own and 1. Which means the given number’s Mod should not be zero (0) with any number. So we have to put one loop to check whether any one of the number from 2 with the input given number’s Mod is zero, if then it is not a prime number, else its a prime number. Program: package in.javadomain; public class PrimeNumberOrNot { public static…

Read More Read More

791 total views, no views today

Taking only String values from ArrayList

Taking only String values from ArrayList

Scenario: You are given with a arraylist with all datatype values. Eg: Integer and String values. But you want to move only string values to another arraylist. Solution you can think suddenly: ArrayList can be declared to hold only string and using addAll method we can move. Eg: ArrayList arStr = new ArrayList(); arStr.addAll(“given_arrayList”); But the above one does not throw any error as well which will move all the values(String and Integer) to another list. If you try to…

Read More Read More

737 total views, no views today