Sunday, 31 May 2015

Loops in Java


  • FOR LOOP

public class ForLoopExample {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("working");
for(int i=1; i<=50 ; i++){
int n = 2 * i;
System.out.println("2 * "+ i + " = " + n);
}
}

}



  • WHILE LOOP
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("working");
int i = 0;
while (i < 50) {
 i++;
 int m = i*2;
        System.out.println("2 * "+ i + " = " + m);
        }
}
}


  • DO WHILE LOOP
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("working");
int i = 0;
do {
 i++;
 int m = i*2;
        System.out.println("2 * "+ i + " = " + m);
        } while (i < 50);
}
}


OUTPUT:-
2 * 1 = 2
2 * 2 = 4
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12
2 * 7 = 14
2 * 8 = 16
2 * 9 = 18
2 * 10 = 20
2 * 11 = 22
2 * 12 = 24
2 * 13 = 26
2 * 14 = 28
2 * 15 = 30
2 * 16 = 32
2 * 17 = 34
2 * 18 = 36
2 * 19 = 38
2 * 20 = 40
2 * 21 = 42
2 * 22 = 44
2 * 23 = 46
2 * 24 = 48
2 * 25 = 50
2 * 26 = 52
2 * 27 = 54
2 * 28 = 56
2 * 29 = 58
2 * 30 = 60
2 * 31 = 62
2 * 32 = 64
2 * 33 = 66
2 * 34 = 68
2 * 35 = 70
2 * 36 = 72
2 * 37 = 74
2 * 38 = 76
2 * 39 = 78
2 * 40 = 80
2 * 41 = 82
2 * 42 = 84
2 * 43 = 86
2 * 44 = 88
2 * 45 = 90
2 * 46 = 92
2 * 47 = 94
2 * 48 = 96
2 * 49 = 98
2 * 50 = 100

Friday, 22 May 2015

Liferay Interview Questions.....



1>Diff Between Hook And Ext?
2>what are the types of hooks?
3>mention the types of plugins in liferay?
4>explain service builder?
5>what is web content?
6>How to increase the size of column in liferay?
7>what are the possible DataTypes in Liferay?
8>How can you store image in Liferay Technology?
9>How To Embed One Portlet In another Portlet?
10>What is Liferay?
11>Diff Between 286 and 168 JSR Complaint?
12>What are users and usergroups?
13>explain IPC?
14>diff between dynamic query and custom query>
15>diff between liferay and other frameworks?
16>portal instance in liferay?
17>how to add portlet in control panel?

Wednesday, 13 May 2015

portal-ext.properties entries and Explanation

Place portal-ext.properties file below location or
liferay-portal-6.2-ce-ga2/tomcat-7.0.25
or

liferay-portal-6.2-ce-ga2/tomcat-7.0.25/webapps/ROOT/WEB-INF/classes


portal-ext.properties is used to override portal.properties file
and location of portal.properties file is

liferay-portal-6.2-ce-ga2\tomcat-7.0.42\webapps\ROOT\WEB-INF\lib\portal-impl.jar


This is used to override portal.properties file
1>passwords.encryption.algorithm = NONE
----------->This is used to Save password in normal form..By default Liferay Save passwords in encrypted format.

2>auto.deploy.enabled = true
--------------->This helps for autodeploy the plugin.

3>company.security.auth.type = emailAddress
------------>Default Authentication

4>company.security.auth.type = screenName
------------>This helps  the users to authenticate using Screen Name

5>company.security.auth.type = userId
------------->This helps the users to authenticate using user Id

6>theme.portlet.decorate.default = false
------------------> It will hide portlet border.

7>live.users.enabled = true
-------------->  to know number of live users 

8>openoffice.server.enabled = true
-------------->  To enable open office ,It will help to convert content into doc like pdf,doc etc 

9>terms.of.use.required = false
-------------> to disable the terms of use page

Monday, 11 May 2015

difference between string, string buffer and string builder in java.

String is an immutable class, so you cannot make changes on a String after creating it. All methods that do an operation on String returns a new one, subString(), toLowercase() etc. You can reinitialize it though, but this creates a new String in memory (as it should do).

This helps in many cases, most of the times you do not want to alter a String (in methods etc.). Unless you need to build a long text by appending new strings to a String. In this situation, you need to use StringBuilder or StringBuffer for memory's sake. These classes are mutable so a new String is not created on every append.

The main difference between StringBuilder and StringBuffer is thread safety. 
StringBuffer is synchronized, StringBuilder is not.
StringBuilder is faster than StringBuffer.

Liferay Plugins

There are different types of plugins available,


  1. Portlet
  2. Layout Template
  3. Theme
  4. Hook
  5. Ext(Extension)
  6. Web Content
  7. Service Builder

Theme                 :- It helps to maintain Look & feel of  Liferay portal. 
Hook                  :- Is Used to customise core functionality of liferay.
Service Builder    :- A tool which is generally used to generate code to interact with database
Ext                 :-This is also used to customize core functionalitly.Hooks having some                 limitation beyond that we haveto use ext.if we use ext                                                   restart  would  be required.