Search This Blog

Loading...

Wednesday, 9 December 2015

Ignore JUnit Test Case

How can we stop a test case not to run??


Dont use java comment to comment the test case function,
Please use @Ignore annotation to comment test case,


Example


on function level


@Ignore("not ready yet")
@Test public void testOnething() {
System.out.println("This method is ignored because its not ready yet");
}


on class level

@Ignore public class Ignored {
@Test public void test1() {
System.out.println("Ignored test case 1");
}
@Test public void test2() {
System.out.println("Ignored test case 2");
}
 }

Monday, 7 December 2015

How to turn off interactive prompt while sending bulk files to an ftp server



When we want to send 1000 number of files at a time to an ftp server,

We will use mput *, but for every file it will ask you to enter yes or no to transfer the file,
to avoid this,
use command prompt.

Example below

ftp hostname
username : username
password : password
prompt (this will turn off interactive mode)

now you use mput * to send all files .


Wednesday, 24 September 2014

Hibernate Introduction



  • Hibernate is an ORM (Object Relational Mapping) Tool
  • Hibernate is Open Source
  • Hibernate is used to persist data to Databases
  • Hibernate was started in 2001 by Gavin King
  • ORM is a programming method for mapping the objects to the relational model where entities/classes are mapped to tables,instances are mapped to rows and attributes of instances are mapped to columns of table.
  • Using Hibernate we can save data from Java Applications to Databases. This acts a medium between Java and Database. 

Wednesday, 12 September 2012

Unix Command passwd

One of the Unix Commands which is useful our day to day life is passwd. We will learn now how to use this command.

To change your password this command is useful.
How to change a password for your login:

Login to unix machine with your login id and enter your password
Now if you want to change the current password  passwd command is used to change password.
Type passwd in your command prompt:
Now machine will ask you to enter your current password,please enter it, then it will ask for new password
please enter new password ,the machine will ask again to confirm the new passward please enter it.

Now you changed your password now.

Tuesday, 28 August 2012

Email and URL validation in Javascript using Regular Expression

JavaScrip URL & Email Validation
Enter Valid URL :
Enter Valid Email :

Sunday, 18 December 2011

Difference between Statement and Prepared Statement

Statement:

When you use normal statements compilation of statement or
parsing of statement will happen every time. This is time
consuming when u have multiple queries to execute.

Statement s = conn.createStatement();
s.executeQuery();

Prepared Statement:
In prepared statement SQL query will be compiled or parsed
for the very first time and kept in some kind of pool. When
u execute one more time the same statement with different
values it saves the parsing time.

The PreparedStatement is a slightly more powerful version of a Statement, and should always be at least as quick and easy to handle as a Statement.

The PreparedStatement may be parametrized.
Prepared statement is precompiled statement it is used when
we want one query to be executed n no. of times.
Prepared Statement is Pre-compiled class , but Statement is not.
So in PreparedStatement the execution will be faster.

SQL select * from employee where employeeID=?,empName=?;
PreparedStatement ps = conn.PreparedStatement();
ps.execute(1,aru);
ps.execute(2,arya);

Callable Statement:

Callable statements are used to execute stored procedures
similar to java functions.

Tuesday, 6 December 2011

Object Class functions in java

Object Class
Object Class is the Super class for all classes in JAVA.The Object class defines the basic state and behavior that all objects must have, such as the ability to compare oneself to another object, to convert to a string, to wait on a condition variable, to notify other objects that a condition variable has changed, and to return the object's class.
The Object Class Functions:
equals:
This function is used to compare two objects whether they have equivalent values are not.
It returns true if they are equal else returns false.
The getClass() Method:
The getClass method is a final method (cannot be overridden)
This method returns a Class object.With this class you can get the information of object like name, its super class, and the names of the interfaces that it implements.
use of the getClass method is to create a new instance of a class without knowing what the class is at compile time. This sample method creates a new instance of the same class as obj which can be any class that inherits from Object (which means that it could be any class):
Object createNewInstanceOf(Object obj) {
return obj.getClass().newInstance();
}
The toString Method
Object's toString method returns a String representation of the object. You can use toString to display an object.
The Object class also provides five methods that are critical when writing multithreaded Java programs:
• notify
• notifyAll
• wait (three versions)
hashCode()
Returns a hash code value for the object.
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.