Thursday 24 December 2015

ADF : JSPX and JSFF onPageLoad display Popup

ADF : JSPX and JSFF onPageLoad display Popup


1. JSPX page load


  a. <f:view> has beforePhase , afterPhase property.
  b. <af: form> -> showPopupBehaviour  - onLoad
       http://andrejusb.blogspot.in/2012/03/open-adf-popup-on-page-load.html
  c. before loading this jspx page -> have method call activity in the taskflow (but by that time page would not have loaded so popup might not display)

2. JSFF page load


       a. <af: Popup> -> below that <af: commandButton visible="false" binding="Bean.myButton">
            in getter method of myButton -> Popup.show()
          [Note : button shoud be below the popup component ]

Thursday 17 December 2015

PUZZLE : Simple puzzle questions : Ans

PUZZLE : Simple puzzle questions : Ans


1. instead of weighing 4 and 4, take 3 and 3.
    In 1st weigh -> if you get any difference, then take all 3 higher one.(Note: if there is no difference, then left out balls will be 2, you can use these 2 for next weight)





2. instead of thinking to cut in different degree angles.
    1st cut   : half
        keep 2 half cakes one on another.
    2nd cut  : quarter
        keep all 4 quarter pieces one on another
    3rd cut   : 8 equal pieces.






3. distribute coins as shown below.


PUZZLE : Simple puzzle questions

PUZZLE : Simple puzzle questions


1. I have 8 balls. among 8 one ball weigh little more. In how many try will you identify the ball which weigh's more.





2. I have a cake, i will give you 3 cut's , you need to make 8 equal pieces in 3 cuts.








3. I have 1000 gold coins and i have 10 sacks, you need to put all 1000 gold coins among 10 sacks.
    If i ask you any number between 1 to 1000, you should be able to give coins in terms of sacks.
    you need think and arrange the coins in each of the sack. (eg: after arranging if i ask you to give 205   coins,    you should be able to give in terms of sacks).




Ans : http://pavanadf.blogspot.in/2015/12/puzzle-simple-puzzle-questions-ans.html



Thursday 26 November 2015

ADF : ViewAccessor(A,B,C) customize ViewAccessor(A,B)

ADF : ViewAccessor(A,B,C) customize ViewAccessor(A,B)


1. If In my drop down getting values from VA(A,B,C) based on viewcriteria
2. If i want to filter again based on my requirement VA(A,B) and remove C




3. If you have requirement that on change of some thing in UI, then VORowImpl will not call by default, in that case we need to call ROImpl methods. either by VO.execute or VO.getCurrentRowImpl.method() as shown below....


Wednesday 18 November 2015

ADF : Navigation in Unbounded and Bounded Task Flow

ADF : Navigation in Unbounded and Bounded Task Flow


1-jspx to jspx
2-jspx to bounded task flow(which has jspx)
3-jspx to bounded task flow (which has jsff) 
4-jsff to jsff
5-bounded task flow to bounded task flow

http://adfwithejb.blogspot.in/2012/06/navigation-in-unbounded-and-bounded.html

Sunday 8 November 2015

ADF : Download Image from BLOB column using Servlet.

ADF : Download Image from BLOB column using Servlet.




ADF : Upload Image to BLOB column

ADF : Upload Image to BLOB column



Upload Image ADF

1> af:form -> useUpload -> true (if you are using jsff, then you can add to the parent jspx)
2> AdminBean ->  declare UploadedFile file -> file assign to value of inputFile in UI.
3> AdminBean -> keep it in session scope
3> weblogic.xml -> Enable getRealPath() results for archived web apps -> check this option

https://www.youtube.com/watch?v=cDz9V_mxlPo

Wednesday 28 October 2015

JAVA : JVM Architecture

JAVA : JVM Architecture


eg : -Doracle.adfm.usemds=true -Xms256m -Xmx1024m -XX:PermSize=96m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000 -Djbo.debugoutput=silent





Tuesday 27 October 2015

JAVA : SingleTon correct Implementation

JAVA : SingleTon correct Implementation

As discussed in previous session, there are many ways that singleton can break.
We can over come with those situations by implementing the singleton as shown below.


Monday 26 October 2015

JAVA : SingleTon Break

