- 10月 11 週三 200620:03
北橫兩日遊
- 10月 05 週四 200620:01
我的Eclipse裝了哪些Plug-in
- 9月 29 週五 200620:01
安裝Postfix和SASL2
安裝/usr/ports/security/cyrus-sasl2-saslauthd和/usr/ports/mail/postfix 建立/usr/local/lib/sasl2/smtpd.conf: pwcheck_method: saslauthd mech_list: plain login 修改/usr/local/etc/rc.d/saslauthd.sh,將saslauthd_flags="-a pam"改成saslauthd_flags="-a getpwent"
- 9月 12 週二 200620:00
我的spring-beans.xml
<?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE beans PUBLIC “-//SPRING/DTD BEAN/EN” “http://www.springframework.org/dtd/spring-beans.dtd”> <beans> <bean id=”dataSource” class=”org.logicalcobwebs.proxool.ProxoolDataSource” destroy-method=”close”> <property name=”driver”><value>${jdbc.driver}</value></property> <property name=”driverUrl”><value>${jdbc.url}</value></property> <property name=”user”><value>${jdbc.username}</value></property> <property name=”password”><value>${jdbc.password}</value></property> <property name=”alias”><value>xfort</value></property> <property name=”houseKeepingTestSql”><value>SELECT 1</value></property> <property name=”testBeforeUse”><value>false</value></property> <property name=”maximumActiveTime”><value>86400000</value></property> <property name=”maximumConnectionCount”><value>${proxool.maximum-connection-count}</value></property> <property name=”delegateProperties”><value>user=${jdbc.username},password=${jdbc.password}</value></property> </bean> <bean id=”sessionFactory” class=”org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean”> <property name=”dataSource”><ref bean=”dataSource” /></property> <property name=”hibernateProperties”> <props> <prop key=”hibernate.dialect”>${hibernate.dialect}</prop> <prop key=”hibernate.format_sql”>true</prop> <prop key=”hibernate.show_sql”>false</prop> <prop key=”hibernate.cache.use_second_level_cache”>false</prop> <prop key=”hibernate.cache.provider_class”>org.hibernate.cache.EhCacheProvider</prop> <prop key=”hibernate.current_session_context_class”>thread</prop> <prop key=”hibernate.connection.release_mode”>after_transaction</prop> <prop key=”hibernate.transaction.factory_class”>org.hibernate.transaction.JDBCTransactionFactory</prop> <prop key=”hibernate.transaction.auto_close_session”>false</prop> </props> </property> <property name=”annotatedPackages”> <list> <value>forth.model</value> </list> </property> <property name=”annotatedClasses”> <list> <value>zbwei.model.ModelName</value> </list> </property> </bean> </beans> - 9月 07 週四 200620:00
我的build.xml
<?xml version=”1.0″ encoding=”UTF-8″?> <project name=”Forth” default=”compile” basedir=”.”> <property name=”build.dir” value=”build” /> <property name=”build.dist.dir” value=”${build.dir}/dist” /> <property name=”build.main.dir” value=”${build.dir}/main” /> <property name=”build.test.dir” value=”${build.dir}/test” /> <property name=”build.test.output.dir” value=”${build.dir}/test-output” /> <property name=”build.test.report.dir” value=”${build.dir}/test-report” /> <property name=”src.dir” value=”src” /> <property name=”test.dir” value=”test” /> <property name=”lib.dir” value=”lib” /> <property name=”ext.dir” value=”ext” /> <property name=”web.dir” value=”web” /> <path id=”classpath”> <pathelement location=”${build.main.dir}” /> <pathelement location=”${build.test.dir}” /> <fileset dir=”${lib.dir}” includes=”*.jar” /> <fileset dir=”${ext.dir}” includes=”*.jar” /> </path> <target name=”prepare”> <mkdir dir=”${build.dist.dir}” /> <mkdir dir=”${build.main.dir}” /> <mkdir dir=”${build.test.dir}” /> <mkdir dir=”${build.test.output.dir}” /> <mkdir dir=”${build.test.report.dir}” /> </target> <target name=”clean” depends=”prepare”> <delete dir=”${build.dir}” /> </target> <target name=”compile” depends=”prepare”> <javac srcdir=”${src.dir}” destdir=”${build.main.dir}” encoding=”UTF-8″> <classpath refid=”classpath” /> </javac> </target> <target name=”compile-test” depends=”compile”> <javac srcdir=”${test.dir}” destdir=”${build.test.dir}” encoding=”UTF-8″> <classpath refid=”classpath” /> </javac> </target> <target name=”test” depends=”compile-test”> <taskdef name=”testng” classname=”org.testng.TestNGAntTask” classpath=”${ext.dir}/testng-5.1.jar” /> <testng classpathref=”classpath” outputdir=”${build.test.output.dir}” haltOnfailure=”true”> <xmlfileset dir=”test” includes=”testng.xml” /> </testng> </target> <target name=”test-report” depends=”test”> <junitreport todir=”${build.test.report.dir}”> <fileset dir=”${build.test.output.dir}” includes=”**/*.xml” /> <report format=”noframes” todir=”${build.test.report.dir}” /> </junitreport> </target> <target name=”pack-main” depends=”compile”> <jar destfile=”${build.dist.dir}/setup.jar”> <manifest> <attribute name=”Main-Class” value=”Installer” /> <attribute name=”Class-Path” value=”. server.jar” /> </manifest> </jar> <jar destfile=”${build.dist.dir}/server.jar”> <fileset dir=”${build.main.dir}” /> </jar> <jar destfile=”${build.dist.dir}/web.war”> <fileset dir=”${web.dir}” /> </jar> </target> <target name=”pack-test” depends=”compile-test”> <jar destfile=”${build.dist.dir}/test.jar”> <fileset dir=”${build.test.dir}” /> </jar> </target> <target name=”dist” depends=”pack-main, pack-test”> <copy todir=”${build.dist.dir}”> <fileset dir=”.” includes=”resource/*” /> <fileset dir=”.” includes=”config/*” /> </copy> </target> </project> - 9月 07 週四 200619:59
我的Java工作目錄結構
build/dist/ - 封裝成佈署用的檔案 build/main/ - 主程式class檔 build/test/ - 測試程式class檔 build/test-output/ - TestNG輸出 build/test-report/ - JUnitReport config/ - 設定檔 classes/ - Eclipse產生的class檔 ext/ - 其它JAR檔,例如ProGuard、yGuard lib/ - 程式庫JAR檔 resource/ - 資源檔 src/ - 主程式原始碼 test/ - 測試程式原始碼 web/ - 網頁 web/WEB-INF/
- 8月 08 週二 200619:58
Top 11 Rails Plugins
From Top 11 Rails Plugins:
- Acts As Taggable -上tag
- Acts As Rateable – 評分
- Acts As Commentable – 評論
- Acts As Voteable – 投票
- Acts As Blog – Textile, Markup, SmartyPants轉HTML
- Acts As Versioned – 資料歷程
- Acts As Bookmarkable – 書籤
- Riff Rails – 資料比對
- Rails PDF – 產生PDF文件
- Calendar Helper – 日曆元件
- Graphs Rails – CSS長條圖
- 7月 29 週六 200619:58
Postfix Anti-spam
I’ve added following lines to my main.cf of Postfix to try to block more spams.
strict_rfc821_envelopes = yes parent_domain_matches_subdomains = smtpd_access_maps smtpd_helo_required = yes smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, check_client_access hash:/usr/local/etc/postfix/access_client, reject_unauth_pipelining, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.mail-abuse.org
Also ADSL with dynamic IPs from Taiwan listed in access_client are blocked.
dynamic.hinet.net REJECT dynamic.tfn.net.tw REJECT dynamic.seed.net.tw REJECT dynamic.apol.com.tw REJECT dynamic.giga.net.tw REJECT dynamic.ttn.net REJECT dynamic.ebtnet.net REJECT dynamic.so-net.net.tw REJECT dynamic.lsc.net.tw REJECT hkcable.com.hk REJECT
- 7月 29 週六 200619:56
Java和Delphi時間換算
在Java中的Date是以long記錄時間,單位是ms,0表示1970-01-01 00:00:00 GMT,而Delphi的TDateTime則是以double記錄時間,0.0表示1899-12-30 00:00:00,整數部分代表從前述時間到某個日期所經過的天數,小數部分乘以86400代表該日經過的秒數。
從1899年12月30日到1970年1月1日,共計25569日,每日計有86400000ms,因此要把Java的時間轉成Delphi的格式可用下列程式:
static final double DAYS_BETWEEN_18991230_AND_19700101 = 25569; static final double MILLISECONDS_PER_DAY = 86400000; public static double javaTimeToDelphiTime(final Date time) { return (time.getTime() + TIME_ZONE_OFFSET_MILLIS) / MILLISECONDS_PER_DAY + DAYS_BETWEEN_18991230_AND_19700101; } 經過計算得到的時間就可以直接給在Delphi使用。要將時間換算成Java格式可用:
public static Date delphiTimeToJavaTime(final double time) { return new Date((long)((time - DAYS_BETWEEN_18991230_AND_19700101) * MILLISECONDS_PER_DAY - TIME_ZONE_OFFSET_MILLIS)); }