Showing posts from July, 2013

What and where are the stack and heap?

Q. 1
Programming language books usually explain that value types are created on the stack, and reference types are created on the heap, without really explaining what these two things are. With my only programming experience being in high level languages, I haven't read a clear explanation of this. I mean I understand what a stack is, but where and what are they (relative to the physical memory of a real computer)?
To what extent are they controlled by the OS or language runtime?What is their scope?What determines the size of each of them?What makes one faster?  A. 1

The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is always reserved in a LIFO order; the most recently reserved block is always the next block…

String Permutation in java

package com.swain;

public class Permutation {

    public static void main(String args[]) throws Exception {
        String str = "abc";
        System.out.println("String is " + str);
        System.out.println("After Permutation ");
        showString("", str);

    public static void showString(String st, String str) {
        if (str.length() <= 1)
            System.out.println(st + str);
            for (int i = 0; i < str.length(); i++) {
                String newValue = str.substring(0, i) + str.substring(i + 1);
                showString(st + str.charAt(i), newValue);

package com.swain;

public class Permutation {
    static String permutationStr[];
    static int indexStr = 0;

    static int factorial(int i) {
        if (i == 1)
            return 1;

how to replace 2 or more spaces with single space in string using Java

package com.swain;

public class StringUtil {
    public static void main(String args[]) {
        String before = " Himanshu      Sekhar           Swain  ";
        System.out.println("before: " + before);
        String after = before.trim().replaceAll(" +", " ");
        System.out.println("after: " + after);


How to disable selected date range of Datebox in zk

  <window border="normal" title="hello" apply="pkg$.TestComposer">

      <div>Welcome to ZK Fiddle , run it right now!</div>

    <datebox id="db11" width="150px" constraint="no empty,after 20130710,before 20130720" />

* constraint="no empty,after 20130710,before 20130720"
*  20130710 means 2013-07-10 and 20130720 means 2013-07-20

how to change java version in websphere

Find out this video tutorial.

How to install IBM WebSphere Application Server with java 7 in windows

Step 1:

Download  WebSphere Installation manager here

Step 2:  install WebSphere Installation manager

Step 3: Select java 7

Step 4.
 Step 5.
Choose Path.





 Select profile management tool then Finish

 Create Profile click on Create.

 Select Application Server


Set your admin details.


Then start window will open You can start your server.

Default profile Name : AppSrv01
Default Admin port: 9060
Http port : 9080

Admin Url- http://localhost:9060/admin

Login here with your admin user name and password.

Then follow some video tutorial here

 1.  how to deploy war file in websphere
2.  how to create user and delete user in Websphere
3. how to change java version in websphere

How to deploy war file in websphere

Look this video tutorial.

how to create user and delete user in websphere

Look this video tutorial.

how to check virtual host in websphere

You can find out this video tutorial.