<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5049805918186067723</id><updated>2010-06-29T00:16:53.664+08:00</updated><title type='text'>LogFactory.getLog(popo.class)</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://log.chuo.me/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default'/><link rel='alternate' type='text/html' href='http://log.chuo.me/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-8341700919178149532</id><published>2010-02-12T11:17:00.003+08:00</published><updated>2010-02-12T11:21:46.146+08:00</updated><title type='text'>Mac下java版本管理</title><content type='html'>&lt;p&gt;mac下可以安装多个版本，并且可以设置优先级&lt;/p&gt;&lt;p&gt;具体设置的地方&lt;/p&gt;&lt;pre&gt;Application -&gt; Utilities -&gt; Java -&gt; Java Preferences
&lt;/pre&gt;&lt;p&gt;现在只需按照优先级排列，系统就会根据这个顺序进行检测&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-8341700919178149532?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/8341700919178149532/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2010/02/macjava.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/8341700919178149532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/8341700919178149532'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2010/02/macjava.html' title='Mac下java版本管理'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-3035829391459200244</id><published>2009-12-23T15:06:00.004+08:00</published><updated>2009-12-23T15:23:04.692+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='crlf'/><title type='text'>各个系统的换行和回车</title><content type='html'>&lt;p&gt;每个操作系统对应的换行都是不同的&lt;/p&gt;&lt;ol&gt;&lt;li&gt;window里叫CRLF,也就是换行和回车&lt;/li&gt;&lt;li&gt;linux里叫LF,只有换行&lt;/li&gt;&lt;li&gt;mac里叫CR,只有回车&lt;/li&gt;&lt;/ol&gt;下面是字符的一一对应关系
&lt;ol&gt;&lt;li&gt;CR,回车,\r,\015&lt;/li&gt;&lt;li&gt;LF,换行,\n,\012&lt;/li&gt;&lt;/ol&gt;如果想转换文件的格式,可以使用tr命令
&lt;pre&gt;#去除回车符,将window格式转换城linux格式
tr -d "\015" file.txt
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-3035829391459200244?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/3035829391459200244/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/12/blog-post.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3035829391459200244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3035829391459200244'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/12/blog-post.html' title='各个系统的换行和回车'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-7400761993591652209</id><published>2009-12-18T21:13:00.002+08:00</published><updated>2009-12-18T21:19:14.153+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='正则'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>php的匹配图片的正则</title><content type='html'>&lt;p&gt;提取图片&lt;/p&gt;&lt;code&gt;
if(preg_match('{&lt;img.*src="(.*(.png|.jpg|.gif))".*&gt;}x',$content,$matchs))
  $match[1];
}
&lt;/img.*src="(.*(.png|.jpg|.gif))".*&gt;&lt;/code&gt;

&lt;p&gt;顺便加个方法strip_tags,可以去除内容中的标签,返回纯文本.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-7400761993591652209?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/7400761993591652209/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/12/php.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/7400761993591652209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/7400761993591652209'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/12/php.html' title='php的匹配图片的正则'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-2492245344909837586</id><published>2009-12-17T12:25:00.001+08:00</published><updated>2009-12-17T12:28:27.550+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='长度'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>file设置长度</title><content type='html'>&lt;p&gt;input的file是很神奇的东西,在每个浏览器下样式也各不同,而且是很大的不同,如果改造又会变得很复杂,这次遇到了设置长度的问题&lt;/p&gt;&lt;p&gt;IE下可以直接设置width,firefox下可以设置size属性,这size是啥单位啊&lt;/p&gt;&lt;p&gt;不过IE6和7下显示的长度也合有不同,仍旧需要hack一下
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-2492245344909837586?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/2492245344909837586/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/12/file.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2492245344909837586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2492245344909837586'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/12/file.html' title='file设置长度'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-5447833452437963445</id><published>2009-11-20T10:28:00.001+08:00</published><updated>2009-11-20T10:29:33.334+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Clearing float</title><content type='html'>&lt;pre style="margin-right: -742px;"&gt;div.container {
 border: 1px solid #000000;
        overflow: hidden;
 width: 100%;

}

div.left {
 width: 45%;
 float: left;
}

div.right {
 width: 45%;
 float: right;
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-5447833452437963445?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/5447833452437963445/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/11/clearing-float.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5447833452437963445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5447833452437963445'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/11/clearing-float.html' title='Clearing float'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-3435466792804810168</id><published>2009-11-08T01:12:00.005+08:00</published><updated>2009-12-18T21:22:33.873+08:00</updated><title type='text'>curl发送rest请求</title><content type='html'>&lt;p&gt;今天在用twitter api的时候用到了curl函数，在这记录一下.下面那个请求是不需要认证的，所以不用输用户名和密码&lt;/p&gt;
&lt;code&gt;
$tweets = "https://twitter/statuses/public_timeline.xml";

$tw = curl_init();
curl_setopt($tw, CURLOPT_URL, $tweets);
//false为停止认证
curl_setopt($tw, CURLOPT_SSL_VERIFYPEER, false);
//如果为false，那么下面的curl_exec会直接输出而不会返回字符串
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);

$twi = curl_exec($tw);
&lt;/code&gt;
&lt;p&gt;如果需要认证，那么就多加一个参数&lt;/p&gt;
&lt;code&gt;curl_setopt($tw, CURLOPT_USERPWD, $login);&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-3435466792804810168?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/3435466792804810168/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/11/curlrest.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3435466792804810168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3435466792804810168'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/11/curlrest.html' title='curl发送rest请求'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-2185483992234328457</id><published>2009-11-03T13:21:00.003+08:00</published><updated>2009-11-03T13:25:43.568+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='iebug'/><title type='text'>缺少标示符 字符串 或字数</title><content type='html'>&lt;p&gt;在用ie调试的时候竟然会碰到这个错误&lt;/p&gt;&lt;p&gt;ie在解析对象的时候，最后一个属性不能带逗号&lt;/p&gt;
&lt;code&gt;
{
   m1:'a',
   m2:'b',
   m3:'c'&lt;span style="color:red;"&gt;,&lt;/span&gt;
}
&lt;/code&gt;&lt;p&gt;上面这个对象，ie解析就会有问题&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-2185483992234328457?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/2185483992234328457/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/11/blog-post.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2185483992234328457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2185483992234328457'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/11/blog-post.html' title='缺少标示符 字符串 或字数'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-5481470436758121519</id><published>2009-09-08T14:45:00.003+08:00</published><updated>2009-09-08T14:52:33.982+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='配置'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='sofa'/><title type='text'>SOFA中errors.proporties的编码问题</title><content type='html'>&lt;p&gt;SOFA中使用的是GBK编码，如果errors.proporties使用的是utf-8的话，那么就要进行配置。&lt;/p&gt;&lt;p&gt;在每个car包中的resources\META-INF\spring\team1_lms-web-home.xml中进行配置。&lt;/p&gt;&lt;p&gt;&lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" basenames="file:${team1_lms_templates}/home/message/errors" defaultencoding="GBK" cacheseconds="60"&gt;&lt;/bean&gt;

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-5481470436758121519?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/5481470436758121519/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/09/sofaerrorsproporties.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5481470436758121519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5481470436758121519'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/09/sofaerrorsproporties.html' title='SOFA中errors.proporties的编码问题'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-1499940258113637522</id><published>2009-04-09T21:02:00.001+08:00</published><updated>2009-04-09T21:04:52.160+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream</title><content type='html'>&lt;p&gt;在使用Commons-fileupload时出现的错误，缺少类DeferredFileOutputStream，一看是IO包里的。&lt;/p&gt;&lt;p&gt;这个东西还有依赖，去这里下，&lt;a href="http://commons.apache.org/io/"&gt;http://commons.apache.org/io/&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-1499940258113637522?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/1499940258113637522/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/04/javalangnoclassdeffounderror.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/1499940258113637522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/1499940258113637522'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/04/javalangnoclassdeffounderror.html' title='java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-5593007881306007404</id><published>2009-04-08T22:40:00.001+08:00</published><updated>2009-04-08T22:44:25.196+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>#1205 - Lock wait timeout exceeded; try restarting transaction</title><content type='html'>&lt;p&gt;在用mysql的时候发现了这个错误，是由于其他程序在用，造成了死锁。&lt;/p&gt;&lt;p&gt;可以show processlist;显示出正在使用的程序，我是hibernate正在使用。&lt;/p&gt;&lt;p&gt;ps：我是要修改表结构才出现这个错误的&lt;/p&gt;&lt;p&gt;ALTER TABLE feature MODIFY entityid VARCHAR(32) NULL;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-5593007881306007404?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/5593007881306007404/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/04/1205-lock-wait-timeout-exceeded-try.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5593007881306007404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/5593007881306007404'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/04/1205-lock-wait-timeout-exceeded-try.html' title='#1205 - Lock wait timeout exceeded; try restarting transaction'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-2443105458189846907</id><published>2009-03-30T14:44:00.006+08:00</published><updated>2009-03-30T15:24:05.862+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>hibernate检索的参数</title><content type='html'>&lt;h3&gt;lazy&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;true：默认值，为延迟加载。从数据库装载成对象后，并没有同时载入相关对象，而是生成一个对象的代理，到使用时才载入。不过使用的时候必须在同一个session，不然就成了托管对象，这时需要使用Hibernate.initialize()方法来初始化对象，但并不能初始化嵌套对象，需要一个一个初始化。&lt;/li&gt;&lt;li&gt;false：立即加载，装载成该对象的同时也把相关对象载入，是否嵌套就要看其他对象是不是也设为立即加载。
&lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;fetch
&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;join：预先抓取，多用于一对多。使用外连接将多聚SQL浓缩成一句，减少请求数量。
&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-2443105458189846907?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/2443105458189846907/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/hibernate_30.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2443105458189846907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2443105458189846907'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/hibernate_30.html' title='hibernate检索的参数'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-7816210679932927325</id><published>2009-03-30T10:47:00.002+08:00</published><updated>2009-03-30T11:13:10.945+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>mysql的enum类型</title><content type='html'>&lt;p&gt;mysql中的枚举类型，可以限制可数个数的插入，可以作为一种约束条件。比如我现在要插入点，线，面。&lt;/p&gt;&lt;pre&gt;create table geometry ( type enum('Point','Line','Polygon'));
&lt;/pre&gt;&lt;p&gt;这时只能插入这三个参数，正如我上面的例子，我并没有限制这个字段不能为NULL，所以他的默认值为NULL，如果不插入那么其值就为NULL。如果我设置了不为NULL，那么如果不插入其值就为索引为1的。&lt;/p&gt;&lt;p&gt;enum中可以按照索引插入，也可以按照设定的值插入。&lt;/p&gt;&lt;p&gt;如果字段可以为NULL，那么NULL的索引就为NULL。空字符''的索引为0。其他从1开始索引，所以enum中值的位置也是很重要的。&lt;/p&gt;&lt;p&gt;我如果要插入Point，可以用以下两种方式
&lt;/p&gt;&lt;pre&gt;insert into geometry values('Point');
insert into geometry values(1);
&lt;/pre&gt;&lt;p&gt;此枚举的索引为&lt;/p&gt;&lt;table border="1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;NULL
&lt;/td&gt;&lt;td&gt;NULL
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;''
&lt;/td&gt;&lt;td&gt;0
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;'Point'
&lt;/td&gt;&lt;td&gt;1
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;'Line'
&lt;/td&gt;&lt;td&gt;2
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;'Polygon'
&lt;/td&gt;&lt;td&gt;3
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;
&lt;/td&gt;&lt;td&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;如果插入非法值，就会出现错误&lt;/p&gt;&lt;p&gt;Data truncated for column 'type' at row 1&lt;/p&gt;&lt;p&gt;如果使用ignore强制插入，那么type就会被设为空&lt;/p&gt;&lt;pre&gt;insert ignore into geometry values('unknown');&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-7816210679932927325?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/7816210679932927325/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/mysqlenum.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/7816210679932927325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/7816210679932927325'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/mysqlenum.html' title='mysql的enum类型'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-8772058366076968087</id><published>2009-03-29T18:35:00.002+08:00</published><updated>2009-03-29T18:43:35.645+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>width的优先级</title><content type='html'>&lt;p&gt;大部分元素都可以用width来设置宽度，但width也有失效的时候。
&lt;/p&gt;&lt;p&gt;在传统盒式模型中，容器的width会受限于与内部元素的参数，以及自己的padding和 border。如果元素的margin，border，padding都设为固定值，自己的padding和border也设为固定值，这时如果容器的 width小于他们的和，那么引擎就会采用较大值，而忽略了容器的width。&lt;/p&gt;&lt;p&gt;你可以想象，在一个盒子中放入一个大于盒子的东西，那么这东西就会把盒子撑破。
&lt;/p&gt;&lt;p&gt;在W3C盒式模型中，容器的width只受限于内部的元素，而和自己的padding和border无关。
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-8772058366076968087?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/8772058366076968087/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/width.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/8772058366076968087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/8772058366076968087'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/width.html' title='width的优先级'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-4454890255033593738</id><published>2009-03-29T16:57:00.003+08:00</published><updated>2009-03-29T17:19:58.404+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>width percentage in IE quirks mode</title><content type='html'>&lt;p&gt;以前说过IE的quirks mode下盒式模型为传统模型（border-box），意为&lt;/p&gt;&lt;p&gt;width＝border+padding+content&lt;/p&gt;&lt;p&gt;但在width设为百分比的时候，则会有所不同。一般width设为百分比后，引擎会根据容器的width来计算所得的值。所以在W3C盒式模型（content-box）下，width:100%就等于content的width。&lt;/p&gt;&lt;p&gt;但传统模型中，也就是IE的quirks mode下，width:100%还是等于content的width。但这时content的width不等于box的width。&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.brunildo.org/test/IE-Quirks-perc-width-box-model.html"&gt;具体的测试看这里&lt;/a&gt;。请使用IE打开。&lt;/p&gt;&lt;p&gt;测试中，如果按照原来的定义width:100%，在传统模型下，容器的width不变，那么元素的width也应该不变，而测试结果并不是如此。&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-4454890255033593738?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/4454890255033593738/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/width-percentage-in-ie-quirks-mode.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/4454890255033593738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/4454890255033593738'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/width-percentage-in-ie-quirks-mode.html' title='width percentage in IE quirks mode'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-2321023948531961044</id><published>2009-03-28T22:53:00.004+08:00</published><updated>2009-03-28T23:24:24.747+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>display,position,float的关系</title><content type='html'>&lt;ol&gt;&lt;li&gt;如果display设为none，那么浏览器就会忽略position和float&lt;/li&gt;&lt;li&gt;否则display不为none，position设为absolute或fixed，float为none。元素是按照top，left，right，bottom定位。&lt;/li&gt;&lt;li&gt;否则float不为none,position设为absolute或fixed,元素还是和第二点一样，如果设为reletive或static，元素就会飘逸。&lt;/li&gt;&lt;/ol&gt;所以display的none的优先级是最高的。接下来是position的absolute或fixed，只要设置了这个，元素必须是固定的。float和position:reletive可以并存，是相对于float后的位置再进行偏移。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-2321023948531961044?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/2321023948531961044/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/displaypositionfloat.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2321023948531961044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2321023948531961044'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/displaypositionfloat.html' title='display,position,float的关系'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-4580982305079565541</id><published>2009-03-28T18:16:00.004+08:00</published><updated>2009-03-28T18:42:27.766+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='doctype'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>选择XHTML1.0 Transitional</title><content type='html'>&lt;p&gt;为什么选择XHTML1.0 Transitional，因为他对于大部分浏览器触发的都是almost strict mode，除了Mozilla 0.6…0.9.4 and Netscape 6.0…6.2.3，Mozilla 0.9.5 through 1.1 alpha and Mozilla 1.0。想必现在用户很少了吧。&lt;/p&gt;&lt;p&gt;而XHTML1.0 Strict和HTML4.0 Strict等大部分strict版本对于一些主流浏览器则&lt;a href="http://hsivonen.iki.fi/doctype/"&gt;分成了两派&lt;/a&gt;。&lt;/p&gt;&lt;p&gt;strict mode：IE 7 &amp;amp; Opera 7.10，IE 6 &amp;amp; Opera 7.0，Mac IE 5，Konq 3.2&lt;/p&gt;&lt;p&gt;almost strict mode：其他的浏览器&lt;/p&gt;&lt;p&gt;所以strict要&lt;a href="http://log.chuo.me/2009/03/almost-strict-mode.html"&gt;考虑到img的问题&lt;/a&gt;，而transitional却一视同仁。&lt;/p&gt;&lt;p&gt;PS:flickr选择是HTML 4.01 Transitional，触发都是quirks mode，这个好像有点怪异。难道他们的程序员都是骨灰级的？
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-4580982305079565541?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/4580982305079565541/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/xhtml10-transitional.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/4580982305079565541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/4580982305079565541'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/xhtml10-transitional.html' title='选择XHTML1.0 Transitional'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-2678697311517537174</id><published>2009-03-28T02:30:00.003+08:00</published><updated>2009-03-28T02:59:55.243+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='doctype'/><category scheme='http://www.blogger.com/atom/ns#' term='IE6'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>IE6特有的怪异模式</title><content type='html'>&lt;p&gt;如果用IE6访问带有strict mode的doctype，带前面带有xml声明的，则还是会激发quirks mode。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;?xml &gt;
&lt;doctype&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;xml在html中是无效的，对于xhtml来说IE6不能接受application/xhmlt+xml类型。对于text/html的xhtml来说加上xml声明也是无意义的，所以如果不用application/xhmlt+xml的话，最好不要加XML声明。&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-2678697311517537174?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/2678697311517537174/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/ie6.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2678697311517537174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/2678697311517537174'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/ie6.html' title='IE6特有的怪异模式'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-3180795228054840582</id><published>2009-03-28T01:08:00.003+08:00</published><updated>2009-03-28T02:25:29.135+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='doctype'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>almost strict mode</title><content type='html'>&lt;p&gt;在跨浏览编程时总是会遇到&lt;a href="http://kino.javaeye.com/blog/241260"&gt;quirks mode和strict mode&lt;/a&gt;。而还有一种模式为almost strict mode，这种模式只是对于图片标签img来说的。&lt;/p&gt;&lt;p&gt;在strict mode，img表现为inline，而在img的下方会产生一块小的空白，是由bottom margin造成的。&lt;/p&gt;&lt;p&gt;还记得小时候写英文字母的四线三格的本子么，inline就是为这个准备的。如y，q，j等字母，下半部分会写到底下那格，而a，e只占中间那格。inline有一条基础线，就是那第三条线，而这条基础线的位置是由各种字体来确定的。所以img标签载入图片时，图片的底边与这条基础线对齐，下面就会留出一片空白的部分。&lt;/p&gt;&lt;p&gt;所以一些厂商会搞出almost strict mode，用来避免这个BUG，将img标签视为block。&lt;/p&gt;&lt;p&gt;如果你一定要用strict mode的doctype，那么可以显式将img设为block&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;img {display:block}&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;或者可以用&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;img {vertical-align: bottom}&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;意为将img的底边和父级的底边对齐，而不是基础线。&lt;/p&gt;&lt;p&gt;可以&lt;a href="http://devedge-temp.mozilla.org/viewsource/2002/img-table/"&gt;参考这篇&lt;/a&gt;，关于img的bug。
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-3180795228054840582?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/3180795228054840582/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/almost-strict-mode.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3180795228054840582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/3180795228054840582'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/almost-strict-mode.html' title='almost strict mode'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-315206652655516120</id><published>2009-03-27T17:30:00.002+08:00</published><updated>2009-03-27T17:42:49.314+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>mysql删除外键</title><content type='html'>&lt;p&gt;其实大部分操作都可以用alter，尤其是像定义外键，可以不用再create table中定义。因为create table的依赖性太强，如果外键所指向的表没有还没有创建则会有错误。所以可以在创建所有表后，在用alter定义外键，约束等等。&lt;/p&gt;&lt;p&gt;alter的定义可以&lt;a href="http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html#alter-table"&gt;参考这个&lt;/a&gt;，我就是轻信了&lt;a href="http://www.ss64.com/ora/table_a_cons.html"&gt;这个&lt;/a&gt;才搞了半天。&lt;/p&gt;&lt;p&gt;我是要删除表的外键，但&lt;a href="http://www.ss64.com/ora/table_a_cons.html"&gt;这里&lt;/a&gt;只有定义删除约束的，于是我就&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;ATLER TABLE tablename DROP CONSTAINT constraintname&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;发现提示1046错误，去官网一查，原来可以直接删除外键&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;ATLER TABLE tablename DROP FOREIGN KEY constraintname&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;这个件事告诉我们一个道理，查东西要去官网。
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-315206652655516120?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/315206652655516120/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/mysql_5922.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/315206652655516120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/315206652655516120'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/mysql_5922.html' title='mysql删除外键'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-9089325166788307837</id><published>2009-03-27T17:04:00.003+08:00</published><updated>2009-03-27T17:16:41.783+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>mysql查看表的元数据</title><content type='html'>&lt;p&gt;在新建完一个表后，我们可以查看这个表中的数据&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;select * from tablename&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;也可以查看表的描述&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;describe tablename&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;describe所给出的是表的具体信息，就是你在create table时定义的各个字段，他们的类型，默认值，是否为空，是否为主键等等。&lt;/p&gt;&lt;p&gt;但还有一种方法也可以查看表的元数据&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;show create table tablename&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;这个方法可以查看创建表的源码，与describe不同，describe给出的其实是表元数据的一个表，但这个方法给出的是文本，就是你创建时的文本。&lt;/p&gt;&lt;p&gt;但与你保存的数据还有所不同，mysql为你添加了一些默认值，比如engine默认设为innoDB。
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-9089325166788307837?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/9089325166788307837/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/mysql_27.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/9089325166788307837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/9089325166788307837'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/mysql_27.html' title='mysql查看表的元数据'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-609603508467872724</id><published>2009-03-27T16:01:00.004+08:00</published><updated>2009-03-30T13:21:04.638+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>hibernate的依赖库</title><content type='html'>&lt;p&gt;在启动hibernate的时候不是只需要hibernate3.jar，还需要其他的一些库，如果你不嫌多，可以把lib中的库全部加进classpath中，但有些可能用不到。&lt;/p&gt;&lt;p&gt;我试了下如下库是必需的：
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;asm.jar&lt;/li&gt;&lt;li&gt;cglib-2.1.3.jar&lt;/li&gt;&lt;li&gt;commons-logging-1.0.4.jar&lt;/li&gt;&lt;li&gt;commons-collections-2.1.1.jar&lt;/li&gt;&lt;li&gt;dom4j-1.6.1.jar&lt;/li&gt;&lt;li&gt;ehcache-1.2.3.jar&lt;/li&gt;&lt;li&gt;jta.jar&lt;/li&gt;&lt;li&gt;log4j-1.2.11.jar
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;mysql驱动&lt;/span&gt;:mysql-connector-java-5.0.8-bin.jar&lt;/p&gt;&lt;p&gt;
这些库具体干什么用的去&lt;a href="http://blog.csdn.net/chunkyo/archive/2006/04/12/660053.aspx"&gt;这里&lt;/a&gt;。&lt;/p&gt;&lt;p&gt;添加完后新建hibernate配置文件，hibernate默认会去根目录找配置文件，&lt;span style="color: rgb(255, 0, 0);"&gt;不是项目的根目录&lt;/span&gt;，编译后的目录，和log4j的目录是相同的，可能会在class中。如果想自定义也是可以的。
&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;update：&lt;/span&gt;&lt;span&gt;在查询的时候会出现java.lang.NoClassDefFoundError: antlr/ANTLRException，所以还需要包antlr-2.7.6.jar。&lt;/span&gt;&lt;a href="http://dreamhead.blogbus.com/logs/10756716.html"&gt;&lt;span&gt;antlr是什么？&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;
&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-609603508467872724?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/609603508467872724/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/hibernate.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/609603508467872724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/609603508467872724'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/hibernate.html' title='hibernate的依赖库'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-6828129004787613950</id><published>2009-03-26T19:48:00.003+08:00</published><updated>2009-03-26T20:50:05.540+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>mysql设置编码</title><content type='html'>&lt;h3&gt;服务器范围&lt;/h3&gt;&lt;pre class="programlisting"&gt;&lt;code&gt;./configure --with-charset=utf8 &lt;/code&gt;&lt;code&gt;--with-collation=utf8&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;mysql系统默认的character set为latin1，collate为latin1_swedish_ci，所以要修改服务器的编码就用以上的参数。&lt;code class="option"&gt;&lt;/code&gt;&lt;/p&gt;&lt;h3&gt;数据库范围&lt;/h3&gt;&lt;pre class="programlisting"&gt;CREATE DATABASE &lt;em class="replaceable"&gt;&lt;code&gt;db_name&lt;/code&gt;&lt;/em&gt;
[[DEFAULT] CHARACTER SET &lt;em class="replaceable"&gt;&lt;code&gt;charset_name&lt;/code&gt;&lt;/em&gt;]
[[DEFAULT] COLLATE &lt;em class="replaceable"&gt;&lt;code&gt;collation_name&lt;/code&gt;&lt;/em&gt;]&lt;/pre&gt;&lt;p&gt;alter与create相同，character set与collate可以不全设，但有一定的要求。&lt;/p&gt;&lt;ol&gt;&lt;li&gt;两个都存在的话就各自设置他们的值&lt;/li&gt;&lt;li&gt;如果character set存在而collate不存在，那么character set为设置的值，collate为系统默认&lt;/li&gt;&lt;li&gt;如果collate存在而character set不存在，那么两个值都设为collate的值&lt;/li&gt;&lt;li&gt;如果都没有设置则使用服务器范围的编码
&lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;表范围&lt;/h3&gt;&lt;pre class="programlisting"&gt;CREATE TABLE &lt;em class="replaceable"&gt;&lt;code&gt;tbl_name&lt;/code&gt;&lt;/em&gt; (&lt;em class="replaceable"&gt;&lt;code&gt;column_list&lt;/code&gt;&lt;/em&gt;)
 [[DEFAULT] CHARACTER SET &lt;em class="replaceable"&gt;&lt;code&gt;charset_name&lt;/code&gt;&lt;/em&gt;] [COLLATE &lt;em class="replaceable"&gt;&lt;code&gt;collation_name&lt;/code&gt;&lt;/em&gt;]]
