My name is Asim Ghaffar and I am from Pakistan and shaghab is my pseudonym. On this blog I will share thoughts/opinions/ideas with a hope that readers will educate me with comments.
Sunday, February 17, 2013
Evaluating a few To-Do apps for iPhone
Thursday, January 21, 2010
OCI, NetBeans and Cygwin
Prerequisites
Here are the software and the versions used- OCI Instance Client
- instantclient-sdk-win32-11.1.0.7.0.zip
- instantclient-basiclite-win32-11.1.0.7.0.zip
- NetBeans 6.8
- Cygwin 1.7.1-1
- gdb 6.8
- make 3.81
- gcc 3.4.4
- g++ 3.4.4
Setup
- In NetBeans, create new project. Choose Category: C/C++ and Projects: C/C++ Application.
- Give project any name e.g. OCIDemo. Give main file any name e.g. main, but ensure its extension is C rather than C++.
- Copy paste code from cdemo81.c to main.c
- cdemo81.c is in d:/oracle/instantclient_11_1\sdk\demo
- Open OCIDemo project properties using right click on the project name in Project Windows (CTRL + 1).
- Go to Category Build -> C Compiler and add D:/oracle/instantclient_11_1/sdk/include to Include Directories
- Go to Category Build -> Linker and add D:/oracle/instantclient_11_1/oci.dll to Libraries (not same as Additional Library Directories)
Connection String
cdemo81.c uses scott account for the demo. AS no connection string is given, so edit the line(void) OCIServerAttach(srvhp, errhp, (text *) "", strlen(""), 0);
to
(void) OCIServerAttach(srvhp, errhp, (text *) "//localhost:1521/orcl", strlen("//localhost:1521/orcl"), (ub4) OCI_DEFAULT);
Note that on my machine SID is ORCL and its available on port 1521. Change this as per your instance setting.
Run
Press F6.Sunday, August 23, 2009
File upload and download in Toplink, ADF Faces, Oracle 11g and JDeveloper 10g (10.1.3.3)
Application is simple; you upload files to Oracle database. Uploaded files are shown in a grid. To download a file, you simply click on link in the code column.
I have tried hard to write this blog-entry in detail, but still if there is anything you wanna ask then just email me at asim.ghaffar@gmail.com or simply add a comment.
Create Database
Schema
CREATE USER file_example
IDENTIFIED BY "12"
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT CONNECT TO file_example;
GRANT RESOURCE TO file_example;
Table
CREATE TABLE file_example.x_files
(
file_code NUMBER(38),
file_name VARCHAR2(256 BYTE),
file_content BLOB,
file_type VARCHAR2(50 BYTE),
file_size NUMBER(38),
CONSTRAINT x_files_pk PRIMARY KEY (file_code)
);
In this example, file_code is the primary key It is basically a hash-value of uploaded file's contents calculated using Java Arrays.hashCode(Byte[]). This ensures that a same file cannot be added more than once.
Create JDeveloper Application
Basic Application
- Press (Ctrl + n) to open New Gallery dialogue.
- In the Categories pan on the left, select General (if not already selected).
- In the Items pan on the right, select Application (if not already selected).
- Press Ok button.
- Create Application dialogue should appear. Fill it as following.
- Application name: Cabinet
- Application Package Prefix: cabinet
- Application Template: Web Application [JSF, EJB, Toplink]
- You should be seeing newly created project under Applications node in the Application Navigator window. If the window is not open press (Ctrl+Shift+A).
- In Application Navigator select Model project of the newly created application. Press (Ctrl + n) to open New Gallery dialogue.
- In the Categories pan on the left, select Business Tier -> TopLink.
- In the Items pan on the right, select Java Objects from Tables.
- Press Ok button.
- Multistep dialogue will appear Create Java Objects from Tables
- Step 1 of 4: Select DB Connection.
- Click on the new button in row of Connection or press (Alt + w)
- Connection Name: file_conn, Connection Type: Oracle (JDBC)
- Username: file_example, Password: 12, Deploy password: [CHECKED]
- Driver: thin, Host Name: localhost, JDBC port: 1521, SID: ORCL
- This should reflect your DBMS specific values. Above should hold if you installed DB yourself on your machine with default SID.
- Test to verify. Else see what you missed in 2 or 3.
- Press Finish
- Click on the new button in row of Toplink Map or press (Alt + .)
- ToplLink Map Name: tlMap1, Connection: file_conn, Database platform: Oracle 10g
- Press Ok
- Press Next
- Step 2 of 4: Select Tables.
- Press Query or [CHECK] Auto-Query.
- Move table X_FILES from Available to Selected.
- Press Next
- Step 3 of 4: General Options.
- Press Next
- Step 4 of 4: Specifiy Object Details.
- Press Fnish.
- In Application Navigator select Model project of the newly created application. Press (Ctrl + n) to open New Gallery dialogue.
- In the Categories pan on the left, select Business Tier -> EJB.
- In the Items pan on the right, select Session Bean (EJB 1.1/2.x/3.0).
- If you are using other version of JDeveloper than 10.1.3.3 and you don't have this item available then choose the one which says Session Bean and Version 3.0.
- Press Ok button.
- Multistep dialogue will appear Create Java Objects from Tables
- Step 1 of 4: EJB Name and Options
- EJB Name: SessionEJB
- Session Type: Stateless
- Transaction Type: Container
- Generate Session Façade Methods: [CHECKED]
- Entity Implementation: TopLink POJOs
- Press Next
- Step 2 or 4: Session Façade – Select Service Methods
- [Check All]
- Press Next
- Step 3 or 4: Class Definitions
- Press Next
- Step 4 or 4: Class Definitions
- Implement a Remote Interface: [UNCHECKED]
- Implement a Local Interface: [CHECKED]
- Include Web Service Endpoint Interface: [Unchecked]
- Press Finish
- In Application Navigator select ViewController project of the newly created application. Press (Ctrl + n) to open New Gallery dialogue.
- In the Categories pan on the left, select Web Tier -> JSF.
- In the Items pan on the right, select JSF JSP.
- Press Ok button.
- Multistep dialogue will appear Create JSF JSP
- Step 1 of 4: JSP File
- File Name: index.jspx
- Type: [JSP Document (*.jspx)]]
- Add Mobile Support: [UNCHECKED]
- Press Next
- Step 2 or 4: Component Binding
- Select [Do Not Automatically Expose UI Components in a Managed Bean]
- Press Next
- Step 3 or 4: Tag Libraries
- Filter by Project Technologies.
- Move these from available libraries to selected Libraries.
- ADF Faces Component 10_1_3_3_0
- ADF Faces HTML 10_1_3_3_0
- JSF Core 1.0
- JSF HTML 1.0
- Press Next
- Step 4 or 4: HTML Options
- HTML Version: 4.0.1 Transitional
- Title: Index
- Press Finish
Model Project enhancement to complete example application
- In Application Navigator collapse tree for Model project and double click Application Sources à cabinet.model.SessionEjbBean.java to open it in the editor. Add following:
public Integer saveXFile(String fileName,byte[] fileContent,int filesize,String filetype){
int code=Arrays.hashCode(fileContent);
XFiles list=findXFiles(code);
if(list!=null) {
System.err.println("File already exist");
return code;
}
list=new XFiles();
list.setFileName(fileName);
list.setFileContent(fileContent);
list.setFileSize((double)filesize);
list.setFileType(filetype);
list.setFileCode((double)code);
try{
persistEntity(list);
} catch(Exception e){
e.printStackTrace();
return null;
}
return code;
}
public XFiles findXFiles(int code){
Session sess=getSessionFactory().acquireSession();
Expression exp=new ExpressionBuilder().get("fileCode").equal(code);
XFiles list=(XFiles)sess.readObject(XFiles.class,exp);
sess.release();
return list;
}
- While in SessionEjbBean.java, press (Ctrl+Shift+S) to open structure window. Collapse Sources, and double click on SessionEJBLocal.java to open it in the editor. Add following:
Integer saveXFile(String fileName,byte[] fileContent,int filesize,String filetype);
XFiles findXFiles(int code);
- In Application Navigator collapse tree for Model project and select Application Sources à cabinet.model.SessionEjbBean.java. Right click on the file and choose option Create Data Control.
ViewController Project enhancement to complete example application
- In Application Navigator collapse tree for ViewController project and double click web Content à index.jspx to open it in the editor. Choose Design view.
- From Data Control Palette, drag and drop SessionEJBLocal à findAllXFiles() à XFiles at center of open page. Use option Tables à ADF Read-only Table…
- You will get a notification Client Project Libraries Added, if this is the first page on which you are dropping a data control.
- Click anywhere on page and press (Ctrl + Shift + S).
- In Structure window navigate to jsp:root à f:view à afh:html à afh:body à h:form à af:table and then double click on it to open Table Properties dialogue.
- On Column Summary tab, rename Column headers
- #{bindings.findAllXFiles1.labels.fileCode} à Code
- #{bindings.findAllXFiles1.labels.fileName} à Name
- #{bindings.findAllXFiles1.labels.fileSize} à File Size
- #{bindings.findAllXFiles1.labels.fileType} à File Type
- On same tab, change Component of first row (value=#{row.fileCode})
- af:outputText à af:commandLink
- Press OK
- In Structure window navigate to jsp:root à f:view à afh:html à afh:body à h:form à af:table à af:column – Code à af:commandLink - #{row.fileCode} and then press (Ctrl + Shift + I) to open Property Inspector.
- In Action property write #{backing_index.download}
- In Structure window navigate to jsp:root à f:view à afh:html à afh:body à h:form and then right click on it and choose Convert option. Convert Form dialogue will open.
- From ADF Faces Core category choose Form.
- Press OK
- With af:form still selected press (Ctrl + Shift + I) to open Property Inspector.
- In UsesUpload choose true. (IMPORTANT)
- Click anywhere on page. Press (Ctrl + Shift + P) to open Component Palette.
- From Component Palette, drag and drop ADF Faces Core à InputFile at center of open page. New Component will appear below existing Table.
- With newly added component selected press (Ctrl + Shift + I) to open Property Inspector.
- In Label property remove existing text i.e. Label 1
- In Value property enter #{backing_index.uploadedFile}
- Click anywhere on page. Press (Ctrl + Shift + P) to open Component Palette.
- From Component Palette, drag and drop ADF Faces Core à CommandButton at center of open page. New Component will appear below existing File Input Compoent.
- With newly added component selected press (Ctrl + Shift + I) to open Property Inspector.
- In Text property replace existing text with Upload
- In Structure window navigate to jsp:root à f:view à afh:html à afh:body à h:form and then (Ctrl) select af:inputFile and af:commandButton - Upload. Right click on the selection and choose Surround With. Surround With dialogue will open.
- From ADF Faces Core category choose PanelHorizontal.
- Press OK
- In Structure window navigate to jsp:root à f:view à afh:html à afh:body à h:form à af:table à af:column – Code à af:commandLink - #{row.fileCode} and then right click and choose Insert inside of af:commandLink - #{row.fileCode} à ADF Faces Core. Insert ADF Faces Core Item dialogue will appear.
- From ADF Faces Core category choose SetActionListener.
- Press OK.
- Insert SetActionaListener dialogue will appear. Add following values
- From: #{row.fileCode}
- To: #{backing_index.fileCode}
Now we need a backing bean. For this we will create a file and then add relevant information in faces-config.
- In Application Navigator select ViewController project of the newly created application. Press (Ctrl + n) to open New Gallery dialogue.
- In the Categories pan on the left, select General.
- In the Items pan on the right, select Java Class.
- Copy paste Index.java code from next section: Complete Source
- Press Ok.
- Create Java Class dialogue will appear
- Set following values
- Name: Index
- Package: cabinet.view
- Public: [CHECKED]
- Generate Default Constructor: [UNCHECKED]
- Generate Main Method: [UNCHECKED]
- Press OK
- In Application Navigator collapse tree for ViewController project and double click web Content à faces-config.xml to open it in the editor. Choose Source view.
- Before last tag </faces-config> add these lines
<managed-bean>
<managed-bean-name>backing_index</managed-bean-name>
<managed-bean-class>cabinet.view.Index</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindings</property-name>
<value>#{bindings}</value>
</managed-property>
</managed-bean>
Complete Source
index.jspx
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces" xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML" doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<afh:html>
<afh:head title="Index">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
</afh:head>
<afh:body>
<af:messages/>
<af:form usesUpload="true">
<af:table value="#{bindings.findAllXFiles1.collectionModel}" var="row" rows="#{bindings.findAllXFiles1.rangeSize}" first="#{bindings.findAllXFiles1.rangeStart}"
emptyText="#{bindings.findAllXFiles1.viewable ? 'No rows yet.' : 'Access Denied.'}">
<af:column sortProperty="fileCode" sortable="false" headerText="Code">
<af:commandLink text="#{row.fileCode}" action="#{backing_index.download}">
<af:setActionListener from="#{row.fileCode}" to="#{backing_index.fileCode}"/>
</af:commandLink>
</af:column>
<af:column sortProperty="fileName" sortable="false" headerText="Name">
<af:outputText value="#{row.fileName}"/>
</af:column>
<af:column sortProperty="fileSize" sortable="false" headerText="File Size">
<af:outputText value="#{row.fileSize}">
<f:convertNumber groupingUsed="false" pattern="#{bindings.findAllXFiles1.formats.fileSize}"/>
</af:outputText>
</af:column>
<af:column sortProperty="fileType" sortable="false" headerText="File Type">
<af:outputText value="#{row.fileType}"/>
</af:column>
</af:table>
<af:panelHorizontal>
<af:inputFile value="#{backing_index.uploadedFile}"/>
<af:commandButton text="Upload"/>
</af:panelHorizontal>
</af:form>
</afh:body>
</afh:html>
</f:view>
</jsp:root>
faces-config.xml
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<application>
<default-render-kit-id>oracle.adf.core</default-render-kit-id>
</application>
<lifecycle>
<phase-listener>oracle.adf.controller.faces.lifecycle.ADFPhaseListener</phase-listener>
</lifecycle>
<managed-bean>
<managed-bean-name>backing_index</managed-bean-name>
<managed-bean-class>cabinet.view.Index</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindings</property-name>
<value>#{bindings}</value>
</managed-property>
</managed-bean>
</faces-config>
Index.java
package cabinet.view;
import cabinet.model.SessionEJBLocal;
import cabinet.model.XFiles;
import java.io.IOException;
import java.io.InputStream;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import oracle.adf.view.faces.model.UploadedFile;
import oracle.binding.BindingContainer;
public class Index{
private BindingContainer bindings;
private UploadedFile uploadedFile;
private Double fileCode;
public BindingContainer getBindings(){
return this.bindings;
}
public void setBindings(BindingContainer bindings){
this.bindings=bindings;
}
public void setFileCode(Double fileCode){
this.fileCode=fileCode;
}
public Double getFileCode(){
return fileCode;
}
public void setUploadedFile(UploadedFile uploadedFile){
this.uploadedFile=uploadedFile;
try{
Integer code=uploadFile(uploadedFile);
// To refresh table
bindings.getOperationBinding("findAllXFiles").execute();
} catch(IOException e){
e.printStackTrace();
}
}
public UploadedFile getUploadedFile(){
return uploadedFile;
}
public String download(){
if(fileCode!=null)
try{
XFiles atchmn=getEJBLocal().findXFiles(fileCode.intValue());
if(atchmn==null)
return null;
downloadFile(atchmn);
} catch(Exception ex){
ex.printStackTrace();
}
return null;
}
public static Integer uploadFile(UploadedFile file) throws IOException{
byte[] array=new byte[(int)file.getLength()];
InputStream in=file.getInputStream();
int offset=0;
int numRead=0;
do{
numRead=in.read(array,offset,array.length-offset);
offset+=2048;
} while(numRead!=-1);
Integer code=getEJBLocal().saveXFile(file.getFilename(),array,(int)file.getLength(),file.getContentType());
return code;
}
public static void downloadFile(XFiles atchmn){
String fname=atchmn.getFileName();
byte[] pdf=atchmn.getFileContent();
FacesContext faces=FacesContext.getCurrentInstance();
HttpServletResponse response=(HttpServletResponse)faces.getExternalContext().getResponse();
response.setContentType(atchmn.getFileType());
response.setContentLength(atchmn.getFileSize().intValue());
response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma","public");
response.setHeader("Content-disposition","attachment; filename=\""+fname+"\"");
try{
ServletOutputStream out;
out=response.getOutputStream();
out.write(pdf);
} catch(IOException ex){
ex.printStackTrace();
}
faces.responseComplete();
}
public static Object getELObj(String s){
FacesContext fc=FacesContext.getCurrentInstance();
ValueBinding vb=fc.getApplication().createValueBinding(s);
return vb.getValue(fc);
}
public static SessionEJBLocal getEJBLocal(){
try{
SessionEJBLocal ejb=(SessionEJBLocal)getELObj("#{data.SessionEJBLocal.dataProvider}");
return ejb;
} catch(Exception ex){
ex.printStackTrace();
}
return null;
}
}
Note:
If in Index.java you get error on oracle.binding.BindingContainer then this means certain required libraries are not added to your project. When you drag and drop control from Data Control Palette these libraries are automatically added.
Wednesday, July 23, 2008
Avoid ADF Table selection-state reset
This is a small code snippet on how to avoid selection-state reset of an ADF table when the underlying method is re-queried.
Assuming that you have a Master-Detail situation. Lets says, you have a methodAction e.g. id="findAllItems" and an associated methodIterator e.g. id="findAllItemsIter", then following is the code snippet that you can use in the page's managed backing bean to avoid selection-state reset.
public void refreshButRetainSelection(){
CoreTable table=this.getMasterTable();
RowKeySet rowSet=table.getSelectionState();
OperationBinding operationBinding=
bindings.getOperationBinding("findAllItems");
operationBinding.execute(); // requery
table.setSelectionState(rowSet);
Set keySet=table.getSelectionState().getKeySet();
Iterator rowSetIter=keySet.iterator();
DCIteratorBinding iterBinding=
(DCIteratorBinding)bindings.get("findAllItemsIter");
while(rowSetIter.hasNext()){
Key key=(Key)rowSetIter.next();
iterBinding.setCurrentRowWithKey(key.toStringFormat(true));
}
}
Saturday, January 26, 2008
TOPLINK SORTING: How to
One of the first queries I had when I started working with Toplink was how to get sorted results. Here are few techniques that may help newbies (especially the tip at the end regarding child collections sorting).
All example will be given using a two table schema:
CREATE TABLE ACCOUNTS (
LOGIN VARCHAR2(10) NOT NULL PRIMARY KEY,
PASSWORD VARCHAR2(20),
CREATED DATE);
CREATE TABLE LOGINS(
ACCOUNTS_LOGIN VARCHAR2(10) NOT NULL PRIMARY KEY, -- FK pointing to ACCOUNT->LOGIN
LOGIN_TIME DATE NOT NULL PRIMARY KEY,
LOGOUT_TIME DATE,
COMPUTER VARCHAR2(30));
ALTER TABLE LOGINS ADD CONSTRAINT
LOGINS_ACCOUNTS_FK FOREIGN KEY(ACCOUNTS_LOGIN)REFERENCES ACCOUNTS(LOGIN) ENABLE;
For rest of the article, I will assume you have generated pojo using toplink over above mentioned tables.
Sorting Toplink Named Queries
Named queries can be sorted using “AfterLoad” technique.
Let say you have a readAllquery findAllLoginsOf that takes a parameter login (String). A expression is defined as 1. accountsLogin EQUAL login. This query will return all logins by a particular user - without sorting. To add sorting do this:
1. Create static function (This can be any class e.g. MyAfterLoads)
public static void afterLoadLogins(ClassDescriptor descriptor){ // Again, name of method is immaterial.
ReadAllQuery raq=(ReadAllQuery)descriptor.getDescriptorQueryManager().getQuery("findAllLogins");// Default query generated using Toplink POJO creations
raq.addAscendingOrdering("loginTime");
raq=(ReadAllQuery)descriptor.getDescriptorQueryManager().getQuery("findAllLoginsOf");// Our query
raq.addAscendingOrdering("loginTime");
}
2. In Structure window right click on the Logins descriptor. (You will need to first select Toplink map file using the application navigator first).
3. Through the context menu choose Advanced Properties -> After Load
4. Point to the class MyAfterLoads and choose from the drop-down your method. Note: In earlier versions of jdev 10.1.3 there is a bug. So if your method des not appear in the list you may need to open up the class MyAfterLoads choose “Reformat”.
That is all. Note that you can have different sorting for different named queries.
Sorting Toplink Direct Queries
In case you writing Toplink queries directly in java then there is a way for sorting there as well. Taking the same example i.e. findAllLoginsOf, a common way to query it will be:
// LIST (A)
Session session=getSessionFactory().acquireSession();
ExpressionBuilder builder=new ExpressionBuilder();
Expression exp=builder.get("accountsLogin").equal(user);
List
However this will return unsorted list. To sort you will need to use the following code. Notice that instead of readAllObject now I am using executeQuery. Bold is the different part in list A & list B.
// LIST (B)
Session session=getSessionFactory().acquireSession();
ExpressionBuilder builder=new ExpressionBuilder();
Expression exp=builder.get("accountsLogin").equal(user);
ReadAllQuery query=new ReadAllQuery(builder);
query.setReferenceClass(Logins.class);
query.addAscendingOrdering("loginTime");
query.setSelectionCriteria(exp);
List
Sorting Java Entities
You can always do sorting using java Collections i.e. implement Comparable in your POJO (In our case that would be class Logins). We will have something like this after implementing
public int compareTo(Object o){
Logins that = (Logins) o;
return this.getLoginTime().compareTo(that.getLoginTime());
}
Now when you have your collection then all you need to do is to pass it to Collections.sort(List). So list A can be modified as (modification in bold):
Session session=getSessionFactory().acquireSession();
ExpressionBuilder builder=new ExpressionBuilder();
Expression exp=builder.get("accountsLogin").equal(user);
List
logins = (List
The main strength (or weakness) of this particular java technique is that you have only one sorting criteria per table. There are other java techniques as well that give you more options in this regard.
Sorting Child Collection
Use above mentioned technique (i.e. implementing Comparable) to sort child collections.
Accounts account;
//accounts initialization code
//.....
List
logins = (List
Tuesday, January 22, 2008
Do not Automatically Expose UI components in a Managed Bean

Next comes performance. Page (A) needed around 11 seconds to open up (cold start) in Jdeveloper design view. Page (B) took around 35 seconds. However, both pages took same amount of time while opening in a web browser.

Conclusion: 44% additional code is maintanence over-head and a lagging designer is productivity killer. So do not use it unless you have a solid reason for it.
Note (1): All pages were formatted using line length = 127 Character. This has an impact on # of lines.
Note (2): I used Jdeveloper Version 10.1.3.3 on NT 5.
Sunday, April 08, 2007
ADF Faces: Programmatically setting SetActionListener….WHY?
Question: Because the af:setActionListener component is intended to avoid some managed bean code, is there any particular reason why programming with SetActionListener should be preferred?
1) MORE CONTROL: it gives more control...e.g. we can have:
if(A) EL.set("#{sessionScope.someOtherAttribute}", EL.get("#{sessionScope.someAttribute}"));
else if (B) EL.set("#{sessionScope.someOtherAttribute}", EL.get("#{sessionScope.someAttribute2}"));
2) NO CASTING ISSUES: There are casting issues with af:SetActionListener when TO field is pointing to primitive data type e.g. boolean (small b)
if a variable (e,g, enbaleUpdate) is of type boolean rather Boolean then the following line throws EvaluationException ( IllegalArgumentException: type mismatch)
<af:setActionListener to="#{UserStateBean.enableUpdate}" from="true"/>
3) EASIER TO DEBUG: For case like (2) I have found it pretty hard to debug af:SetActionListener component (as compared to code in backing bean)
Saturday, April 07, 2007
Hiding Details if Master doesn’t have any in ADF Faces Tables
I had a use case in which some rows in the Master Table can never have any details; so it makes sense to hide details table instead of printing a blank table with some default text message.
I tried to fit in lot of (buggy) logic and then I realized it can be done using simpler way which is:
Let say the child table has
value="#{bindings.ChildCollection.collectionModel}"
to hide details add:
rendered="#{bindings. ChildCollection.estimatedRowCount>0}"
Monday, March 06, 2006
First International Workshop on Agent Technology for Disaster Management (ATDM) at AAMAS 2006, Hakodate, Japan
This is my first blood in publication so i am excited :).. I hope i will be writing another paper soon. Inhshallah
Saturday, January 07, 2006
Tulip
I found a good software for network visualization i.e. Tulip Software home page. They rightly claim that on regular machine there software can handle 50 thousand nodes. Which is a good number. I still have to hack into there code.
There is a short c++.NET console code that I wrote to generate dummy data for tulip. If you want I can send it over to you. (It won't take more then 30 min to make it a portable C++ code - however I am in no mood for doing that)