Friday, January 29, 2016

Skit

The Eagle does not fight the snake on the ground. It picks it up into the sky and changes the battle ground, and then it releases the snake into the sky. The snake has no stamina, no power and no balance in the air. It is useless, weak and vulnerable unlike on the ground where it is powerful wise and deadly. Take your fight into the spiritual realm by praying and when you are in the spiritual realm God takes over your battles. Don't fight the enemy in his comfort zone, change the battle grounds like the Eagle and let God take charge through your earnest prayer

Thursday, January 28, 2016

What is the meaning of JBoss GA version?


GA, SP, CR meaning:


  • Final = a polished, tested, and approved version
  • GA = General Availability, a final version preparing for the big time
  • CR = a Candidate Release in the running for GA, undergoing final testing and QE
  • M = a Milestone release, rolling features and bug fixes into a build
  • ER = an Engineering Release, typically a build for the engineering team

Hibernate Vs JDBC

Hibernate Vs JDBC is given below:

JDBC 
Hibernate 
With JDBC, developer has to write code to map an object model's data representation to a relational data model and its corresponding database schema.  
Hibernate is flexible and powerful ORM solution to map Java classes to database tables. Hibernate itself takes care of this mapping using XML files so developer does not need to write code for this. 
With JDBC, the automatic mapping of Java objects with database tables and vice versa conversion is to be taken care of by the developer manually with lines of code.  
Hibernate provides transparent persistence and developer does not need to write code explicitly to map database tables tuples to application objects during interaction with RDBMS.  
JDBC supports only native Structured Query Language (SQL). Developer has to find out the efficient way to access database, i.e. to select effective query from a number of queries to perform same task.  
Hibernate provides a powerful query language Hibernate Query Language (independent from type of database) that is expressed in a familiar SQL like syntax and includes full support for polymorphic queries. Hibernate also supports native SQL statements. It also selects an effective way to perform a database manipulation task for an application.  
Application using JDBC to handle persistent data (database tables) having database specific code in large amount. The code written to map table data to application objects and vice versa is actually to map table fields to object properties. As table changed or database changed then it’s essential to change object structure as well as to change code written to map table-to-object/object-to-table. 
Hibernate provides this mapping itself. The actual mapping between tables and application objects is done in XML files. If there is change in Database or in any table then the only need to change XML file properties.  
With JDBC, it is developer’s responsibility to handle JDBC result set and convert it to Java objects through code to use this persistent data in application. So with JDBC, mapping between Java objects and database tables is done manually.  
Hibernate reduces lines of code by maintaining object-table mapping itself and returns result to application in form of Java objects. It relieves programmer from manual handling of persistent data, hence reducing the development time and maintenance cost.  
With JDBC, caching is maintained by hand-coding.  
Hibernate, with Transparent Persistence, cache is set to application work space. Relational tuples are moved to this cache as a result of query. It improves performance if client application reads same data many times for same write. Automatic Transparent Persistence allows the developer to concentrate more on business logic rather than this application code.  
In JDBC there is no check that always every user has updated data. This check has to be added by the developer.  
Hibernate enables developer to define version type field to application, due to this defined field Hibernate updates version field of database table every time relational tuple is updated in form of Java class object to that table. So if two users retrieve same tuple and then modify it and one user save this modified tuple to database, version is automatically updated for this tuple by Hibernate. When other user tries to save updated tuple to database then it does not allow saving it because this user does not have updated data.  



Monday, January 25, 2016

Preparation for Interview - Part 1

What do you know about Rakuten?
Ans:
Rakuten is one of the biggest e-commerce companies covering from shopping, travelling, credit card, banking, etc

https://www.hubspot.com/sales/follow-up-email-after-interview

Interview Questions

1. Benifit of ORM
Ans: https://www.quora.com/What-are-the-benefits-of-using-an-ORM-layer
  • ORM usually helps you create a developer friendly work flow !
  • ORM helps you focus on object oriented world and then takes you towards relational world.
  • ORM works well when you have simple CRUD cases.
  • ORM are not so well in addressing relational database specific features.
  • In Java ecosystem Hibernate is one popular ORM, but for complex queries people prefer Data Mapper technologies like MyBatis, new tools and thought process are also getting traction with arrival of libraries like JOOQ.
2. Coding Standard/ Best practices you follow
3. Performance of issue you have followed
4. Bottleneck pattern you faced
5. Why did you use hibernate ?