&lt;/pre&gt;&lt;p&gt;在新建的表后添加参数，设置情况与数据库类似，只不过没有设置的话是使用数据库的编码。&lt;/p&gt;&lt;h3&gt;列范围
&lt;/h3&gt;&lt;pre class="programlisting"&gt;&lt;em class="replaceable"&gt;&lt;code&gt;col_name&lt;/code&gt;&lt;/em&gt; {CHAR | VARCHAR | TEXT} (&lt;em class="replaceable"&gt;&lt;code&gt;col_length&lt;/code&gt;&lt;/em&gt;)
  [CHARACTER SET &lt;em class="replaceable"&gt;&lt;code&gt;charset_name&lt;/code&gt;&lt;/em&gt;] [COLLATE &lt;em class="replaceable"&gt;&lt;code&gt;collation_name&lt;/code&gt;&lt;/em&gt;]&lt;/pre&gt;&lt;p&gt;也与上次类似
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-6828129004787613950?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log.chuo.me/feeds/6828129004787613950/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://log.chuo.me/2009/03/mysql.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/6828129004787613950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/6828129004787613950'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/mysql.html' title='mysql设置编码'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5049805918186067723.post-1503663056834255857</id><published>2009-03-26T18:30:00.002+08:00</published><updated>2009-03-26T18:37:18.151+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>MySQL ERROR 1005: Can't create table</title><content type='html'>&lt;p&gt;在mysql导入sql的时候出现了这个错误，这个错误是由引用约束造成的，具体有可能造成的情况：&lt;/p&gt;&lt;ol&gt;&lt;li&gt;外键的引用类型不一样，主键是int外键是char &lt;/li&gt;&lt;li&gt;找不到主表中 引用的列 &lt;/li&gt;&lt;li&gt;主键和外键的字符编码不一致， &lt;/li&gt;&lt;/ol&gt;而我出现的比较呆，我把所有的create都写在一个文件里。在创建的时候每个create表的顺序不同，所以在引用外键的时候该表还没创建。其实可以用alter创建引用，看个人喜好。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5049805918186067723-1503663056834255857?l=log.chuo.me' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/1503663056834255857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5049805918186067723/posts/default/1503663056834255857'/><link rel='alternate' type='text/html' href='http://log.chuo.me/2009/03/mysql-error-1005-cant-create-table.html' title='MySQL ERROR 1005: Can&apos;t create table'/><author><name>popo</name><uri>http://www.blogger.com/profile/05954242742948575659</uri><email>sakura9515@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08983462552916435212'/></author></entry></feed>