周五,吃了晚饭和同事到新开的宠物店闲逛。一边赞叹琳琅满目的宠物食/用品,同事指了指包装精美的四只宠物狗鞋子。
下意识的,我回应说“不错哦,有两双可以替换”。。。。
“两双?”,同事楞了楞说道。
我说“对啊,四只不就两双吗?”。。。。
“狗有四只脚。。。。”
哈哈,惯性思维。总想着人就一双两只鞋呗,所以见到四只鞋子就理所当然的以为是两双,还“替换”呢!
其实日常工作中,常有因为惯性思维而闹笑话的事,很多时候当事人并不知晓犯了什么错误,就像我一样,愣是得意着。
注:请不要咬文嚼字计较四只,该说是一套/一双/两双?重点在于“替换” 与 “惯性思维”
Friday, March 12, 2010
Tuesday, March 2, 2010
Jasper Report + Oracle CURSOR_SHARING='FORCE'
Notice that if i set the Oracle Initialization Parameter
CURSOR_SHARING = 'FORCE' or
CURSOR_SHARING = 'SIMILAR'
the Jasper Report (iReport) with UNION query does not work. It shall give the following error:
java sql sqlexception : no more data read from socket
To solve this, I have to tell the optimiser to switch off the cursor sharing feature for this query by inserting the phrase /*+ CURSOR_SHARING_EXACT */ into the query.
E.g.
SELECT /*+ CURSOR_SHARING_EXACT */ field 1 FROM TABLE 1
UNION
SELECT field 2 FROM TABLE 2
References:
1. Extract from http://www.psoug.org/reference/hints.html
Oracle can replace literals in SQL statements with bind variables, when it is safe to do so. This replacement is controlled with the CURSOR_SHARING initialization parameter. The CURSOR_SHARING_EXACT hint instructs the optimizer to switch this behavior off. In other words, Oracle executes the SQL statement without any attempt to replace literals with bind variables.
2. CURSOR_SHARING :
http://www.oracle.com/technology/oramag/oracle/06-jan/o16asktom.html
CURSOR_SHARING = 'FORCE' or
CURSOR_SHARING = 'SIMILAR'
the Jasper Report (iReport) with UNION query does not work. It shall give the following error:
java sql sqlexception : no more data read from socket
To solve this, I have to tell the optimiser to switch off the cursor sharing feature for this query by inserting the phrase /*+ CURSOR_SHARING_EXACT */ into the query.
E.g.
SELECT /*+ CURSOR_SHARING_EXACT */ field 1 FROM TABLE 1
UNION
SELECT field 2 FROM TABLE 2
References:
1. Extract from http://www.psoug.org/reference/hints.html
Oracle can replace literals in SQL statements with bind variables, when it is safe to do so. This replacement is controlled with the CURSOR_SHARING initialization parameter. The CURSOR_SHARING_EXACT hint instructs the optimizer to switch this behavior off. In other words, Oracle executes the SQL statement without any attempt to replace literals with bind variables.
2. CURSOR_SHARING :
http://www.oracle.com/technology/oramag/oracle/06-jan/o16asktom.html
Thursday, February 4, 2010
jQuery/Plugin : Problem with Add/Remove row for Tablesorter Plugin
For using the jQuery tablesorter (http://tablesorter.com/docs/ ), the table will not refresh correctly if you use the additional pager plugin.
To solve this problem, you have to add in 2 customised functions/events to take care of the row adding/removal.
Add the following 2 functions to the tablesoter javascript file.
You can bind the functions 2 customised events as follows:
Finally you can call the events from your page as follows:
To solve this problem, you have to add in 2 customised functions/events to take care of the row adding/removal.
Add the following 2 functions to the tablesoter javascript file.
function addRow(table, newRow){
//Rebuild html table from the modified rowsCopy
$.tablesorter.clearTableBody(table);
if (table.config.rowsCopy!=undefined)
$.each(table.config.rowsCopy, function() {
$(table).find('tbody:first').append($(this));
});
//Append new row to the HTML table
$(table).find('tbody:first').append(newRow);
//Update call will rebuild tablesorter.cache from the existing HTML table
$(table).trigger("update");
//With pager plugin, this will call appender function in pager
//In turn, it will redraw the table with pagination
$(table).trigger("appendCache");
//Retain sorting if any
$(table).trigger("sorton",[table.config.sortList]);
}
function removeRow(table, rowId){
//Remove the selected row from pager.rowsCopy
var newRowsCopy = $.grep(table.config.rowsCopy, function(n, i){
return ($(n).attr('id')!=rowId);
});
table.config.rowsCopy = newRowsCopy;
//Rebuild html table from the modified rowsCopy
$.tablesorter.clearTableBody(table);
if (table.config.rowsCopy!=undefined)
$.each(table.config.rowsCopy, function() {
$(table).find('tbody:first').append($(this));
});
//Update call will rebuild tablesorter.cache from the existing HTML table
$(table).trigger("update");
//With pager plugin, this will call appender function in pager
//In turn, it will redraw the table with pagination
$(table).trigger("appendCache");
}
You can bind the functions 2 customised events as follows:
$this.bind("addRow",function(event,newRow){
addRow(this,newRow);
});
$this.bind("removeRow",function(event,rowId){
removeRow(this,rowId);
});
Finally you can call the events from your page as follows:
$(sortTable).trigger("removeRow",[id for the row to be removed]);
var newTr = $('<tr><td>New Row</td></tr>');
$(sortTable).trigger("addRow",[newTr]);
Deploy Netbeans 6.1 Web Application to Tomcat 5.5
Netbeans 6.1 come bundles with Tomcat 6.0. So you will encounter problem if you upload the war file directly to your production Tomcat 5.5 server.
Reason being the web.xml in you war file use version 2.5 XML declaration but Tomcat 5.5 uses version 2.4. The web.xml is located at
<catalina-home>/webapps/<your apps>/WEB_INF
Look at the first two lines of the web.xml, you shall see something like the following
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Whereas in Tomcat 5.5, the two lines shall be replaced with the following
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
After which, you have to clear the cache of compiled JSP file.
<catalina-home>\work\Catalina\<your apps>
Remove the whole folder with name "_" (underscore). This is the compiled JSP file (java class) by tomcat and is compiled only once when the jsp page is accessed/requested for the first time.
You have to stop the tomcat before removing the folder.
The folder will be rebuild automatically after you have restarted the tomcat and the jsp is being accessed.
Reason being the web.xml in you war file use version 2.5 XML declaration but Tomcat 5.5 uses version 2.4. The web.xml is located at
<catalina-home>/webapps/<your apps>/WEB_INF
Look at the first two lines of the web.xml, you shall see something like the following
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Whereas in Tomcat 5.5, the two lines shall be replaced with the following
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
After which, you have to clear the cache of compiled JSP file.
<catalina-home>\work\Catalina\<your apps>
Remove the whole folder with name "_" (underscore). This is the compiled JSP file (java class) by tomcat and is compiled only once when the jsp page is accessed/requested for the first time.
You have to stop the tomcat before removing the folder.
The folder will be rebuild automatically after you have restarted the tomcat and the jsp is being accessed.
Thursday, January 21, 2010
Install OSX86 on Dell Vostro 220S
Background :
1. OSX86 : iAKTOS V7 - Leopard 10.5.7
2. Dell Vostro Slim 220s
- Chipset : Intel G45
- Audio : 82801JI (ICH10 Family) HD Audio
- Video : Intel GMA X4500HD
- LAN : Realtek RTL8111/8168B
3. Reference : http://www.insanelymac.com/forum/lofiversion/index.php/t149504.html
1. OSX86 : iAKTOS V7 - Leopard 10.5.7
2. Dell Vostro Slim 220s
- Chipset : Intel G45
- Audio : 82801JI (ICH10 Family) HD Audio
- Video : Intel GMA X4500HD
- LAN : Realtek RTL8111/8168B
3. Reference : http://www.insanelymac.com/forum/lofiversion/index.php/t149504.html
Installation Instructions:
1. Load iAktos V7 DVD
2. At prompt, press F8 and type in cpus=1 (Otherwise, you are not able to boot up)
3. Customised Options
a. X86 Patches -> ACPI -> X86 ACPI
b. X86 Patches -> Disabler (uncheck, it is checked by default)
c. Drivers -> VGA -> Intel -> EFI String for Intel
d. Drivers -> System -> SATA/IDE -> AHCI
(must set bios with SATA = AHCI, else you will get "waiting for root device
error during boot up later after finish the installation)
e. Drivers -> System -> IntelSpeedStep -> Choose both
f. Drivers -> System -> USB -> checked
g. Drivers -> System -> Sound -> AppleAzalia
( I choose the default Voodoo HDA driver before and ran into problem during boot up)
g. Drivers -> System -> PS/2 Mouse/Keyboard -> Apple PS/2 Driver
The rest just leave it as default.
I am able to make it work with the above installation, network proven working.
However, it tooks quite long to boot up
Going to test installing Xcode.
Going to test installing Xcode.
Wednesday, January 6, 2010
Project : MyERA Portal
Project : MyERA Portal
Platform : JSP / Apache Tomcat
Company : ERA Realty Network Pte Ltd
This is the first web application that I developed using JSP + Tomcat.
It is designed to serve as a one-stop portal for our property agents initially and grows to assists our staff as well todate.
This is really a 'break-through' for our company as it is the first web application launched to provide various online services to our agents and staff.
Thorough the portal, our agent can

1. Check their transactions online
2. Print their commission payment voucher
3. Check past transaction sales price
4. Check property available for sales/rental
5. Updated property news
6. Company annoucements
7. Download electronic copy of various documents/forms
There is a lot more that agent can benefit from the portal and I am consistently improving it to provide more services online.
Amid improving the portal, I found that there are some services that are also useful to our staff by acessing the same data source. Therefore, I added in some services for the staff to replace their manual workflow.
More importantly, our management can retrieve various reports online anytime anywhere now compare to last time whereby I need to prepare for them manually upon request.
In fact, I am very satisfied and proud this portal as it not only benefit our agents in terms of convenience and efficiency but also streamline our office workflow by automate it to save manpower as well.
For example, last time we need dedicated manpower to update some of the details on our company website http://www.era.com.sg/ on a regular basis. It is a very routine and tedious tasks whereby the department concern need to compile the updated information and pass it to the IT for converting to the web pages. In the end, I created a module so that the staff in charge can update the information directly without going through IT and it will be reflected online immediately. Through many of such modules, I am able to cut down uncessary manpower wastage on these routine tasks.
Well, I have more ideas to make it better but.....
Anyway, the next improvement in the pipeline is to implement SSL on the website to make it secure!
Platform : JSP / Apache Tomcat
Company : ERA Realty Network Pte Ltd
This is the first web application that I developed using JSP + Tomcat. It is designed to serve as a one-stop portal for our property agents initially and grows to assists our staff as well todate.
This is really a 'break-through' for our company as it is the first web application launched to provide various online services to our agents and staff.
Thorough the portal, our agent can

1. Check their transactions online
2. Print their commission payment voucher
3. Check past transaction sales price
4. Check property available for sales/rental
5. Updated property news
6. Company annoucements
7. Download electronic copy of various documents/forms
There is a lot more that agent can benefit from the portal and I am consistently improving it to provide more services online.
Amid improving the portal, I found that there are some services that are also useful to our staff by acessing the same data source. Therefore, I added in some services for the staff to replace their manual workflow.
More importantly, our management can retrieve various reports online anytime anywhere now compare to last time whereby I need to prepare for them manually upon request.
In fact, I am very satisfied and proud this portal as it not only benefit our agents in terms of convenience and efficiency but also streamline our office workflow by automate it to save manpower as well.
For example, last time we need dedicated manpower to update some of the details on our company website http://www.era.com.sg/ on a regular basis. It is a very routine and tedious tasks whereby the department concern need to compile the updated information and pass it to the IT for converting to the web pages. In the end, I created a module so that the staff in charge can update the information directly without going through IT and it will be reflected online immediately. Through many of such modules, I am able to cut down uncessary manpower wastage on these routine tasks.
Well, I have more ideas to make it better but.....
Anyway, the next improvement in the pipeline is to implement SSL on the website to make it secure!
Friday, December 18, 2009
Journey Start : On way up to Mt KK - Part I (18 Dec 09)
[18 Dec 09]
Waked up early in the morning as we are leaving to the KK park HQ to start climbing.
First and foremost, make sure you have booked a room with Laban Rata or Pendant Hut, otherwise you are not allowed to climb the moutain.
1. Firstly, you can deposit your luggage at the HQ, Sutera Santuary Lodge at RM10/luggage. Make sure you packed only the necessary items as you will be carrying them for the next 6km uphill.
2. Next, you have to register at the office to get your climbing permit and engage a moutain guide.

3. After which, remember to collect your free packed lunch from the Sutera Santuary Cafeteria. There is a staircase opposite the luggage
deposit leading downward to the cafeteria (behind the trail map sign board). There are 2 companies who provide accommodation up in Mt KK. One is Laban Rata by Sutera Sanctuary and another is Pendant Hut by Moutain Torq. You can get the packed lunch from the cafeteria only if you book thru the Sutera Sanctuary. As whether Mountain Torq do provide lunch or not, I am not too sure because I learned about it only after I returned from the peak :)
4. Wait for your moutain guide and there will be a van to send you to the Timpohon Gate, the starting point of the 6km trail.
Necessary Items Checklist:
(I). Clothes for changing and those to keep you warm. Bring extra pairs especially the socks as you will get wet when you reached Laban Rata.
(II). Gloves - Strongly recommended if you going to the summit. It is very cold up there. However, if you going to the Ferrata, then you may prepare another thiner pair gloves so that it is easier to grap the rope.
(III). Head light with extra batteries - Strongly recommended and preferred over a torch light if you going to climb the summit
(IV). Food - For you to consume along the trail and when you rest at Laban Rata. Can bring energy/chocalate bar, 3-in-1 Coffee, instant noodle etc, coz these items are very costly up there.
(V). Hiking pole/Walking stick - Can buy a cheap walking stick at RM3 from the guide if you did not bring your own hiking pole. Personally i did not use it for the 6Km trail up/down but it does help me when climbing the 2.7km trail to the summit.
(VI). Poncho - A must unless you don't mind to get wet :).
Transportation costs (according to my tour guide, to be verified):
There is also long distance bus available but I did not check for the details.
However, I did see a "Transportation Office" next to the luggage deposit, not sure if it is relevant.
Album:
Waked up early in the morning as we are leaving to the KK park HQ to start climbing.
First and foremost, make sure you have booked a room with Laban Rata or Pendant Hut, otherwise you are not allowed to climb the moutain.
1. Firstly, you can deposit your luggage at the HQ, Sutera Santuary Lodge at RM10/luggage. Make sure you packed only the necessary items as you will be carrying them for the next 6km uphill.2. Next, you have to register at the office to get your climbing permit and engage a moutain guide.
3. After which, remember to collect your free packed lunch from the Sutera Santuary Cafeteria. There is a staircase opposite the luggage
deposit leading downward to the cafeteria (behind the trail map sign board). There are 2 companies who provide accommodation up in Mt KK. One is Laban Rata by Sutera Sanctuary and another is Pendant Hut by Moutain Torq. You can get the packed lunch from the cafeteria only if you book thru the Sutera Sanctuary. As whether Mountain Torq do provide lunch or not, I am not too sure because I learned about it only after I returned from the peak :)
4. Wait for your moutain guide and there will be a van to send you to the Timpohon Gate, the starting point of the 6km trail.Necessary Items Checklist:
(I). Clothes for changing and those to keep you warm. Bring extra pairs especially the socks as you will get wet when you reached Laban Rata.
(II). Gloves - Strongly recommended if you going to the summit. It is very cold up there. However, if you going to the Ferrata, then you may prepare another thiner pair gloves so that it is easier to grap the rope.
(III). Head light with extra batteries - Strongly recommended and preferred over a torch light if you going to climb the summit
(IV). Food - For you to consume along the trail and when you rest at Laban Rata. Can bring energy/chocalate bar, 3-in-1 Coffee, instant noodle etc, coz these items are very costly up there.
(V). Hiking pole/Walking stick - Can buy a cheap walking stick at RM3 from the guide if you did not bring your own hiking pole. Personally i did not use it for the 6Km trail up/down but it does help me when climbing the 2.7km trail to the summit.
(VI). Poncho - A must unless you don't mind to get wet :).
Transportation costs (according to my tour guide, to be verified):
1 KKIA (Airport) to Kota Kinabalu Park HQ : RM180/one way per 8-seater taxi (Toyota Unser). Can accommodate 7 passengers.
2. Kota Kinabalu Park HQ to KK city : RM150/one wayThere is also long distance bus available but I did not check for the details.
However, I did see a "Transportation Office" next to the luggage deposit, not sure if it is relevant.
Album:
![]() |
| 18 Dec 09 (Mt KK - Up to Laban Rata) |
Subscribe to:
Posts (Atom)