Friday, January 22, 2016

How to convert ArrayList containing Strings to an array of Strings in Java?

ArrayList to array Conversion


How might I convert an ArrayList<String> object to a String[] array in Java?

List<String> list = ..;
String[] array = list.toArray(new String[list.size()]);
For example:
List<String> list =new ArrayList<String>();
//add some stuff
list.add("android");
list.add("apple");
String[] stringArray = list.toArray(new String[list.size()]);
The toArray() method without passing any argument returns Object[]. So you have to pass an array as an argument, which will be filled with the data from the list, and returned. You can pass an empty array as well, but you can also pass an array with the desired size.

Java 8 implements:

An alternative in Java 8:
String[] strings = list.stream().toArray(String[]::new);

Study Line for mine

Thursday, January 21, 2016

Differences between cookies and sessions?

Sessions are server-side files that contain user information, while Cookies are client-side files that contain user information. Sessions have a unique identifier that maps them to specific users. This identifier can be passed in the URL or saved into a session cookie.
Most modern sites use the second approach, saving the identifier in a Cookie instead of passing it in a URL (which poses a security risk). 
The session cookie is stored on the client (and its value contains the unique session identifier which is sent with every request to map the browser session to the user session on the server

Another answer by Elan Govan:
Cookies are stored in browser as a text file format.It is stored limit amount of data.It is only allowing4kb[4096bytes].It is not holding the multiple variable in cookies.
we can accessing the cookies values in easily.So it is less secure.The setcookie() function must appear BEFORE the tag.
Sessions are stored in server side.It is stored unlimit amount of data.It is holding the multiple variable in sessions. we cannot accessing the cookies values in easily.So it is more secure.

Cookies

Session

Cookies are stored in browser as
text file format.
Sessions are stored in server side.
It is stored limit amount of data.
It is only allowing 4kb[4096bytes]
It is stored unlimit amount of data.
It is not holding the multiple variable
 in cookies.
It is holding the multiple variable
 in sessions.
we can accessing the cookies values easily.
So it is less secure.
 The setcookie() function must
 appear BEFORE the <html> tag
we cannot accessing the sessions
values easily.
So it is more secure.
Destroy Cookies:
 1. if we Closing the browsers at the time
 cookies values destoryed.
 2. setting the cookie time to expire the cookie.
Destroy Sessions :
 1. using unset() session,we will
destroyed the sessions.
 2. using session_destory(), we we will
destroyed the sessions.
Example:
<?php
setcookie(name, value, expire,
path,domain, secure, httponly);
$cookie_uame = "codingslover";
$cookie_uvalue= "website";
//set cookies for 1 hour time
setcookie($cookie_uname,
$cookie_uvalue, 3600, "/");
//expire cookies
setcookie($cookie_uname,"",-3600);
?>
Example:
<?php
session_start();
//session variable
$_SESSION['testvaraible'] = 'Codings';
//destroyed the entire sessions
session_destroy();  
//Destroyed the session
variable "testvaraible".
unset($_SESSION['testvaraible']);
?>

Sunday, January 17, 2016

New Element types in HTML5


There are 10 important new form elements introduced in HTML 5:-
1.       Color.
2.       Date
3.       Datetime-local
4.       Email
5.       Time
6.       Url
7.       Range
8.       Telephone
9.       Number
10.    Search
Let’s understand these elements step by step.
If you want to show color picker dialog box.
<input type="color" name="favcolor"> 

Pic1:





















If you want to show calendar dialog box.
<input type="date" name="bday"> 
Pic2:

















If you want to show calendar with local time.
<input type="datetime-local" name="bdaytime"> 
Pic3:















If you want to create a HTML text with email validation we can set the type as “email”.
   
<input type="email" name="email">
Pic4:







For URL validation set the type as “url” as shown in the below HTML code.
   
<input type="url" name="sitename"> 
Pic5:






 
For URL validation set the type as “url” as shown in the below HTML code.
If you want to display textbox with number range you can set type to number.
<input type="number" name="quantity" min="1" max="5"> 
Pic6:






If you want to display a range control you can use type as range.
<input type="range" min="0" max="10" step="2" value="6">
Pic7:





Want to make text box as search engine box.
<input type="search" name="googleengine"> 
What to only take time input.
   
<input type="time" name="usr_time"> 
If you want to make text box to accept telephone numbers.
<input type="tel" name="mytel">