Tuesday, July 28, 2009

JSF Thing to cater for if you are JSF Developer

It is because JSF is component base(not simple as MVC direct request to action in controller layer).

Problem of coding style

1) DB query inside getter method of backing bean.

public List getUserRole(){
return userRoleDao.queryAllUserRole();
}


Issue : Getter may be call in restore view or apply request value or render response phase
  • Table component, it wil cause the data being query 2 times.
  • inputText/radio etc. component, it will check the previous submitted value store(JSF will store previous submitted value automatically) inside the inputText. If it is null, it will call the getter in backing bean to retrieve the value.
Following was the log.
[ INFO] 29-07-09 11:10:34 : BEFORE RESTORE_VIEW(1)
[ INFO] 29-07-09 11:10:34 : AFTER RESTORE_VIEW(1)
[ INFO] 29-07-09 11:10:34 : BEFORE APPLY_REQUEST_VALUES(2) Hibernate: select this_.role_name as ...
[ INFO] 29-07-09 11:10:34 : AFTER APPLY_REQUEST_VALUES(2)
[ INFO] 29-07-09 11:10:34 : BEFORE PROCESS_VALIDATIONS(3)
[ INFO] 29-07-09 11:10:34 : AFTER PROCESS_VALIDATIONS(3)
[ INFO] 29-07-09 11:10:34 : BEFORE UPDATE_MODEL_VALUES(4)
[ INFO] 29-07-09 11:10:34 : AFTER UPDATE_MODEL_VALUES(4)
[ INFO] 29-07-09 11:10:34 : BEFORE INVOKE_APPLICATION(5)
[ INFO] 29-07-09 11:10:34 : AFTER INVOKE_APPLICATION(5)
[ INFO] 29-07-09 11:10:34 : BEFORE RENDER_RESPONSE(6) Hibernate: select this_.role_name ...
[ INFO] 29-07-09 11:10:35 : AFTER RENDER_RESPONSE(6)

Solution : Only query DB when it is in render response phase.

public List getUserRole(){
if (FacesContext.getCurrentInstance().getRenderResponse())
return userRoleDao.queryAllUserRole();
else
return null;
}

or

public List getUserRole(){
if ( userRoleList!=null)
userRoleList = userRoleDao.queryAllUserRole();

return userRoleList;
}

JSF 2 going to have MVC lifecycle!!!

JSF 1 Immediate property

Immediate = true , it will no proceed to Validations phase. It suit for Cancel button that you don't want any validation(require=true etc.) on the page but it will reach to action of Cancel button. Since those parameters of inputText do not go through validation phase, it also will not update to your variable in backing bean. There is a workaround solution to retrieve those values.

hyperlink immediate = true. that only accepts values from a specific control (the immediate property for all of these components would be true).

Wednesday, June 24, 2009

Attractive Tourism in Google Earth


Create tour in google earth for all tourist attraction.
  • Bring tourist to go arround tourist attraction.
  • Youtube included for more interactive.
  • Search engine looking for place to go example shopping, outlet, night market,night scene, beach...
Thing to do
  • Collect tourist attraction information.
  • Build all the 3D building for tourist attraction in google earth. It not only building. 3D can be table, swimming poor, car... All Objects.
  • Make movie in youtube.
Money channel Hotel, Restaurant, Government Tourism
  • Specialist tourism IT department for government.
  • Search nearest hotel.
  • Build 3d hotel for them. Information and youtube intro the hotel. Then bring customer to their hotel home page.
  • Ocean feature in google earth is focus on educate ppl importance of environmental protection. Help government to educate ppl, submit geographical data for research. See the youtube Google earth 5 launch event to know more about ocean.


Technically work!!! Totally not an issue.
It easier than war game in google earth. Start this phase first for training our guy to get use to google earth technology. Prepare for the second phase of social networking and war game.

Progress
Learning
  • Using SketchUp to draw 3d building and integrate to google earth.
  • Export kmz file for ppl download.
Next - How to import it to google earth to make it share with all users. No need download individual file to view. Because it can be public in google servel or private in individual kmz file.

Thursday, June 18, 2009

Vista Setup Guide

1) Step

UAC Popup "Windows needs your permission to continue":

UAC Popup example

How to quickly disable User Account Control (UAC):

  1. Click the round blue Windows Start button. Now click Control Panel
  2. From the Control Panel, click User Accounts and Family Safety (or User Accounts if your in classic view)
  3. Click the option to Turn User Account Control on or off
  4. Uncheck the box next to Use User Account Control (UAC) to help protect your computer and click OK
  5. Restart when prompted

2 )Step Configuration for Vista accept XP folder
Vista uses the more-picky NTLMv2 network protocol, while XP uses NTLMv1. The answer is, therefore, to switch Vista to use NTLMv1.

Here's the Mac-oriented post which tells how to modify Vista: http://www.broadbandreports.com/faq/14837

Rewriting it in Windows terminology, it would read:

To allow Vista to talk to your XP/2000/Linux shares, you must allow Vista to authenticate via NTLMv1:

If you have Windows Vista Home Basic/Premium:
Open the registry editor. Navigate to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa.

There will be a value called LmCompatibilityLevel. Set that to DWORD 1. Reboot and try to connect again.

Sunday, June 14, 2009

Research 1 on Google earth

Thing can be on google earth



Create 3d model on google earth by using sketchup



Google Earth can be develop using Java Gwt API for Google Map

KML in Google Earth

KML is a file format used to display geographic data in an Earth browser, such as Google Earth, Google Maps, and Google Maps for mobile. You can create KML files to pinpoint locations, add image overlays, and expose rich data in new ways. KML is an international standard maintained by the Open Geospatial Consortium, Inc. (OGC).


KML Interactive Sampler You can see what can be done in google earth

Wednesday, May 6, 2009