linux mysql

八月 14th, 2010

让远程主机访问mysql,需要

修改/etc/mysql/my.cnf, 给bind_address加上注释,重启mysql

为远程主机赋权限

Posted in mysql

Excel小技巧

八月 3rd, 2010

删除空行

选中要删除空行的范围,筛选,选择(空白),选择删除行

Posted in office

Java ClassLoader

八月 1st, 2010

ClassLoader的作用: 将java类库加载到JVM中,一般类在实例化对象的时候才真正加载.

同一个类名在同一个classLoader中只会加载一次.

在JVM启动时,有三种classLoader会被使用到

bootstrap class loader,是jvm内部机制的一部分,负责加载<JAVA_HOME>/lib下的类库

extenstions class loader,加载<JAVA_HOME>/lib/ext下的类库

system class loader,加载CLASSPATH下的类库(这里还不明白)

classLoader使用父子委托模型,即

有parent classLoader的情况下,递归委托parent classLoader加载

无parent classLoader的情况下,使用bootstrap class loader加载

上述两种情况都加载不到类时,调用当前classLoader的findClass方法加载

要实现自定义的classLoader,需要继承java.lang.ClassLoader,并且重写findClass方法.

Download: 一个例子

由数据库驱动的加载方式来看classLoader的作用:

Class.forName("com.mysql.jdbc.Driver"); 定位,加载,实例化

以上这个语句的执行效果等同于new com.mysql.jdbc.Driver();

ps: DriverManager的注释中提到: the DriverManager class will attempt to load the driver classes referenced in the "jdbc.drivers" system property.那么也就是说System.setProperty("jdbc.drivers","com.mysql.jdbc.Driver");也是同样的效果.

classLoader.loadClass("com.mysql.jdbc.Driver"); 定位,加载,并没有实例化, 所以DriverManager.getConnection在调用driver.connect方法时会报错.

Posted in java

合同英语

七月 31st, 2010

名词

Share Purchase Agreement 购股协议

Holding Limited 控股有限公司

British Virgin Islands 英属维京群岛

Ordinary Shares 普通股

respective dates of payment specified 各自指定的付款日

miscellaneous 杂项

Governing Law 适用法律

Dispute Resolution 争议解决

其他

hereinafter  以下

hereto 本协议 

herein 此处

hereof 本法  

whereas 鉴于

hereunder 下文

consent 同意

jurisdiction 管辖权

consultation 磋商

agreements or instruments 协议或文书

disbursements 付款

waiver 自动放弃

courier 快递

facsimile 传真

par value 面值

covenant 公约

installment 分期付款

Posted in 乱七八糟

android初试

七月 31st, 2010

Download: andhello.apk

自己参照http://code.google.com/p/androidbmi/wiki/AndroidLogic做的一个体型测试的小软件

helloworld

Posted in android

存储过程: table_to_bean

七月 30th, 2010

Download: table_to_bean_generator.pck

procedure generate_bean(p_tbl_name in varchar2, p_bean_name in varchar2) is
  begin
    dbms_output.enable(100000);
    w('public class ' || p_bean_name || ' {');
    -- iterate over columns
    for col in c_col(b_tbl_name => p_tbl_name) loop
      w('private ' || col.java_type || ' ' ||
        genVariableName(col.column_name) || ';' || '//' || col.comments);
    end loop;

    -- now generate accessor methods
    for col in c_col(b_tbl_name => p_tbl_name) loop
      w('public void set' || genMethodName(col.column_name) || ' (' ||
        col.java_type || ' ' || genVariableName(col.column_name) || ') {');
      w('this.' || genVariableName(col.column_name) || '=' ||
        genVariableName(col.column_name) || ';');
      w('}');

      if col.java_type = 'boolean' then
        w('public ' || col.java_type || ' is' ||
          genMethodName(col.column_name) || ' () {');
      else
        w('public ' || col.java_type || ' get' ||
          genMethodName(col.column_name) || ' () {');
      end if;
      w('  return this.' || genVariableName(col.column_name) || ';');
      w('}');
    end loop;
    w('}');
  end generate_bean;

 

Posted in java pl/sql

搭建maven仓库

七月 30th, 2010

仓库: ubuntu10

下载maven的library管理软件artifactory

unzip –d /usr/local artifactory.zip

cd INSTALL_PATH/artifactory/bin/

./install.sh 安装为服务

访问 http://192.168.1.254:8081/artifactory, 用户名admin,密码password

客户端: win7

eclipse中安装m2eclipse

右键项目,选择"Maven-Enable Dependency Management"

等待eclipse更新maven仓库的索引

下载maven

解压,把settings.xml文件放入自动生成的C:\Users\admin\.m2

编辑settings.xml

      设置<localRepository>D:/library</localRepository>

      在profile标签中,添加repository,指向服务器上的仓库url,可以添加多个

      打开activeProfiles标签,指向有效的profile

      在eclipse中编辑pom.xml,添加dependency

Posted in java 项目管理

一直想有一个属于自己的博客

七月 25th, 2010

终于能有自己的博客了,还没想好要写些什么

Posted in 乱七八糟