Monday, August 24, 2009

Insteresting reading points

A. Once you have a direction, you stick to it. But no matter how far you traveled to a wrong direction, turn around.
B. If the only tool you have is a hammer, then everything looks like a nail.
C. Nothing is permanent than temporary patch in a system.

Tuesday, August 18, 2009

Attribute vs element, XML schema

Data goes to element, metadata goes to attribute

Monday, August 17, 2009

powerbuilder path

jonview_socket

T:\jonview_soket\jonview_socket.pbl;
T:\jonview_soket\proxy_socket_call.pbl;

jonview_remote

T:\jonview_remote\jonview_remote.pbl;
T:\jonview_remote\remote_call.pbl;
T:\jonview_remote\remote_fun.pbl;
T:\jonview_remote\remote_call_new.pbl;
T:\jonview_remote\remote_fun_new.pbl;

jonviewhostclient

T:\jonviewclient\client\jonviewclient\jonviewhostclient.pbl;
T:\jonviewclient\client\jonviewclient\voucher.pbl;
T:\jonviewclient\client\jonviewclient\jonview_report.pbl;
T:\jonviewclient\client\jonviewclient\jonview_report_win.pbl;
T:\jonviewclient\client\jonviewclient\jonview_report2.pbl;
T:\jonviewclient\client\jonviewclient\jonviewclient_proxy.pbl;
T:\jonviewclient\client\jonviewclient\library.pbl;
T:\jonviewclient\client\jonviewclient\jonview_common.pbl;

jonviewhostserver_trion

T:\jonviewhost_xml\jonviewhostserver_allian.pbl;
T:\jonviewhost_xml\xml_exchange.pbl;
T:\jonviewhost_xml\jonviewproxy.pbl;
T:\jonviewhost_xml\jonview_common.pbl;
T:\jonviewhost_xml\jonview_xml_parent.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_product.pbl;
T:\jonview_web\common\jonview_public_trion.pbl;
T:\jonview_web\common\jonview_public_h2h.pbl;
T:\jonview_web\common\jonview_public_string.pbl;
T:\jonview_web\common\jonview_public_login.pbl;
T:\jonview_web\common\jonview_public_tariff.pbl;
T:\jonviewhost_xml\jonview_xml_download.pbl;


jonviewhostserver_xml

T:\jonviewhost_xml\jonviewhostserver.pbl;
T:\jonviewhost_xml\jonview_xml_parent.pbl;
T:\jonviewhost_xml\xml_exchange.pbl;
T:\jonviewhost_xml\jonviewproxy.pbl;
T:\jonviewhost_xml\jonview_allian_proxy.pbl;
T:\jonviewhost_xml\jonview_common.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_product.pbl;
T:\jonview_web\common\jonview_public_trion.pbl;
T:\jonview_web\common\jonview_public_h2h.pbl;
T:\jonview_web\common\jonview_public_string.pbl;
T:\jonview_web\common\jonview_public_login.pbl;
T:\jonview_web\common\jonview_public_tariff.pbl;
T:\jonviewhost_xml\jonview_xml_download.pbl;


jonviewhostserver

T:\jonviewhost_all\jonviewhostserver.pbl;
T:\jonviewhost_all\jonview_core_proxy.pbl;
T:\jonviewhost_all\jonview_common.pbl;
T:\jonview_web\common\jonview_public_paxspecial.pbl;
T:\jonview_web\common\jonview_public_nvo.pbl;


jonviewhostserver_voucher

T:\jonviewclient\jonviewhostserver_voucher.pbl;
T:\jonviewclient\jonviewhostserver_father.pbl;
T:\jonviewclient\jonview_common_fun.pbl;
T:\jonviewclient\voucher.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_product.pbl;
T:\jonview_web\common\jonview_public_string.pbl;

jonviewhostserver_report

T:\jonviewclient\jonviewhostserver_report.pbl;
T:\jonviewclient\jonviewhostserver_father.pbl;
T:\jonviewclient\jonview_common.pbl;
T:\jonviewclient\jonview_common_fun.pbl;
T:\jonviewclient\jonview_report2.pbl;
T:\jonviewclient\jonview_report.pbl;

jonviewhostserver(jonviewclient)