JAVA : SingleTon Break




Overcome


Overcome


  • Preferred way is not to implement Cloneable interface as why should one wants to create clone() of Singleton 
  • And if you still do, then just throw Exception from clone() method as “Can not create clone of Singleton class”.





JAVA : Singleton Implementation

JAVA : Singleton Implementation




  • Synchronization is very expensive when we are talking about the performance. 
  • We can see that the synchronized method getInstance does not need to be checked for syncronization after the object is initialized

Tuesday 20 October 2015

JAVA : HashSet -> Equals and hashCode

JAVA : HashSet -> Equals and hashCode


1. In HashSet(value) -> if we are adding string or int as then no need of equals and hascode override, If we are using object (Eg : Employee) as then we need to override equals and hashcode method.

Below screen shot, since we are going to use Employee object in HashSet, If we dont override hashCode method how HashSet behaves.

WithOut hashCode override:




With hashCode override:


Ref: https://www.youtube.com/watch?v=IwUwIrz9Ge8

JAVA : HashMap -> Equals and HashCode

JAVA : HashMap -> Equals and HashCode


1. In HashMap (key, value) -> if we are adding string or int as key then no need of equals and hascode override, If we are using object (Eg : Employee) as a key then we need to override equals and hashcode method.

Below screen shot, since we are going to use Employee object as a key in HashMap, If we dont override hashCode method how HashMap behaves.

WithOut hashCode override:




With hashCode override:

Ref : https://www.youtube.com/watch?v=IwUwIrz9Ge8

EXCEL : Check 1st column value in 2nd column, if not there then add 1st column value in 4th column.

EXCEL : Check 1st column value in 2nd column, if not there then add 1st column value in 4th column.



Thursday 15 October 2015

JAVA : COLLECTION Tips

1. Check Duplicate in collection.



2. Want to add objects in order



3. SORT HASHTABLE -> JUST CONVERT HASHTABLE TO TREEMAP (Automatically will be sorted)

public static void main (String[] args) {
Hashtable<String, String> ht= new Hashtable<String, String>();
       ht.put("zac", "Chaitanya");
       ht.put("abc", "Ajeet");
       ht.put("yyt", "Test");
       ht.put("ddc", "Demo");
       ht.put("ssa", "Anuj");

    Map<String, String> map = new TreeMap<String, String>(ht);
    for(Map.Entry<String,String> entry : map.entrySet()) {
          String key = entry.getKey();
          String value = entry.getValue();
        
          System.out.println(key + " => " + value);
    }

OR

    Map hm = new TreeMap(ht);
    Set<String> keys = hm.keySet();
        for(String key: keys){
            System.out.println("Value of "+key+" is: "+hm.get(key));
        }


}

Monday 14 September 2015

ADF : Create Nested AM

Create Nested AM


HistoryDataService AM (Pointing to different DB and in different project)
       | _   CustomerService AM (Pointing to different DB and in different project)








Tuesday 25 August 2015

Monday 24 August 2015

ADF: New ViewLink instance to AM

ADF: New ViewLink instance to AM

If we add new viewLink to AM, the backend changes are as follows :


ADF: inputComboboxListOfValues Use

ADF: inputComboboxListOfValues Use

Problem faced in below use case:

Problem : we had Transient attribute in search criteria, and 1st time on click of search button using transient attribute it was not working, after adding any transient attribute from "Add fields" option it was working.

Solution: If you have any transient attribute in search criteria then select "In Memory" option instead of "Database" in ViewCriteria.



Thursday 19 February 2015

JTATransaction: javax.transaction.InvalidTransactionException.

 JTATransaction:  javax.transaction.InvalidTransactionException.


For Weblogic server, for complete domain level we set JTA time out.
If we are facing JTATransaction Time out exceptions, please go and increase the time.
If Application Modules are not commited between this time automatically it will be roll backed and you will get exception.


JAVA : TempFile : How to avoide InputStrem Loss.

TempFile : How to avoide InputStrem Loss.


1. Assume we are getting stream from UCM, and we are going to use that stream in our java code.
If file is huge then we may not handle that stream for long time, It will be lost after some time.

So to avoide that we can get the stream and write it in to tempFile, and then we can use that stream for further coding.

Below is the sample code: