Wednesday 6 July 2016

how to add google search box in blog OR website

1. To get started, you'll need an account with Google search. Create a free account here. https://www.google.com/cse/
2. Click on "Sign In to Custom Search Engine".

3. Enter the URL of your site to search . in this case, the URL of your website on Zoho Sites. If required, you can also specify multiple websites to search from.

4. Click on "Create". 


5. Then click on Get Code, here you will get some javascript. then place that code in your blog or website that all you are done.



ntt data java interview questions

Below interview questions asked in NTT data in 5 rounds for Java Profile

  1. Can we call garbage collector?
  2. Can you write customized collection like list?
  3. Do you know Any sorting and searching algorithms?
  4. What is the differences b/ w implements runnable and thread?
  5. Difference b/w sleep and wait?
  6. Hash Map internal working, specially in case of Equals and hashcode?
  7. How will check code performance? any tools Did you used?
  8. Write query to print sum of department salary ?
  9. Sorting age first and name next? Comparator and comparable.
  10. What is the difference between constant and enum?
  11. What is hash collision?
  12. What if equals return true always (hashmap)?
  13. What if hashcode returns same hash for two objects (hashmap)
  14. What is wild card in java?
  15. Generics List<Number> ar  = ArrayList<Integer> () any error?
  16. What is Serialization?
  17. What is N+1 problem in hibernate?
  18. Inheritance in hibernate?
  19. Diff between filter (JEE concept) and interceptor (struts or spring concept)?
  20. How Hash map internal works?
  21. Write a program to print count of each character in Given string?
  22. Write program for Reverse string?
  23. Write a program to Removing duplicate from list with using set?
  24. Write a Program for each number occurrence in list?
  25. Write Quick sort algorithm?
  26. How to sort map using key or value?
  27. What is Fail fast and fail safe?
  28. Red block tree?
  29. Difference between arraylist and linked list?
  30. Is linked list is single linked or double linked?
  31. How can you cut the cake into 8 peaces in 3 cuts?
  32. Opps concepts?
  33. Mvc pull and mvc push?
  34. comparator and comparable difference?
  35. How to create immutable class?how to create class like string?
  36. Impliments runnable and extends thread? Which is better?
  37. Editing 10th line in file?
  38. Name="damu ragam" sort by second part of name?
  39. Query to get n th high sal?
  40. Males and female count from emp table?
  41. What is Left outer, right outer and inner join?
  42. Employee name and respective manager names?
  43. Select query syntax?
  44. Db indexs?
Final class Emp{
Final private Date d;
Emp(Date d){
This.d=d;
}
}
Is above class is immutable class?

hcl java interview questions

Below interview questions asked in HCL in first 2 technical rounds for Java Profile

  1. What are the oops concepts?
  2. Comparator and comoarable differwnce?
  3. TreeSet<stringbuilder> can we create?
  4. Different ways of instantiation?
  5. Diff b/w queue and dqueue?
  6. Diff b/w iterator and list iterator?
  7. Class level locking and object level locking?
  8. Do we have distuctors in java?
  9. Can we call gc , will that clean up memory?
  10. Any searching and sorting algorithms?
  11. How can we say How much space is consuming by any object?
  12. How can we get all members of class?
  13. Exception hierarchy?
  14. Collection hierarchy?
  15. How Hashmap works internally?
  16. What is fast fail and fast safe?
  17. How can we avoid fail fast?
  18. Why hash map domminates gc?
  19. What is weakhashmap?
  20. What is identityhashmap?
  21. What is concurrent hashmap?
  22. CopyorwriteArrayList?
  23. How will get set values in reverse order?
  24. if hashmap having fixed 5 value, in that case how will you create map object?
  25. What is the intial size of ArrayList?How arraylist size get increase?
  26. how can we synchronize any collection?
  27. How can we sort collection values?
  28. how to convert arraylist to array vice versa?
  29. Contract b/w equals and hashcode? 
  30. How can you check code performance?
  31. Can overridden method can throw checked exception?
  32. Instance block and static block?
  33. When will static block get executed?
  34. Can two overloading methods can return two data types?
  35. How can we return multiple data type values from method?
  36. What ar the memory areas do we have in jvm?
  37. What is JIT?
  38. Difference b/w path and classpath?
  39. Code for reverse number?
  40. Given string is polindram or not?
  41. Diff b/w replace and replaceall?
  42. How will you handle null pointer exceptions?
  43. Architecture of your current project?
  44. Synchronization?
  45. Difference b/w synch block and synch method?
  46. Transiat ?
  47. Volatile?
  48. How can you confirm whether string is immutable?
  49. Char count given string?
  50. Few questions on serialization?




Questions on below concepts
Threads
Runnable thread
Notify notifyall
Join
Wait and sleep?

M(String s)
M(object o)
M(null) which will get called?

M(string... S) what does it mean?

If you define 2 methods as below
M(string... S)
M(string... S,string s)
Will class compiles successfully?

Sb s=new sb("aa");
Sb s1=new sb("dd");
s.equals(s1) is true/false?

int i=10;
Try{
Return ++i; //try return 
} finally{
Return ++i;//final return
}

“Search This Blog" is not Working on Blogger


After searching for 1 Hour I got final below solution that fixed my blog search issue.

First check yours to see if it works.  If not go to your layout page and remove the current gadget. Next you need to add an Html/ Javascript gadget  to your page.  You need to paste the following into the gadget where YOURBLOG is obviously the site for your blog:

<form action="http://www.YOURBLOG.com/search" name="input" method="get">
<input value=" " name="q" size="20" type="text"/>
<input value="Go!" type="submit"/>
</form>

How to create JKS file using java keytool

How to create JKS file using java keytool?

Example:
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass mypassword -validity 360 -keysize 2048

In above Example selfsigned  and keystore.jks are user defined


How to extract cer(public-key for client) file from JKS?
Example:
keytool -export -alias selfsigned -file certfile.cer -keystore keystore.jks


How to import certificate in to java cacert?

keytool -import -keystore -file %JAVA_HOME%\jre\lib\security\cacerts -file </path/filename.crt>


Friday 1 July 2016

How to search file in linux find command

How to search file in Linux with find command

Syntax:
find <directory> -name <file-name>

Description: In place of '<directory>' place search directory and in place of '<file-name>' place search file.


Example 1:

find . -name  test.txt

Description 1:
In above command finds test.txt file in current directory( '.' represents current directory)


Example 2:

find . -name  test*

Description 1:
In above command finds files whose name starts with 'test' in current directory( '.' represents current directory)

How to use SSH command in linux?

Syntax:
ssh <user>@<IP>

Example 1:
 ssh root@192.168.1.1 

Example 2:
 ssh root@192.168.1.1 "cat /etc/fstab"

Description: In example2  "cat /etc/fstab" is directory

Linux grep command

How to search string in file in linux?

grep "<search-string>" <file>

Search string by ignoring case with grep.

grep -i "<search-string>" <file>

Search text in one or more files

grep "<search-string>" <file-names-starting>*

Word count with grep?

Example:

grep "2015-05-25 20:19:00" connectProcess.log | grep "successful" | wc -l

Note: Above example give count of lines which has "2015-05-25 20:19:00" and "successful"


How to search string in direcoty using grep?
syntax: grep -nr string my_directory

-n ==> line number in the file
'string' ==> String for search, followed by a wildcard character
-r ==> Recursively search sub directories listed

Exmaple:
grep -nr 'prmconnect' .

here . repesents current directory