T:\jonviewclient\jonviewhostserver.pbl;
T:\jonviewclient\jonviewhostserver_father.pbl;
T:\jonviewclient\jonview_core_proxy.pbl;
T:\jonviewclient\jonview_common.pbl;
T:\jonviewclient\jonview_common_fun.pbl;
T:\jonviewclient\jonviewhost_xmlproxy.pbl;
T:\jonviewclient\jonviewhost_pdfproxy.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_product.pbl;
T:\jonview_web\common\jonview_public_string.pbl;


jonview_trion

T:\jonview_trion\jonview_trion.pbl;
T:\jonview_trion\jonview_trion_common.pbl;
T:\jonview_trion\jonview_proxy.pbl;
T:\jonview_web\common\jonview_public_string.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_reference.pbl;
T:\jonview_web\common\jonview_public_product.pbl;
T:\jonview_web\common\jonview_public_trion.pbl;
T:\jonview_web\common\jonview_public_h2h.pbl;
T:\jonview_web\common\jonview_public_login.pbl;
T:\jonview_web\common\jonview_public_paxspecial.pbl;
T:\jonview_web\common\jonview_public_report.pbl;
T:\jonview_web\common\jonview_public_itinerary.pbl;
T:\jonview_web\common\jonview_public_transportation.pbl;
T:\jonview_web\common\jonview_public_nvo.pbl;
T:\jonview_web\common\jonview_public_tariff.pbl;


jonview_pdf

T:\jonview_pdf\jonview_pdf.pbl;
T:\jonview_pdf\proxy_mail.pbl;

jonview_public

T:\jonview_web\public\jonview_public.pbl;
T:\jonview_web\public\jonview_public_alternate.pbl;
T:\jonview_web\common\jonview_public_common.pbl;
T:\jonview_web\common\jonview_public_login.pbl;
T:\jonview_web\common\jonview_public_tariff.pbl;

how to fix activeMq inactive errors.

Change configuration file under transportConnectors tag
from
transportConnector name="openwire" uri="tcp://localhost:61616" discoveryUri="multicast://default"
to
transportConnector name="openwire" uri="tcp://localhost:61616?wireFormat.maxInactivityDuration=0"

Thursday, August 13, 2009

Inversion of control and dependency injection

The caller eventually get the results, but how and when is out of its control. The callee decide when and how. This is a technique separating execution of a certain task from its implementation.

1. decoupling execution and its implementation
2. Every system focus on what it is designed for.
3. Every system does not what other system will do or should do.
4. Changing one system will not affect others.

Techniques:

1. Factory pattern.
2. setter injection
3. Constructor injection.
4. Services Locater
5. Interface injection

Dependency Injection is decoupling high level modules from low level services.

Monday, August 10, 2009

template VS stragety

he Template pattern is similar to the Strategy pattern. These two patterns differ in scope and in methodology.

Strategy is used to allow callers to vary an entire algorithm, like how to calculate different types of tax, while Template Method is used to vary steps in an algorithm. Because of this, Strategy is more coarsely grained. The Template allows finer-grained controls in the sequent of operations, and yet allows the implementations of these details to vary.

The other main difference is that Strategy uses delegation while Template Method uses inheritance. In Strategy, the algorithm is delegated to the another xxxStrategy class that the subject will have a reference to, but with Template you subclass the base and override methods to make changes.

Strategy pattern example:
Class MainSubject
{

ITaxStrategy taxCalculator = GetStrategy(taxType);
//strategy is member class.
taxCalculator.Calculate();

private GetStrategy(string taxType)
{

if (taxType == "incometax")
return new IncomeTaxStrategy();
else if (taxType == "propertytax")
return new PropertyTaxStrategy();
}
}

Class IncomeTaxStrategy : ITaxStrategy
{


public Calculate()
{
//calculate based on income tax rates.
}

}

Class PropertyTaxStrategy : ITaxStrategy
{

public Calculate()
{
//calculate based on property tax
policies.
}

}

Template pattern example:


abstract Class TaxCalculator
{
public CalculateTax()
{
CalculateIncome();
tax =+ CalculateTax();
tax =+ CalculateRelief();

}
abstract CalculateTax();
abstract CalculateRelief();

}

Class IncomeTaxCalculator : TaxCalculator
{

override CalculateTax() { //calculate income tax. }
override CalculateRelief() { //calculate personal relief }

}

Class PropertyTaxCalculator : TaxCalculator
{

override CalculateTax() { //calculate property tax. }
override CalculateRelief() { //do nothing; no relief. }

}