Saturday, June 18, 2016

Notepad++ replace with regular expression

(\w+),$
logger.info\("\1="+\1\);

aomBeforeChildItemCode,
aomByitmcat,

to

logger.info("aomBeforeChildItemCode="+aomBeforeChildItemCode);
logger.info("aomByitmcat="+aomByitmcat);


Friday, May 27, 2016

Scala SBT error: sun.security.validator.ValidatorException: PKIX path building failed

Environment: 
Windows 7 in the company, no proxy
No installation on Scala SDK

When run "sbt" from command line, got the error:
sun.security.validator.ValidatorException: PKIX path building failed Error ...

The reason is that Java cannot access https website without trusted key store.
The below two articles explained very well and have the detailed solution, after put the key file to folder jre\lib\security, and rerun "sbt", the error is gone. (my concern, why "mvn" has no such error?)

http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/
https://github.com/escline/InstallCert

Thursday, May 19, 2016

mvn archetype:generate does not work-no plugin found

When run the below:
mvn archetype:generate
got the below error:

mvn archetype:generate does not work-no plugin found for prefix 'archetype'

add -X and search metadata.xml:
mvn -X archetype:generate
It cannot get the *metadata.xml from the central repository because of the firewall/certification
although from the web browser the link is accessible:
Two solutions:
1. add settings.xml in the mvn .m2 folder:
<settings>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>securecentral</activeProfile>
  </activeProfiles>
  <profiles>
    <profile>
      <id>securecentral</id>
      <!--Override the repository (and pluginRepository) "central" from the
         Maven Super POM -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>
2. get and set the certificate file
See:
http://stackoverflow.com/questions/25911623/problems-using-maven-and-ssl-behind-proxy

Monday, May 9, 2016

健身

心肺能力的提高,靠的是长时间的低强度运动,俗称有氧运动,也就是长跑、游泳等。 
我认识一个人,只做俯卧撑,一天做3种变式的俯卧撑,共12组,每组15个,胸肌腹肌分离度和形状都非常棒
【无氧运动的时间】如果是力量训练,实际上时间控制在1小时为最佳,因为男性在进行力量训练的时候,会分泌睾酮,但是睾酮在训练后半小时大幅减少,所以无氧锻炼是前半小时的效率是最高的,因此时间控制在30~60min最好。

蛋清可以多吃,蛋黄一天一个或者两个就够了

https://www.zhihu.com/question/20687290/answer/15853608
最简单的锻炼计划
1.慢跑3~5分钟。总之达到身体微微出汗或者发热的效果即可停止。
2.做仰卧起坐和俯卧撑。
3.然后出去跑5公里,两天或者三天一次。


要保证每天至少7小时的睡眠,让肌肉在睡眠中得到充分的增长。而且每块大肌肉(胸背肩腿)每周练到力竭不要超过两次,小肌肉(手臂、腹部)每周练到力竭不要超过三次。这样能够保证最好的增长。

https://www.zhihu.com/question/19850561/answer/91268580

https://www.zhihu.com/question/29083850/answer/44593248

Sunday, May 1, 2016

How to trace SOAP message in Eclipse IDE

http://www.mkyong.com/webservices/jax-ws/how-to-trace-soap-message-in-eclipse-ide/

1. Endpoint publish
public class HelloWorldPublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
}
}

2. Soap client
public class HelloClient {
public static void main(String[] args) throws Exception {

URL url = new URL("http://localhost:8080/ws/hello?wsdl");
QName qname = new QName("http://ws.mkyong.com/", "HelloWorldImplService");
Service service = Service.create(url, qname);
HelloWorld hello = service.getPort(HelloWorld.class);
System.out.println(hello.getHelloWorldAsString("test"));
}
}

3. Eclipse configuration
Hostname: localhost:9999
Local port: 8080

4. Response message:
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.mkyong.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.mkyong.com/" name="HelloWorldImplService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.mkyong.com/" schemaLocation="http://localhost:9999/ws/hello?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="getHelloWorldAsString">
<part name="parameters" element="tns:getHelloWorldAsString"></part>
</message>
<message name="getHelloWorldAsStringResponse">
<part name="parameters" element="tns:getHelloWorldAsStringResponse"></part>
</message>
<portType name="HelloWorld">
<operation name="getHelloWorldAsString">
<input wsam:Action="http://ws.mkyong.com/HelloWorld/getHelloWorldAsStringRequest" message="tns:getHelloWorldAsString"></input>
<output wsam:Action="http://ws.mkyong.com/HelloWorld/getHelloWorldAsStringResponse" message="tns:getHelloWorldAsStringResponse"></output>
</operation>
</portType>
<binding name="HelloWorldImplPortBinding" type="tns:HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="getHelloWorldAsString">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="HelloWorldImplService">
<port name="HelloWorldImplPort" binding="tns:HelloWorldImplPortBinding">
<soap:address location="http://localhost:9999/ws/hello"></soap:address>
</port>
</service>
</definitions>

Wednesday, April 20, 2016

TD Benifit

If you select a registered account:
• your contributions are made with ‘before-tax’ dollars each pay.
• TD’s contributions will go into a Deferred Profit Sharing Plan or DPSP and you will receive a tax
receipt showing TD’s contributions as part of your Pension Adjustment. This amount will reduce
your RSP contribution room for the next year.
If you direct either your own or TD’s contributions into a registered account, you need to ensure you
have available RSP contribution room.
If you select a non registered account…
• your contributions are made with ‘after tax’ dollars.
• TD’s contributions are considered taxable income and you will receive a T4PS slip at tax time.
The Employee Ownership Plan provides flexibility to make changes each calendar quarter.

If you withdraw from an RSP account,
 The amount withdrawn is taxable.
 You’ll receive a tax receipt for your withdrawal amount and you’ll need to report this as
taxable income for the year.
If you withdraw from a non-registered account no tax slip is issued.
• You are responsible for calculating and reporting any capital gains or losses on your TD
Bank shares on your income tax return.
• Please refer to HR Self Service for your annual statements, transaction history and your
withdrawal statement for the information you need to calculate and report you capital gains
or losses.

If you leave TD and…
have been employed by TD for 2 continuous years, you’re entitled
to your total Employee Ownership Plan balance
 have not been employed by TD for 2 continuous years, you can
withdraw your contributions only. TD’s contributions are forfeited.
 If you return to TD within 3 months, you can participate in the
Employee Ownership Plan immediately.

Oracle pl/sql note

DBMS_METADATA
BEGIN DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', true); END;
DBMS_METADATA.GET_DDL

Oracle 11g new features:
continue support
virtual column
disabled triggers
result cache

The advantage to using RAISE_APPLICATION_ERROR instead of RAISE is that you can associate
an error message with the exception.

SQLERRM will return is 512 bytes, Oracle recommends DBMS_UTILITY.FORMAT_ERROR_STACK
DBMS_UTILITY.FORMAT_ERROR_BACKTRACE --see the error line number

System exception
An exception that is defined by Oracle and is usually raised by the PL/SQL runtime
engine when it detects an error condition. Some system exceptions have names,
such as NO_DATA_FOUND, while many others simply have numbers and
descriptions.
Programmer-defined exception
An exception that is defined by the programmer and is therefore specific to the
application at hand. You can associate exception names with specific Oracle errors
using the EXCEPTION_INIT pragma (a compiler directive, requesting a specific
behavior), or you can assign a number and description to that error using
RAISE_APPLICATION_ERROR.

Associative arrays:
 like hash table
Nested tables:
 unbounded
 become sparse through deletions
 no inherent order to the elements
varrays:
 must specify the max number of elements
 never sparse
 element order is preserved