Search This Blog

Loading...

Wednesday, 9 March 2016

How can we call Function in Scala

Here are couple of scala points

  • You can call a function without using . operator example : emp getName , Here emp is the object getName is function, just by giving space you can call the function.
  • No need to provide braces after the function Name, unlike in java we use paranthesis (getName()).

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.