Skip to main content

Posts

Write simple codes

Rule #1: codes should simple Struggling for fixing the bugs within the complex and repeatable codes in the projects. Codes should always be  simple and readable.  If you have to write complicated codes, refer to rule #1.

Lesson learned from current projects(ongoing)

Took a few months to be familiar with existing projects and try to fix bunch of issues reported by customer and team. Learned huge amount of things from the codes, 1. Use hibernate instead of jdbc sql. This will be extremely help to deal with the change of requirements. 2. Nice convention is necessary. The Java Class should have  the same pre-file name with the Jsp page; Should put all those similiar function codes in one place(e.g. pojo in folder Model , dao in Dao, controller in Controller ,service in folder service), put all the constants in one file(it's really helpful when you have to change them) 3. Test is important( need to plan the test before you commit the codes in production) 4. Version control. Currently, the projects running on three places. The development, staging and production. The production running the stable codes retrieved from trunk, the staging always have the tested codes from development environment; development environment have the lat...

Spring 3.0 ,Axis2 1.6 Integration in Eclipse

You can find this kind of blog from lots of place. The key is: in file /META-INF/services.xml , Should add below bold part to the auto-generated code by Eclipse. <service name="xxxxWebService" > <Description> Please Type your service description here </Description> <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter> <parameter name="SpringBeanName">  programService      </parameter>  <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass" locked="false">c...

Obtaining Spring Releases From Maven Central

You do not have to add a repository to your .pom to obtain  final  releases of Spring projects from Maven Central. Simply add the dependencies your project requires. A .pom <dependency> snippet for each Spring Framework 3 artifact as it will be indexed in Maven Central is listed below. <!-- Shared version number properties --> <properties>     <org.springframework.version>3.0.5.RELEASE</org.springframework.version> </properties> <!--     Core utilities used by other modules.     Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*) --> <dependency>   <groupId>org.springframework</groupId>   <artifactId>spring-core</artifactId>   <version>${org.springframework.version}</version> </dependency> <!--     Expression Language (depends on spring-core)     Def...

How to config Spring JdbcTemplate

jdbc.properties hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.url=jdbc:mysql://localhost/abc?blobSendChunkSize=1024000000&amp;max_allowed_packet=1024000000&amp;autoReconnect=true hibernate.connection.username=abc hibernate.connection.password=abc spring : applicationContext.xml <!-- DataSource defintion --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>${hibernate.connection.driver_class}</value> </property> <property name="url"> <value>${hibernate.connection.url}</value> </property> <property name="username"> <value>${hibernate.connection.username}</value> </property> <property name="password"> <value>${hibernate.connection.password}</value> </pr...

Mysql : The sqls for clone db and rename db

-- -------------------------------------------------------------------------------- -- Clone a db -- Note: comments before and after the routine body will not be stored by the server -- -------------------------------------------------------------------------------- DELIMITER $$ CREATE DEFINER=`dbname`@`%` PROCEDURE `clone_db`(IN old_db VARCHAR(100), IN new_db VARCHAR(100)) BEGIN     DECLARE current_table VARCHAR(100);     DECLARE done INT DEFAULT 0;     DECLARE old_tables CURSOR FOR select table_name from information_schema.tables where table_schema = old_db  and table_type='BASE TABLE';     DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;     OPEN old_tables;     REPEAT         FETCH old_tables INTO current_table;         IF NOT done THEN         SET @output = CONCAT('create table ', new_db, '.', current_table, ' like ', old_db, '.', curren...