Wednesday, December 25, 2013

Program to check if two string are anagrams.

//There are two ways to do this.
//1.Sort both the strings and check if both of them are equal;

   public boolean isStringsAreAnagrams(String source, String target){
        if(null == source  || null == target){
            return false;
        }
        return (source.isEmpty() && target.isEmpty()) || (sort(source).equals(sort(target)));
    }
    //Insertion Sort
    public String sort(String source)
    {
        char temp_char;
        int j;
        char[] sourceInCharArray = source.toCharArray();
        for(int i = 0; i < sourceInCharArray.length ; i++){
            j = i - 1;
            temp_char = sourceInCharArray[i];
            while(j >= 0 && temp_char < sourceInCharArray[j]){
                sourceInCharArray[j + 1] =  sourceInCharArray[j];
                j--;
            }
            sourceInCharArray[j + 1] = temp_char;   
        } 
        return new String(sourceInCharArray);
    }
//2.Check if the count of each unique characters in both the Strings are same.
//Program upcoming.

Tuesday, December 24, 2013

ADF Selection Components.

ADF Selection Components like af:selectBooleanRadio, af:selectOneChoice,af:selectBooleanCheckBox always cause problems when dealt with partialTriggers.

When a selection component is made as partial targets of any other ADF components, it does following:

if(component.isRendered() && component.getSubmittedValue() != null)
     processComponent(component);
else
     skipComponent(component);

Because of this, the values of such selection components get reset upon submission of source components and assigned default values to them.



Saturday, December 14, 2013

Welcome people, this is first blog I created today, though I know this facility from a long time.I have been into Computers, working on Applications more than a decade, but yes,now its the time.

Its better late than never, so lets start.