<?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:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-26648150</id><updated>2011-12-20T11:37:07.770+08:00</updated><category term='Location'/><category term='Get'/><category term='Hash'/><category term='ECMA'/><category term='pseudo-protocol'/><category term='bashrc'/><category term='getURL'/><category term='Bug'/><category term='String'/><category term='p3p'/><category term='10进制'/><category term='Route'/><category term='border'/><category term='Period'/><category term='scrrun.dll'/><category term='500'/><category term='Gvim'/><category term='komodo'/><category term='$GLOBALS'/><category term='extension'/><category term='lightbox'/><category term='unicode'/><category term='中文'/><category term='dmesg'/><category term='Query'/><category term='Gui'/><category term='ApplicationStateCreator'/><category term='Gears'/><category term='encodeURIComponent'/><category term='ComponentResourcesCommon'/><category term='Modifiers'/><category term='Clear'/><category term='Resig'/><category term='ComponentSource'/><category term='Master'/><category term='mvc'/><category term='DateTime'/><category term='Firefox'/><category term='httpfox'/><category term='Exec'/><category term='pixel'/><category term='Expression'/><category term='Reference'/><category term='Operate'/><category term='onerror'/><category term='Bash'/><category term='Method'/><category term='nvidia'/><category term='Apache2'/><category term='RMagick'/><category term='Explain'/><category term='Acts_as_taggable'/><category term='Post'/><category term='radix'/><category term='in_array'/><category term='Replication'/><category term='Eruby'/><category term='Martin Fowler'/><category term='遍历'/><category term='get_class'/><category term='Balance'/><category term='Types'/><category term='sqlite3'/><category term='Shiv'/><category term='MAX'/><category term='addons'/><category term='flow'/><category term='AutoRestart'/><category term='Language'/><category term='BDD'/><category term='Clusters'/><category term='Hide'/><category term='compare'/><category term='concept'/><category term='CMD'/><category term='Jester'/><category term='mod_rails'/><category term='polymorphism'/><category term='vhosts'/><category term='Transaction'/><category term='Inheritance'/><category term='gconf-editor'/><category term='focus'/><category term='Object'/><category term='arping'/><category term='FollowSymLinks'/><category term='main'/><category term='Begin'/><category term='autocomplete'/><category term='Hpricot'/><category term='Models'/><category term='Operator'/><category term='Options'/><category term='Features'/><category term='Assignment'/><category term='Ruby'/><category term='Validation'/><category term='LifeCycle'/><category term='Substitute'/><category term='callee'/><category term='Tools'/><category term='Frame'/><category term='Fetchmail'/><category term='Stop'/><category term='Readline'/><category term='字符集'/><category term='Setters'/><category term='yield'/><category term='||'/><category term='nexus'/><category term='chkconfig'/><category term='rsync'/><category term='encoding'/><category term='phpunit'/><category term='blogspot'/><category term='inline-elements'/><category term='false'/><category term='Delete'/><category term='Kernel'/><category term='GD'/><category term='Key-Value'/><category term='Paste'/><category term='FlashVars'/><category term='HTTP'/><category term='Try'/><category term='Text'/><category term='Flash'/><category term='Rhino'/><category term='Oriented'/><category term='UDP'/><category term='Return'/><category term='Console'/><category term='favicon'/><category term='List'/><category term='Extend'/><category term='Too'/><category term='Modules'/><category term='Balancer'/><category term='Error'/><category term='integer'/><category term='Preview'/><category term='Sendmail'/><category term='PP'/><category term='marker'/><category term='Handler'/><category term='Rubyline'/><category term='offset'/><category term='Send'/><category term='Expand'/><category term='virtualbox'/><category term='jQuery'/><category term='logout'/><category term='ignore'/><category term='Top'/><category term='toolbar'/><category term='textmate'/><category term='Static'/><category term='Select'/><category term='traditional'/><category term='Smtp'/><category term='Pseudo'/><category term='Vim'/><category term='global'/><category term='Self'/><category term='Protocol'/><category term='negative'/><category term='Firefox3'/><category term='Visibility'/><category term='命令'/><category term='oct'/><category term='bit'/><category term='Usage'/><category term='Space'/><category term='ASO'/><category term='outline'/><category term='javamail'/><category term='Explorer'/><category term='Sysstat'/><category term='Date'/><category term='Connections'/><category term='Compress'/><category term='mvn'/><category term='classpath'/><category term='directory'/><category term='Configure'/><category term='Reset'/><category term='Parse'/><category term='curl'/><category term='__CLASS__'/><category term='download'/><category term='File'/><category term='Response'/><category term='STDOUT'/><category term='Webalizer'/><category term='CPU'/><category term='Function'/><category term='NetScape'/><category term='windows'/><category term='timestamp'/><category term='default'/><category term='Yahoo'/><category term='noSQL'/><category term='Application'/><category term='Instance'/><category term='Override'/><category term='Mail'/><category term='Menu'/><category term='Partition'/><category term='繁体'/><category term='wshom.ocx'/><category term='font'/><category term='Search'/><category term='EventLink'/><category term='Effect'/><category term='fixed'/><category term='Properties'/><category term='Singleton'/><category term='https'/><category term='Update'/><category term='ODBC'/><category term='article'/><category term='Missing'/><category term='Iframe'/><category term='Glassfish'/><category term='iptables'/><category term='nc'/><category term='addEvent'/><category term='netcat'/><category term='pageAttached'/><category term='Scalar'/><category term='child'/><category term='TTL'/><category term='i386'/><category term='onSubmit'/><category term='decode'/><category term='Fundamental'/><category term='Print'/><category term='Hack'/><category term='parseFloat'/><category term='hex'/><category term='apt-get'/><category term='fonts'/><category term='SQLite'/><category term='Techniques'/><category term='ntpdate'/><category term='PHP4'/><category term='Permission'/><category term='Backup'/><category term='git'/><category term='permanently'/><category term='nginx'/><category term='AllowOverride'/><category term='Start'/><category term='Xdebug'/><category term='deflate'/><category term='Flex'/><category term='office2008'/><category term='eager'/><category term='Quiz'/><category term='Service'/><category term='checkbox'/><category term='Commit'/><category term='PDF'/><category term='Selection'/><category term='bridge'/><category term='Token'/><category term='AliasOverride'/><category term='field'/><category term='VS-NAT'/><category term='Perl'/><category term='Line'/><category term='validates_uniqueness_of'/><category term='fcgi'/><category term='bbs'/><category term='wordpress'/><category term='Variable'/><category term='回收站'/><category term='Extjs'/><category term='mysql5'/><category term='Parameters'/><category term='Tomcat'/><category term='thinkpad'/><category term='ctags'/><category term='乱码'/><category term='Methods'/><category term='SQL_slave_SKIP_COUNTER'/><category term='Layout'/><category term='Coverage'/><category term='Implements'/><category term='terms'/><category term='PageLoaderProcessor'/><category term='Relative'/><category term='Binlog'/><category term='Uptime'/><category term='CommandLine'/><category term='mx'/><category term='密钥'/><category term='Python'/><category term='Unix'/><category term='Pop'/><category term='Abstraction'/><category term='ntpd'/><category term='comment'/><category term='headers'/><category term='Captcha'/><category term='Numbers'/><category term='ActionScript'/><category term='Insertion'/><category term='Restart'/><category term='Anonymous'/><category term='URI'/><category term='Sort'/><category term='Serialize'/><category term='Configuration'/><category term='Shell'/><category term='Clone'/><category term='Functional'/><category term='leopard'/><category term='Logs'/><category term='Explicit'/><category term='Unauthenticated'/><category term='macbook'/><category term='Win32'/><category term='Attr_accessor'/><category term='Crontab'/><category term='ntsysv'/><category term='instance_methods'/><category term='injectComponent'/><category term='Awk'/><category term='kvm'/><category term='async'/><category term='repository'/><category term='泛型'/><category term='Deny'/><category term='PCRE'/><category term='Factory'/><category term='Margin'/><category term='screen'/><category term='true'/><category term='lastlog'/><category term='mod_usertrack'/><category term='Prototype'/><category term='keypress'/><category term='vertical-align'/><category term='Google'/><category term='Set'/><category term='MPM'/><category term='Alias'/><category term='Database'/><category term='Darwinports'/><category term='PHP5'/><category term='defer'/><category term='inline-box'/><category term='DNS'/><category term='Protected'/><category term='Require'/><category term='Cookbook'/><category term='Model'/><category term='NameSpace'/><category term='charCodeAt'/><category term='Multiple'/><category term='Constant'/><category term='Form'/><category term='jar'/><category term='Length'/><category term='Scrap'/><category term='globalEvel'/><category term='XMLHTTP'/><category term='Scope'/><category term='emerald'/><category term='keyCode'/><category term='Drag'/><category term='LRO'/><category term='window'/><category term='Mrtg'/><category term='spring'/><category term='grep'/><category term='Mac'/><category term='keyboard'/><category term='todo'/><category term='Gem'/><category term='character-set-server'/><category term='eclipse'/><category term='Float'/><category term='MD5'/><category term='getSelection'/><category term='distribute'/><category term='Startup'/><category term='Class'/><category term='advertise'/><category term='$this'/><category term='基础'/><category term='IE7'/><category term='ofc2'/><category term='Recycle'/><category term='src'/><category term='GROUP_CONCAT'/><category term='security'/><category term='i'/><category term='Scim'/><category term='Rails'/><category term='Xpath'/><category term='httpclient'/><category term='Rollback'/><category term='toJSON'/><category term='InnoDB'/><category term='mod_ssl'/><category term='hidden'/><category term='Development'/><category term='Color'/><category term='AND'/><category term='Month'/><category term='escape'/><category term='Regular'/><category term='Tree'/><category term='Lambda'/><category term='IE8'/><category term='Curry'/><category term='HTML'/><category term='InnerHTML'/><category term='Delegation'/><category term='Resolve'/><category term='scroll'/><category term='Debug'/><category term='JavaScript'/><category term='Exceptions'/><category term='ActionMailer'/><category term='mysqlbinlog'/><category term='Atom'/><category term='onActivate'/><category term='Template'/><category term='Tee'/><category term='Baidu'/><category term='Logical'/><category term='Management'/><category term='export'/><category term='Interface'/><category term='Include'/><category term='Observe'/><category term='match'/><category term='Programming'/><category term='ActionController'/><category term='Transparent'/><category term='font-size'/><category term='Absolute'/><category term='find'/><category term='commands'/><category term='Relay'/><category term='address'/><category term='onunload'/><category term='IRB'/><category term='Currying'/><category term='hotkey'/><category term='ppt'/><category term='height'/><category term='Specific'/><category term='Link'/><category term='XHTML'/><category term='Chart'/><category term='Member'/><category term='Magic'/><category term='HTML5'/><category term='hibernate'/><category term='element'/><category term='Script'/><category term='soap'/><category term='Cookie'/><category term='eventmachine'/><category term='Migration'/><category term='douban'/><category term='Optimize'/><category term='Caching'/><category term='__proto__'/><category term='urldecode'/><category term='discuz'/><category term='Binary'/><category term='Callback'/><category term='conflict'/><category term='GeoIP'/><category term='Syntax'/><category term='Firebug'/><category term='Ubiquity'/><category term='简体'/><category term='mod_headers'/><category term='Comparable'/><category term='johnson'/><category term='APR_ICONV_PATH'/><category term='zindex'/><category term='middle'/><category term='Message'/><category term='Path'/><category term='super'/><category term='ARP'/><category term='Zen'/><category term='Urlencode'/><category term='DBI'/><category term='none'/><category term='Apple'/><category term='Webrick'/><category term='Test'/><category term='http-access2'/><category term='Watch'/><category term='Code'/><category term='mouse'/><category term='passenger'/><category term='email'/><category term='.htaccess'/><category term='Apache'/><category term='closures'/><category term='End'/><category term='wget'/><category term='Plugin'/><category term='Position'/><category term='Mongrel_cluster'/><category term='MSN'/><category term='SSH'/><category term='uuid'/><category term='CSS'/><category term='Subversion'/><category term='Alias_method'/><category term='Tips'/><category term='Maximum'/><category term='Printf'/><category term='Metaprogramming'/><category term='int'/><category term='page'/><category term='Webmaster'/><category term='doc'/><category term='CSR'/><category term='ActiveRecord::Base'/><category term='Interfaces'/><category term='Array'/><category term='gedit'/><category term='z-index'/><category term='Nodes'/><category term='tap'/><category term='Cron'/><category term='Scriptaculous'/><category term='Load'/><category term='Implement'/><category term='Sequence'/><category term='getElementById'/><category term='json'/><category term='Capistrano'/><category term='this'/><category term='ComponentResources'/><category term='MacOSX'/><category term='simplified'/><category term='Cache'/><category term='Save'/><category term='Control'/><category term='lexical'/><category term='Callbacks'/><category term='Freeze'/><category term='filter_parameter_logging'/><category term='demo'/><category term='Repair'/><category term='glob'/><category term='Mongrel_rails'/><category term='Constructor'/><category term='Deploying'/><category term='Jetty'/><category term='Leak'/><category term='Marshal'/><category term='Framework'/><category term='ReplaceChild'/><category term='Variables'/><category term='Convert'/><category term='Private'/><category term='scene'/><category term='Dump'/><category term='Faker'/><category term='SSL'/><category term='CGI'/><category term='Terminal'/><category term='PDT'/><category term='Cloud'/><category term='__clone'/><category term='LightTPD'/><category term='Network'/><category term='Until'/><category term='Tag'/><category term='Config'/><category term='tricks'/><category term='ifconfig 详解'/><category term='last'/><category term='IE6'/><category term='Selinux'/><category term='Hello Wrold'/><category term='howto'/><category term='GBK'/><category term='fromCharCode'/><category term='LoadModule'/><category term='ASCII'/><category term='engine'/><category term='Subroutine'/><category term='dispatcher'/><category term='启动'/><category term='Registry'/><category term='Action'/><category term='Shortcut'/><category term='Hosts'/><category term='Hierarchy'/><category term='PHP'/><category term='toString()'/><category term='cool'/><category term='sudo'/><category term='快捷方式'/><category term='16进制'/><category term='Install'/><category term='Click'/><category term='While'/><category term='Instance_eval'/><category term='Proxy'/><category term='bookmark'/><category term='mod_rewrite'/><category term='Keynote'/><category term='Memory'/><category term='accessor'/><category term='Track'/><category term='paginate'/><category term='Referrer'/><category term='charset'/><category term='Public'/><category term='DOS'/><category term='parseInt'/><category term='ZenGarden'/><category term='Tidy'/><category term='Type'/><category term='Xargs'/><category term='Yum'/><category term='display'/><category term='Results'/><category term='Image'/><category term='__unset'/><category term='Jmeter'/><category term='annotations'/><category term='Client'/><category term='encodeURI'/><category term='apply'/><category term='Large'/><category term='Rspec'/><category term='Quote'/><category term='$argc'/><category term='submit'/><category term='dispatch'/><category term='base64'/><category term='Once'/><category term='attributes'/><category term='Safari'/><category term='ActionLink'/><category term='href'/><category term='Benchmark'/><category term='IP'/><category term='Gc Patch'/><category term='Folder'/><category term='Tail'/><category term='Collision'/><category term='Inner'/><category term='Status'/><category term='Throw'/><category term='SHELL32.dll'/><category term='ExternalInterface'/><category term='Phase'/><category term='local'/><category term='DOCTYPE'/><category term='IO'/><category term='CentOS'/><category term='simsun'/><category term='URL'/><category term='onload'/><category term='Push_with_attributes'/><category term='openssl'/><category term='XML'/><category term='pom'/><category term='Developer'/><category term='Replace'/><category term='Rm'/><category term='vixie-cron'/><category term='case'/><category term='Pattern'/><category term='Jruby'/><category term='Map'/><category term='Observer'/><category term='Resolv.conf'/><category term='interpreter'/><category term='Ping'/><category term='noscript'/><category term='Rdoc'/><category term='Chain'/><category term='Sed'/><category term='Row'/><category term='Cookies'/><category term='RLO'/><category term='remove'/><category term='Block'/><category term='Gzip'/><category term='line-height'/><category term='shadow'/><category term='keyEvent'/><category term='Robots'/><category term='inline'/><category term='Define'/><category term='RunTime'/><category term='ns'/><category term='mongo'/><category term='Calendar'/><category term='AJAX'/><category term='Write'/><category term='E4X'/><category term='2003'/><category term='tooltip'/><category term='User'/><category term='each'/><category term='Module'/><category term='commons'/><category term='Through'/><category term='tapestry5'/><category term='Sar'/><category term='OR'/><category term='ActiveRecord Base find'/><category term='saved'/><category term='Has_one'/><category term='1064'/><category term='Anchor'/><category term='Extends'/><category term='Custom'/><category term='Ri'/><category term='feed'/><category term='Internet'/><category term='tool'/><category term='Library'/><category term='AS3'/><category term='target'/><category term='Echo'/><category term='SpreadSheet'/><category term='pageLink'/><category term='undefined'/><category term='ICMP'/><category term='Java'/><category term='API'/><category term='字符串'/><category term='null'/><category term='Command'/><category term='YAML'/><category term='Edit'/><category term='Tload'/><category term='Browser'/><category term='arithmetic'/><category term='Getters'/><category term='Render'/><category term='blogger'/><category term='RegExp'/><category term='text， 中文'/><category term='call'/><category term='onbeforeunload'/><category term='history'/><category term='Garden'/><category term='Slave'/><category term='Time'/><category term='Password'/><category term='MarkupWriter'/><category term='Rcov'/><category term='Redirect'/><category term='addEventListener'/><category term='keywords'/><category term='日志滚动'/><category term='colorscheme'/><category term='ClipBoard'/><category term='Memcached'/><category term='Performance'/><category term='Desktop'/><category term='package'/><category term='Recursive'/><category term='reopen'/><category term='void'/><category term='offline'/><category term='maven'/><category term='Rescue'/><category term='RPM'/><category term='Swap'/><category term='ComponentClassResolver'/><category term='Request'/><category term='Abstract'/><category term='Prefork'/><category term='__set'/><category term='rss'/><category term='resource'/><category term='Difference'/><category term='Property'/><category term='Goldberg'/><category term='transform'/><category term='Blobs'/><category term='window.name'/><category term='native2ascii'/><category term='Unpack'/><category term='Quotes'/><category term='fastCGI'/><category term='301'/><category term='LVM'/><category term='__get'/><category term='Range'/><category term='theme'/><category term='core'/><category term='正则表达式'/><category term='Folding'/><category term='format'/><category term='Session'/><category term='Zend'/><category term='mkdir'/><category term='class_eval'/><category term='Scruby'/><category term='References'/><category term='Uninstall'/><category term='annotation'/><category term='welcome'/><category term='alert'/><category term='Cronolog'/><category term='ppc'/><category term='Iterator'/><category term='Catch'/><category term='keydown'/><category term='ApplicationStatePersistenceStrategy'/><category term='时间戳'/><category term='nslookup'/><category term='Cursor'/><category term='Order'/><category term='chinese'/><category term='ApplicationStateManager'/><category term='Excel'/><category term='Random'/><category term='pageLoaded'/><category term='generic'/><category term='Root'/><category term='ActiveRecord'/><category term='Remote'/><category term='Postfix'/><category term='event'/><category term='mixins'/><category term='Relationship'/><category term='submission'/><category term='IDE'/><category term='png'/><category term='New'/><category term='LVS'/><category term='Dzone'/><category term='Drop'/><category term='Mapper'/><category term='Support'/><category term='Year'/><category term='Index'/><category term='lite'/><category term='access'/><category term='textarea'/><category term='CIDR'/><category term='Components'/><category term='Size'/><category term='IM'/><category term='Vimrc'/><category term='Content'/><category term='__call'/><category term='Optimze'/><category term='闭包'/><category term='LogFormat'/><category term='Mongrel'/><category term='Create'/><category term='Lock'/><category term='header'/><category term='currentTarget'/><category term='Server'/><category term='version'/><category term='sources'/><category term='Component'/><category term='$argv'/><category term='Statement'/><category term='Functions'/><category term='JDBC'/><category term='seo'/><category term='Overloading'/><category term='AWStats'/><category term='Example'/><category term='Mechanism'/><category term='div'/><category term='Linux'/><category term='Xterm'/><category term='id'/><category term='Ubuntu'/><category term='Gd2'/><category term='korean'/><category term='show'/><category term='Cut'/><category term='call_user_func_array'/><category term='Encode'/><category term='SQL'/><category term='pentaho'/><category term='Initialize'/><category term='img'/><category term='条件日志'/><category term='word'/><category term='column'/><category term='Enumerable'/><category term='Clean'/><category term='Web'/><category term='rewrite'/><category term='Telnet'/><category term='Referer'/><category term='Environment'/><category term='DOM'/><category term='formatter'/><category term='Net'/><category term='Axis'/><category term='Debugger'/><category term='utf8'/><category term='IOC'/><category term='管道日志'/><category term='CakePHP'/><category term='Edge'/><category term='MySQL'/><category term='After'/><category term='httpd'/><category term='tablekit'/><category term='Gmail'/><category term='utf-8'/><category term='Reflect'/><category term='__isset'/><category term='FrameSet'/><category term='links'/><category term='Rest'/><category term='Worker'/><category term='XEN'/><category term='Reboot'/><category term='editor'/><category term='Blank'/><category term='Has_many'/><category term='Symbol'/><category term='View'/><category term='Strtotime'/><category term='Mechanize'/><category term='Table'/><category term='Copy'/><category term='Increment'/><category term='gnome-panel'/><category term='Persistent'/><category term='Union'/><category term='fun'/><category term='Upload'/><category term='ls'/><category term='Basic'/><category term='MyISAM'/><category term='Interoperability'/><category term='value'/><category term='width'/><category term='onPassivate'/><category term='auto'/><category term='Binding'/><category term='XP'/><category term='Railsbench'/><category term='Sniff'/><category term='renderSupport'/><category term='Center'/><category term='overflow'/><category term='Partial'/><category term='Before'/><category term='helper'/><category term='Mozilla'/><category term='top-level'/><category term='setting'/><category term='多态'/><category term='juggernaut'/><category term='Var'/><category term='Setter'/><category term='McKoi'/><category term='Parseexcel'/><category term='Check'/><category term='Problem'/><category term='mongoDB'/><category term='fwrite'/><category term='Translate'/><category term='Style'/><category term='setTimeout'/><category term='Selector'/><category term='Arguments'/><category term='Redhat'/><category term='Nesting'/><category term='document'/><category term='tutorial'/><category term='gsub'/><category term='name'/><category term='pageDetached'/><category term='blog'/><category term='Evaluate'/><category term='Number'/><category term='Data'/><category term='中文乱码'/><category term='Controller'/><category term='icon'/><category term='Mixin'/><category term='Mask'/><category term='IE'/><category term='Patterns'/><category term='userData'/><category term='ac'/><category term='SVN'/><category term='aptana'/><category term='Module_eval'/><category term='Character'/><title type='text'>yuweijun'blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default?start-index=101&amp;max-results=100'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>722</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-26648150.post-3357633440117945596</id><published>2011-12-20T11:37:00.001+08:00</published><updated>2011-12-20T11:37:07.949+08:00</updated><title type='text'>apache2.2 日志中的一些注意事项</title><content type='html'>&lt;span class="Apple-style-span" style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;background-color:rgb(255,255,255)"&gt;一些说明&lt;/span&gt;&lt;br style="word-wrap:break-word;color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;text-align:left;background-color:rgb(255,255,255)"&gt; &lt;span class="Apple-style-span" style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;text-align:left;background-color:rgb(255,255,255)"&gt;出于安全考虑，从2.0.46版本开始，%r, %i, %o 中的特殊字符，除了双引号(&amp;quot;)和反斜线(\)分别用 \&amp;quot; 和 \\ 进行转义、空白字符用C风格(\n, \t 等)进行转义以外，非打印字符和其它特殊字符使用 \xhh 格式进行转义(hh是该字符的16进制编码)。在2.0.46以前的版本中，这些内容会被完整的按原样记录。这种做法将导致客户端可以在日志中插入控制字 符，所以你在处理这些日志文件的时候要特别小心。&lt;/span&gt;&lt;br style="word-wrap:break-word;color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;text-align:left;background-color:rgb(255,255,255)"&gt; &lt;br style="word-wrap:break-word;color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;text-align:left;background-color:rgb(255,255,255)"&gt;&lt;span class="Apple-style-span" style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;text-align:left;background-color:rgb(255,255,255)"&gt;在2.0版本中(不同于1.3)，%b 和 %B 格式字符串并不表示发送到客户端的字节数，而只是简单的表示HTTP应答字节数(在连接中断或使用SSL时与前者有所不同)。mod_logio提供的 %O 格式字符串将会记录发送的实际字节数。&lt;/span&gt;&lt;br style="word-wrap:break-word;color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;text-align:left;background-color:rgb(255,255,255)"&gt;  &lt;div&gt;&lt;span class="Apple-style-span" style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;text-align:left;background-color:rgb(255,255,255)"&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color:rgb(68,68,68);font-family:Verdana,Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;text-align:left;background-color:rgb(255,255,255)"&gt;&lt;div&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;String url = &amp;quot;&lt;a href="http://www.baidu.com/s?cl=3&amp;amp;wd=\\xe6\\x90\\x9e\\xe7\\xac\\x91\\xe6\\xbc\\xab\\xe7\\x94\\xbb\\xe9\\x9b\\x86"&gt;http://www.baidu.com/s?cl=3&amp;amp;wd=\\xe6\\x90\\x9e\\xe7\\xac\\x91\\xe6\\xbc\\xab\\xe7\\x94\\xbb\\xe9\\x9b\\x86&lt;/a&gt;&amp;quot;;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;String replaced = url.replaceAll(&amp;quot;\\\\x&amp;quot;, &amp;quot;%&amp;quot;);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;String decode = URLDecoder.decode(replaced, &amp;quot;utf-8&amp;quot;);&lt;/div&gt; &lt;/span&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-3357633440117945596?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/3357633440117945596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=3357633440117945596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3357633440117945596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3357633440117945596'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/12/apache22.html' title='apache2.2 日志中的一些注意事项'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4731379932071953206</id><published>2011-07-02T15:31:00.001+08:00</published><updated>2011-07-02T15:32:41.546+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gconf-editor'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome-panel'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>clear run history in gnome panel</title><content type='html'>run "gconf-editor" and find "gnome-panel", modify "history-gnome-run".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4731379932071953206?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4731379932071953206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4731379932071953206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4731379932071953206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4731379932071953206'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/clear-run-history-in-gnome-panel.html' title='clear run history in gnome panel'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1132543514850747307</id><published>2011-07-02T15:26:00.002+08:00</published><updated>2011-07-02T15:30:37.054+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ntpdate'/><category scheme='http://www.blogger.com/atom/ns#' term='XEN'/><title type='text'>Xen and ntpdate</title><content type='html'>ntpdate在XEN虚拟机上执行后，不能更新当前时间。&lt;br /&gt;修复方法：&lt;br /&gt;将下面的指令加入/etc/rc.local文件后重启机器就可以，不重启的话手动在命令行中运行此命令。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;echo 1 &gt; /proc/sys/xen/independent_wallclock&lt;br /&gt;ntpdate ntp.ubuntu.com &gt; /dev/null&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1132543514850747307?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1132543514850747307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1132543514850747307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1132543514850747307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1132543514850747307'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/xen-and-ntpdate.html' title='Xen and ntpdate'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4534776417482924119</id><published>2011-07-02T15:16:00.000+08:00</published><updated>2011-07-02T15:18:06.469+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nginx'/><category scheme='http://www.blogger.com/atom/ns#' term='rewrite'/><title type='text'>nginx rewrite command spec</title><content type='html'>rewrite&lt;br /&gt;syntax: rewrite regex replacement flag&lt;br /&gt;&lt;br /&gt;default: none&lt;br /&gt;&lt;br /&gt;context: server, location, if&lt;br /&gt;&lt;br /&gt;This directive changes URI in accordance with the regular expression and the replacement string. Directives are carried out in order of appearance in the configuration file.&lt;br /&gt;&lt;br /&gt;Flags make it possible to end the execution of rewrite directives.&lt;br /&gt;&lt;br /&gt;If the replacement string begins with http:// then the client will be redirected, and any further rewrite directives are terminated.&lt;br /&gt;&lt;br /&gt;Flags can be any of the following:&lt;br /&gt;&lt;br /&gt;last - completes processing of rewrite directives, after which searches for corresponding URI and location&lt;br /&gt;break - completes processing of rewrite directives&lt;br /&gt;redirect - returns temporary redirect with code 302; it is used if the substituting line begins with http://&lt;br /&gt;permanent - returns permanent redirect with code 301&lt;br /&gt;Note that if a redirect is relative (has no host part), then when redirecting Nginx uses the "Host" header if the header match name of server_name directive or the first name of server_name directive, if the header does not match or is absent. If no server_name is set, then the local hostname is used. If you want Nginx to always use the "Host" header, you can use a wildcard "*" server_name (but see the restrictions on doing so). Example:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;rewrite  ^(/download/.*)/media/(.*)\..*$  $1/mp3/$2.mp3  last;&lt;br /&gt;rewrite  ^(/download/.*)/audio/(.*)\..*$  $1/mp3/$2.ra   last;&lt;br /&gt;return   403;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;But if we place these directives in location /download/, then it is necessary to replace flag "last" by "break", otherwise Nginx will hit the 10 cycle limit and return error 500:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;location /download/ {&lt;br /&gt;  rewrite  ^(/download/.*)/media/(.*)\..*$  $1/mp3/$2.mp3  break;&lt;br /&gt;  rewrite  ^(/download/.*)/audio/(.*)\..*$  $1/mp3/$2.ra   break;&lt;br /&gt;  return   403;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If in the line of replacement arguments are indicated, then the rest of the request arguments are appended to them. To avoid having them appended, place a question mark as the last character:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  rewrite  ^/users/(.*)$  /show?user=$1?  last;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Note: for curly braces( { and } ), as they are used both in regexes and for block control, to avoid conflicts, regexes with curly braces are to be enclosed with double quotes (or single quotes). For example, to rewrite URLs like:&lt;br /&gt;&lt;br /&gt;/photos/123456&lt;br /&gt;to:&lt;br /&gt;&lt;br /&gt;/path/to/photos/12/1234/123456.png&lt;br /&gt;use the following (note the quotes enclosing the regex):&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;rewrite  "/photos/([0-9] {2})([0-9] {2})([0-9] {2})" /path/to/photos/$1/$1$2/$1$2$3.png;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If you specify a ? at the end of a rewrite then Nginx will drop the original $args (arguments). When using $request_uri or $uri&amp;$args you should specify the ? at the end of the rewrite to avoid Nginx doubling the query string.&lt;br /&gt;&lt;br /&gt;Example using $request_uri in a rewrite from www.example.com to example.com&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;server {&lt;br /&gt;   server_name www.example.com;&lt;br /&gt;   rewrite ^ http://example.com$request_uri? permanent;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Also rewrite operates only on path, not parameters. To rewrite a URL with parameters to another URL, use this instead:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;if ($args ^~ post=100){&lt;br /&gt;  rewrite ^ http://example.com/new-address.html? permanent;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Note that the $args variable is not decoded, unlike URIs during location matching.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4534776417482924119?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4534776417482924119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4534776417482924119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4534776417482924119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4534776417482924119'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/nginx-rewrite-command-spec.html' title='nginx rewrite command spec'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7745837911345547192</id><published>2011-07-02T15:12:00.002+08:00</published><updated>2011-07-02T15:15:21.625+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='phpunit'/><title type='text'>phpunit error in ubuntu 11.04</title><content type='html'>Got below warning when run phpunit in ubuntu 11.04:&lt;br /&gt;&lt;br /&gt;PHP Warning:  require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38&lt;br /&gt;PHP Stack trace:&lt;br /&gt;PHP   1. {main}() /usr/bin/phpunit:0&lt;br /&gt;PHP Fatal error:  require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38&lt;br /&gt;PHP Stack trace:&lt;br /&gt;PHP   1. {main}() /usr/bin/phpunit:0&lt;br /&gt;&lt;br /&gt;repair commands:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;sudo apt-get remove phpunit&lt;br /&gt;sudo pear channel-discover pear.phpunit.de&lt;br /&gt;sudo pear channel-discover pear.symfony-project.com&lt;br /&gt;sudo pear channel-discover components.ez.no&lt;br /&gt;sudo pear update-channels&lt;br /&gt;sudo pear upgrade-all&lt;br /&gt;sudo pear install --alldeps phpunit/PHPUnit&lt;br /&gt;sudo apt-get install phpunit&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7745837911345547192?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7745837911345547192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7745837911345547192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7745837911345547192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7745837911345547192'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/phpunit-error-in-ubuntu-1104.html' title='phpunit error in ubuntu 11.04'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2761441441859927376</id><published>2011-07-02T15:09:00.001+08:00</published><updated>2011-07-02T15:11:45.688+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='thinkpad'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>修复 ubuntu 11.04 亮度调节组合键功能</title><content type='html'>安装N卡驱动之后，Thinkpad的Fn+Home调节亮度的组合键失效。&lt;br /&gt;修改/etc/X11/xorg.conf 文件，加入Option那一行，重启生效。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;Section "Device"&lt;br /&gt;    Identifier     "Device0"&lt;br /&gt;    Driver         "nvidia"&lt;br /&gt;    VendorName     "NVIDIA Corporation"&lt;br /&gt;    BoardName      "NVS 3100M"&lt;br /&gt;    &lt;span style="color: red;"&gt;Option         "RegistryDwords" "EnableBrightnessControl=1"&lt;/span&gt;&lt;br /&gt;EndSection&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2761441441859927376?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2761441441859927376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2761441441859927376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2761441441859927376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2761441441859927376'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/ubuntu-1104.html' title='修复 ubuntu 11.04 亮度调节组合键功能'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5622161761714910514</id><published>2011-07-02T15:08:00.000+08:00</published><updated>2011-07-02T15:09:04.829+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDE'/><category scheme='http://www.blogger.com/atom/ns#' term='aptana'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>IDE aptana menu problem in ubuntu 11.04</title><content type='html'>&lt;div class="pre"&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;export UBUNTU_MENUPROXY=0&lt;br /&gt;/path/to/AptanaStudio3&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5622161761714910514?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5622161761714910514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5622161761714910514' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5622161761714910514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5622161761714910514'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/ide-aptana-menu-problem-in-ubuntu-1104.html' title='IDE aptana menu problem in ubuntu 11.04'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1217738937718082094</id><published>2011-07-02T15:06:00.000+08:00</published><updated>2011-07-02T15:07:33.702+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mod_rewrite'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache2'/><category scheme='http://www.blogger.com/atom/ns#' term='Query'/><category scheme='http://www.blogger.com/atom/ns#' term='String'/><title type='text'>Modifying the Query String In mod_rewrite of Apache2</title><content type='html'>RewriteRule backreferences: These are backreferences of the form $N (0 &lt;= N &lt;= 9), which provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions..&lt;br /&gt;RewriteCond backreferences: These are backreferences of the form %N (1 &lt;= N &lt;= 9), which provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions.&lt;br /&gt;&lt;br /&gt;By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt; # rewrite without old query string&lt;br /&gt;    RewriteCond %{QUERY_STRING} ^page_id=(.*)$&lt;br /&gt;    RewriteRule ^index.php$ /index/%1.php? [R=301,L]&lt;br /&gt;&lt;br /&gt; # rewrite with new query string&lt;br /&gt;    RewriteCond %{QUERY_STRING} ^page_id=(.*)$&lt;br /&gt;    RewriteRule ^index.php$ /index/%1.php\?test=1 [R=301,L]&lt;br /&gt;&lt;br /&gt; # rewrite with combined old query string&lt;br /&gt;    RewriteCond %{QUERY_STRING} ^page_id=(.*)$&lt;br /&gt;    RewriteRule ^index.php$ /index/%1.php\?test=1 [QSA,R=301,L]&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1217738937718082094?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1217738937718082094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1217738937718082094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1217738937718082094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1217738937718082094'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/modifying-query-string-in-modrewrite-of.html' title='Modifying the Query String In mod_rewrite of Apache2'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4303422901583404890</id><published>2011-07-02T14:53:00.000+08:00</published><updated>2011-07-02T14:59:09.641+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='globalEvel'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>globalEval function of jQuery changed in version 1.6</title><content type='html'>globalEval function of jquery before version 1.6, such as 1.5.2 and 1.2.6, source code:&lt;br /&gt;&lt;div class="pre"&gt;// Evalulates a script in a global context&lt;br /&gt; globalEval: function( data ) {&lt;br /&gt;  if ( data &amp;&amp; rnotwhite.test(data) ) {&lt;br /&gt;   // Inspired by code by Andrea Giammarchi&lt;br /&gt;   // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html&lt;br /&gt;   var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,&lt;br /&gt;    script = document.createElement( "script" );&lt;br /&gt;&lt;br /&gt;   if ( jQuery.support.scriptEval() ) {&lt;br /&gt;    script.appendChild( document.createTextNode( data ) );&lt;br /&gt;   } else {&lt;br /&gt;    script.text = data;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   // Use insertBefore instead of appendChild to circumvent an IE6 bug.&lt;br /&gt;   // This arises when a base node is used (#2709).&lt;br /&gt;   head.insertBefore( script, head.firstChild );&lt;br /&gt;   head.removeChild( script );&lt;br /&gt;  }&lt;br /&gt; },&lt;/div&gt;&lt;br /&gt;globalEval function of jquery 1.6 source code:&lt;br /&gt;&lt;div class="pre"&gt; // Evaluates a script in a global context&lt;br /&gt; // Workarounds based on findings by Jim Driscoll&lt;br /&gt; // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context&lt;br /&gt; globalEval: function( data ) {&lt;br /&gt;  if ( data &amp;&amp; rnotwhite.test( data ) ) {&lt;br /&gt;   // We use execScript on Internet Explorer&lt;br /&gt;   // We use an anonymous function so that context is window&lt;br /&gt;   // rather than jQuery in Firefox&lt;br /&gt;   ( window.execScript || function( data ) {&lt;br /&gt;    window[ "eval" ].call( window, data );&lt;br /&gt;   } )( data );&lt;br /&gt;  }&lt;br /&gt; },&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4303422901583404890?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4303422901583404890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4303422901583404890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4303422901583404890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4303422901583404890'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/globaleval-function-of-jquery-changed.html' title='globalEval function of jQuery changed in version 1.6'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5637679739448183187</id><published>2011-07-02T14:51:00.001+08:00</published><updated>2011-07-02T14:51:57.185+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='Rdoc'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>rails 3.0.7 在ubuntu 11.04中安装问题</title><content type='html'>&lt;div class="pre"&gt;&lt;br /&gt;$&gt; sudo gem install rails&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This is the problematic part:&lt;br /&gt;&lt;br /&gt; File not found: lib&lt;br /&gt;ERROR:  While generating documentation for rails-3.0.7&lt;br /&gt;... MESSAGE:   exit&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;这个问题是因为Rails新版本使用了最新的Rdoc/ri版本，而系统中原来的版本有些功能不是兼容的，因此报错。&lt;br /&gt;卸载已经安装的rails3，先安装rdoc-data成功后再安装rails3。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$&gt; sudo gem uninstall rails --version 3.0.7&lt;br /&gt;$&gt; sudo gem install rdoc-data&lt;br /&gt;$&gt; sudo rdoc-data --install&lt;br /&gt;$&gt; sudo gem install rails&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;安装成功信息：&lt;br /&gt;Successfully installed rails-3.0.7&lt;br /&gt;1 gem installed&lt;br /&gt;Installing ri documentation for rails-3.0.7...&lt;br /&gt;Installing RDoc documentation for rails-3.0.7...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5637679739448183187?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5637679739448183187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5637679739448183187' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5637679739448183187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5637679739448183187'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/07/rails-307-ubuntu-1104.html' title='rails 3.0.7 在ubuntu 11.04中安装问题'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1564510666988716053</id><published>2011-05-18T17:25:00.000+08:00</published><updated>2011-05-18T17:26:18.073+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Xdebug'/><category scheme='http://www.blogger.com/atom/ns#' term='Config'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>configure php xdebug in ubuntu</title><content type='html'>先安装php和xdebug，并配置php.ini文件&lt;br /&gt;$&gt; sudo apt-get install apache2 php5 xdebug&lt;br /&gt;$&gt; sudo vi /etc/php5/apache2/php.ini&lt;br /&gt;在php.ini文件最后面添加下面3行内容，其他如zend_extension的值ubuntu在xdebug安装完会自动在/etc/php5/conf.d/xdebug.ini中设置:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;[Xdebug]&lt;br /&gt;xdebug.remote_autostart=On&lt;br /&gt;xdebug.remote_enable=On&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;然后从eclipse.org官网下载eclipse for php版本：&lt;br /&gt;我的电脑是ubuntu 11.04 64位的机器，所以下载64位的版本：&lt;br /&gt;$&gt; wget http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/SR2/eclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz&amp;url=http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/helios/SR2/eclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz&amp;mirror_id=1093&lt;br /&gt;&lt;br /&gt;打开eclipse之后，进入window-Performances-PHP-Debug设置面板，在右边的“PHP Debuger”中选择Xdebug，然后点击Xdebug的Configure，再选择其中的Xdebug进行编辑，将"Accept remote session(JIT)"的值设置为"localhost"，(默认值为off时，是不会开启xdebug调试功能的)，这个设置和php.ini设置必须要都做到才会开启debug功能。&lt;br /&gt;这样配置就完成了，可以打开浏览器访问PHP页面，在eclipse中的PHP源码，如果有设置断点就会进入Debug模式。&lt;br /&gt;&lt;br /&gt;在Debug模式中的Server就使用默认的http://localhost，"PHP Executeable"原来是"None Defined"，这个没有关系，也可以手动设置一个值，如"/usr/bin/php5"，这个不影响debug功能。&lt;br /&gt;&lt;br /&gt;抄录部分xdebug远程调试相关的参数说明，官网可参考http://xdebug.org/docs/remote中的说明。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;xdebug.remote_autostart&lt;br /&gt;类型：布尔型 默认值：0&lt;br /&gt;一般来说，你需要使用明确的HTTP GET/POST变量来开启远程debug。而当这个参数设置为On，xdebug将经常试图去开启一个远程debug session并试图去连接客户端，即使GET/POST/COOKIE变量不是当前的。&lt;br /&gt;&lt;br /&gt;xdebug.remote_enable&lt;br /&gt;类型：布尔型 默认值：0&lt;br /&gt;这个开关控制xdebug是否应该试着去连接一个按照xdebug.remote_host和xdebug.remote_port来设置监听主机和端口的debug客户端。&lt;br /&gt;&lt;br /&gt;xdebug.remote_host&lt;br /&gt;类型：字符串 默认值：localhost&lt;br /&gt;选择debug客户端正在运行的主机，你不仅可以使用主机名还可以使用IP地址&lt;br /&gt;&lt;br /&gt;xdebug.remote_port&lt;br /&gt;类型：整型 默认值：9000&lt;br /&gt;这个端口是xdebug试着去连接远程主机的。9000是一般客户端和被绑定的debug客户端默认的端口。许多客户端都使用这个端口数字，最好不要去修改这个设置。&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Windows的设置可以参考下面这个链接中说明：http://be-evil.org/post-70.html&lt;br /&gt;Mac中可以下载一个MacGDBp，这个用来调试PHP，非常好用，与IDE就完全脱离关系了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1564510666988716053?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1564510666988716053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1564510666988716053' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1564510666988716053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1564510666988716053'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/05/configure-php-xdebug-in-ubuntu.html' title='configure php xdebug in ubuntu'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1542066975218008989</id><published>2011-04-19T14:28:00.000+08:00</published><updated>2011-04-19T14:29:08.731+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scroll'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='width'/><title type='text'>get window scroll bar width</title><content type='html'>浏览器因为操作系统或者系统主题不同，导致当前窗口中的scrollbar的宽度不一致，在web应用中影响了页面布局，下述方法可以获取到当前浏览器的滚动条宽度：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;function getScrollBarWidth () {&lt;br /&gt; var inner = document.createElement('p');&lt;br /&gt; inner.style.width = "100%";&lt;br /&gt; inner.style.height = "200px";&lt;br /&gt;&lt;br /&gt; var outer = document.createElement('div');&lt;br /&gt; outer.style.position = "absolute";&lt;br /&gt; outer.style.top = "0px";&lt;br /&gt; outer.style.left = "0px";&lt;br /&gt; outer.style.visibility = "hidden";&lt;br /&gt; outer.style.width = "200px";&lt;br /&gt; outer.style.height = "150px";&lt;br /&gt; outer.style.overflow = "hidden";&lt;br /&gt; outer.appendChild (inner);&lt;br /&gt;&lt;br /&gt; document.body.appendChild (outer);&lt;br /&gt; var w1 = inner.offsetWidth;&lt;br /&gt; outer.style.overflow = 'scroll';&lt;br /&gt; var w2 = inner.offsetWidth;&lt;br /&gt; if (w1 == w2) w2 = outer.clientWidth;&lt;br /&gt;&lt;br /&gt; document.body.removeChild (outer);&lt;br /&gt;&lt;br /&gt; return (w1 - w2);&lt;br /&gt;};&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Reference:http://www.alexandre-gomes.com/?p=115 &lt;br /&gt;http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1542066975218008989?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1542066975218008989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1542066975218008989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1542066975218008989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1542066975218008989'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/04/get-window-scroll-bar-width.html' title='get window scroll bar width'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7306770046202895792</id><published>2011-04-18T18:34:00.002+08:00</published><updated>2011-04-19T14:27:59.875+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='classpath'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='resource'/><title type='text'>The classpath*: prefix of java</title><content type='html'>When constructing an XML-based application context, a location string may use the special classpath*: prefix:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:conf/appContext.xml");&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This special prefix specifies that all classpath resources that match the given name must be obtained (internally, this essentially happens via a ClassLoader.getResources(...) call), and then merged to form the final application context definition.&lt;br /&gt;&lt;br /&gt;Classpath*: portability&lt;br /&gt;The wildcard classpath relies on the getResources() method of the underlying classloader. As most application servers nowadays supply their own classloader implementation, the behavior might differ especially when dealing with jar files. A simple test to check if classpath* works is to use the classloader to load a file from within a jar&lt;br /&gt;on the classpath:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  getClass().getClassLoader().getResources("someFileInsideTheJar").&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Try this test with files that have the same name but are placed inside two different locations.&lt;br /&gt;In case an inappropriate result is returned, check the application server documentation for settings that might affect the classloader behavior.&lt;br /&gt;&lt;br /&gt;The "classpath*:" prefix can also be combined with a PathMatcher pattern in the rest of the location path, for example "classpath*:META-INF/*-beans.xml". In this case, the resolution strategy is fairly simple: a ClassLoader.getResources() call is used on the last non-wildcard path segment to get all the matching resources in the class loader hierarchy, and then off each resource the same PathMatcher resoltion strategy described above is used for the wildcard subpath.&lt;br /&gt;&lt;br /&gt;Memo: This article content copied from spring 3.0 framework reference PDF file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7306770046202895792?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7306770046202895792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7306770046202895792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7306770046202895792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7306770046202895792'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/04/classpath-prefix-of-java.html' title='The classpath*: prefix of java'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-3339825686836264697</id><published>2011-04-18T18:26:00.002+08:00</published><updated>2011-04-18T18:33:35.428+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='netcat'/><category scheme='http://www.blogger.com/atom/ns#' term='nc'/><category scheme='http://www.blogger.com/atom/ns#' term='Telnet'/><title type='text'>linux命令nc使用实例说明</title><content type='html'>使用netcat检查服务器的指定的端口是否开通：&lt;br /&gt;root@localhost:~$ nc -z -v 192.168.1.242 80&lt;br /&gt;linux.local [192.168.1.242] 80 (www) open&lt;br /&gt;&lt;br /&gt;使用netcat扫描端口：&lt;br /&gt;root@localhost:~$ nc -z -v -w 1 192.168.1.242 1-100&lt;br /&gt;linux.local [192.168.1.242] 80 (www) open&lt;br /&gt;linux.local [192.168.1.242] 22 (ssh) open&lt;br /&gt;&lt;br /&gt;使用netcat模拟HTTP请求：&lt;br /&gt;root@localhost:~$ nc www.google.com.hk 80&lt;br /&gt;GET / HTTP/1.1&lt;br /&gt;Host: www.google.com.hk&lt;br /&gt;User-Agent: google-chrome9&lt;br /&gt;&lt;br /&gt;HTTP/1.1 200 OK&lt;br /&gt;Date: Mon, 18 Apr 2011 08:56:03 GMT&lt;br /&gt;Expires: -1&lt;br /&gt;Cache-Control: private, max-age=0&lt;br /&gt;Content-Type: text/html; charset=Big5&lt;br /&gt;Set-Cookie: PREF=ID=5006f5c292697224:FF=0:NW=1:TM=1303116963:LM=1303116963:S=Lr6ijyXSbmjA6bmZ; expires=Wed, 17-Apr-2013 08:56:03 GMT; path=/; domain=.google.com.hk&lt;br /&gt;Set-Cookie: NID=46=ky6egq_YajJNEzdnM39_2u3CFq2hJLvSVuQm6BokYXSBKhAefFIuL-ZsZOvnDpMISnI2glY25IZxS8_5G0V-EHj-oEc7KRGW4rSZk9yIRnCgsPnm43qhLUMb9hJuKeVW; expires=Tue, 18-Oct-2011 08:56:03 GMT; path=/; domain=.google.com.hk; HttpOnly&lt;br /&gt;Server: gws&lt;br /&gt;X-XSS-Protection: 1; mode=block&lt;br /&gt;Transfer-Encoding: chunked&lt;br /&gt;[......]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-3339825686836264697?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/3339825686836264697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=3339825686836264697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3339825686836264697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3339825686836264697'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/04/linuxnc.html' title='linux命令nc使用实例说明'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7166625637647249444</id><published>2011-01-28T15:53:00.001+08:00</published><updated>2011-01-28T15:58:52.717+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='中文'/><category scheme='http://www.blogger.com/atom/ns#' term='Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Configure'/><title type='text'>Tomcat URL 支持中文文件名</title><content type='html'>在tomcat的默认配置情况下，如果访问一个"中文.html"页面，服务器会抛出文件找不到的错误提示，这需要对tomcat的配置文件略作改动，为Connector设置URIEncoding的参数。&lt;br /&gt;在server.xml文件中找到8080服务器配置的一段设置：&lt;br /&gt;&lt;div class="pre"&gt;&amp;lt;Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;加上 URIEncoding="UTF-8" 这句就可以识别中文文件名了，同时如果url中的参数值有中文，服务器端也可以正常解析对应的参数，否则服务器端Java程序中取到的参数是以ISO-8859-1编码的，有中文字符的参数值是乱码的，加了URIEncoding="UTF-8"之后，就可以正确获取到参数值了。&lt;br /&gt;对于这个参数的说明，可以查看tomcat目录中的doc帮助文件，也可以从官网中找到此参数的解释。&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://tomcat.apache.org/tomcat-7.0-doc/config/http.html"&gt;官方文档&lt;/a&gt;&lt;br /&gt;&lt;a href="http://confluence.atlassian.com/display/DOC/Configuring+Tomcat's+URI+encoding"&gt;Configure tomcat's uri encoding&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7166625637647249444?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7166625637647249444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7166625637647249444' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7166625637647249444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7166625637647249444'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/01/tomcat-url.html' title='Tomcat URL 支持中文文件名'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1984063206299639586</id><published>2011-01-28T15:39:00.002+08:00</published><updated>2011-01-28T15:40:18.430+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>IE throw null object exception when flash call javascript function</title><content type='html'>用open flash chart第一次正常载入一个图表到页面之后，当使用jQuery.fn.empty()方法移除此图表时，IE中会抛出一个错误，其他浏览器都是正常的，内容如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;JScript - script block, line 1 character 124&lt;br /&gt;'null' is null or not an object&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;通过IE8的debug工具可以看到出错时，javascript正在执行的代码如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;try { document.getElementById("report-charts").SetReturnValue(__flash__toXML(ofc_resize([66,-96,66,-87])) ); } catch (e) { document.getElementById("report-charts").SetReturnValue("&amp;lt;undefined/&amp;gt;"); }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;这个并不是页面中的javascript代码，应该是flash中调用外部javascript方法时，所使用的javascript代码，在IE8中断点调试，可以发现document.getElementById("report-charts")的结果为null，所以抛出了以上错误。&lt;br /&gt;避过此问题的办法是在陊除已经载入的图表时，不调用jQuery.fn.empty()方法，而是直接使用jQuery.fn.html('')，将flash所在父元素的内容置空：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    $('#report-charts').parent().html('');&lt;br /&gt;    // 如果使用$('#report-charts').parent().empty();在IE中则会报错&lt;br /&gt;    // ... 重新生成report-charts对象并载入新的flash图表&lt;br /&gt;    swfobject.embedSWF(ofc, "report-charts", "100%", "300", "9.0.0", "expressInstall.swf", {"get-data":"get_chart_0"});&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1984063206299639586?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1984063206299639586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1984063206299639586' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1984063206299639586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1984063206299639586'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/01/ie-throw-null-object-exception-when.html' title='IE throw null object exception when flash call javascript function'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6096639891990338213</id><published>2011-01-27T17:46:00.001+08:00</published><updated>2011-01-28T15:42:13.615+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='sqlite3'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>sqlite3 database disk image is malformed</title><content type='html'>sqlite3 报错提示： database disk image is malformed&lt;br /&gt;&lt;br /&gt;看提示意思是指数据库的数据文件格式发生异常，所以数据查询和写入不正常，在网上google了一些文章，找到了一个解决方法。&lt;br /&gt;一般来说，sqlite3的数据文件发生这个问题，想直接修复数据是行不通了，&lt;br /&gt;在进入sqlite3后的命令行中，运行以下命令：&lt;br /&gt;PRAGMA integrity_check&lt;br /&gt;*** in database main ***&lt;br /&gt;On tree page 120611 cell 0: 3 of 4 pages missing from overflow list starting at 120617&lt;br /&gt;On tree page 120616 cell 0: 3 of 4 pages missing from overflow list starting at 120621&lt;br /&gt;On tree page 3309 cell 0: 3 of 4 pages missing from over&lt;br /&gt;&lt;br /&gt;假设原数据库名: abc.db&lt;br /&gt;&lt;br /&gt;运行命令:&lt;br /&gt;$&amp;gt; sqlite3 abc.db&lt;br /&gt;&lt;br /&gt;.output "data.sql"&lt;br /&gt;.dump&lt;br /&gt;.quit&lt;br /&gt;&lt;br /&gt;再建个新数据库 abcd.db&lt;br /&gt;$&amp;gt; sqlite3 abcd.db&lt;br /&gt;&lt;br /&gt;然后&lt;br /&gt;&lt;br /&gt;.read "data.sql"&lt;br /&gt;.quit&lt;br /&gt;&lt;br /&gt;然后修复原来的数据库名和文件权限，应该就没事了。&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://vi-i.blogspot.com/2009/02/sqlite3-database-disk-image-is.html"&gt;sqlite3 database disk image malformed&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6096639891990338213?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6096639891990338213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6096639891990338213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6096639891990338213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6096639891990338213'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/01/sqlite3-database-disk-image-is.html' title='sqlite3 database disk image is malformed'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-41163275961405121</id><published>2011-01-27T17:24:00.000+08:00</published><updated>2011-01-27T17:25:25.578+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='Chart'/><category scheme='http://www.blogger.com/atom/ns#' term='ofc2'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Open Flash Chart IO ERROR Loading test data Error #2032</title><content type='html'>在IE6中使用open flash chart2加载图表的json数据时，第一次载入数据，图表渲染正常，第二次就会报一个错误，提示数据加载错误：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;Open Flash Chart&lt;br /&gt;IO ERROR&lt;br /&gt;Loading test data&lt;br /&gt;Error #2032&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;而在其他的浏览器，如IE8/firefox/chrome中都是正常的，在网上搜索了一些回答，其中有人提到说这是因为浏览器的缓存造成的问题，只要在用swfobject加载open-flash-chart.swf时，在url后面加上一个动态参数，让浏览器不要使用本地缓存：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;swfobject.embedSWF("open-flash-chart.swf?t=" + (new Date()).getTime(), "charts-div-id", "100%", "300", "9.0.0", "expressInstall.swf", {"get-data":"get_chart_0"});&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://www.sodiy.com.cn/blog/201011/Open_Flash_Chart_IO_ERROR_2032.html"&gt;Open Flash Chart IO ERROR Loading test data Error #2032&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-41163275961405121?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/41163275961405121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=41163275961405121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/41163275961405121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/41163275961405121'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/01/open-flash-chart-io-error-loading-test.html' title='Open Flash Chart IO ERROR Loading test data Error #2032'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6443045541690783458</id><published>2011-01-13T11:30:00.001+08:00</published><updated>2011-01-13T11:42:52.399+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='中文乱码'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='mvc'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><title type='text'>springmvc 中ajax提交发生乱码问题</title><content type='html'>这个问题目前只是在springmvc项目中碰到，在IE和Chrome中，当用jQuery.post()方法发起ajax请求时，Controller中收到的中文内容变成乱码了，而在firefox中用jQuery.post()进行ajax请求时是正常的。&lt;br /&gt;在Controller中调用如下代码(项目为UTF-8编码)：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    // name 是post收到的字符串变量名&lt;br /&gt;    System.out.println(new String(name.getBytes(HTTP.ISO_8859_1), HTTP.UTF_8));&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;可以看到乱码恢复正常，说明IE和Chrome提交的ajax请求中的内容被编码成 ISO-8859-1 编码了。&lt;br /&gt;而实际上，对于IE而已，所有的ajax请求都是以UTF-8方式发起的，通过以下方式设置ajax请求的编码为GBK实际是没有用的，服务器收到仍然是UTF-8编码的请求体：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    xmlhttp.setRequestHeader( "Content-Type", "text/html;charset=GBK" ); &lt;br /&gt;    // or&lt;br /&gt;    xmlhttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=GBK");&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;因此可以肯定是springmvc在收到POST请求后，将请求体的数据用 ISO-8859-1 编码来处理了，最后传到Controller中时变成了乱码，但是为何firefox中提交的却仍然是正确的呢？&lt;br /&gt;在firebug中观察firefox中的ajax请求头，可以看到firebug中的提示：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    Content-Type application/x-www-form-urlencoded; charset=UTF-8&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;而在IE中用http analysis工具看到的却是：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    Content-Type application/x-www-form-urlencoded&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;google Chrome中与IE一样，ajax请求头中没有指明编码，所以Chrome和IE一样将发生乱码了。&lt;br /&gt;查看jquery-1.4.4.js源码可以看到，jQuery中原来的 contentType设置为"application/x-www-form-urlencoded"，IE和Chrome中的请求头显示是正确的，没有问题，反而是firefox将contentType中设置了编码。&lt;br /&gt;从这个请求头分析来看，应该是springmvc没有得到请求的编码，而将其内容设置为ISO-8859-1了，因此发生了乱码的情况。&lt;br /&gt;&lt;br /&gt;解决方法还是参考firefox的请求头，在contentType中指定编码，明确告诉服务器端，当前请求体的编码方式为UTF-8。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    xmlhttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;如果使用jQuery发起ajax请求，javascript的代码改为如下方式发起ajax请求，而不是以$.post()和$.get()等快捷方法：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    $.ajax({&lt;br /&gt;        url: url,&lt;br /&gt;        type: "POST",&lt;br /&gt;        dataType: "html",&lt;br /&gt;        contentType: "application/x-www-form-urlencoded; charset=UTF-8",&lt;br /&gt;        data: data,&lt;br /&gt;        complete:function(data) {&lt;br /&gt;        }&lt;br /&gt;    });&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6443045541690783458?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6443045541690783458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6443045541690783458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6443045541690783458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6443045541690783458'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2011/01/springmvc-ajax.html' title='springmvc 中ajax提交发生乱码问题'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4424107496118761403</id><published>2010-12-19T15:36:00.002+08:00</published><updated>2010-12-19T15:40:53.652+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Property'/><category scheme='http://www.blogger.com/atom/ns#' term='editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Date'/><category scheme='http://www.blogger.com/atom/ns#' term='mvc'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><title type='text'>spring的属性编辑器CustomDateEditor及日期对象转化</title><content type='html'>在spring mvc的Controller中，属性在通过依赖注入(DI)时，普通数据类型都能够辨识。但诸如Date之类，就需要自定义属性编辑器解决。否则报如下错误：&lt;br /&gt;org.springframework.beans.TypeMismatchException:&lt;br /&gt;Failed to convert property value of type [java.lang.String] to required type&lt;br /&gt;[java.util.Date] for property 'date'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'date': no matching editors or conversion strategy found&lt;br /&gt;这表示spring无法找到合适的转换策略，需要自己写一个转换器，在spring中称之为属性编辑器。&lt;br /&gt;spring中的属性编辑器可以将字符串转换为相应的对象，然后注入到其它对象中去。&lt;br /&gt;编写自己的属性编辑器的步骤很简单，属性编辑器类需要从java.beans.PropertyEditorSupport类继承，在这个类中有一个setAsText方法，这个方法有一个String类型的参数，通过这个方法，可以将String类型的参数值转换成其他类型的属性。在这个方法中我们还需要使用一个setValue方法，就来指定转换后的对象实例。&lt;br /&gt;spring 中有个 CustomDateEditor 的类就是继承 PropertyEditorSupport 的一个属性编辑器，在Controller中添加一个@InitBinder的Annotation到某个方法上，在方法中指明日期字符串的格式，就可以将符合此格式的字符串转化为日期对象，代码如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;/**&lt;br /&gt; * &amp;lt;pre&amp;gt;&lt;br /&gt; * HTML forms work with string values only, when your Authority is a complex bean. You need to configure a PropertyEditor to perform conversion between Authority and String:&lt;br /&gt; * &lt;br /&gt; * @InitBinder &lt;br /&gt; * public void initBinder(WebDataBinder b) {&lt;br /&gt; *     b.registerCustomEditor(Authority.class, new AuthorityEditor());&lt;br /&gt; * }&lt;br /&gt; * &lt;br /&gt; * private class AuthorityEditor extends PropertyEditorSupport {&lt;br /&gt; *     @Override&lt;br /&gt; *     public void setAsText(String text) throws IllegalArgumentException {&lt;br /&gt; *         // 另外一个例子是根据字符串，从数据库中查找返回对象&lt;br /&gt; *         setValue(authorityService.findById(Long.valueOf(text))); &lt;br /&gt; *     }&lt;br /&gt; * &lt;br /&gt; *     @Override&lt;br /&gt; *     public String getAsText() {&lt;br /&gt; *         return ((Authority) getValue()).getId();&lt;br /&gt; *     }&lt;br /&gt; * }&lt;br /&gt; * &amp;lt;/pre&amp;gt;&lt;br /&gt; * &lt;br /&gt; * 这个方法用来将页面表单上传的Date字符串转化成java的Date对象&lt;br /&gt; * &lt;br /&gt; * @param binder&lt;br /&gt; */&lt;br /&gt;@InitBinder&lt;br /&gt;public void initBinder(WebDataBinder binder) {&lt;br /&gt;    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");&lt;br /&gt;    dateFormat.setLenient(false);&lt;br /&gt;    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.mkyong.com/spring/spring-how-to-pass-a-date-into-bean-property-customdateeditor/"&gt;how to pass a date into bean property&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4424107496118761403?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4424107496118761403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4424107496118761403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4424107496118761403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4424107496118761403'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/12/springcustomdateeditor.html' title='spring的属性编辑器CustomDateEditor及日期对象转化'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6497728515021656691</id><published>2010-12-19T15:08:00.003+08:00</published><updated>2010-12-19T15:16:23.090+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='comment'/><category scheme='http://www.blogger.com/atom/ns#' term='Bug'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><title type='text'>comments bug on firefox</title><content type='html'>&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;&lt;br /&gt;这段HTML注释代码因为中间多了2个连字符，在firefox中会导致解析出错，这段内容被做为正常的文本内容显示在浏览器中。&lt;br /&gt;This entire comment -- will show in web browser&lt;br /&gt;&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;br /&gt;Reference: &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=214476"&gt; (SGMLComment) Mozilla interprets a -- (two dashes in a row) inside of a comment or an include improperly &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6497728515021656691?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6497728515021656691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6497728515021656691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6497728515021656691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6497728515021656691'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/12/comments-bug-on-firefox.html' title='comments bug on firefox'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1006993558432776381</id><published>2010-12-19T15:06:00.001+08:00</published><updated>2010-12-19T15:07:56.063+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='call'/><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='Sort'/><category scheme='http://www.blogger.com/atom/ns#' term='this'/><title type='text'>javascript中array方法调用返回window对象</title><content type='html'>array中的很多方法通过call和apply调用时会返回window对象，如下写法在Firefox、Chrome等浏览器中会取到window对象:&lt;div class="pre"&gt;&lt;br /&gt;window === ([]).sort.call();&lt;br /&gt;window === ([]).reverse.call();&lt;br /&gt;([]).concat.call()[0] === window&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;可以将这些array的方法重写，避免它在运行时的this指向window，如重写sort方法：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;Array.prototype.sort = (function(sort) { return function(callback) {&lt;br /&gt;    return (this == window) ? null : (callback ? sort.call(this, function(a,b) {&lt;br /&gt;        return callback(a,b)}) : sort.call(this));&lt;br /&gt;}})(Array.prototype.sort);&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1006993558432776381?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1006993558432776381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1006993558432776381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1006993558432776381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1006993558432776381'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/12/javascriptarraywindow.html' title='javascript中array方法调用返回window对象'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2341546744250291710</id><published>2010-11-27T13:28:00.000+08:00</published><updated>2010-11-27T13:30:15.807+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='main'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>用maven来运行一个main方法或者启动Server</title><content type='html'>在maven项目的pom.xml文件的plugins中加入"exec-maven-plugin"这个插件，这个在运行"mvn package"时，会在当前的mvn进程中直接执行指定的class文件的main方法，也可以配置其他的参数，让此main在另一个java进程中启动。如果其中将phase的内容改为"test"，就会在运行"mvn test"时执行main方法，也可以在命令行里直接用mvn运行，如下注释说明。&lt;br /&gt;更详细的信息和配置方法，可参考&lt;a href="http://mojo.codehaus.org/exec-maven-plugin/usage.html"&gt;http://mojo.codehaus.org/exec-maven-plugin/usage.html&lt;/a&gt;说明。&lt;br /&gt;&lt;div class="pre"&gt;&amp;lt;!-- commandline: mvn exec:java -Dexec.mainClass="org.phpfirefly.test.Server" --&amp;gt;&lt;br /&gt;&amp;lt;plugin&amp;gt;&lt;br /&gt;    &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;&lt;br /&gt;    &amp;lt;artifactId&amp;gt;exec-maven-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;    &amp;lt;version&amp;gt;1.1&amp;lt;/version&amp;gt;&lt;br /&gt;    &amp;lt;executions&amp;gt;&lt;br /&gt;        &amp;lt;execution&amp;gt;&lt;br /&gt;            &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;&lt;br /&gt;            &amp;lt;goals&amp;gt;&lt;br /&gt;                &amp;lt;goal&amp;gt;java&amp;lt;/goal&amp;gt;&lt;br /&gt;            &amp;lt;/goals&amp;gt;&lt;br /&gt;        &amp;lt;/execution&amp;gt;&lt;br /&gt;    &amp;lt;/executions&amp;gt;&lt;br /&gt;    &amp;lt;configuration&amp;gt;&lt;br /&gt;        &amp;lt;mainClass&amp;gt;org.phpfirefly.test.Server&amp;lt;/mainClass&amp;gt;&lt;br /&gt;    &amp;lt;/configuration&amp;gt;&lt;br /&gt;&amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2341546744250291710?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2341546744250291710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2341546744250291710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2341546744250291710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2341546744250291710'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/11/mavenmainserver.html' title='用maven来运行一个main方法或者启动Server'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5012170682573377068</id><published>2010-11-27T13:06:00.003+08:00</published><updated>2010-11-27T13:12:40.701+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='nexus'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>maven2 repository server install</title><content type='html'>以下为安装免费版本的nexus maven2服务器和简单的设置过程：&lt;div class="pre"&gt;&lt;br /&gt;$&gt; wget http://nexus.sonatype.org/downloads/nexus-oss-webapp-1.8.0-bundle.tar.gz&lt;br /&gt;$&gt; tar zxvf nexus-oss-webapp-1.8.0-bundle.tar.gz&lt;br /&gt;$&gt; mv nexus-webapp-1.8.0-bundle  /usr/local/nexus  &lt;br /&gt;$&gt; cd /usr/local/nexus  &lt;br /&gt;$&gt; ls bin/jsw/  &lt;br /&gt;$&gt; bin/jsw/linux-x86-32/nexus start  &lt;br /&gt;$&gt; tail -f logs/wrapper.log  &lt;/div&gt;&lt;br /&gt;启动服务后默认URL为：http://localhost:8081/nexus&lt;br /&gt;默认的登录名和密码：admin/admin123&lt;br /&gt;nexus默认是关闭远程索引下载功能的，主要是担心会造成对服务器的巨大负担，需要我们手工开启。 &lt;br /&gt;开启的方式： 点击Administration菜单下面的Repositories，将这4个仓库Apache Snapshots，Google code，Codehaus Snapshots，Maven Central的Configuration - Download Remote Indexes修改为true。然后在这三个仓库上分别右键，选择reIndex，这样Nexus就会去下载远程的索引文件。&lt;br /&gt;部署构件至Nexus： Nexus提供了两种方式来部署构件，你可以从UI直接上传，也可以配置Maven部署构件，在上传一个版本时，可以将jar包和source jar包一起上传。&lt;br /&gt;&lt;br /&gt;本地maven仓库配置文件，默认位置在用户根目录下的".m2"目录，文件名为settings.xml，如果没有，则创建一份，更新内容如下：&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"&lt;br /&gt;  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;pluginGroups&amp;gt;&lt;br /&gt;    &amp;lt;!-- pluginGroup&lt;br /&gt;     | Specifies a further group identifier to use for plugin lookup.&lt;br /&gt;    &amp;lt;pluginGroup&amp;gt;com.your.plugins&amp;lt;/pluginGroup&amp;gt;&lt;br /&gt;    --&amp;gt;&lt;br /&gt;    &amp;lt;pluginGroup&amp;gt;org.mortbay.jetty&amp;lt;/pluginGroup&amp;gt;&lt;br /&gt;  &amp;lt;/pluginGroups&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;profiles&amp;gt;&lt;br /&gt;    &amp;lt;profile&amp;gt;&lt;br /&gt;      &amp;lt;id&amp;gt;nexus&amp;lt;/id&amp;gt;&lt;br /&gt;      &amp;lt;repositories&amp;gt;&lt;br /&gt;        &amp;lt;repository&amp;gt;&lt;br /&gt;          &amp;lt;id&amp;gt;nexus&amp;lt;/id&amp;gt;&lt;br /&gt;          &amp;lt;name&amp;gt;local nexus&amp;lt;/name&amp;gt;&lt;br /&gt;          &amp;lt;url&amp;gt;http://localhost:8081/nexus/content/groups/public/&amp;lt;/url&amp;gt;&lt;br /&gt;          &amp;lt;releases&amp;gt;&lt;br /&gt;            &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;          &amp;lt;/releases&amp;gt;&lt;br /&gt;          &amp;lt;snapshots&amp;gt;&lt;br /&gt;            &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;          &amp;lt;/snapshots&amp;gt;&lt;br /&gt;        &amp;lt;/repository&amp;gt;&lt;br /&gt;      &amp;lt;/repositories&amp;gt;&lt;br /&gt;      &amp;lt;pluginRepositories&amp;gt; &lt;br /&gt;        &amp;lt;pluginRepository&amp;gt; &lt;br /&gt;            &amp;lt;id&amp;gt;nexus&amp;lt;/id&amp;gt; &lt;br /&gt;            &amp;lt;name&amp;gt;local nexus&amp;lt;/name&amp;gt; &lt;br /&gt;            &amp;lt;url&amp;gt;http://localhost:8081/nexus/content/groups/public/&amp;lt;/url&amp;gt;&lt;br /&gt;            &amp;lt;releases&amp;gt;&amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&amp;lt;/releases&amp;gt; &lt;br /&gt;            &amp;lt;snapshots&amp;gt;&amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;&amp;lt;/snapshots&amp;gt; &lt;br /&gt;        &amp;lt;/pluginRepository&amp;gt; &lt;br /&gt;       &amp;lt;/pluginRepositories&amp;gt; &lt;br /&gt;    &amp;lt;/profile&amp;gt;&lt;br /&gt;  &amp;lt;/profiles&amp;gt;&lt;br /&gt;  &amp;lt;activeProfiles&amp;gt;&lt;br /&gt;    &amp;lt;activeProfile&amp;gt;nexus&amp;lt;/activeProfile&amp;gt;&lt;br /&gt;  &amp;lt;/activeProfiles&amp;gt;&lt;br /&gt;&amp;lt;/settings&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;References: http://juvenshun.javaeye.com/blog/349534&lt;br /&gt;http://wj98127.javaeye.com/blog/306358&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5012170682573377068?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5012170682573377068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5012170682573377068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5012170682573377068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5012170682573377068'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/11/maven2-repository-server-install.html' title='maven2 repository server install'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5260044145538817241</id><published>2010-11-05T10:55:00.002+08:00</published><updated>2010-11-05T15:11:19.529+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xpath'/><category scheme='http://www.blogger.com/atom/ns#' term='Firebug'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><title type='text'>get Xpath of html element</title><content type='html'>在Firefox中有二个非常有用的插件，可以直接得到HTML页面中元素的XPath：&lt;br /&gt;&lt;br /&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1095?id=1095"&gt;XPath Checker&lt;/a&gt; - suggests XPath and can be used to test XPath results.&lt;br /&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt; - XPath suggestions are just one of the many powerful features of this very useful add-on.&lt;br /&gt; &lt;br /&gt;XPath的参考资料：&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.w3schools.com/Xpath/"&gt;W3Schools XPath Tutorial&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.w3.org/TR/xpath"&gt;W3C XPath Recommendation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.zvon.org/xxl/XPathTutorial/General/examples.html"&gt;XPath Tutorial - with interactive examples&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5260044145538817241?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5260044145538817241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5260044145538817241' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5260044145538817241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5260044145538817241'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/11/get-xpath-of-html-element.html' title='get Xpath of html element'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8498870085091455933</id><published>2010-10-24T19:21:00.001+08:00</published><updated>2010-10-24T19:30:00.859+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Rhino'/><title type='text'>Scripting java using rhino and javascript</title><content type='html'>通过Rhino可以使javascript调用java的标准类库,这使得javascript的编程能力得以强化,在服务器端已经有javascript的MVC框架,一般也是基于Rhino的.&lt;br /&gt;首先在ubuntu上可以通过命令安装rhino:&lt;br /&gt;$&gt; sudo apt-get install rhino&lt;br /&gt;&lt;br /&gt;安装完成后,在命令行中输入js或者rhino:&lt;br /&gt;&lt;div class="pre"&gt;    $&gt; js&lt;br /&gt;    $&gt; rhino&lt;br /&gt;    Rhino 1.7 release 2 2010 09 15&lt;br /&gt;    js&gt; new Date()&lt;br /&gt;    Sun Oct 24 2010 17:24:27 GMT+0800 (CST)&lt;br /&gt;    js&gt; /^\d+$/.test("369");&lt;br /&gt;    true&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;就可以进入javascript的控制台.&lt;br /&gt;&lt;br /&gt;另外一种方式就是从网上下载rhino 1.5R4.1版本,在命令行中用java运行,下面的代码在命令行的rhino1.7版本中不能运行,因为无法导入java.awt.*的包:&lt;br /&gt;&lt;div class="pre"&gt;    $&gt; java -jar rhino-1.5R4.1.jar &lt;br /&gt;    Rhino 1.5 release 4.1 2003 04 21&lt;br /&gt;    js&gt; importPackage(java.awt);&lt;br /&gt;    js&gt; frame = new Frame("JavaScript")&lt;br /&gt;    js&gt; frame.show()&lt;br /&gt;    js&gt; button = new Button("OK")&lt;br /&gt;    js&gt; frame.add(button)&lt;br /&gt;    js&gt; frame.show()&lt;br /&gt;    js&gt; function printDate() { print(new Date()) }&lt;br /&gt;    js&gt; o = { actionPerformed: printDate }&lt;br /&gt;    js&gt; buttonListener = java.awt.event.ActionListener(o)&lt;br /&gt;    js&gt; button.addActionListener(buttonListener)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;javascript访问java的包和class&lt;/h4&gt;java中所有的代码都是class包装了的,而class又是在package下的,rhino为此封装了一个全局对象Packages,通过Packages可以引入所有的java类,如Package.java.lang, Packages.java.io等:&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;    js&gt; Packages.java.io.File&lt;br /&gt;    [JavaClass java.io.File]&lt;br /&gt;    js&gt; importPackage(java.io)&lt;br /&gt;    js&gt; File&lt;br /&gt;    [JavaClass java.io.File]&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;importPackage(java.io)的效果类似java代码中的import java.io.*;&lt;br /&gt;java中的第三方类库也可以通过importClass和importPackage引入,如:&lt;br /&gt;&lt;div class="pre"&gt;    js&gt; importPackage(Packages.org.mozilla.javascript);&lt;br /&gt;    js&gt; Context.currentContext&lt;br /&gt;    org.mozilla.javascript.Context@1bc887b&lt;br /&gt;    js&gt; importClass(java.awt.List)&lt;br /&gt;    js&gt; List&lt;br /&gt;    [JavaClass java.awt.List]&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;在引入了java的类库之后,就可以在javascript中使用这些类库了,如:&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;    js&gt; new java.util.Date()&lt;br /&gt;    Sun Oct 24 17:46:50 CST 2010&lt;br /&gt;    js&gt; new Date()&lt;br /&gt;    Sun Oct 24 2010 17:46:54 GMT+0800 (CST)&lt;br /&gt;    js&gt; var f = new java.io.File("/etc/hosts");&lt;br /&gt;    js&gt; f.exists();                            &lt;br /&gt;    true&lt;br /&gt;    js&gt; f.getName();&lt;br /&gt;    hosts&lt;br /&gt;    js&gt; java.lang.Math.PI&lt;br /&gt;    3.141592653589793&lt;br /&gt;    js&gt; java.lang.Math.cos(0)&lt;br /&gt;    1&lt;br /&gt;    js&gt; for (i in f) { print(i) }&lt;br /&gt;    getAbsoluteFile&lt;br /&gt;    setReadOnly&lt;br /&gt;    listFiles&lt;br /&gt;    setReadable&lt;br /&gt;    writable&lt;br /&gt;    hashCode&lt;br /&gt;    wait&lt;br /&gt;    setExecutable&lt;br /&gt;    usableSpace&lt;br /&gt;    file&lt;br /&gt;    canonicalPath&lt;br /&gt;    getUsableSpace&lt;br /&gt;    notifyAll&lt;br /&gt;    equals&lt;br /&gt;    getParent&lt;br /&gt;    mkdirs&lt;br /&gt;    parent&lt;br /&gt;    class&lt;br /&gt;    compareTo&lt;br /&gt;    freeSpace&lt;br /&gt;    getTotalSpace&lt;br /&gt;    createNewFile&lt;br /&gt;    toString&lt;br /&gt;    toURI&lt;br /&gt;    toURL&lt;br /&gt;    getCanonicalPath&lt;br /&gt;    getCanonicalFile&lt;br /&gt;    canonicalFile&lt;br /&gt;    renameTo&lt;br /&gt;    getParentFile&lt;br /&gt;    executable&lt;br /&gt;    getFreeSpace&lt;br /&gt;    absolute&lt;br /&gt;    deleteOnExit&lt;br /&gt;    canWrite&lt;br /&gt;    name&lt;br /&gt;    notify&lt;br /&gt;    path&lt;br /&gt;    canRead&lt;br /&gt;    getPath&lt;br /&gt;    delete&lt;br /&gt;    length&lt;br /&gt;    getClass&lt;br /&gt;    readable&lt;br /&gt;    totalSpace&lt;br /&gt;    absoluteFile&lt;br /&gt;    lastModified&lt;br /&gt;    absolutePath&lt;br /&gt;    isAbsolute&lt;br /&gt;    list&lt;br /&gt;    mkdir&lt;br /&gt;    setWritable&lt;br /&gt;    isHidden&lt;br /&gt;    readOnly&lt;br /&gt;    canExecute&lt;br /&gt;    isDirectory&lt;br /&gt;    hidden&lt;br /&gt;    directory&lt;br /&gt;    isFile&lt;br /&gt;    getName&lt;br /&gt;    getAbsolutePath&lt;br /&gt;    exists&lt;br /&gt;    parentFile&lt;br /&gt;    setLastModified&lt;br /&gt;&lt;/div&gt;在上面列出的File的方法中,还包括了其从java.lang.Object中继承的所有方法.对于java的重载方法,javascript调用需要用特别的方式.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;用javascript实现java的接口&lt;/h4&gt;如要实现Runnable接口,按以下方式操作:&lt;br /&gt;&lt;div class="pre"&gt;    js&gt; var obj = { run: function () { print("\nrunning"); } }&lt;br /&gt;    js&gt; obj.run()&lt;br /&gt;&lt;br /&gt;    running&lt;br /&gt;    js&gt; var r = new java.lang.Runnable(obj);&lt;br /&gt;    js&gt; r.getClass()&lt;br /&gt;    class adapter1&lt;br /&gt;    js&gt; var t = new java.lang.Thread(r)&lt;br /&gt;    Thread[Thread-1,5,main]&lt;br /&gt;    js&gt; t.start();&lt;br /&gt;    js&gt; &lt;br /&gt;    running&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;用javascript创建java的数组对象&lt;/h4&gt;一般直接用javascript创建数组就可以,转为java对象时,rhino会处理类型转换,也可以用以下方法直接创建java数组:&lt;br /&gt;&lt;div class="pre"&gt;    js&gt; var arr = java.lang.reflect.Array.newInstance(java.lang.String, 5); arr[0] = arr[1] = arr[2] = arr[3] = arr[4] = 'create java array using javascript.'&lt;br /&gt;    create java array using javascript.&lt;br /&gt;    js&gt; arr&lt;br /&gt;    [Ljava.lang.String;@1e97f9f&lt;br /&gt;    js&gt; arr[1]&lt;br /&gt;    create java array using javascript.&lt;br /&gt;    js&gt; &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reference: http://www.mozilla.org/rhino/scriptjava.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8498870085091455933?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8498870085091455933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8498870085091455933' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8498870085091455933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8498870085091455933'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/scripting-java-using-rhino-and.html' title='Scripting java using rhino and javascript'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2773007963013049113</id><published>2010-10-23T19:26:00.002+08:00</published><updated>2010-10-24T19:37:08.900+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='format'/><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Tidy'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>在VIM中如何使用Tidy为HTML验证并格式化内容</title><content type='html'>在ubuntu中安装tidy只要输入命令:&lt;br /&gt;    $&gt; sudo apt-get install tidy&lt;br /&gt;&lt;br /&gt;    $&gt; man tidy&lt;br /&gt;&lt;br /&gt;    查看手册,可以看到比较有用的参数设置,一般我的文件都是utf8编码的,所以tidy命令会跟上"-utf8",并且一般情况就是将tidy输出的文件直接替换掉原来的文件,所以"-m"选项也很有用,输出的HTML也希望是格式化,有缩进的代码,这时就要加上"-i"参数,这样在命令行上我的tidy命令会如下所示:&lt;br /&gt;&lt;br /&gt;    $&gt; tidy -m -i -utf8 target-files1 target-files2&lt;br /&gt;&lt;br /&gt;    可以将常用的参数设置写在一个配置文件中,在调用tidy命令时指定"-config config-file-name",下面这份配置就是官网上的一个配置例子,稍做了点调整:&lt;br /&gt;    &lt;div class="pre"&gt;    // sample config file for HTML tidy&lt;br /&gt;    indent: auto&lt;br /&gt;    indent-spaces: 4&lt;br /&gt;    wrap: 120&lt;br /&gt;    markup: yes&lt;br /&gt;    output-xml: no&lt;br /&gt;    input-xml: no&lt;br /&gt;    show-warnings: yes&lt;br /&gt;    numeric-entities: yes&lt;br /&gt;    quote-marks: yes&lt;br /&gt;    quote-nbsp: yes&lt;br /&gt;    quote-ampersand: no&lt;br /&gt;    break-before-br: no&lt;br /&gt;    uppercase-tags: no&lt;br /&gt;    uppercase-attributes: no&lt;br /&gt;    char-encoding: utf8&lt;br /&gt;    new-inline-tags: cfif, cfelse, math, mroot, &lt;br /&gt;    mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,&lt;br /&gt;    munder, mover, mmultiscripts, msup, msub, mtext,&lt;br /&gt;    mprescripts, mtable, mtr, mtd, mth&lt;br /&gt;    new-blocklevel-tags: cfoutput, cfquery&lt;br /&gt;    new-empty-tags: cfelse&lt;br /&gt;    &lt;/div&gt;    在VIM中,如果需要对当前文件进行HTML格式化操作,那么可以在VIM命令模式下输入以下指令:&lt;br /&gt;&lt;br /&gt;    :!tidy -m -i -utf8 %&lt;br /&gt;&lt;br /&gt;    References: &lt;a href="http://www.w3.org/People/Raggett/tidy/"&gt;Clean up your Web pages with HTML TIDY&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2773007963013049113?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2773007963013049113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2773007963013049113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2773007963013049113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2773007963013049113'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/vimtidyhtml.html' title='在VIM中如何使用Tidy为HTML验证并格式化内容'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2411784879259782652</id><published>2010-10-19T20:05:00.008+08:00</published><updated>2010-10-24T19:34:31.073+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='RegExp'/><title type='text'>VIM正则表达式说明</title><content type='html'>Vim 中查找替换使用的正则表达式与一般的编程语言如javascript/ruby/perl不一样,尤其是在进行非贪婪匹配时,下面主要是分析在VIM中怎么进行非贪婪匹配的.&lt;br /&gt;&lt;br /&gt;在VIM手册中有这样的说明: If a character is taken literally or not depends on the 'magic' option and the items mentioned next.&lt;br /&gt;It is recommended to always keep the 'magic' option at the default setting, which is 'magic'.  This avoids portability problems.&lt;br /&gt;&lt;br /&gt;就是说默认的搜索替换是按magic模式进行查找的,如果有字符用反斜杠"\"转义的话,是会在magic模式中检查其对应转义后含意.并且在VIM配置文件中尽量保持使用magic模式.&lt;br /&gt;&lt;br /&gt;VIM中有4种正则匹配模式,可以用":h /magic"查看帮助文档的说明,简单说就是有"\m", "\M", "\v", "\V"这四种,最常用的是默认的"\m",其次"\v"在进行分组捕获时也非常有用,因为不需要像在"\m"模式下那样对小括号进行转义,写起来比较麻烦,另二个模式用得较少些.&lt;br /&gt;&lt;br /&gt;在帮助手册中对"\v"的说明如下: &lt;br /&gt;Use of "\v" means that in the pattern after it all ASCII characters except '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning.  "very magic"&lt;br /&gt;&lt;br /&gt;也就是除了0-9, a-z, A-Z和下划线"_"之外的其他ASCII字符都有特殊含义,如(, ), |, $, ^, [, ], {, }, :, !, ., *, ?, +, &lt;, &gt;等,这与其他的如javascript的正则更接近一些,在这些字符用得比较多的时候,就考虑用"\v"模式,可以少打好多反斜杠,更像其他语言中的正则表达式,更容易看得明白,所以"\v"模式很好用.&lt;br /&gt;&lt;br /&gt;关于"\m", "\v"二种模式的比较说明,摘自帮助手册,移除了"\M", "\V"部分,只要掌握好前面的二种模式就已经够用.&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    \v             \m           matches &lt;br /&gt;    $              $            matches end-of-line&lt;br /&gt;    .              .            matches any character&lt;br /&gt;    *              *            any number of the previous atom&lt;br /&gt;    ()             \(\)         grouping into an atom&lt;br /&gt;    |              \|           separating alternatives&lt;br /&gt;    \a             \a           alphabetic character&lt;br /&gt;    \\             \\           literal backslash&lt;br /&gt;    \.             \.           literal dot&lt;br /&gt;    \{             {            literal '{'&lt;br /&gt;    a              a            literal 'a'&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;对于这二种模式而言,"\a"都是代表字母,其中需要注意的是"\m"中的"|"(或分隔符)需要转义,这个与linux中的grep命令一样,另外其 "(", ")", "{" 这三个字符也需要转义,但是对于"\m"模式, "}"却可以无需转义(The } may optionally be preceded with a backslash: \{n,m\}),所以在"\m"模式中写出来的没有"\v"中的正则表达式更加整齐好明白,下面提到的非贪婪匹配正是与 "{", "}"这对花括号有关.&lt;br /&gt;&lt;h3&gt;非贪婪匹配写法&lt;/h3&gt;&lt;br /&gt;VIM中的匹配1个或者更多相同字符的"+",在magic模式下需要转义,即用"\+"表示.如"\w\+"匹配一个或者一个以上的字母数字或者下划线."\+"和"*"一样是贪婪匹配的.&lt;br /&gt;&lt;br /&gt;可以通过":h non-greedy"查看非贪婪匹配的写法.只能在"\m"模式下进行非贪婪匹配,使用".\{-}"进行最小匹配,如果写整齐点也可以用".\{-\}"来表示,如"pa.\{-\}n"可以匹配到"pattern"或者是"pan".摘录帮助手册中关于贪婪/非贪婪匹配说明如下(magic模式):&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    \{n,m}              Matches n to m of the preceding atom, as many as possible&lt;br /&gt;    \{n}                Matches n of the preceding atom&lt;br /&gt;    \{n,}               Matches at least n of the preceding atom, as many as possible&lt;br /&gt;    \{,m}               Matches 0 to m of the preceding atom, as many as possible&lt;br /&gt;    \{}                 Matches 0 or more of the preceding atom, as many as possible (like *)&lt;br /&gt;    \{-n,m}             Matches n to m of the preceding atom, as few as possible&lt;br /&gt;    \{-n}               Matches n of the preceding atom&lt;br /&gt;    \{-n,}              Matches at least n of the preceding atom, as few as possible&lt;br /&gt;    \{-,m}              Matches 0 to m of the preceding atom, as few as possible&lt;br /&gt;    \{-}                Matches 0 or more of the preceding atom, as few as possible&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;匹配包括换号符在内的任意字符&lt;/h3&gt;&lt;br /&gt;如果匹配内容有换行符,用通配符"."不能匹配换行符,在其他语言如perl/php/javascript是用"/m"修饰符让"."可以匹配字符串内的换行符,VIM中是用一个转义的下划线"\_"加上"."组成的"\_."来表示包括换行符在内的任意字符,与此效果相似的还有"\_^", "\_$", "\_s".关于VIM和perl的正则表达式区别可以通过":h perl-patterns"查看更详细的说明.&lt;br /&gt;&lt;h3&gt;字符类(Character classes)&lt;/h3&gt;&lt;br /&gt;摘录部分常用的字符类如下,这部分多数与其他语言相似,其他很多字符类与别的语言中的字符类完全不一样,并且大小写的字符集不是取反的字符集,如"\i",就不作记录说明.另外如果需要忽略大小写,可查看":h /ignorecase", 在任何位置加入"\c"标记开始忽略字母的大小写.&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    \s          whitespace character: &amp;lt;Space&amp;gt; and &amp;lt;Tab&amp;gt;&lt;br /&gt;    \S          non-whitespace character; opposite of \s&lt;br /&gt;    \d          digit:    [0-9]&lt;br /&gt;    \D          non-digit:   [^0-9]&lt;br /&gt;    \w          word character:   [0-9A-Za-z_]&lt;br /&gt;    \W          non-word character:  [^0-9A-Za-z_]&lt;br /&gt;    \a          alphabetic character:  [A-Za-z]&lt;br /&gt;    \A          non-alphabetic character: [^A-Za-z]&lt;br /&gt;    \l          lowercase character:  [a-z]&lt;br /&gt;    \u          uppercase character:  [A-Z]&lt;br /&gt;    \t          matches &amp;lt;Tab&amp;gt;&lt;br /&gt;    \r          matches &amp;lt;CR&amp;gt;&lt;br /&gt;    \n          matches an end-of-line&lt;br /&gt;    \1          Matches the same string that was matched by the first sub-expression in \( and \). Example: "\([a-z]\).\1" matches "ata", "ehe", "tot", etc.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;关于VIM中的[](:h /collection)&lt;/h3&gt;&lt;br /&gt;在其他语言中perl/javascript/ruby中,方括号可以使用转义字符代替的字符集,如"\s", "\w"等,在VIM中只能在方括号中使用字符序列,也可以像其他编程语言一样放入"a-z", "0-9"等,但不能用转义字符,这点在使用时比较不顺手.&lt;br /&gt;&lt;br /&gt;以上是个人认为比较常用并且较为简单的部分内容,更多神奇的VIM正则查找,以及结合一些VIM内置方法进行正则替换,则需要仔细阅读帮助手册说明.要熟练掌握VIM,就需要多查手册,多实践.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2411784879259782652?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2411784879259782652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2411784879259782652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2411784879259782652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2411784879259782652'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/vim_19.html' title='VIM正则表达式说明'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-3795915969634009687</id><published>2010-10-08T22:12:00.002+08:00</published><updated>2010-10-19T20:57:00.635+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emerald'/><category scheme='http://www.blogger.com/atom/ns#' term='theme'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>个人一直使用的一套ubuntu主题</title><content type='html'>&lt;span style="font-family: tahoma, arial, helvetica, sans-serif;"&gt;从&lt;a href="http://www.bisigi-project.org/?page_id=8&amp;amp;lang=en"&gt;http://www.bisigi-project.org/?page_id=8&amp;amp;lang=en&lt;/a&gt;上下载安装,在ubuntu上用apt-get安装很简单:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif;"&gt;&lt;br /&gt;$&amp;gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt; sudo add-apt-repository ppa:bisigi/ppa  &amp;amp;&amp;amp; sudo apt-get update&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif;"&gt;$&amp;gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif;"&gt;sudo  aptitude install showtime-theme&lt;br /&gt;&lt;br /&gt;其他更多主题可以选择,都很不错.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: tahoma, arial, helvetica, sans-serif;"&gt;ubuntu 10.10 自带的Ambiance配合mac4Lin的emerald主题也很酷.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-3795915969634009687?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/3795915969634009687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=3795915969634009687' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3795915969634009687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3795915969634009687'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/ubuntu.html' title='个人一直使用的一套ubuntu主题'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6901859066515621607</id><published>2010-10-01T19:29:00.000+08:00</published><updated>2010-10-01T19:29:42.518+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='Replace'/><category scheme='http://www.blogger.com/atom/ns#' term='RegExp'/><title type='text'>vim中匹配换行符的正则表达式</title><content type='html'>\s* 匹配0或多个空白(比如空格,Tab等,不匹配换行)&lt;br /&gt;VIM里面,如果要连换行一起匹配,则加个下划线,比如&lt;b&gt;&lt;i&gt;\_s&lt;/i&gt;&lt;/b&gt;匹配包括换行在内的空白,而&lt;b&gt;&lt;i&gt;\_.&lt;/i&gt;&lt;/b&gt;匹配包括换行在内的任意字符 (注意,后面有个小数点)&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://jianzi0307.blog.163.com/blog/static/2081200200951613843867/"&gt;VIM正则表达式查找替换&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6901859066515621607?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6901859066515621607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6901859066515621607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6901859066515621607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6901859066515621607'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/vim.html' title='vim中匹配换行符的正则表达式'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5995299017905339318</id><published>2010-10-01T19:01:00.003+08:00</published><updated>2010-10-01T19:01:42.411+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screen'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='nvidia'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Ubuntu下Nvidia显卡不定时闪屏的解决</title><content type='html'>解决方法:&lt;br /&gt;&lt;br /&gt;在配置文件中添加一行:&lt;br /&gt;$&gt; sudo vi /etc/modprobe.d/nvidia-kernel-nkc&lt;br /&gt;options nvidia NVreg_Mobile=1 NVreg_RegistryDwords="PerfLevelSrc=0x2222"&lt;br /&gt;&lt;br /&gt;更多信息可查看ubuntu的bug list:&lt;a href="https://bugs.launchpad.net/ubuntu/+source/nvidia-kernel-common/+bug/164589"&gt;Occasional screen-wide "blink" when using opengl apps (compiz also) and Nvidia cards&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://forum.ubuntu.org.cn/viewtopic.php?f=42&amp;t=152433&amp;start=0"&gt;[分享]解决Nvidia显卡不定时闪屏问题&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5995299017905339318?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5995299017905339318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5995299017905339318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5995299017905339318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5995299017905339318'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/10/ubuntunvidia.html' title='Ubuntu下Nvidia显卡不定时闪屏的解决'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8815237395582316577</id><published>2010-09-17T18:24:00.002+08:00</published><updated>2010-10-24T19:41:00.212+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='pom'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>maven 学习笔记</title><content type='html'>maven的POM文件有一份默认的Super POM，所有新建的POM文件都是继承自此POM，这个Super POM的build配置部分如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  &amp;lt;build&amp;gt;&lt;br /&gt;    &amp;lt;directory&amp;gt;target&amp;lt;/directory&amp;gt;&lt;br /&gt;    &amp;lt;outputDirectory&amp;gt;target/classes&amp;lt;/outputDirectory&amp;gt;&lt;br /&gt;    &amp;lt;finalName&amp;gt;${artifactId}-${version}&amp;lt;/finalName&amp;gt;&lt;br /&gt;    &amp;lt;testOutputDirectory&amp;gt;target/test-classes&amp;lt;/testOutputDirectory&amp;gt;&lt;br /&gt;    &amp;lt;sourceDirectory&amp;gt;src/main/java&amp;lt;/sourceDirectory&amp;gt;&lt;br /&gt;    &amp;lt;scriptSourceDirectory&amp;gt;src/main/scripts&amp;lt;/scriptSourceDirectory&amp;gt;&lt;br /&gt;    &amp;lt;testSourceDirectory&amp;gt;src/test/java&amp;lt;/testSourceDirectory&amp;gt;&lt;br /&gt;    &amp;lt;resources&amp;gt;&lt;br /&gt;      &amp;lt;resource&amp;gt;&lt;br /&gt;        &amp;lt;directory&amp;gt;src/main/resources&amp;lt;/directory&amp;gt;&lt;br /&gt;      &amp;lt;/resource&amp;gt;&lt;br /&gt;    &amp;lt;/resources&amp;gt;&lt;br /&gt;    &amp;lt;testResources&amp;gt;&lt;br /&gt;      &amp;lt;testResource&amp;gt;&lt;br /&gt;        &amp;lt;directory&amp;gt;src/test/resources&amp;lt;/directory&amp;gt;&lt;br /&gt;      &amp;lt;/testResource&amp;gt;&lt;br /&gt;    &amp;lt;/testResources&amp;gt;&lt;br /&gt;  &amp;lt;/build&amp;gt;&lt;/div&gt; &lt;br /&gt;在WEB项目中会希望在mvn package之后将maven导入的lib文件自动复制到wepapp/WEB-INF/lib下方便测试，如果maven导入的依赖文件发生变化时，将lib目录下的文件先清理之后，再重新加入，同时也可以将其他的lib目录的文件一起复制到webapp/WEB-INF/lib下，要达到这个功能，可以用maven去运行ant的可执行脚本，maven-antrun-plugin 就达到这个目的，只要将ant的任务放到tasks标签里，格式如：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;project&amp;gt;&lt;br /&gt;  &amp;lt;build&amp;gt;&lt;br /&gt;    &amp;lt;plugins&amp;gt;&lt;br /&gt;      &amp;lt;plugin&amp;gt;&lt;br /&gt;        &amp;lt;artifactId&amp;gt;maven-antrun-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;        &amp;lt;version&amp;gt;1.4&amp;lt;/version&amp;gt;&lt;br /&gt;        &amp;lt;executions&amp;gt;&lt;br /&gt;          &amp;lt;execution&amp;gt;&lt;br /&gt;            &amp;lt;phase&amp;gt; &amp;lt;!-- a lifecycle phase --&amp;gt; &amp;lt;/phase&amp;gt;&lt;br /&gt;            &amp;lt;configuration&amp;gt;&lt;br /&gt;              &amp;lt;tasks&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;!--&lt;br /&gt;                  Place any Ant task here. You can add anything&lt;br /&gt;                  you can add between &amp;lt;target&amp;gt; and &amp;lt;/target&amp;gt; in a&lt;br /&gt;                  build.xml.&lt;br /&gt;                --&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;/tasks&amp;gt;&lt;br /&gt;            &amp;lt;/configuration&amp;gt;&lt;br /&gt;            &amp;lt;goals&amp;gt;&lt;br /&gt;              &amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;&lt;br /&gt;            &amp;lt;/goals&amp;gt;&lt;br /&gt;          &amp;lt;/execution&amp;gt;&lt;br /&gt;        &amp;lt;/executions&amp;gt;&lt;br /&gt;      &amp;lt;/plugin&amp;gt;&lt;br /&gt;    &amp;lt;/plugins&amp;gt;&lt;br /&gt;  &amp;lt;/build&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;/div&gt; &lt;br /&gt;在linux中，因为默认使用了openjdk，所以在使用maven时，会遇到提示 tools.jar 包的依赖问题，可以在POM中添加下面的配置，引入 tools.jar:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  &amp;lt;profiles&amp;gt;&lt;br /&gt;    &amp;lt;profile&amp;gt;&lt;br /&gt;      &amp;lt;id&amp;gt;default-tools.jar&amp;lt;/id&amp;gt;&lt;br /&gt;      &amp;lt;activation&amp;gt;&lt;br /&gt;        &amp;lt;property&amp;gt;&lt;br /&gt;          &amp;lt;name&amp;gt;java.vendor&amp;lt;/name&amp;gt;&lt;br /&gt;          &amp;lt;value&amp;gt;Sun Microsystems Inc.&amp;lt;/value&amp;gt;&lt;br /&gt;        &amp;lt;/property&amp;gt;&lt;br /&gt;      &amp;lt;/activation&amp;gt;&lt;br /&gt;      &amp;lt;dependencies&amp;gt;&lt;br /&gt;        &amp;lt;dependency&amp;gt;&lt;br /&gt;          &amp;lt;groupId&amp;gt;com.sun&amp;lt;/groupId&amp;gt;&lt;br /&gt;          &amp;lt;artifactId&amp;gt;tools&amp;lt;/artifactId&amp;gt;&lt;br /&gt;          &amp;lt;version&amp;gt;1.4.2&amp;lt;/version&amp;gt;&lt;br /&gt;          &amp;lt;scope&amp;gt;system&amp;lt;/scope&amp;gt;&lt;br /&gt;          &amp;lt;systemPath&amp;gt;${java.home}/../lib/tools.jar&amp;lt;/systemPath&amp;gt;&lt;br /&gt;        &amp;lt;/dependency&amp;gt;&lt;br /&gt;      &amp;lt;/dependencies&amp;gt;&lt;br /&gt;    &amp;lt;/profile&amp;gt;&lt;br /&gt;  &amp;lt;/profiles&amp;gt;&lt;/div&gt;&lt;br /&gt;在项目目录下运行mvn命令时，如果看到 jvm 1.3 的编译错误，则需要为maven指定源码和JVM的版本，如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  &amp;lt;build&amp;gt;&lt;br /&gt;    &amp;lt;plugins&amp;gt;&lt;br /&gt;      &amp;lt;plugin&amp;gt;&lt;br /&gt;        &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;&lt;br /&gt;        &amp;lt;artifactId&amp;gt;maven-compiler-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;        &amp;lt;version&amp;gt;2.0.2&amp;lt;/version&amp;gt;&lt;br /&gt;        &amp;lt;configuration&amp;gt;&lt;br /&gt;          &amp;lt;source&amp;gt;1.5&amp;lt;/source&amp;gt;&lt;br /&gt;          &amp;lt;target&amp;gt;1.5&amp;lt;/target&amp;gt;&lt;br /&gt;        &amp;lt;/configuration&amp;gt;&lt;br /&gt;      &amp;lt;/plugin&amp;gt;&lt;br /&gt;    &amp;lt;/plugins&amp;gt;&lt;br /&gt;  &amp;lt;/build&amp;gt;&lt;/div&gt;&lt;br /&gt;在项目下面运行 jUnit test 时，如果运行 mvn test 是成功的，但是单独在一个test文件是运行jUnit test时则报错说 Class not found(或者二者相反)，这个是因为maven默认为test的java文件生成的class放到target/test-classes，项目本身的classes output目录可能是设置在webapp/WEB-INF/classes目录中的，二者不一致才造成这个问题，需要在build标签下面设置 outputDirectory 和 testOutputDirectory 这二个标签，让maven也到webapp/WEB-INF/classes目录中查找编译后的文件。&lt;br /&gt;&lt;br /&gt;maven中常用命令说明，项目打包和安装到仓库中，在项目下运行:&lt;br /&gt;$&amp;gt; mvn package&lt;br /&gt;为当前项目生成一个jar文件或者是war文件，这个由POM文件配置中的packaging参数决定是jar还是war，运行成功后，会在${basedir}/target目录下生成文件。如果需要将生成的jar文件放到maven仓库中(默认是: ~/.m2/repository)，则运行命令:&lt;br /&gt;$&amp;gt; mvn install&lt;br /&gt;&lt;br /&gt;为eclipse IDE生成maven项目，配合eclipse maven插件如: m2e - http://m2eclipse.sonatype.org/sites/m2e 一起使用：&lt;br /&gt;$&amp;gt; mvn eclipse:eclipse&lt;br /&gt;&lt;br /&gt;运行当前项目中的jUnit test，maven是使用maven-surefire-plugin完成test的，关于这个插件，可以查看 http://tianya23.blog.51cto.com/1081650/386012 中的说明，可以忽略或者指定测试文件的名字，以及在test发生错误如何不影响打包:&lt;br /&gt;$&amp;gt; mvn test&lt;br /&gt;&lt;br /&gt;根据上面的maven知识点，配置出符合项目需求的POM配置的build部分如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;    &amp;lt;build&amp;gt;&lt;br /&gt;        &amp;lt;sourceDirectory&amp;gt;src/main/java&amp;lt;/sourceDirectory&amp;gt;&lt;br /&gt;        &amp;lt;resources&amp;gt;&lt;br /&gt;            &amp;lt;resource&amp;gt;&lt;br /&gt;                &amp;lt;directory&amp;gt;src/main/resources&amp;lt;/directory&amp;gt;&lt;br /&gt;            &amp;lt;/resource&amp;gt;&lt;br /&gt;        &amp;lt;/resources&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;outputDirectory&amp;gt;src/main/webapp/WEB-INF/classes&amp;lt;/outputDirectory&amp;gt;&lt;br /&gt;        &amp;lt;testOutputDirectory&amp;gt;src/main/webapp/WEB-INF/classes&amp;lt;/testOutputDirectory&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;plugins&amp;gt;&lt;br /&gt;            &amp;lt;plugin&amp;gt;&lt;br /&gt;                &amp;lt;artifactId&amp;gt;maven-compiler-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;                &amp;lt;configuration&amp;gt;&lt;br /&gt;                    &amp;lt;source&amp;gt;1.6&amp;lt;/source&amp;gt;&lt;br /&gt;                    &amp;lt;target&amp;gt;1.6&amp;lt;/target&amp;gt;&lt;br /&gt;                    &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;&lt;br /&gt;                &amp;lt;/configuration&amp;gt;&lt;br /&gt;            &amp;lt;/plugin&amp;gt;&lt;br /&gt;            &amp;lt;plugin&amp;gt;&lt;br /&gt;                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;&lt;br /&gt;                &amp;lt;artifactId&amp;gt;maven-war-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;                &amp;lt;configuration&amp;gt;&lt;br /&gt;                    &amp;lt;webXml&amp;gt;src/main/webapp/WEB-INF/web.xml&amp;lt;/webXml&amp;gt;&lt;br /&gt;                &amp;lt;/configuration&amp;gt;&lt;br /&gt;            &amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;plugin&amp;gt;&lt;br /&gt;                &amp;lt;artifactId&amp;gt;maven-antrun-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;                &amp;lt;executions&amp;gt;&lt;br /&gt;                    &amp;lt;execution&amp;gt;&lt;br /&gt;                        &amp;lt;id&amp;gt;copy-lib-src-webapp&amp;lt;/id&amp;gt;&lt;br /&gt;                        &amp;lt;phase&amp;gt;install&amp;lt;/phase&amp;gt;&lt;br /&gt;                        &amp;lt;configuration&amp;gt;&lt;br /&gt;                            &amp;lt;tasks&amp;gt;&lt;br /&gt;                                &amp;lt;delete dir="src/main/webapp/WEB-INF/lib" /&amp;gt;&lt;br /&gt;                                &amp;lt;copy todir="src/main/webapp/WEB-INF/lib"&amp;gt;&lt;br /&gt;                                    &amp;lt;fileset dir="target/package-name-0.0.1-SNAPSHOT/WEB-INF/lib"&amp;gt;&lt;br /&gt;                                        &amp;lt;include name="*" /&amp;gt;&lt;br /&gt;                                    &amp;lt;/fileset&amp;gt;&lt;br /&gt;                                &amp;lt;/copy&amp;gt;&lt;br /&gt;                                &amp;lt;copy todir="src/main/webapp/WEB-INF/lib"&amp;gt;&lt;br /&gt;                                    &amp;lt;fileset dir="lib"&amp;gt;&lt;br /&gt;                                        &amp;lt;include name="*" /&amp;gt;&lt;br /&gt;                                    &amp;lt;/fileset&amp;gt;&lt;br /&gt;                                &amp;lt;/copy&amp;gt;&lt;br /&gt;                            &amp;lt;/tasks&amp;gt;&lt;br /&gt;                        &amp;lt;/configuration&amp;gt;&lt;br /&gt;                        &amp;lt;goals&amp;gt;&lt;br /&gt;                            &amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;&lt;br /&gt;                        &amp;lt;/goals&amp;gt;&lt;br /&gt;                    &amp;lt;/execution&amp;gt;&lt;br /&gt;                &amp;lt;/executions&amp;gt;&lt;br /&gt;            &amp;lt;/plugin&amp;gt;&lt;br /&gt;        &amp;lt;/plugins&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/build&amp;gt;&lt;/div&gt; &lt;br /&gt;可以从下面的maven仓库中查找包的依赖和maven配置：&lt;br /&gt;* http://repository.apache.org&lt;br /&gt;* http://www.artifact-repository.org&lt;br /&gt;* http://mvnrepository.com&lt;br /&gt;* http://www.mvnbrowser.com&lt;br /&gt;* http://www.jarvana.com&lt;br /&gt;* http://mavensearch.net&lt;br /&gt;      &lt;br /&gt;Reference:&lt;br /&gt;http://maven.apache.org/general.html&lt;br /&gt;http://maven.apache.org/plugins/&lt;br /&gt;http://maven.apache.org/pom.html&lt;br /&gt;http://maven.apache.org/settings.html&lt;br /&gt;http://maven.apache.org/guides/getting-started/index.html&lt;br /&gt;http://maven.apache.org/plugins/maven-antrun-plugin/usage.html&lt;br /&gt;http://maven.apache.org/plugins/maven-surefire-plugin/usage.html&lt;br /&gt;http://maven.apache.org/guides/introduction/introduction-to-the-pom.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8815237395582316577?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8815237395582316577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8815237395582316577' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8815237395582316577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8815237395582316577'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/09/maven.html' title='maven 学习笔记'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5205116526807216107</id><published>2010-08-30T11:29:00.002+08:00</published><updated>2010-10-24T19:43:18.160+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mvn'/><category scheme='http://www.blogger.com/atom/ns#' term='Plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>maven:install在命令行构建成功而m2eclipse中构建失败</title><content type='html'>在命令行中用&lt;br /&gt;$&amp;gt; mvn package&lt;br /&gt;能构建成功，但在eclipse中用m2eclipse插件则构建失败，提示信息摘录部分如下：&lt;br /&gt;[ERROR] FATAL ERROR&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] dependenciesInfo : dependenciesInfo&lt;br /&gt; ---- Debugging information ----&lt;br /&gt;message : dependenciesInfo : dependenciesInfo&lt;br /&gt;cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException&lt;br /&gt;cause-message : dependenciesInfo : dependenciesInfo&lt;br /&gt;class : org.apache.maven.plugin.war.util.WebappStructure&lt;br /&gt; required-type : org.apache.maven.plugin.war.util.WebappStructure&lt;br /&gt;path : /webapp-structure/dependenciesInfo&lt;br /&gt;&lt;br /&gt;在网上查了一些资料，主要参考： &lt;a href="http://jira.codehaus.org/browse/MWAR-187"&gt;http://jira.codehaus.org/browse/MWAR-187&lt;/a&gt;&lt;br /&gt; 之所以命令行能成功，而插件不成功，主要原因是二者的maven版本不一样造成的，因为2eclipse使用embedded Maven 3 (Maven Embedder 3.0.-SNAPSHOT)，可以通过window-&amp;gt;perferences-&amp;gt;Maven-&amp;gt;Installations查看到。&lt;br /&gt;&lt;br /&gt;解决这个问题的方法在上文链接中也有提到：&lt;br /&gt;1、Maven版本降级&lt;br /&gt;2、最快捷的方式是禁用缓存(webapp-cache.xml)&lt;br /&gt;&lt;div class="pre"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;    &amp;lt;useCache&amp;gt;false&amp;lt;/useCache&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/div&gt;&lt;br /&gt;3、在eclipse中用m2eclipse插，先运行mvn clean后(这样会删除target目录)，再运行mvn install&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://jira.codehaus.org/browse/MWAR-187"&gt;http://jira.codehaus.org/browse/MWAR-187&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5205116526807216107?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5205116526807216107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5205116526807216107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5205116526807216107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5205116526807216107'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/08/maveninstallm2eclipse.html' title='maven:install在命令行构建成功而m2eclipse中构建失败'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8724918308869577470</id><published>2010-08-08T18:22:00.001+08:00</published><updated>2010-08-08T18:22:53.781+08:00</updated><title type='text'>install sun java on ubuntu 10.04</title><content type='html'>Sun Java moved to the Partner repository&lt;br&gt;&lt;br&gt;For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.&lt;br&gt;&lt;br&gt;If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:&lt;br&gt; &lt;br&gt;$&amp;gt; add-apt-repository &amp;quot;deb &lt;a href="http://archive.canonical.com/"&gt;http://archive.canonical.com/&lt;/a&gt; lucid partner&amp;quot;&lt;br&gt;---------------&lt;br&gt;and then：&lt;br&gt;$&amp;gt; sudo add-apt-repository &amp;quot;deb &lt;a href="http://archive.canonical.com/"&gt;http://archive.canonical.com/&lt;/a&gt; lucid partner&amp;quot;&lt;br&gt; $&amp;gt; sudo apt-get update&lt;br&gt;$&amp;gt; sudo apt-get install sun-java6-jdk&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8724918308869577470?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8724918308869577470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8724918308869577470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8724918308869577470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8724918308869577470'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/08/install-sun-java-on-ubuntu-1004.html' title='install sun java on ubuntu 10.04'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6643005048211358124</id><published>2010-07-31T12:43:00.001+08:00</published><updated>2010-07-31T12:43:51.742+08:00</updated><title type='text'>find mysqld configure file position</title><content type='html'>检查mysqld读取配置文件的位置，可以用下面这个命令：&lt;br&gt;$&amp;gt; mysqld --verbose --help|grep -A 1 &amp;#39;Default options&amp;#39;&lt;br&gt;&lt;br&gt;摘自《高性能MySQL》&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6643005048211358124?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6643005048211358124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6643005048211358124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6643005048211358124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6643005048211358124'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/find-mysqld-configure-file-position.html' title='find mysqld configure file position'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8842496748617907801</id><published>2010-07-20T10:08:00.001+08:00</published><updated>2010-07-20T10:08:31.260+08:00</updated><title type='text'>google chrome about command list</title><content type='html'>about:memory&lt;br&gt;about:stats&lt;br&gt;about:network&lt;br&gt;about:internets&lt;br&gt;about:histograms&lt;br&gt;about:dns&lt;br&gt;about:cache&lt;br&gt;about:crash&lt;br&gt;about:plugins&lt;br&gt;about:version&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8842496748617907801?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8842496748617907801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8842496748617907801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8842496748617907801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8842496748617907801'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/google-chrome-about-command-list.html' title='google chrome about command list'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2238468071060031417</id><published>2010-07-20T09:51:00.001+08:00</published><updated>2010-07-20T09:51:30.351+08:00</updated><title type='text'>ubuntu 9.10 上安装facebook XHP</title><content type='html'>&lt;a href="http://wiki.github.com/facebook/xhp/building-xhp"&gt;http://wiki.github.com/facebook/xhp/building-xhp&lt;/a&gt;&lt;br&gt;&lt;br&gt;1. Download xhp from &lt;a href="http://github.com/facebook/xhp/downloads"&gt;http://github.com/facebook/xhp/downloads&lt;/a&gt;&lt;br&gt; &lt;br&gt;$&amp;gt; sudo apt-get install php gcc flex bison re2c&lt;br&gt;&lt;br&gt;$&amp;gt; phpize&lt;br&gt;$&amp;gt; ./configure&lt;br&gt;$&amp;gt; make&lt;br&gt;$&amp;gt; sudo make install&lt;br&gt;&lt;br&gt;3. add xhp config file to php&lt;br&gt;$&amp;gt; sudo vi /etc/php5/conf.d/xhp.ini&lt;br&gt;# add below line to xhp.ini file&lt;br&gt; extension=xhp.so&lt;br&gt;&lt;br&gt;4. test xhp, if you get a syntax error then XHP is not working.&lt;br&gt;$&amp;gt; php -r &amp;#39;echo &amp;quot;XHP!\n&amp;quot;; exit; &amp;lt;a /&amp;gt;;&amp;#39;&lt;br&gt;&lt;br&gt;5. xhp configure&lt;br&gt;xhp.idx_expr = {1 | 0} (default: 0): This is a bonus feature of XHP which adds support for the [] operator on the return value of a function. If you enable this you will be able to write code like foo()[&amp;#39;bar&amp;#39;] without hitting syntax errors. This configuration is mainly around to fix a personal annoyance with PHP's grammar, and has nothing to do with XHP's core features.&lt;br&gt; &lt;br&gt;xhp.include_debug = {1 | 0} (default: 1): You can disable XHP node annotations by turning this setting off. This may in some cases marginally increase performance of XHP-heavy code. It is highly recommended that you leave this on, as tracking errors in XHP applications is very difficult without annotations.&lt;br&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2238468071060031417?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2238468071060031417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2238468071060031417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2238468071060031417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2238468071060031417'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/ubuntu-910-facebook-xhp.html' title='ubuntu 9.10 上安装facebook XHP'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6076081315640614972</id><published>2010-07-17T18:10:00.003+08:00</published><updated>2010-10-24T21:29:58.367+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ping'/><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache'/><category scheme='http://www.blogger.com/atom/ns#' term='Jmeter'/><title type='text'>acme网站上几个http小工具</title><content type='html'>1. http_load: &lt;a href="http://www.acme.com/software/http_load/"&gt;http://www.acme.com/software/http_load/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;同apache ab和JMeter一样可以对数据库和web服务器作压力测试。&lt;br /&gt;$&amp;gt; vi urls&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  $&amp;gt; ./http_load -rate 5 -seconds 10 urls &lt;br /&gt;  49 fetches&lt;br /&gt;  2 max parallel&lt;br /&gt;  289884 bytes&lt;br /&gt;  in 10.0148 seconds 5916 mean bytes/connection 4.89274 fetches/sec&lt;br /&gt;  28945.5 bytes/sec msecs/connect: 28.8932 mean&lt;br /&gt;  44.243 max&lt;br /&gt;  24.488 min msecs/first-response: 63.5362 mean&lt;br /&gt;  81.624 max&lt;br /&gt;  57.803 min&lt;br /&gt;  HTTP response codes:   code 200 -- 49 &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;2. http_ping: &lt;a href="http://www.acme.com/software/http_ping/"&gt;http://www.acme.com/software/http_ping/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;与ping命令类似，但是是通过http请求来检查服务器，而非ICMP请求服务器返回响应。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;  $&amp;gt; http_ping http://www.example.com/&lt;br /&gt;  7816 bytes from http://www.example.com/: &lt;br /&gt;  246.602 ms (9.923c/23.074r/213.605d)&lt;br /&gt;  7816 bytes from http://www.example.com/:&lt;br /&gt;  189.997 ms (11.619c/22.971r/155.407d)&lt;br /&gt;  7816 bytes from http://www.example.com/:&lt;br /&gt;  190.463 ms (8.994c/25.091r/156.378d)&lt;br /&gt;  7816 bytes from http://www.example.com/:&lt;br /&gt;  190.07 ms (9.234c/23.9r/156.936d)&lt;br /&gt;  7816 bytes from http://www.example.com/:&lt;br /&gt;  190.706 ms (10.142c/46.579r/133.985d)&lt;br /&gt;  --- http://www.example.com/&lt;br /&gt;  http_ping statistics&lt;br /&gt;  --- 5 fetches started, 5 completed (100%), 0 failures (0%), 0 timeouts (0%) &lt;br /&gt;  total    min/avg/max = 189.997/201.568/246.602 ms &lt;br /&gt;  connect  min/avg/max = 8.994/9.9824/11.619 ms &lt;br /&gt;  response min/avg/max = 22.971/28.323/46.579 ms &lt;br /&gt;  data     min/avg/max = 133.985/163.262/213.605 ms&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6076081315640614972?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6076081315640614972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6076081315640614972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6076081315640614972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6076081315640614972'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/acmehttp.html' title='acme网站上几个http小工具'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1914245007614166378</id><published>2010-07-06T15:17:00.009+08:00</published><updated>2010-10-24T22:02:59.570+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Key-Value'/><category scheme='http://www.blogger.com/atom/ns#' term='mongoDB'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='mongo'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='noSQL'/><title type='text'>mongodb tutorial and references</title><content type='html'>&lt;h3&gt;Introduction&lt;/h3&gt;&lt;br /&gt;MongoDB is a collection-oriented, schema-free document database.&lt;br /&gt;&lt;br /&gt;By collection-oriented, we mean that data is grouped into sets that are called 'collections'. Each collection has a unique name in the database, and can contain an unlimited number of documents. Collections are analogous to tables in a RDBMS, except that they don't have any defined schema.&lt;br /&gt;&lt;br /&gt;By schema-free, we mean that the database doesn't need to know anything about the structure of the documents that you store in a collection. In fact, you can store documents with different structure in the same collection if you so choose.&lt;br /&gt;&lt;br /&gt;By document, we mean that we store data that is a structured collection of key-value pairs, where keys are strings, and values are any of a rich set of data types, including arrays and documents. We call this data format "BSON" for "Binary Serialized dOcument Notation."&lt;br /&gt;&lt;br /&gt;MongoDB is a server process that runs on Linux, Windows and OS X. It can be run both as a 32 or 64-bit application. We recommend running in 64-bit mode, since Mongo is limited to a total data size of about 2GB for all databases in 32-bit mode.&lt;br /&gt;&lt;br /&gt;The MongoDB process listens on port 27017 by default (note that this can be set at start time - please see Command Line Parameters for more information).&lt;br /&gt;&lt;br /&gt;MongoDB stores its data in files (default location is /data/db/), and uses memory mapped files for data management for efficiency.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Example data of mongodb&lt;/h3&gt;&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; bin/mongo --shell slides.js&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;/*&lt;br /&gt;* Slides for presentation on Mastering the MongoDB Shell.&lt;br /&gt;* Copyright 2010 Mike Dirolf (http://dirolf.com)&lt;br /&gt;* This work is licensed under the Creative Commons&lt;br /&gt;* Attribution-Noncommercial-Share Alike 3.0 United States License. To&lt;br /&gt;* view a copy of this license, visit&lt;br /&gt;* http://creativecommons.org/licenses/by-nc-sa/3.0/us/ or send a&lt;br /&gt;* letter to Creative Commons, 171 Second Street, Suite 300, San&lt;br /&gt;* Francisco, California, 94105, USA.&lt;br /&gt;* Originally given at MongoSF on 4/30/2010.&lt;br /&gt;* Modified and given at MongoNYC on 5/21/2010.&lt;br /&gt;* To use: run `mongo --shell slides.js`&lt;br /&gt;*/&lt;br /&gt;db = db.getSisterDB("shell");&lt;br /&gt;db.dropDatabase();&lt;br /&gt;// some sample data&lt;br /&gt;for (var i = 0; i &lt; 1000; i += 1) {&lt;br /&gt; db.data.save({&lt;br /&gt;  x: i&lt;br /&gt; });&lt;br /&gt;} // "slides"&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 0,&lt;br /&gt; welcome: "to MongoNYC!",&lt;br /&gt; hashtag: "#mongonyc",&lt;br /&gt; mirror: "http://confmirror.10gen.com/"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 1,&lt;br /&gt; title: "Mastering the MongoDB Shell",&lt;br /&gt; who: "Mike Dirolf, 10gen",&lt;br /&gt; handle: "@mdirolf"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 2,&lt;br /&gt; question: "what is the shell?",&lt;br /&gt; answer: "a better Powerpoint?"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 3,&lt;br /&gt; question: "what is the shell?",&lt;br /&gt; answer: "a full JavaScript environment"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 4,&lt;br /&gt; question: "what is the shell?",&lt;br /&gt; answer: "a reference MongoDB client"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 5,&lt;br /&gt; "use cases": ["administrative scripting", "exploring and debugging", "learning (and teaching!)"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 6,&lt;br /&gt; repl: ["arrows for history", "^L"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 7,&lt;br /&gt; "getting help": ["help", "db.help", "db.foo.help"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 8,&lt;br /&gt; "show": ["dbs", "collections", "users", "profile"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 9,&lt;br /&gt; navigating: "databases",&lt;br /&gt; how: "'use' or 'db.getSisterDB'"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 10,&lt;br /&gt; navigating: "collections",&lt;br /&gt; how: "dots, brackets, or 'db.getCollection'",&lt;br /&gt; note: "careful with names like foo-bar"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 11,&lt;br /&gt; "basic operations": ["insert", "findOne", "find", "remove"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 12,&lt;br /&gt; "fun with cursors": ["auto-iteration", "it"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 13,&lt;br /&gt; "error checking": "auto 'db.getLastError'"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 14,&lt;br /&gt; "commands": ["count", "stats", "repairDatabase"],&lt;br /&gt; "meta": "listCommands"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 15,&lt;br /&gt; "pro tip!": "viewing JS source"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 16,&lt;br /&gt; "getting help": "--help"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 17,&lt;br /&gt; scripting: "run .js files",&lt;br /&gt; tools: ["--eval", "--shell", "runProgram"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 18,&lt;br /&gt; warning: "dates in JS suck"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 19,&lt;br /&gt; warning: "array iteration in JS sucks"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 20,&lt;br /&gt; warning: "numeric types in JS suck"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 21,&lt;br /&gt; so: "why JS?"&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 22,&lt;br /&gt; homework: ["convince 2 friends to try MongoDB", "send feedback @mdirolf"]&lt;br /&gt;});&lt;br /&gt;db.deck.save({&lt;br /&gt; slide: 23,&lt;br /&gt; url: "github.com/mdirolf/shell_presentation",&lt;br /&gt; questions: "?"&lt;br /&gt;}); // current slide&lt;br /&gt;var current = 0; // print current slide and advance&lt;br /&gt;var next = function() {&lt;br /&gt; var slide = db.deck.findOne({&lt;br /&gt;  slide: current&lt;br /&gt; });&lt;br /&gt; if (slide) {&lt;br /&gt;  current++;&lt;br /&gt;  delete slide._id;&lt;br /&gt;  delete slide.slide;&lt;br /&gt;  print(tojson(slide, null, false));&lt;br /&gt; } else {&lt;br /&gt;  print("The End!");&lt;br /&gt; }&lt;br /&gt;}; // go to slide and print&lt;br /&gt;var go = function(n) {&lt;br /&gt; current = n;&lt;br /&gt; next();&lt;br /&gt;}; // repeat the previous slide&lt;br /&gt;var again = function() {&lt;br /&gt; current--;&lt;br /&gt; next();&lt;br /&gt;};&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Basic Commands of mongodb&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mongodb.org/display/DOCS/List+of+Database+Commands"&gt;http://www.mongodb.org/display/DOCS/List+of+Database+Commands&lt;/a&gt;&lt;br /&gt;&lt;a href="http://rezmuh.sixceedinc.com/2010/02/basic-commands-to-get-you-started-with-mongodb.html"&gt;http://rezmuh.sixceedinc.com/2010/02/basic-commands-to-get-you-started-with-mongodb.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Privileged Commands&lt;br /&gt;&lt;br /&gt;Certain operations are for the database administrator only. These privileged operations may only be performed on the special database named admin.&lt;br /&gt;&lt;br /&gt;Start the server like this:&lt;br /&gt;$&amp;gt; bin/mongod --dbpath /path/to/data&lt;br /&gt;&lt;br /&gt;Stop it with Ctrl-C or with kill (but don’t use kill -9, which doesn’t give the server a chance to shut down cleanly and flush data to disk).&lt;br /&gt;&lt;br /&gt;Viewing stats without the mongo console:&lt;br /&gt;Visit http://localhost:28017 (28017 is the port the server is running on, plus 1000) to get an overview of what’s going on.&lt;br /&gt;You can also query http://localhost:28017/_status to see the same data that db.serverStatus() returns, but in JSON format.&lt;br /&gt;&lt;br /&gt;Use client command console:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$&amp;gt; bin/mongo&lt;br /&gt;&lt;br /&gt;&amp;gt; use admin;&lt;br /&gt;&amp;gt; db.addUser('dummy, 'dummy') // create new user with password "dummy"&lt;br /&gt;&amp;gt; db.runCommand("shutdown"); // shut down the database&lt;br /&gt;&lt;br /&gt;$&amp;gt; bin/mongo -u dummy -p dummy admin&lt;br /&gt;&lt;/div&gt; &lt;br /&gt;Create a new Database:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; use new_database&lt;br /&gt;&amp;gt; db.addUser('dummy', 'differentpassword')&lt;br /&gt;&lt;br /&gt;$ bin/mongo -u dummy -p differentpassword new_database&lt;br /&gt;&lt;/div&gt; &lt;br /&gt;&lt;br /&gt;Deleting a database:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; use [db name]&lt;br /&gt;&amp;gt; db.dropDatabase()&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Working with Collections (Tables):&lt;br /&gt;&amp;gt; show collections&lt;br /&gt;&lt;br /&gt;Lists all the available databases:&lt;br /&gt;&amp;gt; show dbs&lt;br /&gt;&lt;br /&gt;To get a list of data in a specific collection, use:&lt;br /&gt;&amp;gt; db.[collection name].find()&lt;br /&gt;&lt;br /&gt;Directory Global functions and properties:&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; for(var o in this) {         &lt;br /&gt;print(o);                    &lt;br /&gt;}&lt;br /&gt;__quiet&lt;br /&gt;chatty&lt;br /&gt;friendlyEqual&lt;br /&gt;doassert&lt;br /&gt;assert&lt;br /&gt;argumentsToArray&lt;br /&gt;isString&lt;br /&gt;isNumber&lt;br /&gt;isObject&lt;br /&gt;tojson&lt;br /&gt;tojsonObject&lt;br /&gt;shellPrint&lt;br /&gt;printjson&lt;br /&gt;shellPrintHelper&lt;br /&gt;shellHelper&lt;br /&gt;help&lt;br /&gt;Random&lt;br /&gt;killWithUris&lt;br /&gt;Geo&lt;br /&gt;connect&lt;br /&gt;MR&lt;br /&gt;MapReduceResult&lt;br /&gt;__lastres__&lt;br /&gt;sleep_&lt;br /&gt;sleep&lt;br /&gt;quit_&lt;br /&gt;quit&lt;br /&gt;getMemInfo_&lt;br /&gt;getMemInfo&lt;br /&gt;_srand_&lt;br /&gt;_srand&lt;br /&gt;_rand_&lt;br /&gt;_rand&lt;br /&gt;_isWindows_&lt;br /&gt;_isWindows&lt;br /&gt;_startMongoProgram_&lt;br /&gt;_startMongoProgram&lt;br /&gt;runProgram_&lt;br /&gt;runProgram&lt;br /&gt;runMongoProgram_&lt;br /&gt;runMongoProgram&lt;br /&gt;stopMongod_&lt;br /&gt;stopMongod&lt;br /&gt;stopMongoProgram_&lt;br /&gt;stopMongoProgram&lt;br /&gt;stopMongoProgramByPid_&lt;br /&gt;stopMongoProgramByPid&lt;br /&gt;rawMongoProgramOutput_&lt;br /&gt;rawMongoProgramOutput&lt;br /&gt;clearRawMongoProgramOutput_&lt;br /&gt;clearRawMongoProgramOutput&lt;br /&gt;removeFile_&lt;br /&gt;removeFile&lt;br /&gt;listFiles_&lt;br /&gt;listFiles&lt;br /&gt;resetDbpath_&lt;br /&gt;resetDbpath&lt;br /&gt;copyDbpath_&lt;br /&gt;copyDbpath&lt;br /&gt;_parsePath&lt;br /&gt;_parsePort&lt;br /&gt;createMongoArgs&lt;br /&gt;startMongodTest&lt;br /&gt;startMongod&lt;br /&gt;startMongodNoReset&lt;br /&gt;startMongos&lt;br /&gt;startMongoProgram&lt;br /&gt;startMongoProgramNoConnect&lt;br /&gt;myPort&lt;br /&gt;ShardingTest&lt;br /&gt;printShardingStatus&lt;br /&gt;MongodRunner&lt;br /&gt;ReplPair&lt;br /&gt;ToolTest&lt;br /&gt;ReplTest&lt;br /&gt;allocatePorts&lt;br /&gt;SyncCCTest&lt;br /&gt;db&lt;br /&gt;hex_md5_&lt;br /&gt;hex_md5&lt;br /&gt;version_&lt;br /&gt;version&lt;br /&gt;i&lt;br /&gt;current&lt;br /&gt;next&lt;br /&gt;__iscmd__&lt;br /&gt;___it___&lt;br /&gt;it&lt;/div&gt;&lt;br /&gt;Directory properties of db:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; for(var o in db){&lt;br /&gt;print(o);&lt;br /&gt;}&lt;br /&gt;_mongo&lt;br /&gt;_name&lt;br /&gt;shellPrint&lt;br /&gt;getMongo&lt;br /&gt;getSisterDB&lt;br /&gt;getName&lt;br /&gt;stats&lt;br /&gt;getCollection&lt;br /&gt;commandHelp&lt;br /&gt;runCommand&lt;br /&gt;_dbCommand&lt;br /&gt;_adminCommand&lt;br /&gt;addUser&lt;br /&gt;removeUser&lt;br /&gt;__pwHash&lt;br /&gt;auth&lt;br /&gt;createCollection&lt;br /&gt;getProfilingLevel&lt;br /&gt;dropDatabase&lt;br /&gt;shutdownServer&lt;br /&gt;cloneDatabase&lt;br /&gt;cloneCollection&lt;br /&gt;copyDatabase&lt;br /&gt;repairDatabase&lt;br /&gt;help&lt;br /&gt;printCollectionStats&lt;br /&gt;setProfilingLevel&lt;br /&gt;eval&lt;br /&gt;dbEval&lt;br /&gt;groupeval&lt;br /&gt;groupcmd&lt;br /&gt;group&lt;br /&gt;_groupFixParms&lt;br /&gt;resetError&lt;br /&gt;forceError&lt;br /&gt;getLastError&lt;br /&gt;getLastErrorObj&lt;br /&gt;getLastErrorCmd&lt;br /&gt;getPrevError&lt;br /&gt;getCollectionNames&lt;br /&gt;tojson&lt;br /&gt;toString&lt;br /&gt;currentOp&lt;br /&gt;currentOP&lt;br /&gt;killOp&lt;br /&gt;killOP&lt;br /&gt;getReplicationInfo&lt;br /&gt;printReplicationInfo&lt;br /&gt;printSlaveReplicationInfo&lt;br /&gt;serverBuildInfo&lt;br /&gt;serverStatus&lt;br /&gt;version&lt;br /&gt;printShardingStatus&lt;br /&gt;&lt;/div&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; db.shell.help()&lt;br /&gt;DBCollection help&lt;br /&gt;db.foo.count()&lt;br /&gt;db.foo.dataSize()&lt;br /&gt;db.foo.distinct( key ) - eg. db.foo.distinct( 'x' )&lt;br /&gt;db.foo.drop() drop the collection&lt;br /&gt;db.foo.dropIndex(name)&lt;br /&gt;db.foo.dropIndexes()&lt;br /&gt;db.foo.ensureIndex(keypattern,options) - options should be an object with these possible fields: name, unique, dropDups&lt;br /&gt;db.foo.reIndex()&lt;br /&gt;db.foo.find( [query] , [fields]) - first parameter is an optional query filter. second parameter is optional set of fields to return.&lt;br /&gt;e.g. db.foo.find( { x : 77 } , { name : 1 , x : 1 } )&lt;br /&gt;db.foo.find(...).count()&lt;br /&gt;db.foo.find(...).limit(n)&lt;br /&gt;db.foo.find(...).skip(n)&lt;br /&gt;db.foo.find(...).sort(...)&lt;br /&gt;db.foo.findOne([query])&lt;br /&gt;db.foo.findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } )&lt;br /&gt;db.foo.getDB() get DB object associated with collection&lt;br /&gt;db.foo.getIndexes()&lt;br /&gt;db.foo.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )&lt;br /&gt;db.foo.mapReduce( mapFunction , reduceFunction , &amp;lt;optional params&amp;gt; )&lt;br /&gt;db.foo.remove(query)&lt;br /&gt;db.foo.renameCollection( newName , &amp;lt;droptarget&amp;gt; ) renames the collection.&lt;br /&gt;db.foo.runCommand( name , &amp;lt;options&amp;gt; ) runs a db command with the given name where the 1st param is the colleciton name&lt;br /&gt;db.foo.save(obj)&lt;br /&gt;db.foo.stats()&lt;br /&gt;db.foo.storageSize() - includes free space allocated to this collection&lt;br /&gt;db.foo.totalIndexSize() - size in bytes of all the indexes&lt;br /&gt;db.foo.totalSize() - storage allocated for all data and indexes&lt;br /&gt;db.foo.update(query, object[, upsert_bool, multi_bool])&lt;br /&gt;db.foo.validate() - SLOW&lt;br /&gt;db.foo.getShardVersion() - only for use with sharding&lt;/div&gt;&lt;br /&gt;&lt;div class="pre"&gt;&amp;gt; db.help()      &lt;br /&gt;DB methods:&lt;br /&gt;db.addUser(username, password[, readOnly=false])&lt;br /&gt;db.auth(username, password)&lt;br /&gt;db.cloneDatabase(fromhost)&lt;br /&gt;db.commandHelp(name) returns the help for the command&lt;br /&gt;db.copyDatabase(fromdb, todb, fromhost)&lt;br /&gt;db.createCollection(name, { size : ..., capped : ..., max : ... } )&lt;br /&gt;db.currentOp() displays the current operation in the db&lt;br /&gt;db.dropDatabase()&lt;br /&gt;db.eval(func, args) run code server-side&lt;br /&gt;db.getCollection(cname) same as db['cname'] or db.cname&lt;br /&gt;db.getCollectionNames()&lt;br /&gt;db.getLastError() - just returns the err msg string&lt;br /&gt;db.getLastErrorObj() - return full status object&lt;br /&gt;db.getMongo() get the server connection object&lt;br /&gt;db.getMongo().setSlaveOk() allow this connection to read from the nonmaster member of a replica pair&lt;br /&gt;db.getName()&lt;br /&gt;db.getPrevError()&lt;br /&gt;db.getProfilingLevel()&lt;br /&gt;db.getReplicationInfo()&lt;br /&gt;db.getSisterDB(name) get the db at the same server as this onew&lt;br /&gt;db.killOp(opid) kills the current operation in the db&lt;br /&gt;db.printCollectionStats()&lt;br /&gt;db.printReplicationInfo()&lt;br /&gt;db.printSlaveReplicationInfo()&lt;br /&gt;db.printShardingStatus()&lt;br /&gt;db.removeUser(username)&lt;br /&gt;db.repairDatabase()&lt;br /&gt;db.resetError()&lt;br /&gt;db.runCommand(cmdObj) run a database command.  if cmdObj is a string, turns it into { cmdObj : 1 }&lt;br /&gt;db.serverStatus()&lt;br /&gt;db.setProfilingLevel(level,&lt;slowms&gt;) 0=off 1=slow 2=all&lt;br /&gt;db.shutdownServer()&lt;br /&gt;db.stats()&lt;br /&gt;db.version() current version of the server&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="pre"&gt;&amp;gt; help()&lt;br /&gt;HELP&lt;br /&gt;show dbs                     show database names&lt;br /&gt;show collections             show collections in current database&lt;br /&gt;show users                   show users in current database&lt;br /&gt;show profile                 show most recent system.profile entries with time &amp;gt;= 1ms&lt;br /&gt;use &amp;lt;db name&amp;gt;                set curent database to &amp;lt;db name&amp;gt;&lt;br /&gt;db.help()                    help on DB methods&lt;br /&gt;db.foo.help()                help on collection methods&lt;br /&gt;db.foo.find()                list objects in collection foo&lt;br /&gt;db.foo.find( { a : 1 } )     list objects in foo where a == 1&lt;br /&gt;it                           result of the last line evaluated; use to further iterate&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;If I insert the same Document twice, it does not raise an Error?&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Using PyMongo for example, why does inserting the same document (read same _id) more than once not raise an error? When we need to detect if a document already exists in the database, we could try catching DuplicateKeyError on insert. Below we explicitly insert the document with the same _id twice but the exception is never raised. Why?&lt;br /&gt;&lt;br /&gt;try:&lt;br /&gt;&lt;div class="pre"&gt;doc = { _id: '123123' }&lt;br /&gt;db.foo.insert(doc)&lt;br /&gt;db.foo.insert(doc)&lt;br /&gt;except pymongo.errors.DuplicateKeyError, error:&lt;br /&gt;print("Same _id inserted twice:", error)&lt;br /&gt;&lt;/div&gt; &lt;br /&gt;The answer is that DuplicateKeyError will only be raised if we do the insert in safe mode i.e. db.foo.insert(doc, safe=True). The reason why we do not see an error raised with most drivers but with MongoDB's interactive shell is because the shell does a safe insert by default whereas, with most drivers, it is the developers choice whether or not to use a safe insert.&lt;br /&gt;&lt;br /&gt;MongoDB's interactive shell:&lt;br /&gt;&lt;div class="pre"&gt;&amp;gt; doc = {_id: 123421, name: 'test'};&lt;br /&gt;{ "_id" : 123421, "name" : "test" }&lt;br /&gt;&amp;gt; db.deck.insert(doc)&lt;br /&gt;&amp;gt; db.deck.insert(doc)&lt;br /&gt;E11000 duplicate key error index: shell.deck.$_id_  dup key: { : 123421.0 }&lt;br /&gt;&lt;/div&gt; &lt;br /&gt;&lt;h3&gt; Backup&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://effectif.com/mongodb/mongo-administration"&gt;http://effectif.com/mongodb/mongo-administration&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are basically two approaches to backing up a Mongo database:&lt;br /&gt;&lt;br /&gt;1. mongodump and mongorestore are the classic approach. Dumps the contents of the database to files. The backup is stored in the same format as Mongo uses internally, so is very efficient. But it’s not a point-in-time snapshot.&lt;br /&gt;2. To get a point-in-time snapshot, shut the database down, copy the disk files (e.g. with cp) and then start mongod up again.&lt;br /&gt;&lt;br /&gt;Alternatively, rather than shutting mongod down before making your point-in-time snapshot, you could just stop it from accepting writes:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; db._adminCommand({fsync: 1, lock: 1})&lt;br /&gt;{&lt;br /&gt;"info" : "now locked against writes, use db.$cmd.sys.unlock.findOne() to unlock",&lt;br /&gt;"ok" : 1&lt;br /&gt;}&lt;/div&gt; &lt;br /&gt;To unlock the database again, you need to switch to the admin database and then unlock it:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; use admin&lt;br /&gt;switched to db admin&lt;br /&gt;&amp;gt; db.$cmd.sys.unlock.findOne()&lt;br /&gt;{ "ok" : 1, "info" : "unlock requested" }&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If you don’t switch to the admin database first you’ll get an unauthorized error:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; db._adminCommand({fsync: 1, lock: 1})                                                                          &lt;br /&gt;{&lt;br /&gt;"info" : "now locked against writes, use db.$cmd.sys.unlock.findOne() to unlock",&lt;br /&gt;"ok" : 1&lt;br /&gt;}&lt;/div&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; db.$cmd.sys.unlock.findOne()&lt;br /&gt;{ "err" : "unauthorized" }&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can take a point in time snapshot from a slave just as easily as your master database, which avoids downtime. This is one of the reasons that running a slave is so strongly recommended…&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;What RAID should I use?&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Developer+FAQ"&gt;http://www.mongodb.org/display/DOCS/Developer+FAQ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We recommend not using RAID-5, but rather, RAID-10 or the like. Both will work of course.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Replication&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Do it (did you read the previous section?). Seriously.&lt;br /&gt;&lt;br /&gt;Start your master and slave up like this:&lt;br /&gt;&lt;br /&gt;$ mongod --master --oplogSize 500&lt;br /&gt;$ mongod --slave --source localhost:27017 --port 3000 --dbpath /data/slave&lt;br /&gt;&lt;br /&gt;When seeding a new slave server from master use the --fastsync option.&lt;br /&gt;&lt;br /&gt;You can see what’s going on with these two commands:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;gt; db.printReplicationInfo()  # tells you how long your oplog will last&lt;br /&gt;&amp;gt; db.printSlaveReplicationInfo()  # tells you how far behind the slave is&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If the slave isn’t keeping up, how do you find out what’s going on? Check the mongo log for any recent errors. Try connecting with the mongo console. Try running queries from the console to see if everything is working. Run the status commands above to try and find out which database is taking up resources. If you can’t work it out hop on the IRC channel; Mathias says they’ll be very responsive.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;What is the difference between MongoDB and RDBMSs&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sunoano.name/ws/mongodb.html#faqs"&gt;http://sunoano.name/ws/mongodb.html#faqs&lt;/a&gt;&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;MySQL, PostgreSQL, ...&lt;br /&gt;----------------------&lt;br /&gt;Server:Port&lt;br /&gt;- Database&lt;br /&gt;- Table&lt;br /&gt;- Row&lt;br /&gt;&lt;br /&gt;MongoDB&lt;br /&gt;--------&lt;br /&gt;Server:Port&lt;br /&gt;- Database&lt;br /&gt;- Collection&lt;br /&gt;- Document&lt;/div&gt;&lt;br /&gt;The concept of server and database are very similar. But the concept of table and collection are quite different. In RDBMSs a table is a rectangle. It is all columns and rows. Each row has a fixed number of columns, if we add a new column, we add that column to each and every row.&lt;br /&gt;&lt;br /&gt;In MongoDB a collection is more like a really big box and each document is like a little bag of stuff in that box. Each bag contains whatever it needs in a totally flexible manner (read schema-less). However, schema-less does not equal type-less i.e. it is just that any document has its own schema, which it may or may not share with any other document. In practice it is normal to have the same schema for all the documents in collection.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Clone Database&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Clone+Database"&gt;http://www.mongodb.org/display/DOCS/Clone+Database&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;MongoDB includes commands for copying a database from one server to another.&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;// copy an entire database from one name on one server to another&lt;br /&gt;// name on another server.  omit &amp;lt;from_hostname&amp;gt; to copy from one&lt;br /&gt;// name to another on the same server.&lt;br /&gt;db.copyDatabase(&amp;lt;from_dbname&amp;gt;, &amp;lt;to_dbname&amp;gt;, &amp;lt;from_hostname&amp;gt;);&lt;br /&gt;// if you must authenticate with the source database&lt;br /&gt;db.copyDatabase(&amp;lt;from_dbname&amp;gt;, &amp;lt;to_dbname&amp;gt;, &amp;lt;from_hostname&amp;gt;, &amp;lt;username&amp;gt;, &amp;lt;password&amp;gt;);&lt;br /&gt;// in "command" syntax (runnable from any driver):&lt;br /&gt;db.runCommand( { copydb : 1, fromdb : ..., todb : ..., fromhost : ... } );&lt;br /&gt;// command syntax for authenticating with the source:&lt;br /&gt;n = db.runCommand( { copydbgetnonce : 1, fromhost: ... } );&lt;br /&gt;db.runCommand( { copydb : 1, fromhost: ..., fromdb: ..., todb: ..., username: ..., nonce: n.nonce, key: &amp;lt;hash of username, nonce, password &amp;gt; } );&lt;br /&gt;&lt;br /&gt;// clone the current database (implied by 'db') from another host&lt;br /&gt;var fromhost = ...;&lt;br /&gt;print("about to get a copy of database " + db + " from " + fromhost);&lt;br /&gt;db.cloneDatabase(fromhost);&lt;br /&gt;// in "command" syntax (runnable from any driver):&lt;br /&gt;db.runCommand( { clone : fromhost } );&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;What might be a use case for --fork?&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The --fork switch forks a mongod process of another exiting process. One use case where this is pretty handy for example is if we SSH into a remote machine and start a MongoDB and leave right away after a new mongod got started.&lt;br /&gt;&lt;br /&gt;The fastest way to do so would simply be to append /path/to/mongod --fork to the SSH command line since this will skip creating an intermediate shell and bring up a remote mongod right away.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Are there any Reasons not to use MongoDB?&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sunoano.name/ws/mongodb.html#faqs"&gt;http://sunoano.name/ws/mongodb.html#faqs&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1. We need transactions (read ACID).&lt;br /&gt;2. Our data is very relational.&lt;br /&gt;3. Related to 2, we want to be able to do joins on the server (but can not do embedded objects / arrays).&lt;br /&gt;4. We need triggers on our tables. There might be triggers available soon however.&lt;br /&gt;5. Related to 4, we rely on triggers (or similar functionality) to do cascading updates. or deletes. As for #4, this issue probably goes away once triggers are available.&lt;br /&gt;6. We need the database to enforce referential integrity (MongoDB has no notion of this at all).&lt;br /&gt;7. If we need 100% per node durability.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Use Cases&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB"&gt;http://www.mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It may be helpful to look at some particular problems and consider how we could solve them.&lt;br /&gt;&lt;br /&gt;* if we were building Lotus Notes, we would use Couch as its programmer versioning reconciliation/MVCC model fits perfectly.  Any problem where data is offline for hours then back online would fit this.  In general, if we need several eventually consistent master-master replica databases, geographically distributed, often offline, we would use Couch.&lt;br /&gt;* if we had very high performance requirements we would use Mongo.  For example, web site user profile object storage and caching of data from other sources.&lt;br /&gt;* if we were building a system with very critical transactions, such as bond trading, we would not use MongoDB for those transactions -- although we might in hybrid for other data elements of the system.  For something like this we would likely choose a traditional RDBMS.&lt;br /&gt;* for a problem with very high update rates, we would use Mongo as it is good at that.  For example, updating real time analytics counters for a web sites (pages views, visits, etc.)&lt;br /&gt;&lt;br /&gt;Generally, we find MongoDB to be a very good fit for building web infrastructure.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;ruby driver of mongodb tutorial&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://api.mongodb.org/ruby/1.0.3/index.html"&gt;http://api.mongodb.org/ruby/1.0.3/index.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Ruby+Tutorial"&gt;http://www.mongodb.org/display/DOCS/Ruby+Tutorial&lt;/a&gt;&lt;br /&gt;&lt;a href="http://github.com/mongodb/mongo-ruby-driver"&gt;http://github.com/mongodb/mongo-ruby-driver&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;$&amp;gt; gem update --system&lt;br /&gt;$&amp;gt; gem install mongo&lt;br /&gt;$&amp;gt; gem install bson&lt;br /&gt;$&amp;gt; gem install bson_ext&lt;br /&gt;&lt;br /&gt;Making a Connection:&lt;br /&gt;&lt;div class="pre"&gt;# db = Mongo::Connection.new.db("shell")&lt;br /&gt;# db = Mongo::Connection.new("localhost").db("shell")&lt;br /&gt;db = Mongo::Connection.new("localhost", 27017).db("shell")&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Listing All Databases:&lt;br /&gt;&lt;div class="pre"&gt;m = Mongo::Connection.new # (optional host/port args)&lt;br /&gt;m.database_names.each { |name| puts name }&lt;br /&gt;m.database_info.each { |info| puts info.inspect}&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Dropping a Database:&lt;br /&gt;&lt;div class="pre"&gt;m.drop_database('database_name')&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Authentication (Optional):&lt;br /&gt;&lt;div class="pre"&gt;auth = db.authenticate(my_user_name, my_password) &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Getting a Collection:&lt;br /&gt;&lt;div class="pre"&gt;deck = db.collection("deck") &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Inserting a Document:&lt;br /&gt;&lt;div class="pre"&gt;deck = db['deck']&lt;br /&gt;&lt;br /&gt;doc = {"name" =&amp;gt; "MongoDB", "type" =&amp;gt; "database", "count" =&amp;gt; 1,&lt;br /&gt;"info" =&amp;gt; {"x" =&amp;gt; 203, "y" =&amp;gt; '102'}}&lt;br /&gt;deck.insert(doc)&lt;br /&gt;100.times { |i| deck.insert("i" =&amp;gt; i) } &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Finding the First Document In a Collection using find_one():&lt;br /&gt;&lt;div class="pre"&gt;my_doc = deck.find_one()&lt;br /&gt;puts my_doc.inspect &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Note the _id element has been added automatically by MongoDB to your document. Remember, MongoDB reserves element names that start with _ for internal use.&lt;br /&gt;&lt;br /&gt;Counting Documents in a Collection:&lt;br /&gt;&lt;div class="pre"&gt;puts deck.count() &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Using a Cursor to get all of the Documents:&lt;br /&gt;&lt;div class="pre"&gt;deck.find.each { |row| puts row.inspect } &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Getting a Single Document with a Query:&lt;br /&gt;&lt;div class="pre"&gt;deck.find("i" =&amp;gt; 71).each { |row| puts row.inspect } &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Getting a Set of Documents With a Query:&lt;br /&gt;&lt;div class="pre"&gt;deck.find("i" =&amp;gt; {"$gt" =&amp;gt; 50}).each { |row| puts row } &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Querying with Regular Expressions:&lt;br /&gt;&lt;div class="pre"&gt;deck.find("question" =&amp;gt; /w/i).each { |row| puts row } &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Creating An Index:&lt;br /&gt;To create an index, you specify an index name and an array of field names to be indexed, or a single field name.&lt;br /&gt;&lt;div class="pre"&gt;deck.create_index("i")&lt;br /&gt;# deck.create_index([["i", Mongo::ASCENDING]]) &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Getting a List of Indexes on a Collection:&lt;br /&gt;&lt;div class="pre"&gt;deck.index_information &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Ruby driver example&lt;/h3&gt;&lt;br /&gt;&lt;div class="pre"&gt;require 'rubygems'  not necessary for Ruby 1.9&lt;br /&gt;require 'mongo'&lt;br /&gt;# 需要先导入slides.js之后，再进行下面的ruby代码测试&lt;br /&gt;db = Mongo::Connection.new.db("mydb")&lt;br /&gt;db = Mongo::Connection.new("localhost").db("mydb")&lt;br /&gt;m = Mongo::Connection.new("localhost", 27017)&lt;br /&gt;db = m.db("shell")&lt;br /&gt;puts db.inspect&lt;br /&gt;m.database_names.each { |name| puts name }&lt;br /&gt;m.database_info.each { |info| puts info.inspect}&lt;br /&gt;db.collection_names.each { |name| puts name }&lt;br /&gt;deck = db['deck']&lt;br /&gt;doc = {"name" =&amp;gt; "MongoDB", "type" =&amp;gt; "database", "count" =&amp;gt; 1,&lt;br /&gt;"info" =&amp;gt; {"x" =&amp;gt; 203, "y" =&amp;gt; '102'}}&lt;br /&gt;deck.insert(doc)&lt;br /&gt;100.times { |i| deck.insert("i" =&amp;gt; i) }&lt;br /&gt;my_doc = deck.find_one()&lt;br /&gt;puts my_doc.inspect&lt;br /&gt;puts deck.count()&lt;br /&gt;deck.find.each { |row| puts row.inspect }&lt;br /&gt;deck.find("i" =&amp;gt; 71).each { |row| puts row.inspect }&lt;br /&gt;deck.find("i" =&amp;gt; {"$gt" =&amp;gt; 90}).each { |row| puts row }&lt;br /&gt;deck.find("i" =&amp;gt; {"$gt" =&amp;gt; 20, "$lte" =&amp;gt; 30}).each { |row| puts row }&lt;br /&gt;deck.find("question" =&amp;gt; /w/i).each { |row| puts row }&lt;br /&gt;deck.create_index([["i", Mongo::ASCENDING]])&lt;br /&gt;p deck.index_information&lt;br /&gt;db.validate_collection('deck')&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://www.mongodb.org/display/DOCS/Developer+Zone"&gt;http://www.mongodb.org/display/DOCS/Developer+Zone&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1914245007614166378?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1914245007614166378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1914245007614166378' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1914245007614166378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1914245007614166378'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/mongodb-tutorial-and-references.html' title='mongodb tutorial and references'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6488371640672173431</id><published>2010-07-02T13:12:00.006+08:00</published><updated>2010-10-24T22:56:17.172+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Kernel'/><category scheme='http://www.blogger.com/atom/ns#' term='kvm'/><category scheme='http://www.blogger.com/atom/ns#' term='XEN'/><title type='text'>Installation XEN 4.0 from source</title><content type='html'>以下指令使用root用户执行&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$&amp;gt; sudo su -&lt;br /&gt;&lt;br /&gt;$&amp;gt; apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended pciutils-dev mercurial build-essential make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev iasl libbz2-dev e2fslibs-dev git-core uuid-dev&lt;br /&gt;&lt;br /&gt;$&amp;gt; hg clone http://xenbits.xen.org/xen-4.0-testing.hg&lt;br /&gt;$&amp;gt; cd xen-4.0-testing.hg&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;这个指令会下载linux-2.6-pvops.git，需要较长时间&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make world&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;这个指令会安装xen.gz和vmlinuz-2.6.31到系统/boot目录下，vmlinuz-2.6.31这个linux kernel文件在下面会重新设置参数并生成，可查看后面linux kernel编译步骤详细说明。&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make install&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;不修改.config文件，可以直接重新生成xen, kernels, tools, docs到dist目录中&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make dist&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;修改了.config文件，可以用以下指令重新生成kernel&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make linux-2.6-xen-config CONFIGMODE=menuconfig&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (or xconfig)&lt;br /&gt;$&amp;gt; make linux-2.6-xen-build&lt;br /&gt;$&amp;gt; make linux-2.6-xen-install&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;linux kernel编译步骤&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$&amp;gt; git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;这个指令会从xen.git仓库中下载props dom0 kernel 2.6.31.x，大概是1.6G左右，需要不少时间&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; cd linux-2.6-xen&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;这个指令的作用是检查源码是否有.o文件和依赖问题，从全新的源码编译时不需要这一步。make mrproper主要清除环境变量及配置文件&lt;br /&gt;&lt;div class="pre"&gt;$ make mrproper&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;设置linux kernel编译参数，在图形界面中输入斜杠&amp;quot;/&amp;quot;可以查询&amp;quot;XEN_DOM0&amp;quot;、&amp;quot;PAE&amp;quot;、&amp;quot;HIGHPTE&amp;quot;等参数设置&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make menuconfig&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;退出并保存配置文件之后，手工调整.config文件，并且在内核参数设置中需要注意：&lt;br /&gt;  1、如果编译32位的内核，XEN需要有PAE支持，(Processor type and features -&amp;gt; High Memory Support (64GB) -&amp;gt; PAE (Physical Address Extension) Support)，对于64位内核PAE不需要，32位的操作系统最大内存支持不到4G，安装了PAE之后可以支持64G。&lt;br /&gt;  2、编译32位的内核，必须设置CONFIG_HIGHPTE=n。&lt;br /&gt;  3、要为DOM0开启ACPI功能。&lt;br /&gt;  4、在.config文件中添加以下选项，并重新运行make menuconfig，并检查XEN_DOM0等参数设置状态&lt;br /&gt;     &lt;div class="pre"&gt;&lt;br /&gt;     CONFIG_ACPI_PROCFS=y&lt;br /&gt;     CONFIG_XEN=y&lt;br /&gt;     CONFIG_XEN_MAX_DOMAIN_MEMORY=32&lt;br /&gt;     CONFIG_XEN_SAVE_RESTORE=y&lt;br /&gt;     CONFIG_XEN_DOM0=y&lt;br /&gt;     CONFIG_XEN_PRIVILEGED_GUEST=y&lt;br /&gt;     CONFIG_XEN_PCI=y&lt;br /&gt;     CONFIG_PCI_XEN=y&lt;br /&gt;     CONFIG_XEN_BLKDEV_FRONTEND=m&lt;br /&gt;     CONFIG_NETXEN_NIC=m&lt;br /&gt;     CONFIG_XEN_NETDEV_FRONTEND=m&lt;br /&gt;     CONFIG_XEN_KBDDEV_FRONTEND=m&lt;br /&gt;     CONFIG_HVC_XEN=y&lt;br /&gt;     CONFIG_XEN_FBDEV_FRONTEND=m&lt;br /&gt;     CONFIG_XEN_BALLOON=y&lt;br /&gt;     CONFIG_XEN_SCRUB_PAGES=y&lt;br /&gt;     CONFIG_XEN_DEV_EVTCHN=y&lt;br /&gt;     CONFIG_XEN_BACKEND=y&lt;br /&gt;     CONFIG_XEN_BLKDEV_BACKEND=y&lt;br /&gt;     CONFIG_XEN_NETDEV_BACKEND=y&lt;br /&gt;     CONFIG_XENFS=y&lt;br /&gt;     CONFIG_XEN_COMPAT_XENFS=y&lt;br /&gt;     CONFIG_XEN_XENBUS_FRONTEND=m&lt;br /&gt;     CONFIG_XEN_PCIDEV_FRONTEND=y     &lt;br /&gt;  &lt;/div&gt;   &lt;br /&gt;  在RHEL5和CentOS5中，需要在.config文件中加入以下2个参数：&lt;br /&gt;     &lt;div class="pre"&gt;&lt;br /&gt;     CONFIG_SYSFS_DEPRECATED=y&lt;br /&gt;     CONFIG_SYSFS_DEPRECATED_V2=y&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  要使用initrd，编译内核时必须选择以下两项：&lt;br /&gt;     &lt;div class="pre"&gt;&lt;br /&gt;     CONFIG_BLK_DEV_RAM=y&lt;br /&gt;     CONFIG_BLK_DEV_INITRD=y&lt;br /&gt;     &lt;/div&gt;&lt;br /&gt;重新运行menuconfig，检查配置，最后保存配置文件&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make menuconfig&lt;br /&gt;$&amp;gt; make install&lt;/div&gt;&lt;br /&gt;这个指令会将内核映象和相应的System.map拷贝到/boot目录下。&lt;br /&gt;&lt;br /&gt;可以查看指令运行完成后，在/boot目录下新增加的文件列表&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; ll --sort=time /boot/&lt;br /&gt;total 214594&lt;br /&gt;-rw-r--r--  1 root root  109K 2010-07-02 11:51 config-2.6.31.13&lt;br /&gt;-rw-r--r--  1 root root  1.6M 2010-07-02 11:51 System.map-2.6.31.13&lt;br /&gt;-rw-r--r--  1 root root  3.9M 2010-07-02 11:51 vmlinuz-2.6.31.13&lt;br /&gt;...&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;生成初始化镜像文件(initialed ramdisk)&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; cd /boot&lt;br /&gt;$&amp;gt; depmod 2.6.31.13&lt;br /&gt;# ubuntu中生成初如化镜像文件的指令&lt;br /&gt;$&amp;gt; mkinitramfs -o initrd-2.6.31-xen.img 2.6.31.13&lt;br /&gt;# 或者是用这个指令(CentOS5)&lt;br /&gt;$&amp;gt; mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod initrd-2.6.31-xen.img 2.6.31.13&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;$&amp;gt; vi /boot/grub/menu.lst&lt;br /&gt;&lt;br /&gt;title       Xen 4.0, dom0 Linux kernel 2.6.31.13&lt;br /&gt;kernel       /boot/xen.gz dom0_mem=512M&lt;br /&gt;module       /boot/vmlinuz-2.6.31.13 root=/dev/sda7 ro nomodeset&lt;br /&gt;module       /boot/initrd-2.6.31-xen.img&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;注：一般内核编译中会有以下一些步骤：&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; make menuconfig&lt;br /&gt;$&amp;gt; make&lt;br /&gt;$&amp;gt; make bzImage&lt;br /&gt;$&amp;gt; make modules&lt;br /&gt;$&amp;gt; make modules_install&lt;br /&gt;$&amp;gt; make install&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://wiki.xensource.com/xenwiki/Xen4.0"&gt;http://wiki.xensource.com/xenwiki/Xen4.0&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.xensource.com/xenwiki/XenParavirtOps"&gt;http://wiki.xensource.com/xenwiki/XenParavirtOps&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6488371640672173431?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6488371640672173431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6488371640672173431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6488371640672173431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6488371640672173431'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/07/installation-xen-40-from-source.html' title='Installation XEN 4.0 from source'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5499122504243842094</id><published>2010-06-25T15:24:00.001+08:00</published><updated>2010-06-25T15:24:12.966+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Script'/><category scheme='http://www.blogger.com/atom/ns#' term='async'/><category scheme='http://www.blogger.com/atom/ns#' term='defer'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><title type='text'>script标签中的defer属性说明</title><content type='html'>script中的defer属性默认情况下是false的，其主要作用是为了提升页面性能，实际在目前的HTML 4.0中这个属性是个鸡肋，在各浏览器中表现也不一样，最好忽略此属性。&lt;br /&gt;&lt;br /&gt;在&lt;a href="http://msdn.microsoft.com/en-us/library/ms533055%28v=VS.85%29.aspx"&gt;微软MSDN&lt;/a&gt;中的文档说明摘录部分内容如下：&lt;br /&gt;Remarks: Using the attribute at design time can improve the download performance of a page because the browser does not need to parse and execute the script and can continue downloading and parsing the page instead. &lt;br /&gt;Standards Information: This property is defined in HTML 4.0 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link. &lt;br /&gt;&lt;br /&gt;在&lt;a href="http://www.w3.org/TR/REC-html40/interact/scripts.html#adef-defer"&gt;W3C中的说明&lt;/a&gt;摘录部分内容如下：&lt;br /&gt;defer [CI]&lt;br /&gt;    When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no "document.write" in javascript) and thus, the user agent can continue parsing and rendering.&lt;br /&gt;    指示脚本不会生成任何的文档内容(不要在其中使用document.write命令，不要在defer型脚本程序段中包括任何立即执行脚本要使用的全局变量或者函数)，浏览器可以继续解析并绘制页面。但是defer的script在什么时候执行，执行顺序情况并无明确规定。&lt;br /&gt;&lt;br /&gt;正在制定的HTML5有极大可能会完善&lt;a href="http://www.w3.org/TR/html5/semantics.html#attr-script-defer"&gt;script标签&lt;/a&gt;的定义，这里有简单的HTML5中defer属性的&lt;a href="http://www.w3school.com.cn/html5/html5_script.asp"&gt;定义和用法&lt;/a&gt;。&lt;br /&gt;&lt;br /&gt;async和defer二个属性属性与src属性一起使用，async定义脚本是否异步执行。&lt;br /&gt;如果 async 属性为 true，则脚本会相对于文档的其余部分异步执行，这样脚本会可以在页面继续解析的过程中来执行。&lt;br /&gt;如果 async 属性为 false，而 defer 属性为 true，则脚本会在页面完成解析时得到执行。&lt;br /&gt;如果 async 和 defer 属性均为 false，那么脚本会立即执行，页面会在脚本执行完毕继续解析。&lt;br /&gt;&lt;br /&gt;The async and defer attributes are boolean attributes that indicate how the script should be executed.&lt;br /&gt;&lt;br /&gt;There are three possible modes that can be selected using these attributes. If the async attribute is present, then the script will be executed asynchronously, as soon as it is available. If the async attribute is not present but the defer attribute is present, then the script is executed when the page has finished parsing. If neither attribute is present, then the script is fetched and executed immediately, before the user agent continues parsing the page. The exact processing details for these attributes are described below.&lt;br /&gt;&lt;br /&gt;The defer attribute may be specified even if the async attribute is specified, to cause legacy Web browsers that only support defer (and not async) to fall back to the defer behavior instead of the synchronous blocking behavior that is the default.&lt;br /&gt;&lt;br /&gt;If one or both of the defer and async attributes are specified, the src attribute must also be specified.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5499122504243842094?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5499122504243842094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5499122504243842094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5499122504243842094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5499122504243842094'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/06/scriptdefer.html' title='script标签中的defer属性说明'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5217461761043330725</id><published>2010-06-20T21:17:00.002+08:00</published><updated>2010-10-24T23:05:09.178+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Constructor'/><category scheme='http://www.blogger.com/atom/ns#' term='__proto__'/><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Prototype'/><title type='text'>relationship of constructor and prototype in javascript</title><content type='html'>&lt;div class="pre"&gt;    &lt;br /&gt;var animal = function(status) {&lt;br /&gt; this.status = status;&lt;br /&gt; this.breathes = "yes";&lt;br /&gt; this.action = function() {&lt;br /&gt;  console.log('flying...')&lt;br /&gt; };&lt;br /&gt;},&lt;br /&gt;human = function() {&lt;br /&gt; this.name = 'human';&lt;br /&gt;},&lt;br /&gt;cat = function() {&lt;br /&gt; this.type = 'cat';&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// javascript支持原型继承，这种方式比类继承更强大，类继承中一个对象可以继承结构和行为，而原型继承可以继承结构和行为之外，并可以继承一个对象的状态&lt;br /&gt;// new一个animal的实例对象作为cat.prototype的原型，这个animal实例对象就成为cat的实例对象原型链上的一员&lt;br /&gt;// __proto__这个魔法属性在这些浏览器不能工作： ie 6/7/8, safari &lt; 5, opera &lt; 10.50    &lt;br /&gt;//当在cat的某个实例上检索一个属性时，如果在其本身中没有找到，则会延着原型链向上检索，如下例子中的c.__proto__即为一个animal对象   &lt;br /&gt;//如果检索c.breathes，如果在c对象本身没有找到此属性，则会检索t.__proto__.breathes、t.__proto__.__proto__.breathes等原型链上的对象，直到找到为止，没找到返回undefined    &lt;br /&gt;cat.prototype = new animal("live");&lt;br /&gt;//cat继承的原型对象是具有特定状态的animal对象    &lt;br /&gt;var c = new cat();&lt;br /&gt;console.log(cat.prototype);&lt;br /&gt;console.log(cat.prototype.constructor.tostring());&lt;br /&gt;console.log(c.constructor.tostring());&lt;br /&gt;console.log("cat breathes:" + c.breathes);&lt;br /&gt;console.log("c.__proto__:", c.__proto__);&lt;br /&gt;//ie不支持此属性   &lt;br /&gt;//你可以利用object.__proto__这个魔法属性修改当前对象的原型，下面将一只猫猫化为人形    &lt;br /&gt;var d = new cat();&lt;br /&gt;d.__proto__ = new human();&lt;br /&gt;console.log("d.__proto__:", d.__proto__);&lt;br /&gt;//从上面结果可以看到cat的实例c.constructor不是指向cat这个构造函数，而是animal构造函数   &lt;br /&gt;//需要修改对象的constructor为其构造函数本身   &lt;br /&gt;//当一个函数对象被创建时，function构造器产生的函数对象会运行类似这样的一些代码：this.prototype = {constructor: this}，参考javascript: the good parts 5.1节说明   &lt;br /&gt;//新函数对象被赋予一个prototype属性，其值是包含一个constuctor属性，并且其属性值为此新函数对象本身   &lt;br /&gt;//但是通过原型方式继承时，会给prototype重新赋予一个新对象，此prototype对象中的constructor是指向其自身的构造函数，而不是新函数的，所以需要重置其fn.prototype.constructor = this   &lt;br /&gt;//参考javascript权威指南第五版example 9-3. subclassing a javascript class    &lt;br /&gt;cat.prototype.constructor = cat;&lt;br /&gt;console.log(cat.prototype.constructor.tostring());&lt;br /&gt;console.log(c.constructor.tostring());&lt;br /&gt;console.log(c.__proto__);&lt;br /&gt;var tostring = object.prototype.tostring;&lt;br /&gt;language = function() {&lt;br /&gt; this.type = "programming";&lt;br /&gt; return {&lt;br /&gt;  "locale": "en",&lt;br /&gt;  "class-free": function() {&lt;br /&gt;   return false&lt;br /&gt;  },&lt;br /&gt;  "tostring": function() {&lt;br /&gt;   return tostring.apply(this, arguments)&lt;br /&gt;  }&lt;br /&gt;  // 如果tostring方法被重写成非function对象，则后面console中无法输出对象j        &lt;br /&gt; }&lt;br /&gt;},&lt;br /&gt;javascript = function() {&lt;br /&gt; this.value = "javascript";&lt;br /&gt; this["class-free"] = function() {&lt;br /&gt;  return true&lt;br /&gt; };&lt;br /&gt;};&lt;br /&gt;language.prototype = {&lt;br /&gt; a: 1,&lt;br /&gt; b: 2&lt;br /&gt;};&lt;br /&gt;javascript.prototype = new language();&lt;br /&gt;var j = new javascript();&lt;br /&gt;console.log(j);&lt;br /&gt;console.log(j.__proto__);&lt;br /&gt;//locale: en，此处因为language构造函数返回不是this，而是另一个object直接量，而object直接的构造方法为object()，因此language的原型被丢失了    &lt;br /&gt;console.log(language.prototype);&lt;br /&gt;console.log(javascript.prototype);&lt;br /&gt;console.log(j.constructor.tostring());&lt;br /&gt;//function object() { [native code] }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;构造函数与其返回值&lt;/h3&gt;&lt;br /&gt;构造函数会返回一个对象，如果没有直接return语句，构造函数会自动返回当前对象："return this;"，也可以返回一个对象直接量，而不返回this，这样会中断正常的原型链。&lt;br /&gt;&lt;br /&gt;prototype.js中class对象定义是封装在一个匿名函数里的，从而使得其内部变量和方法与外界隔离，其中有二句代码为：&lt;br /&gt;&lt;div class="pre"&gt;    &lt;br /&gt;function subclass() {};&lt;br /&gt;subclass.prototype = parent.prototype;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;因为parent的构造可能返回语句不是返回this对象，而是返回了一个其他的对象，如{tostring:true}，如果不用subclass.prototype=parent.prototype这样写，可能这样会丢失原型链上的方法和属性，通过subclass这个空构造将parent.prototype引用到自身的prototype上，从而保持住部分原型链。&lt;br /&gt;这其实也已经不是原型继承了，因为它不是通过new parent()来获取原型对象，丢失了new parent所得对象中的属性和方法。&lt;br /&gt;prototype中的class其实放弃了原型对象，只是简单的继承了parent.prototype对象，已经失去原型继承可以继承对象状态的功能，这样操作其实是很好的模似了类继承方式。&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;var class = (function() {&lt;br /&gt; function subclass() {};&lt;br /&gt; function create() {&lt;br /&gt;  var parent = null,&lt;br /&gt;  properties = $a(arguments);&lt;br /&gt;  if (object.isfunction(properties[0])) parent = properties.shift();&lt;br /&gt;&lt;br /&gt;  function klass() {&lt;br /&gt;   this.initialize.apply(this, arguments);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  object.extend(klass, class.methods);&lt;br /&gt;  klass.superclass = parent;&lt;br /&gt;  klass.subclasses = [];&lt;br /&gt;&lt;br /&gt;  if (parent) {&lt;br /&gt;   // 因为parent的构造可能返回对象直接量，而不是返回this，如{tostring:true}&lt;br /&gt;   subclass.prototype = parent.prototype;&lt;br /&gt;   klass.prototype = new subclass;&lt;br /&gt;   parent.subclasses.push(klass);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  for (var i = 0; i &lt; properties.length; i++) klass.addmethods(properties[i]);&lt;br /&gt;  if (!klass.prototype.initialize) klass.prototype.initialize = prototype.emptyfunction;&lt;br /&gt;  klass.prototype.constructor = klass;&lt;br /&gt;  return klass;&lt;br /&gt; }&lt;br /&gt; function addmethods(source) {&lt;br /&gt;  var ancestor = this.superclass &amp;&amp; this.superclass.prototype;&lt;br /&gt;  var properties = object.keys(source);&lt;br /&gt;  if (!object.keys({&lt;br /&gt;   tostring: true&lt;br /&gt;  }).length) {&lt;br /&gt;   if (source.tostring != object.prototype.tostring) properties.push("tostring");&lt;br /&gt;   if (source.valueof != object.prototype.valueof) properties.push("valueof");&lt;br /&gt;  }&lt;br /&gt;  for (var i = 0, length = properties.length; i &lt; length; i++) {&lt;br /&gt;   var property = properties[i],&lt;br /&gt;   value = source[property];&lt;br /&gt;   if (ancestor &amp;&amp; object.isfunction(value) &amp;&amp; value.argumentnames().first() == "$super") {&lt;br /&gt;    var method = value;&lt;br /&gt;    value = (function(m) {&lt;br /&gt;     return function() {&lt;br /&gt;      return ancestor[m].apply(this, arguments);&lt;br /&gt;     };&lt;br /&gt;    })(property).wrap(method);&lt;br /&gt;    value.valueof = method.valueof.bind(method);&lt;br /&gt;    value.tostring = method.tostring.bind(method);&lt;br /&gt;   }&lt;br /&gt;   this.prototype[property] = value;&lt;br /&gt;  }&lt;br /&gt;  return this;&lt;br /&gt; }&lt;br /&gt; return {&lt;br /&gt;  create: create,&lt;br /&gt;  methods: {&lt;br /&gt;   addmethods: addmethods&lt;br /&gt;  }&lt;br /&gt; };&lt;br /&gt;})();&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5217461761043330725?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5217461761043330725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5217461761043330725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5217461761043330725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5217461761043330725'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/06/relationship-of-constructor-and.html' title='relationship of constructor and prototype in javascript'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-606771712141569628</id><published>2010-06-08T11:32:00.001+08:00</published><updated>2010-10-24T23:06:19.657+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='closures'/><category scheme='http://www.blogger.com/atom/ns#' term='Chain'/><category scheme='http://www.blogger.com/atom/ns#' term='lexical'/><category scheme='http://www.blogger.com/atom/ns#' term='Scope'/><title type='text'>javascript: closures, lexical scope and scope chain</title><content type='html'>闭包的定义(javascript权威指南)如下：&lt;br /&gt;JavaScript functions are a combination of code to be executed and the scope in which to execute them. This combination of code and scope is known as a closure in the computer science literature. All JavaScript functions are closures. &lt;br /&gt;javascript的function定义了将要被执行的代码，并且指出在哪个作用域中执行这个方法，这种代码和作用域的组合体就是一个闭包，在代码中的变量是自由的未绑定的。闭包就像一个独立的生命体，有其自身要运行的代码，同时其自身携带了运行时所需要的环境。&lt;br /&gt;javascript所有的function都是闭包。&lt;br /&gt;&lt;br /&gt;闭包中包含了其代码运行的作用域，那这个作用域又是什么样子的呢，这就引入了词法作用域(lexical scope)的概念:&lt;br /&gt;词法作用域是指方法运行的作用域是在方法定义时决定的，而不是方法运行时决定的。&lt;br /&gt;所以在javascript中，function运行的作用域其实是一个static scope。但也有二个例外，就是with和eval，在这2者中的代码处于dynamic scope中，这给javascript带来额外的复杂度和计算量，因而也效率低下，避免使用。&lt;br /&gt;&lt;br /&gt;当闭包在其词法作用域中运行过程中，如何检索其中的变量名？这就再引入了一个概念，作用域链(scope chain)：&lt;br /&gt;当一个方法function定义完成，其作用域链就是固定的了，并被保存成为方法内部状态的一部分，只是这个作用域链中调用对象的属性值不是固定的。作用域链是"活"的。&lt;br /&gt;当一个方法在被调用时，会生成一个调用对象(call object or activation object)，并将此call object加到其定义时确认下来的作用域链的顶端。&lt;br /&gt;在这个call object上，方法的参数和方法内定义的局部变量名和值都会存在这个call object中，如果调用结束，这个call object会从作用域链的顶端移除，再没有被其他对象引用，内存也会被自动回收。&lt;br /&gt;在此call object中使用的变量名会先从此方法局部变量和传入参数中检索，如果没有找到，就会向作用域链上的前一个对象查询，如此向上追溯，一直检索到global object(即window对象上)，如果在整个作用域链上没有找到此变量名，则会返回undefined(没有指定对象直接查询变量名，没找到则抛出异常变量未定义)。&lt;br /&gt;如此通过作用域链，javascrip就实现了call object中变量名检索。&lt;br /&gt;&lt;br /&gt;在全局对象中一个方法调用完成之后，生成的call object会被回收，这看不出闭包(即当前被调用的方法)有什么功用。但是当一个外部方法的内部返回一个嵌套方法，并且返回的嵌套方法被全局对象引用时，或者是外部方法内将嵌套方法赋给全局对象的属性(jQuery构造方法就是在匿名方法内设置在window.jQuery上)，外部方法调用生成的call object就会引用这个嵌套方法，而同时嵌套方法被全局对象引用，所以这个外部方法调用产生的call object及其属性就会继续生存在内存中，这时闭包(外部方法)的功用才被显示出来，下面以jQuery.fn.animation()方法调用过程为例进行说明:&lt;br /&gt;&lt;br /&gt;1、当载入整个jquery.js文件时，会运行最外面的匿名方法(通过这个匿名方法形成一个命名空间，所有的变量名都是匿名方法内部定义的局部变量名):&lt;br /&gt;&lt;div class="pre"&gt;    &lt;br /&gt;    (function( window, undefined ) {&lt;br /&gt;        // ......jQuery source code;&lt;br /&gt;        // Expose jQuery to the global object&lt;br /&gt;        window.jQuery = window.$ = jQuery;&lt;br /&gt;    })(window);&lt;br /&gt;&lt;/div&gt;2、因为匿名方法内部有一个内部方法jQuery被全局对象window的属性jQuery和$引用，这里变量名很搞，一个是匿名方法内嵌套的构造方法jQuery，另一个window对象的属性名jQuery。因为这个匿名方法内部的jQuery构造方法被全局对象window.jQuery引用，所以外围的匿名方法在运行时产生的call object会继续生存在内存中。此时，这个call object可以利用Firebug或者Chrome的debug工具可以看到，在Firebug中的scopeChain中称之为"Object"，在Chrome的console中称之为"Closure"，该对象中记录了当前这个最外围的匿名方法被调用后生成的call object上变量的值，这些变量是未绑定的，是自由的，其值可以被修改并保存在作用域链上。运行此匿名方法时，会将其call object置于global object之上，形成作用域链。&lt;br /&gt;这里注意一点，这匿名方法是一个闭包，但运行方法生成的call object对象只是作用域链顶端的一个对象，记录了方法中的变量名和值。闭包不但包括这个运行的作用域，还包括其运行所需的代码。&lt;br /&gt;3、页面不关闭，这个匿名方法调用生成的call object就会一直驻在内存中，接下来当页面发生了一个jQuery.fn.animate()方法的调用，这个时候javascript又会为.animate()方法生成一个call object，这个对象拥有传进来的参数名和值，以及在.animate()方法内部定义的一个局部变量opt和它的值。&lt;br /&gt;同时，javascript会将生成的这个call object置于其作用域链(scope chain)的最前端，即此时的作用域链为：global object-&gt;anonymous function call object-&gt;animate call object。&lt;br /&gt;4、接下来会调用jQuery.fn.queue()-&gt;jQuery.fn.each()-&gt;jQuery.fn.dequeue()，在这些方法调用过程也都会接触到第2步中所提到的那个匿名方法调用后生成的闭包，这中间过程略过，当运行到最后传参给.queue(function)的function时，因为这个匿名方法是定义在jQuery.fn.animate()方法内部的，所以其作用域链(scope chain)也就已经确定了，即global object-&gt;anonymous function call object-&gt;animate call object，当此匿名方法调用生成一个call object，会将此call object再置于animate call object之上。&lt;br /&gt;5、对于最后的匿名function运行完成之后，如果这个匿名function对象还被其他element的queue数组引用，则第3步中运行.animate()方法生成的闭包将继续生存在内存之中，直到所有的效果方法运行完成，此匿名function没有其他引用时，.animate()调用生成的call object就会被回收。&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://yuweijun.blogspot.com/2008/10/javascript.html"&gt;JavaScript函数调用时的作用域链和调用对象是如何形成的及与闭包的关系&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-606771712141569628?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/606771712141569628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=606771712141569628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/606771712141569628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/606771712141569628'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/06/javascript-closures-lexical-scope-and.html' title='javascript: closures, lexical scope and scope chain'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1336704231252539416</id><published>2010-05-24T14:59:00.001+08:00</published><updated>2010-10-24T23:08:05.674+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='base64'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql5'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqlbinlog'/><title type='text'>mysqlbinlog Ver 3.3和3.1版本之间的输出差异</title><content type='html'>mysqlbinlog Ver 3.3中多了一个--base64-output参数，默认值为auto:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;--base64-output[=name] &lt;br /&gt;    Determine when the output statements should be&lt;br /&gt;    base64-encoded BINLOG statements: 'never' disables it and&lt;br /&gt;    works only for binlogs without row-based events; 'auto'&lt;br /&gt;    is the default and prints base64 only when necessary&lt;br /&gt;    (i.e., for row-based events and format description&lt;br /&gt;    events); 'always' prints base64 whenever possible.&lt;br /&gt;    'always' is for debugging only and should not be used in&lt;br /&gt;    a production system. The default is 'auto'.&lt;br /&gt;    --base64-output is a short form for&lt;br /&gt;    --base64-output=always.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;在原来的Ver3.1版本中没有此参数，对比mysql5.0生成的日志文件的输出结果：&lt;br /&gt;Ver3.1版本中使用mysqlbinlog输出结果：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;shell&gt; mysqlbinlog mysql-bin.000182|less&lt;br /&gt;/*!40019 SET @@session.max_insert_delayed_threads=0*/;&lt;br /&gt;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;&lt;br /&gt;DELIMITER /*!*/;&lt;br /&gt;# at 4&lt;br /&gt;#100515  1:38:58 server id 25  end_log_pos 98   Start: binlog v 4, server v 5.0.37-log created 100515  1:38:58&lt;br /&gt;# at 98&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Ver3.3版本中使用mysqlbinlog输出结果：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;shell&gt; mysqlbinlog --base64-output=never mysql-bin.000182|less&lt;br /&gt;/*!40019 SET @@session.max_insert_delayed_threads=0*/;&lt;br /&gt;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;&lt;br /&gt;DELIMITER /*!*/;&lt;br /&gt;# at 4&lt;br /&gt;#100515  1:38:58 server id 25  end_log_pos 98   Start: binlog v 4, server v 5.0.37-log created 100515  1:38:58&lt;br /&gt;# at 98&lt;br /&gt;&lt;br /&gt;shell&gt; mysqlbinlog --base64-output=auto mysql-bin.000182|less&lt;br /&gt;/*!40019 SET @@session.max_insert_delayed_threads=0*/;&lt;br /&gt;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;&lt;br /&gt;DELIMITER /*!*/;&lt;br /&gt;# at 4&lt;br /&gt;#100515  1:38:58 server id 25  end_log_pos 98   Start: binlog v 4, server v 5.0.37-log created 100515  1:38:58&lt;br /&gt;BINLOG '&lt;br /&gt;sortSw8ZAAAAXgAAAGIAAAAAAAQANS4wLjM3LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;br /&gt;AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAASwAEGg==&lt;br /&gt;'/*!*/;&lt;br /&gt;# at 98&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;从上面结果比较而言，相当于3.1版本的mysqlbinlog的base64-output参数默认为never。&lt;br /&gt;在mysql 5.0中带的mysqlbinlog一般为3.1版本的，而mysql5.1版本中带的mysqlbinlog则为3.3版本，如果需要将mysql5.0生成的日志文件导入mysql5.1时，需要将mysqlbinlog的base64-output值设置为never。如果不设置此参数，导入日志时，会在&lt;br /&gt;&lt;div class="pre"&gt;BINLOG 'sortSw8ZAAAAXgAAAGIAAAAAAAQANS4wLjM3LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;br /&gt;AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAASwAEGg=='&lt;/div&gt;&lt;br /&gt;处报SQL语法错误。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1336704231252539416?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1336704231252539416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1336704231252539416' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1336704231252539416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1336704231252539416'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/mysqlbinlog-ver-3331.html' title='mysqlbinlog Ver 3.3和3.1版本之间的输出差异'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2571265104894502984</id><published>2010-05-24T14:11:00.002+08:00</published><updated>2010-05-24T14:56:51.564+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='Replication'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqlbinlog'/><title type='text'>MySQL5 slave同步报错(server_errno=1236)</title><content type='html'>100519 19:35:33 [Note] Slave I/O thread: connected to master 'repl@master:3306',  replication started in log 'mysql-bin.000176' at position 615525147&lt;br /&gt;&lt;br /&gt;100519 19:35:33 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)&lt;br /&gt;&lt;br /&gt;从日志信息上可知，slave已经连接到master，并且准备从指定的binlog文件指定位置开始同步，但后面错误提示日志文件找不到，而master服务器上日志文件是存在的。&lt;br /&gt;这种情况有二种处理方法：&lt;br /&gt;一、重启主数据库(master)之后，然后slave上stop slave;start slave，再检查同步的状态。&lt;br /&gt;二、不重启主服务器，则用mysqlbinlog根据start-position或者start-datetime，将日志分析出来后，将分析结果在slave上用mysql命令导入，导入完成后，再用CHANGE MASTER TO语句，从下一个日志文件MASTER_LOG_POSITION=98开始同步。&lt;br /&gt;&lt;br /&gt;另外在使用mysqlbinlog工具进行日志导入时，需要注意以下问题，下面内容转自MySQL官方手册：&lt;br /&gt;如果MySQL服务器上有多个要执行的二进制日志，安全的方法是在一个连接中处理它们。下面是一个说明什么是不安全的例子：&lt;br /&gt;&lt;br /&gt;shell&gt; mysqlbinlog hostname-bin.000001 | mysql # DANGER!!&lt;br /&gt;shell&gt; mysqlbinlog hostname-bin.000002 | mysql # DANGER!!&lt;br /&gt;&lt;br /&gt;使用与服务器的不同连接来处理二进制日志时，如果第1个日志文件包含一个CREATE TEMPORARY TABLE语句，第2个日志包含一个使用该临时表的语句，则会造成问题。当第1个mysql进程结束时，服务器撤销临时表。当第2个mysql进程想使用该表时，服务器报告 “不知道该表”。&lt;br /&gt;&lt;br /&gt;要想避免此类问题，使用一个连接来执行想要处理的所有二进制日志中的内容。下面提供了一种方法：&lt;br /&gt;&lt;br /&gt;shell&gt; mysqlbinlog hostname-bin.000001 hostname-bin.000002 | mysql -u root -ppassword&lt;br /&gt;&lt;br /&gt;Reference: http://yuweijun.blogspot.com/2009/12/mysql50.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2571265104894502984?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2571265104894502984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2571265104894502984' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2571265104894502984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2571265104894502984'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/mysql5-slaveservererrno1236.html' title='MySQL5 slave同步报错(server_errno=1236)'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7517867946346453180</id><published>2010-05-24T12:30:00.004+08:00</published><updated>2010-10-24T23:08:57.822+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='keyEvent'/><title type='text'>javascript中keyEvent按键事件说明(录自javascript权威指南第5版)</title><content type='html'>有3种按键类型，分别是keydown、keypress和keyup，它们分别对应onkeydown、onkeypress和onkeyup这几个事件处理器。&lt;br /&gt;一个按键操作会产生这3个事件，依次是keydown、keypress，然后在按键释放的时候keyup。&lt;br /&gt;这3个事件类型中，keypress事件是最为用户友好的：和它们相关的事件对象包含了所产生的实际字符的编码。keydown和keyup事件是较底层的，它们的按键事件包含一个和键盘所生成的硬件编码相关的“虚拟按键码”。对于ASCII字符集中的数字和字符，这些虚拟按键码和ASCII码相同。如果按下SHIFT键并按下数字2，keydown事件将通知发生了“SHITF-2”的按键事件。keypress事件会解释这一事件，说明这次按键产生了一个可打印的字符“@”。&lt;br /&gt;对于不能打印的功能按键，如Backspace、Enter、Escape和箭头方向键、Page Up、Page Down以及F1到F12，它们会产生keydown和keyup事件。&lt;br /&gt;&lt;br /&gt;在不同的浏览器中，按键事件的一些细节区别如下：&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;1、对于不能打印的功能按键，在Firefox中，也会产生keypress事件，在IE和Chrome中，则不会触发keypress事件，只有当按键有一个ASCII码的时候，即此字符为可打印字符或者一个控制字符的时候，keypress事件才会发生。对于这些不能打印的功能按键，可通过和keydown事件相关的keyCode来获取。&lt;br /&gt;2、作为一条通用的规则，keydown事件对于功能按键来说是最有用的，而keypress事件对于可打印的按键来说是最有用的。&lt;br /&gt;3、在IE中，Alt按键组合被认为是无法打印的，所以并不会触发keypress事件。&lt;br /&gt;4、在Firefox中，按键事件定义有二个属性，keyCode存储了一个按键的较低层次的虚拟按键码，并且和keydown事件一起发送。charCode存储了按下一个键时所产生的可打印的字符的编码，并且和keypress事件一起发送。在Firefox中，功能按键会产生一个keypress事件，在这种情况下，charCode是0，而keyCode包含了虚拟按键码。在Firefox中，发生keydown事件时，charCode都为0，所以在keydown时获取charCode是无意义的。&lt;br /&gt;5、在IE中，只有一个keyCode属性，并且它的解释也取决于事件的类型。对于keydown事件来说，keyCode是一个虚拟按键码，对于keypress事件来说，keyCode是一个字符码。&lt;br /&gt;6、在Chrome中，功能键与IE中表现一样，不会触发keypress事件，对于keydown事件，也会在事件的keyCode中存储虚拟按键码，而charCode为0，与IE和Firefox表现一样，然而在发生可打印字符的keypress事件时，除了与Firefox一样，会在事件的charCode中存储实际按键编码之外，也会在keyCode中存储实际按键码，这二个值相同。&lt;br /&gt;7、charCode字符码可以使用静态方数String.fromCharCode()转为字符。&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7517867946346453180?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7517867946346453180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7517867946346453180' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7517867946346453180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7517867946346453180'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/javascriptkeyeventjavascript5.html' title='javascript中keyEvent按键事件说明(录自javascript权威指南第5版)'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1226983431787165787</id><published>2010-05-24T12:15:00.003+08:00</published><updated>2010-10-24T23:09:26.768+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Options'/><category scheme='http://www.blogger.com/atom/ns#' term='Session'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>rails session options</title><content type='html'>&lt;div class="pre"&gt;require 'action_controller/cgi_ext'&lt;br /&gt;require 'action_controller/session/cookie_store'&lt;br /&gt;&lt;br /&gt;module ActionController #:nodoc:&lt;br /&gt;  class Base&lt;br /&gt;    # Process a request extracted from a CGI object and return a response. Pass false as &lt;tt&gt;session_options&lt;/tt&gt; to disable&lt;br /&gt;    # sessions (large performance increase if sessions are not needed). The &lt;tt&gt;session_options&lt;/tt&gt; are the same as for CGI::Session:&lt;br /&gt;    #&lt;br /&gt;    # * &lt;tt&gt;:database_manager&lt;/tt&gt; - standard options are CGI::Session::FileStore, CGI::Session::MemoryStore, and CGI::Session::PStore&lt;br /&gt;    #   (default). Additionally, there is CGI::Session::DRbStore and CGI::Session::ActiveRecordStore. Read more about these in&lt;br /&gt;    #   lib/action_controller/session.&lt;br /&gt;    # * &lt;tt&gt;:session_key&lt;/tt&gt; - the parameter name used for the session id. Defaults to '_session_id'.&lt;br /&gt;    # * &lt;tt&gt;:session_id&lt;/tt&gt; - the session id to use.  If not provided, then it is retrieved from the +session_key+ cookie, or &lt;br /&gt;    #   automatically generated for a new session.&lt;br /&gt;    # * &lt;tt&gt;:new_session&lt;/tt&gt; - if true, force creation of a new session.  If not set, a new session is only created if none currently&lt;br /&gt;    #   exists.  If false, a new session is never created, and if none currently exists and the +session_id+ option is not set,&lt;br /&gt;    #   an ArgumentError is raised.&lt;br /&gt;    # * &lt;tt&gt;:session_expires&lt;/tt&gt; - the time the current session expires, as a Time object.  If not set, the session will continue&lt;br /&gt;    #   indefinitely.&lt;br /&gt;    # * &lt;tt&gt;:session_domain&lt;/tt&gt; - the hostname domain for which this session is valid. If not set, defaults to the hostname of the&lt;br /&gt;    #   server.&lt;br /&gt;    # * &lt;tt&gt;:session_secure&lt;/tt&gt; - if +true+, this session will only work over HTTPS.&lt;br /&gt;    # * &lt;tt&gt;:session_path&lt;/tt&gt; - the path for which this session applies.  Defaults to the directory of the CGI script.&lt;br /&gt;    # * &lt;tt&gt;:cookie_only&lt;/tt&gt; - if +true+ (the default), session IDs will only be accepted from cookies and not from&lt;br /&gt;    #   the query string or POST parameters. This protects against session fixation attacks.&lt;br /&gt;    def self.process_cgi(cgi = CGI.new, session_options = {})&lt;br /&gt;      new.process_cgi(cgi, session_options)&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def process_cgi(cgi, session_options = {}) #:nodoc:&lt;br /&gt;      process(CgiRequest.new(cgi, session_options), CgiResponse.new(cgi)).out&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1226983431787165787?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1226983431787165787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1226983431787165787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1226983431787165787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1226983431787165787'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/rails-session-options.html' title='rails session options'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-3988646764297719657</id><published>2010-05-24T11:14:00.008+08:00</published><updated>2010-10-24T23:15:22.721+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Magic'/><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='RegExp'/><title type='text'>Regexp Magic in vim</title><content type='html'>Some characters in the pattern are taken literally.  They match with the same&lt;br /&gt;character in the text.  When preceded with a backslash however, these&lt;br /&gt;characters get a special meaning.&lt;br /&gt;&lt;br /&gt;Other characters have a special meaning without a backslash.  They need to be&lt;br /&gt;preceded with a backslash to match literally.&lt;br /&gt;&lt;br /&gt;If a character is taken literally or not depends on the 'magic' option and the&lt;br /&gt;items mentioned next.&lt;br /&gt;&lt;br /&gt;*/\m* */\M*&lt;br /&gt;Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,&lt;br /&gt;ignoring the actual value of the 'magic' option.&lt;br /&gt;Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.&lt;br /&gt;&lt;br /&gt;*/\v* */\V*&lt;br /&gt;Use of "\v" means that in the pattern after it all ASCII characters except&lt;br /&gt;'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning.  "very magic"&lt;br /&gt;&lt;br /&gt;Use of "\V" means that in the pattern after it only the backslash has a&lt;br /&gt;special meaning.  "very nomagic"&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;after:    \v           \m           \M           \V             matches ~&lt;br /&gt;          $            $            $            \$             matches end-of-line&lt;br /&gt;          .            .            \.           \.             matches any character&lt;br /&gt;          *            *            \*           \*             any number of the previous atom&lt;br /&gt;          ()           \(\)         \(\)         \(\)           grouping into an atom&lt;br /&gt;          |            \|           \|           \|             separating alternatives&lt;br /&gt;          \a           \a           \a           \a             alphabetic character&lt;br /&gt;          \\           \\           \\           \\             literal backslash&lt;br /&gt;          \.           \.           .            .              literal dot&lt;br /&gt;          \{           {            {            {              literal '{'&lt;br /&gt;          a            a            a            a              literal 'a'&lt;br /&gt;&lt;br /&gt;{only Vim supports \m, \M, \v and \V}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;It is recommended to always keep the 'magic' option at the default setting,&lt;br /&gt;which is 'magic'.  This avoids portability problems.  To make a pattern immune&lt;br /&gt;to the 'magic' option being set or not, put "\m" or "\M" at the start of the&lt;br /&gt;pattern.&lt;br /&gt;&lt;br /&gt;Without \v:&lt;br /&gt;&lt;div class="pre"&gt;:%s/^\%(foo\)\{1,3}\(.\+\)bar$/\1/&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;With \v:&lt;br /&gt;&lt;div class="pre"&gt;:%s/\v^%(foo){1,3}(.+)bar$/\1/&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;See also :h /\v&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-3988646764297719657?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/3988646764297719657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=3988646764297719657' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3988646764297719657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3988646764297719657'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/regexp-magic-in-vim.html' title='Regexp Magic in vim'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1260496670025601428</id><published>2010-05-24T10:51:00.002+08:00</published><updated>2010-10-24T23:16:02.807+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='mod_ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='https'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache2'/><title type='text'>在CentOS 5中开启apache2的mod_ssl模块</title><content type='html'>在配置完/etc/httpd/conf.d/ssl.conf文件之后，进行配置文件语法正确性测试时，报语法错误如下：&lt;br /&gt;$&gt; httpd -t&lt;br /&gt;Syntax error on line 5 of /etc/httpd/conf.d/ssl.conf:&lt;br /&gt;Invalid command 'SSLPassPhraseDialog', perhaps misspelled or defined by a module not included in the server configuration&lt;br /&gt;&lt;br /&gt;移除ssl.conf文件之后，语法检查正确，列出httpd的模块检查：&lt;br /&gt;$&gt; httpd -M&lt;br /&gt;Loaded Modules:&lt;br /&gt;core_module (static)&lt;br /&gt;mpm_prefork_module (static)&lt;br /&gt;http_module (static)&lt;br /&gt;so_module (static)&lt;br /&gt;auth_basic_module (shared)&lt;br /&gt;auth_digest_module (shared)&lt;br /&gt;authn_file_module (shared)&lt;br /&gt;authn_alias_module (shared)&lt;br /&gt;authn_anon_module (shared)&lt;br /&gt;authn_dbm_module (shared)&lt;br /&gt;authn_default_module (shared)&lt;br /&gt;authz_host_module (shared)&lt;br /&gt;authz_user_module (shared)&lt;br /&gt;authz_owner_module (shared)&lt;br /&gt;authz_groupfile_module (shared)&lt;br /&gt;authz_dbm_module (shared)&lt;br /&gt;authz_default_module (shared)&lt;br /&gt;ldap_module (shared)&lt;br /&gt;authnz_ldap_module (shared)&lt;br /&gt;include_module (shared)&lt;br /&gt;log_config_module (shared)&lt;br /&gt;logio_module (shared)&lt;br /&gt;env_module (shared)&lt;br /&gt;ext_filter_module (shared)&lt;br /&gt;mime_magic_module (shared)&lt;br /&gt;expires_module (shared)&lt;br /&gt;deflate_module (shared)&lt;br /&gt;headers_module (shared)&lt;br /&gt;usertrack_module (shared)&lt;br /&gt;setenvif_module (shared)&lt;br /&gt;mime_module (shared)&lt;br /&gt;dav_module (shared)&lt;br /&gt;status_module (shared)&lt;br /&gt;autoindex_module (shared)&lt;br /&gt;info_module (shared)&lt;br /&gt;dav_fs_module (shared)&lt;br /&gt;vhost_alias_module (shared)&lt;br /&gt;negotiation_module (shared)&lt;br /&gt;dir_module (shared)&lt;br /&gt;actions_module (shared)&lt;br /&gt;speling_module (shared)&lt;br /&gt;userdir_module (shared)&lt;br /&gt;alias_module (shared)&lt;br /&gt;rewrite_module (shared)&lt;br /&gt;proxy_module (shared)&lt;br /&gt;proxy_balancer_module (shared)&lt;br /&gt;proxy_ftp_module (shared)&lt;br /&gt;proxy_http_module (shared)&lt;br /&gt;proxy_connect_module (shared)&lt;br /&gt;cache_module (shared)&lt;br /&gt;suexec_module (shared)&lt;br /&gt;disk_cache_module (shared)&lt;br /&gt;file_cache_module (shared)&lt;br /&gt;mem_cache_module (shared)&lt;br /&gt;cgi_module (shared)&lt;br /&gt;version_module (shared)&lt;br /&gt;proxy_ajp_module (shared)&lt;br /&gt;Syntax OK&lt;br /&gt;&lt;br /&gt;发现apache没有加载ssl_module，并且/etc/httpd/modules目录中无mod_ssl.so文件，需要在线安装：&lt;br /&gt;$&gt; yum search mod_ssl&lt;br /&gt;mod_ssl.x86_64 : SSL/TLS module for the Apache HTTP server&lt;br /&gt;&lt;br /&gt;$&gt; yum install mod_ssl&lt;br /&gt;Installed: mod_ssl.x86_64 1:2.2.3-43.el5.centos&lt;br /&gt;Dependency Installed: distcache.x86_64 0:1.4.5-14.1&lt;br /&gt;Updated: httpd.x86_64 0:2.2.3-43.el5.centos&lt;br /&gt;Complete!&lt;br /&gt;&lt;br /&gt;安装mod_ssl会增加一个用户类型，所以会修改/etc/passwd文件。&lt;br /&gt;安装完成之后，修改ssl.conf文件，在文件顶部添加以下一行代码，加载ssl_module:&lt;br /&gt;&lt;div class="pre"&gt;LoadModule ssl_module modules/mod_ssl.so&lt;br /&gt;Listen 443&lt;br /&gt;AddType application/x-x509-ca-cert .crt&lt;br /&gt;AddType application/x-pkcs7-crl    .crl&lt;br /&gt;SSLPassPhraseDialog  builtin&lt;br /&gt;SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)&lt;br /&gt;SSLSessionCacheTimeout  300&lt;br /&gt;SSLMutex  default&lt;br /&gt;&lt;br /&gt;&amp;lt;VirtualHost _default_:443&amp;gt;&lt;br /&gt;DocumentRoot "/path/to/wwwroot"&lt;br /&gt;ServerName www.test.com:443&lt;br /&gt;ServerAdmin test.yu@gmail.com&lt;br /&gt;SSLEngine on&lt;br /&gt;SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW&lt;br /&gt;SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt&lt;br /&gt;SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key&lt;br /&gt;SSLCACertificateFile /usr/local/apache2/conf/ssl.crt/cacertificate.crt&lt;br /&gt;&amp;lt;FilesMatch "\.(cgi|shtml|phtml|php)$"&amp;gt;&lt;br /&gt;SSLOptions +StdEnvVars&lt;br /&gt;&amp;lt;/FilesMatch&amp;gt;&lt;br /&gt;&amp;lt;Directory "/usr/local/apache2/cgi-bin"&amp;gt;&lt;br /&gt;SSLOptions +StdEnvVars&lt;br /&gt;&amp;lt;/Directory&amp;gt;&lt;br /&gt;SetEnvIf User-Agent ".*MSIE.*" \&lt;br /&gt;nokeepalive ssl-unclean-shutdown \&lt;br /&gt;downgrade-1.0 force-response-1.0&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;                        &lt;br /&gt;&lt;/div&gt;再测试httpd配置文件：&lt;br /&gt;$&gt; httpd -t&lt;br /&gt;Syntax OK&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1260496670025601428?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1260496670025601428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1260496670025601428' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1260496670025601428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1260496670025601428'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/centos-5apache2modssl.html' title='在CentOS 5中开启apache2的mod_ssl模块'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4588104326236418146</id><published>2010-05-24T10:48:00.000+08:00</published><updated>2010-05-24T10:48:59.017+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Optimize'/><category scheme='http://www.blogger.com/atom/ns#' term='Table'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>MySQL: Many tables or many databases?</title><content type='html'>&lt;b&gt;Question: &lt;/b&gt;&lt;br /&gt;For a project we having a bunch of data that always have the same structure and is not linked together. There are two approaches to save the data:&lt;br /&gt;    * Creating a new database for every pool (about 15-25 tables)&lt;br /&gt;    * Creating all the tables in one database and differ the pools by table names.&lt;br /&gt;Which one is easier and faster to handle for MySQL?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;br /&gt;There should be no significant performance difference between multiple tables in a single database versus multiple tables in separate databases.&lt;br /&gt;&lt;br /&gt;In MySQL, databases (standard SQL uses the term "schema" for this) serve chiefly as a namespace for tables. A database has only a few attributes, e.g. the default character set and collation. And that usage of GRANT makes it convenient to control access privileges per database, but that has nothing to do with performance.&lt;br /&gt;&lt;br /&gt;You can access tables in any database from a single connection (provided they are managed by the same instance of MySQL Server). You just have to qualify the table name:&lt;br /&gt;&lt;br /&gt;SELECT * FROM database17.accounts_table;&lt;br /&gt;&lt;br /&gt;This is purely a syntactical difference. It should have no effect on performance.&lt;br /&gt;&lt;br /&gt;Regarding storage, you can't organize tables into a file-per-database as @Chris speculates. With the MyISAM storage engine, you always have a file per table. With the InnoDB storage engine, you either have a single set of storage files that amalgamate all tables, or else you have a file per table (this is configured for the whole MySQL server, not per database). In either case, there's no performance advantage or disadvantage to creating the tables in a single database versus many databases.&lt;br /&gt;&lt;br /&gt;There aren't many MySQL configuration parameters that work per database. Most parameters that affect server performance are server-wide in scope.&lt;br /&gt;&lt;br /&gt;Regarding backups, you can specify a subset of tables as arguments to the mysqldump command. It may be more convenient to back up logical sets of tables per database, without having to name all the tables on the command-line. But it should make no difference to performance, only convenience for you as you enter the backup command.&lt;br /&gt;&lt;br /&gt;-- Bill Karwin (the author of &lt;a href="http://www.pragprog.com/titles/bksqla/sql-antipatterns"&gt;SQL Antipatterns&lt;/a&gt; from Pragmatic Bookshelf)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4588104326236418146?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4588104326236418146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4588104326236418146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4588104326236418146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4588104326236418146'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/mysql-many-tables-or-many-databases.html' title='MySQL: Many tables or many databases?'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6537665494556598401</id><published>2010-05-24T10:45:00.002+08:00</published><updated>2010-10-24T23:17:41.296+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Awk'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><category scheme='http://www.blogger.com/atom/ns#' term='Sed'/><category scheme='http://www.blogger.com/atom/ns#' term='CommandLine'/><title type='text'>linux命令行显示指定行号的内容</title><content type='html'>以第四行为例,要查询的文件名为list.txt:&lt;br /&gt;方法1:&lt;br /&gt;&lt;div class="pre"&gt;grep -n '^' list.txt |grep  '^4:'|grep -o '[^4:].*'&lt;/div&gt;&lt;br /&gt;方法2:&lt;br /&gt;&lt;div class="pre"&gt;sed -n '4p' list.txt&lt;/div&gt;&lt;br /&gt;sed -n '4,4p' list.txt&lt;br /&gt;方法3:&lt;br /&gt;&lt;div class="pre"&gt;awk '{if ( NR==4 ) print $0}' list.txt&lt;/div&gt;&lt;br /&gt;方法4:&lt;br /&gt;&lt;div class="pre"&gt;tac list.txt |tail -4|tac|tail -1&lt;br /&gt;tac list.txt |tail -n 4|tac|tail -n 1&lt;/div&gt;&lt;br /&gt;References: &lt;a href="http://zhidao.baidu.com/question/91856742"&gt;http://zhidao.baidu.com/question/91856742&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6537665494556598401?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6537665494556598401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6537665494556598401' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6537665494556598401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6537665494556598401'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/linux.html' title='linux命令行显示指定行号的内容'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8113164104942107018</id><published>2010-05-11T11:14:00.001+08:00</published><updated>2010-10-24T23:18:16.414+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='noscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Write'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='document'/><title type='text'>利用document.write()和noscript标签做内文替换的小技巧</title><content type='html'>&lt;div class="pre"&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt; "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt; &amp;lt;title&amp;gt;noscript tips&amp;lt;/title&amp;gt;&lt;br /&gt; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;script&amp;gt;document.write("新页面内容" + "&amp;lt;nosc"+"ript&amp;gt;");&amp;lt;/script&amp;gt;&lt;br /&gt;      原来的页面内容: 利用document.write()打印新的页面内容，并且打出一个noscript起始标签，在新页面内容想要替换的页面内容结尾处，添加一个noscript结束标签，从而利用document.write()和noscript标签对，用新页面内容替换原来的页面内容，这个小技巧是在看google做页面内容不同时的效果跟踪代码时发现的。&lt;br /&gt;   &amp;lt;/noscript&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8113164104942107018?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8113164104942107018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8113164104942107018' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8113164104942107018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8113164104942107018'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/05/documentwritenoscript.html' title='利用document.write()和noscript标签做内文替换的小技巧'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5623968143285631779</id><published>2010-04-20T14:13:00.002+08:00</published><updated>2010-04-20T14:14:30.244+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='z-index'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='Select'/><category scheme='http://www.blogger.com/atom/ns#' term='IE6'/><title type='text'>IE6中select组件与css中z-index的冲突</title><content type='html'>在&lt;a href="http://www.webreference.com/dhtml/diner/seethru/"&gt;Positioned Elements and OS Controls, Applets and Plug-ins&lt;/a&gt;这篇文章中，描述了当position为absolute一个DIV被拖到select组件上方的时候，在IE6中，select组件会透过DIV层显示出来，这并不是想要的效果，这个问题并非是一个bug，因为在IE6中，select元素是一个window控制组件，并不支持z-index属性，在IE7之后则开始支持z-index属性，更详细的说明可查看&lt;a href="http://msdn.microsoft.com/en-us/library/ms535893.aspx"&gt;MSDN&lt;/a&gt;关于select的文档：&lt;br /&gt;From Microsoft Internet Explorer 5 to Internet Explorer 6, This element is a windowed control and does not support the z-index attribute or zIndex property.&lt;br /&gt;As of Internet Explorer 7, this element is windowless and supports the z-index attribute and the zIndex property. The SELECT element does not require a strict doctype to enable windowless functionality.&lt;br /&gt;This element is an inline element.&lt;br /&gt;This element requires a closing tag.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5623968143285631779?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5623968143285631779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5623968143285631779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5623968143285631779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5623968143285631779'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/04/ie6selectcssz-index.html' title='IE6中select组件与css中z-index的冲突'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7272470224887856015</id><published>2010-03-26T15:08:00.001+08:00</published><updated>2010-10-24T23:38:33.120+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='IE8'/><category scheme='http://www.blogger.com/atom/ns#' term='Var'/><title type='text'>notice "var" keywords of javascript in IE8</title><content type='html'>当前测试只是针对IE8，没有测试之前IE版本，以下代码在firefox/chrome中会按预期一样正常运行，代码测试注意打开firebug或者是console查看输出:&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;// window.a 设置一个属性a到window上&lt;br /&gt;window.a = 1;&lt;br /&gt;// 正常打印出a:1&lt;br /&gt;window.console.log(a);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;// 必须在此分二块script来写，如果写在一块script标签内，都会正常执行&lt;br /&gt;// 在同一个script代码块内，javascript会解析当前代码块中所有的变量(之前没有出现过的变量名)，并且都为 undefined&lt;br /&gt;// 在这里还没有执行到var a=2，a为 undefined&lt;br /&gt;// 针对IE8: window.a 也被置为 undefined&lt;br /&gt;// 其他浏览器: window.a前面代码中已经定义，所以这里还是原来的值：1，而非像IE8中一样为 undefined&lt;br /&gt;window.console.log(a);&lt;br /&gt;var a = 2; // 注意前面有个变量声明: var&lt;br /&gt;window.console.log(a);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;window.console.log(a);&lt;br /&gt;// 这里因为没有用var新定义变量，所以a即为window.a，只是对变量重新赋值，代码执行没有问题&lt;br /&gt;a = 3; // 注意前面没有变量声明: var&lt;br /&gt;window.console.log(a);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;以上代码在firefox/chrome中执行结果为： 1 1 2 2 3&lt;br /&gt;以上代码在IE8中执行结果为： 1 undefined 2 2 3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7272470224887856015?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7272470224887856015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7272470224887856015' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7272470224887856015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7272470224887856015'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/03/notice-var-keywords-of-javascript-in.html' title='notice &quot;var&quot; keywords of javascript in IE8'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8972762185253453609</id><published>2010-03-26T11:20:00.005+08:00</published><updated>2010-10-24T23:38:59.026+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='Gvim'/><title type='text'>隐藏ubuntu命令行中运行gvim的警告信息</title><content type='html'>$&gt; gvim&lt;br /&gt;** (gvim:6676): CRITICAL **: gtk_form_set_static_gravity: assertion `static_gravity_supported' failed&lt;br /&gt;** (gvim:6676): CRITICAL **: gtk_form_set_static_gravity: assertion `static_gravity_supported' failed&lt;br /&gt;** (gvim:6676): CRITICAL **: gtk_form_set_static_gravity: assertion `static_gravity_supported' failed&lt;br /&gt;** (gvim:6676): CRITICAL **: gtk_form_set_static_gravity: assertion `static_gravity_supported' failed&lt;br /&gt;** (gvim:6676): CRITICAL **: gtk_form_set_static_gravity: assertion `static_gravity_supported' failed&lt;br /&gt;&lt;br /&gt;每次运行看到这些警告很不爽，网上找了一下，发现是一个待修正的问题，暂时只能将错误重定向到个人目录的.xsession-errors中，重写一个gvim的命令，放在个人主目录~/bin下：&lt;br /&gt;&lt;div class="pre"&gt;#!/bin/bash&lt;br /&gt;## Execute gvim, sending X/gtk errors to the standard place.&lt;br /&gt;exec /usr/bin/gvim $* &gt; /dev/null 2&gt;&gt;$HOME/.xsession-errors&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8972762185253453609?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8972762185253453609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8972762185253453609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8972762185253453609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8972762185253453609'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/03/ubuntugvim.html' title='隐藏ubuntu命令行中运行gvim的警告信息'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5137876825253289493</id><published>2010-03-09T15:25:00.004+08:00</published><updated>2010-10-24T23:39:17.256+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Config'/><title type='text'>一个tomcat启动二个不同端口的web服务</title><content type='html'>首先在server.xml模仿Service Catalina一样再配一个Service，修改Service/Engine的name，Connector的port&lt;br /&gt;&lt;div class="pre"&gt;&amp;lt;Service name="Catalina2"&amp;gt;&lt;br /&gt;&amp;lt;Connector port="8081" /&amp;gt;&lt;br /&gt;&amp;lt;Engine name="Catalina2" defaultHost="localhost"&amp;gt;&lt;br /&gt;&amp;lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"&lt;br /&gt;resourceName="UserDatabase"/&amp;gt;&lt;br /&gt;&amp;lt;Host name="localhost" appBase="webapps"&lt;br /&gt;unpackWARs="true" autoDeploy="true"&lt;br /&gt;xmlValidation="false" xmlNamespaceAware="false"&amp;gt;&lt;br /&gt;&amp;lt;/Host&amp;gt;&lt;br /&gt;&amp;lt;/Engine&amp;gt;&lt;br /&gt;&amp;lt;/Service&amp;gt;&lt;br /&gt;&lt;/div&gt;其次复制conf下的Catalina整个目录为新的Service名字，注意里面localhost文件夹里的配置因项目不同，进行调整：&lt;br /&gt;$&gt; cp -r conf/Catalina conf/Catalina2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5137876825253289493?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5137876825253289493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5137876825253289493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5137876825253289493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5137876825253289493'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/03/tomcatweb.html' title='一个tomcat启动二个不同端口的web服务'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4648865662442707106</id><published>2010-03-01T17:37:00.002+08:00</published><updated>2010-10-24T23:40:46.739+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='ctags'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Ctags for rails and gvim</title><content type='html'>ctags支持41种语言，常见的 JAVA/C/C++/JavaScript/PHP/Perl/Python/Ruby等都包括其中，更多信息可查看&lt;a href="http://ctags.sourceforge.net/index.html"&gt;官网&lt;/a&gt;和&lt;a href="http://ctags.sourceforge.net/ctags.html"&gt;帮助手册&lt;/a&gt;。&lt;br /&gt;&lt;br /&gt;在ubuntu中安装ctags:&lt;br /&gt;&lt;div class="pre"&gt;$&gt; sudo apt-get install exuberant-ctags&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;在rails项目下生成ctags文件，生成的TAGS文件可以用于vim/emacs等编辑器：&lt;br /&gt;&lt;div class="pre"&gt;$&gt; ctags-exuberant -a -e -f TAGS --tag-relative -R app lib vendor /opt/ruby-enterprise/lib/ruby/gems/1.8/gems&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;在gvim中常的操作有以下4个：&lt;br /&gt;&lt;div class="pre"&gt;$&gt; gvim −t tag&lt;/div&gt;&lt;br /&gt;打开定义 tag 的文件。&lt;br /&gt;&lt;br /&gt;在vi中使用:ta tag打开定义tag的文件&lt;br /&gt;&lt;div class="pre"&gt;:ta tag  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;在vi的指针位置打开定义所在tag的文件&lt;br /&gt;&lt;div class="pre"&gt;Ctrl-]&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;回退到之前的位置 &lt;br /&gt;&lt;div class="pre"&gt;Ctrl-T&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4648865662442707106?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4648865662442707106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4648865662442707106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4648865662442707106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4648865662442707106'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/03/ctags-for-rails-and-gvim.html' title='Ctags for rails and gvim'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4363160112906096029</id><published>2010-03-01T14:06:00.004+08:00</published><updated>2010-10-24T23:41:33.638+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Debugger'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Debugging rails with ruby-debug</title><content type='html'>1. setup&lt;br /&gt;$&gt; sudo gem install ruby-debug &lt;br /&gt;&lt;br /&gt;2. start rails webrick/mongrel web server&lt;br /&gt;$&gt; script/server --debugger&lt;br /&gt;&lt;br /&gt;3. using debugger in controller&lt;br /&gt;&lt;div class="pre"&gt;class PeopleController &lt; ApplicationController   def new     debugger # 当应用程序访问到此行时，在console中会出现debugger控制台    @person = Person.new   end end&lt;/div&gt;&lt;br /&gt;4. debugger shell 命令帮助&lt;br /&gt;&lt;div class="pre"&gt;(rdb:40) help&lt;br /&gt;ruby-debug help v0.10.3&lt;br /&gt;Type 'help &lt;command-name&gt;' for help on a specific command&lt;br /&gt;&lt;br /&gt;Available commands:&lt;br /&gt;backtrace  delete   enable  help    next  quit     show   &lt;br /&gt;break      disable  eval    info    p     reload   source &lt;br /&gt;catch      display  exit    irb     pp    restart  step   &lt;br /&gt;condition  down     finish  list    ps    save     thread &lt;br /&gt;continue   edit     frame   method  putl  set      trace &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;其中比较常用的是next/list/continue/method/backtrace命令。&lt;br /&gt;&lt;br /&gt;更多关于ruby-debug，查看以下链接：&lt;br /&gt;&lt;a href="http://articles.sitepoint.com/article/debug-rails-app-ruby-debug"&gt;http://articles.sitepoint.com/article/debug-rails-app-ruby-debug&lt;/a&gt;&lt;br /&gt;&lt;a href="http://guides.rubyonrails.org/debugging_rails_applications.html"&gt;http://guides.rubyonrails.org/debugging_rails_applications.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4363160112906096029?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4363160112906096029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4363160112906096029' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4363160112906096029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4363160112906096029'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/03/debugging-rails-with-ruby-debug.html' title='Debugging rails with ruby-debug'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6199648109168754868</id><published>2010-02-03T16:46:00.003+08:00</published><updated>2010-02-03T17:11:05.851+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Margin'/><category scheme='http://www.blogger.com/atom/ns#' term='Table'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='Browser'/><title type='text'>collapsing margins of table</title><content type='html'>display=block的元素，垂直方向的collapsing margins会发生重合。&lt;br /&gt;IE8/safari/chrome中table默认的display=table，其渲染时vertical margin会发生重合，与display=block的元素效果一样，但在firefox中测试其效果与float元素的效果一样，不会发生垂直方向的margin重合。&lt;br /&gt;个人的解决方法是将table设置为float=left，并在其后设置一个clear=both的DIV，避免table的margin被重合。&lt;br /&gt;&lt;br /&gt;关于collapsing margins详细说明可查看CSS21规范的8.3.1 Collapsing margins。&lt;br /&gt;另外对于一个maring:10px的DIV元素，如果此元素没有内容，并没有设置padding和border值，其上部的margin与其下部的margin也会重合，也就是此DIV在垂直方向上只会占据10px的高度。如果此DIV的top或者bottom与别的元素发生过重合，则其本身的top和bottom margin不会再重合。&lt;br /&gt;规范原文说明如下：&lt;br /&gt;If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it. In this case, the position of the element depends on its relationship with the other elements whose margins are being collapsed.&lt;br /&gt;If the element’s margins are collapsed with its parent’s top margin, the top border edge of the box is defined to be the same as the parent’s.&lt;br /&gt;Otherwise, either the element’s parent is not taking part in the margin collapsing, or only the parent’s bottom margin is involved. The position of the element’s top border edge is the same as it would have been if the element had a non-zero top border.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6199648109168754868?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6199648109168754868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6199648109168754868' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6199648109168754868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6199648109168754868'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/02/collapsing-margins-of-table.html' title='collapsing margins of table'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-209432371459372552</id><published>2010-01-28T15:35:00.001+08:00</published><updated>2010-01-28T15:36:02.550+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Client'/><category scheme='http://www.blogger.com/atom/ns#' term='commands'/><title type='text'>mysql 客户端中比较有用的几个命令</title><content type='html'>mysql&amp;gt; help&lt;br /&gt;&lt;br /&gt;For information about MySQL products and services, visit:&lt;br /&gt;&amp;nbsp;&amp;nbsp; http://www.mysql.com/&lt;br /&gt;For developer information, including the MySQL Reference Manual, visit:&lt;br /&gt;&amp;nbsp;&amp;nbsp; http://dev.mysql.com/&lt;br /&gt;To buy MySQL Network Support, training, or other products, visit:&lt;br /&gt;&amp;nbsp;&amp;nbsp; https://shop.mysql.com/&lt;br /&gt;&lt;br /&gt;List of all MySQL commands:&lt;br /&gt;Note that all text commands must be first on line and end with ';'&lt;br /&gt;? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (\?) Synonym for `help'.&lt;br /&gt;clear &amp;nbsp; &amp;nbsp; (\c) Clear the current input statement.&lt;br /&gt;connect &amp;nbsp; (\r) Reconnect to the server. Optional arguments are db and host.&lt;br /&gt;delimiter (\d) Set statement delimiter.&lt;br /&gt;edit &amp;nbsp; &amp;nbsp; &amp;nbsp;(\e) Edit command with $EDITOR.&lt;br /&gt;ego &amp;nbsp; &amp;nbsp; &amp;nbsp; (\G) Send command to mysql server, display result vertically.&lt;br /&gt;exit &amp;nbsp; &amp;nbsp; &amp;nbsp;(\q) Exit mysql. Same as quit.&lt;br /&gt;go &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(\g) Send command to mysql server.&lt;br /&gt;help &amp;nbsp; &amp;nbsp; &amp;nbsp;(\h) Display this help.&lt;br /&gt;nopager &amp;nbsp; (\n) Disable pager, print to stdout.&lt;br /&gt;notee &amp;nbsp; &amp;nbsp; (\t) Don't write into outfile.&lt;br /&gt;pager &amp;nbsp; &amp;nbsp; (\P) Set PAGER [to_pager]. Print the query results via PAGER.&lt;br /&gt;print &amp;nbsp; &amp;nbsp; (\p) Print current command.&lt;br /&gt;prompt &amp;nbsp; &amp;nbsp;(\R) Change your mysql prompt.&lt;br /&gt;quit &amp;nbsp; &amp;nbsp; &amp;nbsp;(\q) Quit mysql.&lt;br /&gt;rehash &amp;nbsp; &amp;nbsp;(\#) Rebuild completion hash.&lt;br /&gt;source &amp;nbsp; &amp;nbsp;(\.) Execute an SQL script file. Takes a file name as an argument.&lt;br /&gt;status &amp;nbsp; &amp;nbsp;(\s) Get status information from the server.&lt;br /&gt;system &amp;nbsp; &amp;nbsp;(\!) Execute a system shell command.&lt;br /&gt;tee &amp;nbsp; &amp;nbsp; &amp;nbsp; (\T) Set outfile [to_outfile]. Append everything into given outfile.&lt;br /&gt;use &amp;nbsp; &amp;nbsp; &amp;nbsp; (\u) Use another database. Takes database name as argument.&lt;br /&gt;charset &amp;nbsp; (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.&lt;br /&gt;warnings &amp;nbsp;(\W) Show warnings after every statement.&lt;br /&gt;nowarning (\w) Don't show warnings after every statement.&lt;br /&gt;&lt;br /&gt;For server side help, type 'help contents'&lt;br /&gt;&lt;br /&gt;谈一下个人觉得上面比较有用的几个命令：&lt;br /&gt;1、 edit&lt;br /&gt;mysql&amp;gt;\e&lt;br /&gt;输入\e后调用系统的默认文本编辑器，如vi出来，用于编辑SQL语句，避免直接在命令行中，太长的SQL输入错误，修改起来麻烦，输入完成保存退出即运行。&lt;br /&gt;&lt;br /&gt;2、 pager&lt;br /&gt;利用此命令最方便就是可以结合less查看输出结果，有时比用\G输出要方便整齐。在mysql命令行中输入：&lt;br /&gt;mysql&amp;gt;pager less -S&lt;br /&gt;之后的查询就会以不折行的形式输出到控制台。另一个用法是将SQL输出重定向到另外一个文本日志文件中：&lt;br /&gt;mysql&amp;gt;pager cat &amp;gt; /tmp/sql_log.txt&lt;br /&gt;以后的查询生成结果会被写入此文件中。&lt;br /&gt;&lt;br /&gt;3、 tee&lt;br /&gt;这个命令的功能与pager重定向日志文件类似，可以将生成的日志写入外部文件中。&lt;br /&gt;mysql&amp;gt;tee /tmp/sql_log.txt&lt;br /&gt;&lt;br /&gt;4、 system&lt;br /&gt;在mysql console中运行外部操作系统的命令：&lt;br /&gt;mysql&amp;gt;\! ls -l&lt;br /&gt;&lt;br /&gt;5、 source&lt;br /&gt;执行外部的SQL文件，有时在命令行中直接导入外部的一个SQL文件：&lt;br /&gt;mysql&amp;gt;source /home/yu/test.sql;&lt;br /&gt;这个与在操作系统命令行下执行：&lt;br /&gt;$&amp;gt;mysql -u test -p &amp;lt; /home/yu/test.sql&lt;br /&gt;效果一样。&lt;br /&gt;&lt;br /&gt;Reference:&lt;br /&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html"&gt;http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-209432371459372552?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/209432371459372552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=209432371459372552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/209432371459372552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/209432371459372552'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2010/01/mysql.html' title='mysql 客户端中比较有用的几个命令'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6498952169583636716</id><published>2009-12-10T12:39:00.003+08:00</published><updated>2009-12-14T16:04:23.973+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Replication'/><category scheme='http://www.blogger.com/atom/ns#' term='Slave'/><title type='text'>MySQL5.0 同步备份恢复的三种方法</title><content type='html'>第一种最简单的方法适用于数据库文件比较小，能在停止主数据库服务后几分钟内打完tar包的情况，这种情况与第一次做slave同步的方法一样：&lt;br /&gt;mysql&amp;gt; FLUSH TABLES WITH READ LOCK;&lt;br /&gt;mysql &amp;gt; SHOW MASTER STATUS;&lt;br /&gt;记录状态后进入命令行将数据库原生数据文件打个tar包，再&lt;br /&gt;mysql&amp;gt; UNLOCK TABLES;&lt;br /&gt;将tar包重布署到MySQL slave上即可，注意将tar包中的日志文件，master.info，relay-log.info要删除之后再CHANGE MASTER TO。&lt;br /&gt;&lt;br /&gt;第二种方法是利用mysql的二进制日志文件。&lt;br /&gt;首先重启一次主数据库。&lt;br /&gt;然后在slave上用以下命令查看二进制日志文件执行的最后SQL语句，其中start-datetime时间为此二进制日志文件最后的修改时间，或者提前30秒方便查看最后执行完成的SQL语句：&lt;br /&gt;$&amp;gt; mysqlbinlog -S /tmp/mysql.sock hostname-relay-bin.000002 --start-datetime='2009-12-11 11:12:00'&lt;br /&gt;&lt;br /&gt;然后在主数据库上用命令筛选出符合时间范围的日志：&lt;br /&gt;$&amp;gt; mysqlbinlog --start-datetime='2009-12-11 11:12:00' -S /tmp/mysql.sock mysql-bin.000007 &amp;gt; /home/username/bin-log.sql&lt;br /&gt;再用grep命令，查找到bin-log.sql中与之前在slave上查到的SQL行号，并用sed命令删除1到此行号的全部行(举例查到行号为1234)：&lt;br /&gt;$&amp;gt; grep -n "last executed sql statement" /home/username/bin-log.sql&lt;br /&gt;$&amp;gt; sed '1,1234d' /home/username/bin-log.sql &amp;gt; /home/username/bin-log-sed.sql&lt;br /&gt;将生成的bin-log-sed.sql文件传到slave数据库上用mysql命令行工具导入数据。&lt;br /&gt;$&amp;gt; mysql -uroot -p &amp;lt; bin-log-sed.sql&lt;br /&gt;如果碰到报错，用sed再删除sql文件的前几行导入。&lt;br /&gt;导入完成后，进行mysql控制台，下面的master_log_file是同步中断的主数据库日志文件mysql-bin.000007的后继日志文件名mysql-bin.000008：&lt;br /&gt;$&amp;gt; stop slave;&lt;br /&gt;$&amp;gt; change master to master_log_file='mysql-bin.000008', master_log_pos=98;&lt;br /&gt;$&amp;gt; start slave;&lt;br /&gt;$&amp;gt; show slave status\G&lt;br /&gt;&lt;br /&gt;第三种方法也是利用二进制日志文件恢复。&lt;br /&gt;与第二种方法类似，只是在grep查到行号之后，用awk命令找到日志中断的位置，重新调整slave上的master_log_pos即可。&lt;br /&gt;举例查到行号为1234：&lt;br /&gt;$&amp;gt; cat /home/username/bin-log.sql |awk 'NR &amp;gt;= 1234 {print $0}' |more&lt;br /&gt;可以找到最后执行完的那个SQL之后，服务器的二进制日志文件位置：&lt;br /&gt;last executed sql statuement;&lt;br /&gt;之后会看到类似：&lt;br /&gt;# at 1023411738&lt;br /&gt;这样的内容，用这个值更新slave上的master信息：&lt;br /&gt;$&amp;gt; stop slave;&lt;br /&gt;$&amp;gt; change master to master_log_file='mysql-bin.000007', master_log_pos=1023411738;&lt;br /&gt;$&amp;gt; start slave;&lt;br /&gt;$&amp;gt; show slave status\G&lt;br /&gt;在slave的二进制日志或者是hostname-relay-log.info，hostname.err中也会有master上的end_log_pos，可以先尝试用一下，一般因为master/slave异常才导致同步失败，在slave上的这些信息已经不正确，所以需要用awk找到服务器上的二进制日志位置。&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6498952169583636716?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6498952169583636716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6498952169583636716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6498952169583636716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6498952169583636716'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/12/mysql50.html' title='MySQL5.0 同步备份恢复的三种方法'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4806815771429220232</id><published>2009-12-10T11:46:00.003+08:00</published><updated>2009-12-10T11:47:48.492+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql5'/><category scheme='http://www.blogger.com/atom/ns#' term='Slave'/><title type='text'>MySQL5 Replication fails with "log event entry exceeded max_allowed_packet"</title><content type='html'>配置文件中有二个参数设置需要注意，max_allowed_packet在主从服务器上的设置最好是设置相同，并且将read_buffer_size &amp;lt;= max_allowed_packet。&amp;nbsp; &lt;br /&gt;如果这二个配置正确，仍然报错，则需要STOP SLAVE; 并CHANGE MASTER TO，调整master_log_pos的值，这个值与服务器的日志文件要对应上。&lt;br /&gt;Reference:  &lt;a href="http://bugs.mysql.com/bug.php?id=15937"&gt;http://bugs.mysql.com/bug.php?id=15937&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bugs.mysql.com/bug.php?id=8215"&gt;http://bugs.mysql.com/bug.php?id=8215&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4806815771429220232?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4806815771429220232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4806815771429220232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4806815771429220232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4806815771429220232'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/12/mysql5-replication-fails-with-log-event.html' title='MySQL5 Replication fails with &quot;log event entry exceeded max_allowed_packet&quot;'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-805678326786587092</id><published>2009-12-03T13:56:00.002+08:00</published><updated>2010-10-24T23:42:37.552+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='uuid'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql5'/><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><title type='text'>mysql5中注意UUID函数的使用</title><content type='html'>NOW() 函数，因为在二进制日志里已经包括了时间戳，可以被正确复制到slave server上。&lt;br /&gt;UUID() 函数，具有非确定性，所以不能被复制到slave server，所以在存储过程或者触发器中要慎用。&lt;br /&gt;the UUID() function is nondeterministic (and does not replicate). You should be careful about using such functions in triggers. It is not safe.&lt;br /&gt;SYSDATE() 函数也具有非确定性，与NOW()函数不一样，在同步复制时会与master上的时间不一致。官方文档说明如下：&lt;br /&gt;SYSDATE() &lt;br /&gt;Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. &lt;br /&gt;&lt;br /&gt;As of MySQL 5.0.13, SYSDATE() returns the time at which it executes. This differs from the behavior for NOW(), which returns a constant time that indicates the time at which the statement began to execute. (Within a stored routine or trigger, NOW() returns the time at which the routine or triggering statement began to execute.) &lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;mysql&gt; SELECT NOW(), SLEEP(2), NOW();&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;| NOW()               | SLEEP(2) | NOW()               |&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;| 2006-04-12 13:47:36 |        0 | 2006-04-12 13:47:36 |&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;&lt;br /&gt;mysql&gt; SELECT SYSDATE(), SLEEP(2), SYSDATE();&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;| SYSDATE()           | SLEEP(2) | SYSDATE()           |&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;| 2006-04-12 13:47:44 |        0 | 2006-04-12 13:47:46 |&lt;br /&gt;+---------------------+----------+---------------------+&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In addition, the SET TIMESTAMP statement affects the value returned by NOW() but not by SYSDATE(). This means that timestamp settings in the binary log have no effect on invocations of SYSDATE(). &lt;br /&gt;&lt;br /&gt;Because SYSDATE() can return different values even within the same statement, and is not affected by SET TIMESTAMP, it is non-deterministic and therefore unsafe for replication. If that is a problem, you can start the server with the --sysdate-is-now option to cause SYSDATE() to be an alias for NOW(). The non-deterministic nature of SYSDATE() also means that indexes cannot be used for evaluating expressions that refer to it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-805678326786587092?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/805678326786587092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=805678326786587092' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/805678326786587092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/805678326786587092'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/12/mysql5uuid.html' title='mysql5中注意UUID函数的使用'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5779385617834756696</id><published>2009-12-02T14:42:00.006+08:00</published><updated>2010-10-24T23:43:54.911+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql5'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>在64位的CentOS5中编译安装mysql5.0.88</title><content type='html'>&lt;div class="pre"&gt;$&amp;gt; wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.88.zip/from/http://mysql.byungsoo.net/&lt;br /&gt;$&amp;gt; yum -y install gcc&lt;br /&gt;$&amp;gt; yum -y install gcc-c++&lt;br /&gt;$&amp;gt; yum -y install ncurses-devel&lt;br /&gt;&lt;br /&gt;$&amp;gt; CC=gcc \&lt;br /&gt;CFLAGS="-O3 -fno-omit-frame-pointer" \&lt;br /&gt;CXX=gcc \&lt;br /&gt;CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" \&lt;br /&gt;./configure --prefix=/usr/local/mysql --without-debug --with-big-tables --with-unix-socket-path=/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=gbk,gb2312,utf8 --with-pthread --enable-thread-safe-client&lt;br /&gt;&lt;br /&gt;$&amp;gt; make &amp;amp;&amp;amp; make install&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reference: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/linux-ia-64.html"&gt;http://dev.mysql.com/doc/refman/5.0/en/linux-ia-64.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5779385617834756696?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5779385617834756696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5779385617834756696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5779385617834756696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5779385617834756696'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/12/64centos5mysql5088.html' title='在64位的CentOS5中编译安装mysql5.0.88'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-422323295389347104</id><published>2009-12-02T14:36:00.000+08:00</published><updated>2009-12-02T14:36:46.136+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bashrc'/><title type='text'>.bashrc中rc的含义说明</title><content type='html'>rc (像是 ".cshrc" 或 "/etc/rc" 中的 rc 这两个字母) = "RunCom"&lt;br /&gt;&lt;br /&gt;"rc" 是取自 "runcom", 来自麻省理工学院在 1965 年发展的 CTSS系统。相关文献曾记载这一段话:&lt;br /&gt;具有从档案中取出一系列命令来执行的功能；这称为 "run commands" 又称为 "runcom"，而这种档案又称为一个 runcom (a runcom)。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-422323295389347104?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/422323295389347104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=422323295389347104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/422323295389347104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/422323295389347104'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/12/bashrcrc.html' title='.bashrc中rc的含义说明'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1406119492535477612</id><published>2009-11-09T17:20:00.000+08:00</published><updated>2009-11-09T17:20:37.522+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='directory'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='mkdir'/><title type='text'>在linux命令行中批量新建文件夹</title><content type='html'>&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: arial, 'san serif'; font-size: 14px; line-height: 21px;"&gt;$&amp;gt; printf 'dir%01d\n' {1..100} | xargs mkdir&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1406119492535477612?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1406119492535477612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1406119492535477612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1406119492535477612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1406119492535477612'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/11/linux.html' title='在linux命令行中批量新建文件夹'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1909480607875482532</id><published>2009-11-09T15:55:00.000+08:00</published><updated>2009-11-09T15:55:16.419+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Optimize'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Configure'/><title type='text'>Mysql Server System Variables</title><content type='html'>mysql 数据库中几个系统变量的分析说明&lt;br /&gt;&lt;br /&gt;connect_timeout&lt;br /&gt;&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--connect_timeout=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;connect_timeout&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, connect_timeout&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;connect_timeout&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values (&amp;lt;= 5.1.22)&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values (&amp;gt;= 5.1.23)&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;10&lt;br /&gt;&lt;br /&gt;The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake. The default value is 10 seconds as of MySQL 5.1.23 and 5 seconds before that.&lt;br /&gt;Increasing the connect_timeout value might help if clients frequently encounter errors of the form Lost connection to MySQL server at 'XXX', system error: errno.&lt;br /&gt;增加此值可以解决此问题：Lost connection to MySQL server at 'XXX', system error: errno. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;delay_key_write&lt;br /&gt;&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--delay-key-write[=name]&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;delay-key-write&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, delay_key_write&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;delay-key-write&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;enumeration&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ON&lt;br /&gt;Valid Values &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ON, OFF, ALL&lt;br /&gt;&lt;br /&gt;This option applies only to MyISAM tables.&lt;br /&gt;此参数只针对MyISAM表。&lt;br /&gt;It can have one of the following values to affect handling of the DELAY_KEY_WRITE table option that can be used in CREATE TABLE statements.&lt;br /&gt;Option &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Description&lt;br /&gt;OFF &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;DELAY_KEY_WRITE is ignored.&lt;br /&gt;ON &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;MySQL honors any DELAY_KEY_WRITE option specified in CREATE TABLE statements. This is the default value.&lt;br /&gt;ALL &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;All new opened tables are treated as if they were created with the DELAY_KEY_WRITE option enabled.&lt;br /&gt;&lt;br /&gt;If DELAY_KEY_WRITE is enabled for a table, the key buffer is not flushed for the table on every index update, but only when the table is closed. This speeds up writes on keys a lot, but if you use this feature, you should add automatic checking of all MyISAM tables by starting the server with the --myisam-recover option (for example, --myisam-recover=BACKUP,FORCE). See Section 5.1.2, “Server Command Options”, and Section 13.5.1, “MyISAM Startup Options”.&lt;br /&gt;Warning&lt;br /&gt;如果启用了DELAY_KEY_WRITE，说明使用该项的表的键缓冲区在每次更新索引时不被清空，只有关闭表时才清空。遮掩盖可以大大加快键的写操作，但如果你使用该特性，你应用--myisam-recover选项启动服务器，为所有MyISAM表添加自动检查(例如，--myisam-recover=BACKUP,FORCE)。&lt;br /&gt;If you enable external locking with --external-locking, there is no protection against index corruption for tables that use delayed key writes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;expire_logs_days&lt;br /&gt;&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--expire_logs_days=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;expire_logs_days&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, expire_logs_days&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;expire_logs_days&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0-99&lt;br /&gt;&lt;br /&gt;The number of days for automatic binary log removal. The default is 0, which means “no automatic removal.” Possible removals happen at startup and when the binary log is flushed.&lt;br /&gt;二进制日志自动删除的天数，可设置值的范围为0至99。默认值为0,表示“没有自动删除”。启动时和二进制日志循环时可能删除。&lt;br /&gt;&lt;br /&gt;init_connect&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--init-connect=name&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;init_connect&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, init_connect&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;init_connect&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;string&lt;br /&gt;&lt;br /&gt;A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters. For example, each client begins by default with autocommit mode enabled. There is no global system variable to specify that autocommit should be disabled by default, but init_connect can be used to achieve the same effect:&lt;br /&gt;&lt;br /&gt;SET GLOBAL init_connect='SET autocommit=0';&lt;br /&gt;&lt;br /&gt;This variable can also be set on the command line or in an option file. To set the variable as just shown using an option file, include these lines:&lt;br /&gt;&lt;br /&gt;[mysqld]&lt;br /&gt;init_connect='SET autocommit=0'&lt;br /&gt;&lt;br /&gt;Note that the content of init_connect is not executed for users that have the SUPER privilege. This is done so that an erroneous value for init_connect does not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executing init_connect for users that have the SUPER privilege enables them to open a connection and fix the init_connect value.&lt;br /&gt;在这里比较常用的初始化语句是设置一个字符集，当然也可以直接修改my.cnf中的配置参数(character_set_connection/character_set_client等)：&lt;br /&gt;[mysqld]&lt;br /&gt;init_connect='SET names utf8'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;interactive_timeout&lt;br /&gt;&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--interactive_timeout=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;interactive_timeout&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, interactive_timeout&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;interactive_timeout&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;28800&lt;br /&gt;Min Value &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1&lt;br /&gt;&lt;br /&gt;The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the CLIENT_INTERACTIVE option to mysql_real_connect(). See also wait_timeout.&lt;br /&gt;一个连接如果长时间空闲会被mysql服务端强行关闭掉，其默认的时间是8小时，在用JDBC连接到mysql中，如果池里的连接超过8小时没有使用，就会产生连接异常。&lt;br /&gt;&lt;br /&gt;wait_timeout&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--wait_timeout=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;wait_timeout&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, wait_timeout&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;wait_timeout&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;28800&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-31536000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type (windows) &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;28800&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-2147483&lt;br /&gt;&lt;br /&gt;The number of seconds the server waits for activity on a noninteractive connection before closing it. This timeout applies only to TCP/IP and Unix socket file connections, not to connections made via named pipes, or shared memory.&lt;br /&gt;&lt;br /&gt;On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()).&lt;br /&gt;这个值一般不需要去设置，只要设置interactive_timeout。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;join_buffer_size&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--join_buffer_size=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;join_buffer_size&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, join_buffer_size&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;join_buffer_size&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Platform Bit Size &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;131072&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;8200-18446744073709547520&lt;br /&gt;&lt;br /&gt;The size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. Increase the value of join_buffer_size to get a faster full join when adding indexes is not possible. One join buffer is allocated for each full join between two tables. For a complex join between several tables for which indexes are not used, multiple join buffers might be necessary.&lt;br /&gt;&lt;br /&gt;The maximum allowable setting for join_buffer_size is 4GB. As of MySQL 5.1.23, values larger than 4GB are allowed for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB with a warning).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;key_buffer_size&lt;br /&gt;&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--key_buffer_size=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;key_buffer_size&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, key_buffer_size&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;key_buffer_size&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;8388608&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;8-4294967295&lt;br /&gt;&lt;br /&gt;此参数仅用于MyISAM表中，一般此值可设置为物理内存的25-50%，尽可能的使用 Key_reads/Key_read_requests 的比率小于0.01，最重要的mysql性能调优参数。&lt;br /&gt;&lt;br /&gt;Index blocks for MyISAM tables are buffered and are shared by all threads. key_buffer_size is the size of the buffer used for index blocks. The key buffer is also known as the key cache.&lt;br /&gt;MyISAM表的索引块分配了缓冲区，由所有线程共享。key_buffer_size是索引块缓冲区的大小。键值缓冲区即为键值缓存。&lt;br /&gt;The maximum allowable setting for key_buffer_size is 4GB on 32-bit platforms. As of MySQL 5.1.23, values larger than 4GB are allowed for 64-bit platforms, except 64-bit Windows prior to MySQL 5.1.31, for which large values are truncated to 4GB with a warning. As of MySQL 5.1.31, values larger than 4GB are also allowed for 64-bit Windows. The effective maximum size might be less, depending on your available physical RAM and per-process RAM limits imposed by your operating system or hardware platform. The value of this variable indicates the amount of memory requested. Internally, the server allocates as much memory as possible up to this amount, but the actual allocation might be less.&lt;br /&gt;key_buffer_size的最大允许设定值为4GB。有效最大值可以更小，取决于可用物理RAM和操作系统或硬件平台强加的每个进程的RAM限制。&lt;br /&gt;You can increase the value to get better index handling for all reads and multiple writes; on a system whose primary function is to run MySQL using the MyISAM storage engine, 25% of the machine's total memory is an acceptable value for this variable. However, you should be aware that, if you make the value too large (for example, more than 50% of the machine's total memory), your system might start to page and become extremely slow. This is because MySQL relies on the operating system to perform file system caching for data reads, so you must leave some room for the file system cache. You should also consider the memory requirements of any other storage engines that you may be using in addition to MyISAM.&lt;br /&gt;增加该值，达到你可以提供的更好的索引处理(所有读和多个写操作)。通常为主要运行MySQL的机器内存的25%。但是，如果你将该值设得过大(例如，大于总内存的50%)，系统将转换为页并变得极慢。MySQL依赖操作系统来执行数据读取时的文件系统缓存，因此你必须为文件系统缓存留一些空间。&lt;br /&gt;For even more speed when writing many rows at the same time, use LOCK TABLES. See Section 7.2.21, “Speed of INSERT Statements”.&lt;br /&gt;同时写多行时要想速度更快，应使用LOCK TABLES。&lt;br /&gt;You can check the performance of the key buffer by issuing a SHOW STATUS statement and examining the Key_read_requests, Key_reads, Key_write_requests, and Key_writes status variables. (See Section 12.5.5, “SHOW Syntax”.) The Key_reads/Key_read_requests ratio should normally be less than 0.01. The Key_writes/Key_write_requests ratio is usually near 1 if you are using mostly updates and deletes, but might be much smaller if you tend to do updates that affect many rows at the same time or if you are using the DELAY_KEY_WRITE table option.&lt;br /&gt;&lt;br /&gt;The fraction of the key buffer in use can be determined using key_buffer_size in conjunction with the Key_blocks_unused status variable and the buffer block size, which is available from the key_cache_block_size system variable:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; ((Key_blocks_unused × key_cache_block_size) / key_buffer_size)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;用key_buffer_size结合Key_blocks_unused状态变量和缓冲区块大小，可以确定使用的键值缓冲区的比例。从key_cache_block_size服务器变量可以获得缓冲区块大小。使用的缓冲区的比例为：&lt;br /&gt;&amp;nbsp;&amp;nbsp; ((Key_blocks_unused * key_cache_block_size) / key_buffer_size)&lt;br /&gt;该值为约数，因为键值缓冲区的部分空间被分配用作内部管理结构。&lt;br /&gt;&lt;br /&gt;可以创建多个MyISAM键值缓存。4GB限制可以适合每个缓存，而不是一个组。&lt;br /&gt;This value is an approximation because some space in the key buffer may be allocated internally for administrative structures.&lt;br /&gt;&lt;br /&gt;It is possible to create multiple MyISAM key caches. The size limit of 4GB applies to each cache individually, not as a group. See Section 7.4.5, “The MyISAM Key Cache”.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;log_slave_updates&lt;br /&gt;&lt;br /&gt;Whether updates received by a slave server from a master server should be logged to the slave's own binary log. Binary logging must be enabled on the slave for this variable to have any effect.&lt;br /&gt;假如mysql slave还用作为master server时，需要设置此参数，记录所有SQL操作，提供其他slave复制。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;log_slow_queries&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--log-slow-queries[=name]&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;log-slow-queries&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, log_slow_queries&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;log_slow_queries&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;boolean&lt;br /&gt;&lt;br /&gt;Whether slow queries should be logged. “Slow” is determined by the value of the long_query_time variable.&lt;br /&gt;记录查询非常慢的SQL到一个独立的日志文件中，可用于SQL分析和优化。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;lower_case_file_system&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--lower_case_file_system[=#]&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;lower_case_file_system&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, lower_case_file_system&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;lower_case_file_system&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;No&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;boolean&lt;br /&gt;&lt;br /&gt;This variable describes the case sensitivity of file names on the file system where the data directory is located. OFF means file names are case sensitive, ON means they are not case sensitive.&lt;br /&gt;&lt;br /&gt;lower_case_table_names&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--lower_case_table_names[=#]&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;lower_case_table_names&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, lower_case_table_names&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;lower_case_table_names&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;No&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0-2&lt;br /&gt;&lt;br /&gt;If set to 1, table names are stored in lowercase on disk and table name comparisons are not case sensitive. If set to 2 table names are stored as given but compared in lowercase. This option also applies to database names and table aliases. See Section 8.2.2, “Identifier Case Sensitivity”.&lt;br /&gt;&lt;br /&gt;这个参数在linux服务器上需要注意，一般是将此值设置为1，使表名全部以小写方式写入硬盘，避免表名的大小写问题。&lt;br /&gt;&lt;br /&gt;If you are using InnoDB tables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.&lt;br /&gt;&lt;br /&gt;You should not set this variable to 0 if you are running MySQL on a system that does not have case-sensitive file names (such as Windows or Mac OS X). If this variable is not set at startup and the file system on which the data directory is located does not have case-sensitive file names, MySQL automatically sets lower_case_table_names to 2.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;max_allowed_packet&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--max_allowed_packet=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_allowed_packet&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, max_allowed_packet&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_allowed_packet&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1048576&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1024-1073741824&lt;br /&gt;&lt;br /&gt;The maximum size of one packet or any generated/intermediate string.&lt;br /&gt;&lt;br /&gt;The packet message buffer is initialized to net_buffer_length bytes, but can grow up to max_allowed_packet bytes when needed. This value by default is small, to catch large (possibly incorrect) packets.&lt;br /&gt;&lt;br /&gt;此值需要是1024的一个倍数值，如果操作的数据有使用很长的字符串和大的BLOB字段，如图片，需要增加此值。&lt;br /&gt;You must increase this value if you are using large BLOB columns or long strings. It should be as big as the largest BLOB you want to use. The protocol limit for max_allowed_packet is 1GB. The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.&lt;br /&gt;&lt;br /&gt;When you change the message buffer size by changing the value of the max_allowed_packet variable, you should also change the buffer size on the client side if your client program allows it. On the client side, max_allowed_packet has a default of 1GB. Some programs such as mysql and mysqldump enable you to change the client-side value by setting max_allowed_packet on the command line or in an option file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;max_connect_errors&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--max_connect_errors=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_connect_errors&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, max_connect_errors&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_connect_errors&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Platform Bit Size &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;32&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;10&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-4294967295&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Platform Bit Size &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;10&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-18446744073709547520&lt;br /&gt;&lt;br /&gt;If there are more than this number of interrupted connections from a host, that host is blocked from further connections. You can unblock blocked hosts with the FLUSH HOSTS statement.&lt;br /&gt;如果从某台服务器的连接错误过多，会被mysql服务器阻挡连接。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;max_connections&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--max_connections=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_connections&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, max_connections&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_connections&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values (&amp;lt;= 5.1.14)&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;100&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values (&amp;gt;= 5.1.15)&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;151&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-16384&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values (&amp;gt;= 5.1.17)&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;151&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-100000&lt;br /&gt;&lt;br /&gt;The number of simultaneous client connections allowed. By default, this is 151, beginning with MySQL 5.1.15. (Previously, the default was 100.)&lt;br /&gt;这个值一般都会调整得大一些，如200或者是500，用于处理并发连接数。如果看到“Too many connections”这样的错误提示就是表示mysql服务器的连接数已经被用完。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;max_relay_log_size&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--max_relay_log_size=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_relay_log_size&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, max_relay_log_size&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;max_relay_log_size&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0-1073741824&lt;br /&gt;&lt;br /&gt;If a write by a replication slave to its relay log causes the current log file size to exceed the value of this variable, the slave rotates the relay logs (closes the current file and opens the next one). If max_relay_log_size is 0, the server uses max_binlog_size for both the binary log and the relay log. If max_relay_log_size is greater than 0, it constrains the size of the relay log, which enables you to have different sizes for the two logs. You must set max_relay_log_size to between 4096 bytes and 1GB (inclusive), or to 0. The default value is 0.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;net_read_timeout&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--net_read_timeout=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;net_read_timeout&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, net_read_timeout&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;net_read_timeout&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;30&lt;br /&gt;Min Value &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1&lt;br /&gt;&lt;br /&gt;The number of seconds to wait for more data from a connection before aborting the read. This timeout applies only to TCP/IP connections, not to connections made via Unix socket files, named pipes, or shared memory. When the server is reading from the client, net_read_timeout is the timeout value controlling when to abort. When the server is writing to the client, net_write_timeout is the timeout value controlling when to abort.&lt;br /&gt;此参数只针对TCP/IP的mysql连接，当超过此值的秒数后，服务器端会放弃从客户端读取数据。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;old_passwords&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--old_passwords&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;old-passwords&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, old_passwords&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;old_passwords&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;boolean&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;FALSE&lt;br /&gt;&lt;br /&gt;Whether the server should use pre-4.1-style passwords for MySQL user accounts.&lt;br /&gt;如果客户端收到的错误消息为：“Client does not support authentication protocol”，说明服务器使用的是旧的密码格式，需要为用户按旧的格式重设密码。&lt;br /&gt;mysql&amp;gt;SET PASSWORD 'some_user'@'some_host' = OLD_PASSWORD('newpwd');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;read_only&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--read_only&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;read_only&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, read_only&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;read_only&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;br /&gt;&lt;br /&gt;This variable is off by default. When it is enabled, the server allows no updates except from users that have the SUPER privilege or (on a slave server) from updates performed by slave threads. On a slave server, this can be useful to ensure that the slave accepts updates only from its master server and not from clients. This variable does not apply to TEMPORARY tables, nor does it prevent the server from inserting rows into the log tables (see Section 5.2.1, “Selecting General Query and Slow Query Log Output Destinations”).&lt;br /&gt;&lt;br /&gt;read_only exists only as a GLOBAL variable, so changes to its value require the SUPER privilege. Changes to read_only on a master server are not replicated to slave servers. The value can be set on a slave server independent of the setting on the master.&lt;br /&gt;&lt;br /&gt;As of MySQL 5.1.15, the following conditions apply:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;* If you attempt to enable read_only while you have any explicit locks (acquired with LOCK TABLES) or have a pending transaction, an error occurs.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;* If you attempt to enable read_only while other clients hold explicit table locks or have pending transactions, the attempt blocks until the locks are released and the transactions end. While the attempt to enable read_only is pending, requests by other clients for table locks or to begin transactions also block until read_only has been set.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;* read_only can be enabled while you hold a global read lock (acquired with FLUSH TABLES WITH READ LOCK) because that does not involve table locks.&lt;br /&gt;这个参数用于slave服务器上，可以控制避免同步复制发生问题。在master上设置此值与slave是无关的，二都互相独立。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;server_id&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--server-id=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;server-id&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, server_id&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;server_id&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;0-4294967295&lt;br /&gt;&lt;br /&gt;The server ID, used in replication to give each master and slave a unique identity. This variable is set by the --server-id option. For each server participating in replication, you should pick a positive integer in the range from 1 to 232 – 1 to act as that server's ID.&lt;br /&gt;这个参数用在同步复制时，分配给每个mysql server一个独立唯一的ID标识。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;skip_networking&lt;br /&gt;&lt;br /&gt;This is ON if the server allows only local (non-TCP/IP) connections. On Unix, local connections use a Unix socket file. On Windows, local connections use a named pipe or shared memory. On NetWare, only TCP/IP connections are supported, so do not set this variable to ON. This variable can be set to ON with the --skip-networking option. &lt;br /&gt;这个参数在许多linux发行版中是被打开的，这样如果是通过TCP/IP进行连接的话，是无法连接成功的，需要注释掉这一行设置才可以，或者使用socket进行连接。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;slow_query_log&lt;br /&gt;&lt;br /&gt;Whether the slow query log is enabled. The value can be 0 (or OFF) to disable the log or 1 (or ON) to enable the log. The default value depends on whether the --slow_query_log option is given (--log-slow-queries before MySQL 5.1.29). The destination for log output is controlled by the log_output system variable; if that value is NONE, no log entries are written even if the log is enabled. The slow_query_log variable was added in MySQL 5.1.12.&lt;br /&gt;用于分析查询效率低下的SQL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;slow_query_log_file&lt;br /&gt;Version Introduced &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5.1.12&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--slow-query-log-file=file_name&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;slow_query_log_file&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, slow_query_log_file&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;slow_query_log_file&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;filename&lt;br /&gt;&lt;br /&gt;The name of the slow query log file. The default value is host_name-slow.log, but the initial value can be changed with the --slow_query_log_file option (--log-slow-queries before MySQL 5.1.29). This variable was added in MySQL 5.1.12.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;sort_buffer_size&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--sort_buffer_size=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;sort_buffer_size&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, sort_buffer_size&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;sort_buffer_size&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Both&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Platform Bit Size &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;32&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2097144&lt;br /&gt;Max Value &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;4294967295&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Platform Bit Size &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;2097144&lt;br /&gt;Max Value &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;18446744073709547520&lt;br /&gt;&lt;br /&gt;Each thread that needs to do a sort allocates a buffer of this size. Increase this value for faster ORDER BY or GROUP BY operations. See Section B.5.4.4, “Where MySQL Stores Temporary Files”.&lt;br /&gt;&lt;br /&gt;The maximum allowable setting for sort_buffer_size is 4GB. As of MySQL 5.1.23, values larger than 4GB are allowed for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB with a warning).&lt;br /&gt;对于SQL中用到order by和group by子句的，提高此值可以增加查询的速度。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;table_cache&lt;br /&gt;Version Removed &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5.1.3&lt;br /&gt;Version Deprecated &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5.1.3&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--table_cache=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;table_cache&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, table_cache&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;table_cache&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;Deprecated &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5.1.3, by table_open_cache&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-524288&lt;br /&gt;&lt;br /&gt;This is the old name of table_open_cache before MySQL 5.1.3. From 5.1.3 on, use table_open_cache instead.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;table_open_cache&lt;br /&gt;Version Introduced &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;5.1.3&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--table-open-cache=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;table_open_cache&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;table_open_cache&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;64-524288&lt;br /&gt;&lt;br /&gt;The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. You can check whether you need to increase the table cache by checking the Opened_tables status variable. See Section 5.1.7, “Server Status Variables”. If the value of Opened_tables is large and you don't do FLUSH TABLES often (which just forces all tables to be closed and reopened), then you should increase the value of the table_open_cache variable. For more information about the table cache, see Section 7.4.7, “How MySQL Opens and Closes Tables”. Before MySQL 5.1.3, this variable is called table_cache.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;thread_concurrency&lt;br /&gt;Command Line Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;--thread_concurrency=#&lt;br /&gt;Config File Format &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;thread_concurrency&lt;br /&gt;Option Sets Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Yes, thread_concurrency&lt;br /&gt;Variable Name &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;thread_concurrency&lt;br /&gt;Variable Scope &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Global&lt;br /&gt;Dynamic Variable &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;No&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Permitted Values&lt;br /&gt;Type &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;numeric&lt;br /&gt;Default &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;10&lt;br /&gt;Range &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1-512&lt;br /&gt;&lt;br /&gt;This variable is specific to Solaris systems, for which mysqld invokes the thr_setconcurrency() with the variable value. This function enables applications to give the threads system a hint about the desired number of threads that should be run at the same time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1909480607875482532?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1909480607875482532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1909480607875482532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1909480607875482532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1909480607875482532'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/11/mysql-server-system-variables.html' title='Mysql Server System Variables'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4750889177700218687</id><published>2009-10-27T15:35:00.001+08:00</published><updated>2009-10-27T15:35:10.499+08:00</updated><title type='text'>grep命令参数-显示查询内容的所在行号</title><content type='html'>使用grep命令时，添加行号(-n)可以显示查询内容的所在行的行号，如：&lt;br&gt;$&amp;gt; grep -n ls ~/.bashrc&lt;br&gt;1:# ~/.bashrc: executed by bash(1) for non-login shells.&lt;br&gt;47:    else&lt;br&gt;54:else&lt;br&gt;77:# enable color support of ls and also add handy aliases&lt;br&gt;80:    alias ls=&amp;#39;ls --color=auto&amp;#39;&lt;br&gt;81:    alias ll=&amp;#39;ls -la&amp;#39;&lt;br&gt;90:# some more ls aliases&lt;br&gt;91:#alias ll=&amp;#39;ls -l&amp;#39;&lt;br&gt;92:#alias la=&amp;#39;ls -A&amp;#39;&lt;br&gt;93:#alias l=&amp;#39;ls -CF&amp;#39;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4750889177700218687?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4750889177700218687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4750889177700218687' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4750889177700218687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4750889177700218687'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/10/grep.html' title='grep命令参数-显示查询内容的所在行号'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5593632368577572655</id><published>2009-09-27T09:34:00.002+08:00</published><updated>2010-10-24T23:46:22.674+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Xargs'/><category scheme='http://www.blogger.com/atom/ns#' term='SVN'/><title type='text'>svn 批量添加新文件</title><content type='html'>&lt;div class="pre"&gt;$&amp;gt; svn status |grep &amp;#39;^\?&amp;#39;|awk -F &amp;quot; &amp;quot; &amp;#39;{print $2}&amp;#39;|xargs svn add&lt;/div&gt;&lt;br /&gt;或者是&lt;br /&gt;&lt;div class="pre"&gt;$&amp;gt; svn st|grep &amp;#39;^\?&amp;#39;|sed &amp;#39;s/^\?\s*//g&amp;#39;|xargs svn add&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5593632368577572655?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5593632368577572655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5593632368577572655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5593632368577572655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5593632368577572655'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/09/svn.html' title='svn 批量添加新文件'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8795758428755724683</id><published>2009-09-07T09:21:00.002+08:00</published><updated>2010-10-24T23:46:45.490+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='View'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='Method'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Helpers Outside Views</title><content type='html'>How to access helper methods outside of the view layer?&lt;br /&gt;&lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;# models/category.rb&lt;br /&gt;def description&lt;br /&gt;&amp;nbsp; "This category has #{helpers.pluralize(products.count, 'product')}."&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def helpers&lt;br /&gt;&amp;nbsp; ActionController::Base.helpers&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# products_controller.rb&lt;br /&gt;def create&lt;br /&gt;&amp;nbsp; @product = Product.new(params[:product])&lt;br /&gt;&amp;nbsp; if @product.save&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flash[:notice] = "Successfully created #{@template.link_to('product', @product)}."&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; redirect_to products_url&lt;br /&gt;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; render :action =&amp;gt; 'new'&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reference: &lt;a href="http://railscasts.com/episodes/132-helpers-outside-views"&gt;http://railscasts.com/episodes/132-helpers-outside-views&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8795758428755724683?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8795758428755724683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8795758428755724683' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8795758428755724683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8795758428755724683'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/09/helpers-outside-views.html' title='Helpers Outside Views'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1205563754809770328</id><published>2009-08-23T21:56:00.003+08:00</published><updated>2009-08-23T22:55:48.239+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Unix'/><title type='text'>Unix 哲学基础[Unix编程艺术读书笔记]</title><content type='html'>1、让每个程序就做好一件事。如果有新任务，就重新开始，不要往原程序中加入新功能而搞得复杂。&lt;br /&gt;2、假定每个程序的输出都会成为另一个程序的输入，哪怕那个程序还是未知的。输出中不要有无关的信息干扰。避免使用二进格式输入，而是坚持使用文本流，不要坚持使用交互式输入。&lt;br /&gt;3、尽可能早地将设计和编译的软件投入使用，对于拙劣的代码别犹豫，扔掉重写。&lt;br /&gt;4、优先使用工具减轻编程任务，工欲善其事，必先利其器。&lt;br /&gt;5、花哨的算法复杂度大，并比简单的算法更容易出bug，更难实现，理解和维护。尽量使用简单的算法配合简单的数据结构。&lt;br /&gt;6、编程的核心是数据结构，而不是算法。&lt;br /&gt;7、不确定的时候就用穷举。&lt;br /&gt;8、小就是美，在确保任务完成的基础上，程序功能尽可能少。&lt;br /&gt;&lt;br /&gt;Unix 原则&lt;br /&gt;1、模块原则：使用简洁的接口拼合拼合简单的部件。&lt;br /&gt;2、清晰原则：清晰胜于机巧。&lt;br /&gt;3、组合原则：设计时考虑拼接组合。&lt;br /&gt;4、分离原则：策略同机制分离，接口同引擎分离。&lt;br /&gt;5、简洁原则：设计要简洁，复杂度能低则低。&lt;br /&gt;6、吝啬原则：不要编写庞大的程序。&lt;br /&gt;7、透明性原则：设计要可见，以便审查和调试。&lt;br /&gt;8、健壮原则：健壮源于透明和简洁。&lt;br /&gt;9、表示原则：要求逻辑质朴而健壮。&lt;br /&gt;10、通俗原则：即最小惊异原则，接口设计避免标新立异。&lt;br /&gt;11、缄默原则：如果一个程序没什么好说的，就沉默。&lt;br /&gt;12：补救原则：出现异常时要给出足够的错误信息。&lt;br /&gt;13、经济原则：宁花机器一分钟，不花程序员一分钟。&lt;br /&gt;14、生成原则：避免手工hack，尽量编写程序去生成程序。&lt;br /&gt;15、优化原则：原型设计，先求运行，再求正确，最后求快。&lt;br /&gt;16、多样原则：决不相信所谓“不二法门”的断言。&lt;br /&gt;17、扩展原则：设计着眼未来，未来总比预想来得快。&lt;br /&gt;&lt;br /&gt;Unix 哲学之总结&lt;br /&gt;所有Unix的哲学用一句话来概括就是“KISS”原则：&lt;br /&gt;Keep It Simple, Stupid!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1205563754809770328?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1205563754809770328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1205563754809770328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1205563754809770328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1205563754809770328'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/unix-unix.html' title='Unix 哲学基础[Unix编程艺术读书笔记]'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4427334930475373027</id><published>2009-08-20T11:49:00.002+08:00</published><updated>2010-10-24T23:48:46.733+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Data'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Element Data in jQuery</title><content type='html'>Added in jQuery 1.2&lt;br /&gt;Attaching data to elements can be hazardous.&lt;br /&gt;Store data: jQuery.data(elem, "name", "value");&lt;br /&gt;Read data: jQuery.data(elem, "name");&lt;br /&gt;All data is stored in a central cache and completely garbage collected,&lt;br /&gt;as necessary.&lt;br /&gt;&lt;br /&gt;Added in jQuery 1.2.3&lt;br /&gt;Can handle namespacing: &lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$("div").data("test", "original");&lt;br /&gt;$("div").data("test.plugin", "new data");&lt;br /&gt;$("div").data("test") == "original"; // true&lt;br /&gt;$("div").data("test.plugin") == "new data"; // true&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Advanced data handling can be overridden by plugins: &lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;$(element).bind("setData.draggable", function(event, key, value) {&lt;br /&gt; self.options[key] = value;&lt;br /&gt;}).bind("getData.draggable", function(event, key) {&lt;br /&gt; return self.options[key];&lt;br /&gt;});&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4427334930475373027?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4427334930475373027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4427334930475373027' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4427334930475373027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4427334930475373027'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/element-data-in-jquery.html' title='Element Data in jQuery'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7681424542588218917</id><published>2009-08-20T11:42:00.001+08:00</published><updated>2009-08-20T11:42:16.133+08:00</updated><title type='text'>Special Events in jQuery</title><content type='html'>Added in jQuery 1.2.2&lt;br&gt;  Can create whole shadow event system&lt;br&gt;  New events: mouseenter, mouseleave, ready&lt;br&gt;  $(&amp;quot;li&amp;quot;).bind(&amp;quot;mouseenter&amp;quot;, function(){&lt;br&gt;    $(this).addClass(&amp;quot;hover&amp;quot;);&lt;br&gt;  }).bind(&amp;quot;mouseleave&amp;quot;, function(){&lt;br&gt;    $(this).removeClass(&amp;quot;hover&amp;quot;);&lt;br&gt;  });&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7681424542588218917?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7681424542588218917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7681424542588218917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7681424542588218917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7681424542588218917'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/special-events-in-jquery.html' title='Special Events in jQuery'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2391852787654255450</id><published>2009-08-20T11:27:00.001+08:00</published><updated>2009-08-20T11:27:13.719+08:00</updated><title type='text'>Non-DOM Events in jQuery</title><content type='html'>&amp;gt;&amp;gt;&amp;gt; function User(){}&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; var u = new User&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; u&lt;br&gt;Object&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; $(u)&lt;br&gt;[Object]&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; $(u).bind(&amp;#39;login&amp;#39;, function(){console.log(&amp;#39;login&amp;#39;)})&lt;br&gt;[Object jQuery1250738637761=27]&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; var j = $(u).bind(&amp;#39;login&amp;#39;, function(){console.log(&amp;#39;login&amp;#39;)})&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; j&lt;br&gt;[Object jQuery1250738637761=27]&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; $(u).trigger(&amp;#39;login&amp;#39;)&lt;br&gt;login&lt;br&gt;login&lt;br&gt;[Object jQuery1250738637761=27]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2391852787654255450?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2391852787654255450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2391852787654255450' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2391852787654255450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2391852787654255450'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/non-dom-events-in-jquery.html' title='Non-DOM Events in jQuery'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7142905357993076353</id><published>2009-08-11T12:46:00.001+08:00</published><updated>2009-08-11T12:46:17.046+08:00</updated><title type='text'>Convert ^M to newline character in text files</title><content type='html'>If the ^M character is showing up in files while opening the file &lt;br&gt;concerned, then follow these steps to convert it to a new line.&lt;br&gt;In vi use the following:&lt;p&gt;:%s/^M/\n/g&lt;p&gt;or with perl on the command line:&lt;p&gt;$ perl -pi.bak -e &amp;#39;s/^M/\n/g&amp;#39;&lt;p&gt;NOTE: Be sure to create the ^M by typing ctrl V followed by ctrl M.&lt;p&gt;^M is ASCII 13 (Ctrl M), which is the carriage return.&lt;p&gt;Different operating systems use different symbols to set the end of a &lt;br&gt;line/new line.&lt;br&gt;Unix uses newline (\n)&lt;br&gt;Mac uses carriage return (\r)&lt;br&gt;And Windows/DOS use both (\n\r)&lt;p&gt;To prevent the ^M from showing up in files, be sure to use the ASCII &lt;br&gt;(text) mode when transfering text files.&lt;p&gt;Source article link: &lt;br&gt;&lt;a href="http://blog.eukhost.com/webhosting/convert-m-to-newline-character-in-text-files/"&gt;http://blog.eukhost.com/webhosting/convert-m-to-newline-character-in-text-files/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7142905357993076353?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7142905357993076353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7142905357993076353' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7142905357993076353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7142905357993076353'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/convert-m-to-newline-character-in-text.html' title='Convert ^M to newline character in text files'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2126377972126634713</id><published>2009-08-06T15:57:00.004+08:00</published><updated>2009-12-02T14:35:29.153+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='todo'/><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='List'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>todo list on linux</title><content type='html'>1. devtodo&lt;br /&gt;2. tudu&lt;br /&gt;3. remind&lt;br /&gt;4. todo.txt&lt;br /&gt;5. awn todo list applet&lt;br /&gt;&lt;br /&gt;使用之后觉得devtodo最为好用，tudu也不错，有vi类似的操作快捷键，用起来很顺手。&lt;br /&gt;awn todo list applet结合awn一起用，做为桌面工具可以即时看到任务数量，操作也非常简单。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2126377972126634713?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2126377972126634713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2126377972126634713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2126377972126634713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2126377972126634713'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/08/todo-list-on-linux.html' title='todo list on linux'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5962565850940555881</id><published>2009-07-31T12:04:00.002+08:00</published><updated>2009-08-23T22:50:05.379+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Environment'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='export'/><title type='text'>Linux 环境变量显示和设置</title><content type='html'>$&amp;gt; export&lt;br&gt;export命令不带参数可以将系统的环境变量全部列出来，如果需要设置环境变量， &lt;br&gt;可以在/etc/profile, ~/.bash_profile, ~/.bashrc文件中设置。&lt;p&gt;一些标准的环境变量：&lt;br&gt;SHELL 默认shell&lt;br&gt;LANG 默认语言&lt;br&gt;PATH linux寻找命令的默认路径，一般包括/bin，/usr/bin，/sbin，/usr/sbin， &lt;br&gt;/usr/X11R6/bin， /opt/bin，/usr/local/bin等。用户可以自行添加，&lt;br&gt;MANPATH man手册的默认路径&lt;br&gt;INPUTRC 默认键盘映象，详见/etc/inputrc&lt;br&gt;BASH_ENV bash shell的环境变量，通常在~/.bashrc中&lt;br&gt;DISPLAY X窗口适用的控制台，DISPLAY=：0对应于控制台F7，DISPLAY=：1对应于 &lt;br&gt;控制台F8，DISPLAY=server：0向远程计算机发送 GUI应用程序。&lt;br&gt;COLORTERM GUI中的默认终端，通常是gnome-terminal.&lt;br&gt;USER 自动设置当前登陆用户的用户名。&lt;br&gt;LONGNAME 通常设置为$USER&lt;br&gt;MAIL 设置特定$USR的标准邮件目录&lt;br&gt;HOSTNAME 设置为/bin/hostname的命令输出&lt;br&gt;HISTSIZE 设置为history命令记住的命令数&lt;p&gt;Reference:&lt;a href="http://matt-u.javaeye.com/blog/411379"&gt;http://matt-u.javaeye.com/blog/411379&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5962565850940555881?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5962565850940555881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5962565850940555881' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5962565850940555881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5962565850940555881'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/linux_31.html' title='Linux 环境变量显示和设置'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-313765000244111445</id><published>2009-07-31T11:35:00.000+08:00</published><updated>2009-07-31T11:36:00.912+08:00</updated><title type='text'>IE 中将tr appendChild到Table的问题及解决方法</title><content type='html'>将一个TableRow对象appendChild到Table，在Firefox3/Safari4中测试都正常，在 &lt;br&gt;IE6中则不能正常显示。&lt;br&gt;Table无论是否有写TBODY，生成的DOM中都会自动生成，在IE中，TR对象被 &lt;br&gt;appendChild到了Table中，而非TBODY中，所以无法显示，所以可以将TR对象 &lt;br&gt;appendChild到TBODY中。&lt;br&gt;还有就是可以使用Table.insertRow()方法添加一个新行。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-313765000244111445?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/313765000244111445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=313765000244111445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/313765000244111445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/313765000244111445'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/ie-tr-appendchildtable.html' title='IE 中将tr appendChild到Table的问题及解决方法'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7984599957687068930</id><published>2009-07-27T15:22:00.005+08:00</published><updated>2009-08-23T22:52:00.337+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='timestamp'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Unix'/><title type='text'>在excel中转换unix timestamp</title><content type='html'>A1 = 1248255194&lt;br&gt;=(A1+8*3600)/86400+70*365+19&lt;br /&gt;&lt;br /&gt;在excel中没有直接的函数可以将一个unix时间截，转换为一个可阅读的时间格式，&lt;br /&gt;这个公式可以用来转换显示时间，转换出来的还是一个数字，需要调整其显示格式，选择一个日期格式。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7984599957687068930?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7984599957687068930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7984599957687068930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7984599957687068930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7984599957687068930'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/excelunix-timestamp.html' title='在excel中转换unix timestamp'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8864054679329123796</id><published>2009-07-15T18:29:00.001+08:00</published><updated>2009-07-15T18:29:26.468+08:00</updated><title type='text'>提示是否下载PHP文件的解决方法</title><content type='html'>&lt;p&gt;如果当您浏览PHP网页的时候，浏览器提示您是否下载PHP文件而不是去显示它的时候，就可能是您没有安装libapache2-mod- php5。&lt;/p&gt;&lt;p&gt;当您安装PHP5的时候，它会被默认的安装进去的，如果您不小心的将它遗忘了。&lt;/p&gt;&lt;p&gt;您就需要去将它打开&lt;/p&gt;&lt;p&gt;$&amp;gt; sudo a2enmod php5&lt;/p&gt;&lt;p&gt;然後使用&lt;/p&gt;&lt;p&gt;$&amp;gt; sudo /etc/init.d/apache2 restart&lt;/p&gt;&lt;p&gt;来重新启动APACHE。 &lt;br&gt;&lt;/p&gt;&lt;p&gt;Reference:　&lt;a href="http://blog.chinaunix.net/u2/68904/showart_695284.html"&gt;http://blog.chinaunix.net/u2/68904/showart_695284.html&lt;/a&gt;&lt;br&gt; &lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8864054679329123796?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8864054679329123796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8864054679329123796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8864054679329123796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8864054679329123796'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/php.html' title='提示是否下载PHP文件的解决方法'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2364456372011954489</id><published>2009-07-15T11:40:00.001+08:00</published><updated>2009-07-15T11:40:09.176+08:00</updated><title type='text'>ubuntu上mysql远程访问限制</title><content type='html'>用nestat命令查看3306端口状态：&lt;br&gt;~# netstat -an | grep 3306&lt;br&gt;tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &lt;a href="http://127.0.0.1:3306"&gt;127.0.0.1:3306&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0.0.0:*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LISTEN&lt;br&gt;&lt;br&gt;从结果可以看出3306端口只是在IP 127.0.0.1上监听，所以拒绝了其他IP的访问。&lt;br&gt;&lt;br&gt; 解决方法：修改/etc/mysql/my.cnf文件。打开文件，找到下面内容：&lt;br&gt;&lt;br&gt;# Instead of skip-networking the default is now to listen only on&lt;br&gt;# localhost which is more compatible and is not less secure.&lt;br&gt;bind-address&amp;nbsp; = 127.0.0.1&lt;br&gt;把上面这一行注释掉&lt;br&gt; &lt;br&gt;重新启动后，重新使用netstat检测：&lt;br&gt;&lt;br&gt;~# netstat -an | grep 3306&lt;br&gt;tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &lt;a href="http://0.0.0.0:3306"&gt;0.0.0.0:3306&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0.0.0:*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LISTEN&lt;br&gt;&lt;br&gt;此时再从远程机器就可以telnet通3306端口了。&lt;br&gt;Reference: &lt;a href="http://blog.csdn.net/mydeman/archive/2009/01/21/3847695.aspx"&gt;http://blog.csdn.net/mydeman/archive/2009/01/21/3847695.aspx&lt;/a&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2364456372011954489?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2364456372011954489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2364456372011954489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2364456372011954489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2364456372011954489'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/ubuntumysql.html' title='ubuntu上mysql远程访问限制'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2476211548475005858</id><published>2009-07-15T11:08:00.001+08:00</published><updated>2009-07-15T11:08:59.305+08:00</updated><title type='text'>mysql5 table name case sensitive problem on linux</title><content type='html'>add below line under [mysqld] block of my.cnf :&lt;br&gt;lower_case_table_names=1 &lt;br&gt;Reference:&lt;br&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html&lt;/a&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2476211548475005858?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2476211548475005858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2476211548475005858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2476211548475005858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2476211548475005858'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/mysql5-table-name-case-sensitive.html' title='mysql5 table name case sensitive problem on linux'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-9203814104697511466</id><published>2009-07-12T02:05:00.003+08:00</published><updated>2009-07-12T13:22:26.341+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Iframe'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><title type='text'>iframe src problem in firefox</title><content type='html'>&amp;lt;iframe src='javascript:'&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br&gt;在firefox下，当运行到上面语句的时候，将会弹出错误控制台。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-9203814104697511466?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/9203814104697511466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=9203814104697511466' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/9203814104697511466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/9203814104697511466'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/iframe-src-problem-in-firefox.html' title='iframe src problem in firefox'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4448624822880652459</id><published>2009-07-12T01:58:00.001+08:00</published><updated>2009-07-12T01:58:41.020+08:00</updated><title type='text'>打印IE中iframe内容</title><content type='html'>需要将被打印的iframe先focus()，不然打印仍然是最外面的窗体内容。如：&lt;br&gt; &lt;b&gt;window.frames[0].focus();&lt;br&gt; window.frames[0].print();&lt;/b&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4448624822880652459?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4448624822880652459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4448624822880652459' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4448624822880652459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4448624822880652459'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/ieiframe.html' title='打印IE中iframe内容'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7636285084468945599</id><published>2009-07-12T01:54:00.002+08:00</published><updated>2009-07-12T13:23:34.976+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Gmail'/><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>linux 基础学习篇一</title><content type='html'>1973 UNIX&lt;br&gt;1977 BSD (Bill Joy) -&amp;gt; FreeBSD&lt;br&gt;1979 AT&amp;amp;T 版权声明&lt;br&gt;1984 x86 Minix&lt;br&gt;1984 Richard Mathew Stallman -&amp;gt; GNU &amp;amp; FSF&lt;br&gt;GPL / LGPL / Apache / BSD / MIT&lt;br&gt;1991 Linus Torvalds -&amp;gt; Linux&lt;br&gt;&lt;br&gt;Linux 执行命令&lt;br&gt; Command [-options] parameters&lt;br&gt;date -s &amp;#39;2009-09-09 09:09:09&amp;#39;&lt;br&gt;cal 2009&lt;br&gt;netstat -a&lt;br&gt;ps -aux&lt;br&gt;查看错误信息&lt;br&gt;google错误信息和example用法&lt;br&gt;用man/info查说明及用法&lt;br&gt;&lt;br&gt;keyboard shortcut&lt;br&gt;Tab&lt;br&gt;CTRL + C&lt;br&gt;CTRL + D&lt;br&gt;&lt;br&gt; Linux 目录和文件相关命令&lt;br&gt;root&lt;br&gt;文件权限：所属用户、所属组、其他人&lt;br&gt;drwxr-xr-x&amp;nbsp;&amp;nbsp; 19 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; yu&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; staff&amp;nbsp;&amp;nbsp; 646&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mar 11 18:39 Books&lt;br&gt;[属性]&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [文件数] [所属用户]&amp;nbsp;&amp;nbsp; [所属组]&amp;nbsp; [大小]&amp;nbsp; [修改日期]&amp;nbsp;&amp;nbsp;&amp;nbsp; [文件名]&lt;br&gt;mtime 修改时间(modify)&lt;br&gt;ctime 状态变更时间(change)&lt;br&gt; atime 访问时间(access)&lt;br&gt;touch 修改文件的3个时间值&lt;br&gt;chgrp/chown/chmod&lt;br&gt;&lt;br&gt;目录相关操作&lt;br&gt;./../-/~/~yu&lt;br&gt;pwd/mkdir/rm/ls/cp/mv&lt;br&gt;&lt;br&gt;文件相关操作&lt;br&gt;cat/tac/nl/more/less/head/tail&lt;br&gt;man/more/less 过程中可以按h/H帮助键&lt;br&gt;&lt;br&gt;Note: This article is published from gmail.&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7636285084468945599?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7636285084468945599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7636285084468945599' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7636285084468945599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7636285084468945599'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/07/linux.html' title='linux 基础学习篇一'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2721363368298228404</id><published>2009-05-14T14:57:00.003+08:00</published><updated>2009-05-14T15:50:02.328+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Function'/><category scheme='http://www.blogger.com/atom/ns#' term='escape'/><category scheme='http://www.blogger.com/atom/ns#' term='callee'/><category scheme='http://www.blogger.com/atom/ns#' term='Arguments'/><category scheme='http://www.blogger.com/atom/ns#' term='RegExp'/><title type='text'>RegExp escape function</title><content type='html'>&lt;div class="pre"&gt;RegExp.escape = (function() {&lt;br /&gt; var punctuationChars = /([.*+?|/(){}[\]\\])/g;&lt;br /&gt;  return function(text) {&lt;br /&gt;    return text.replace(punctuationChars, '\\$1');&lt;br /&gt;  }&lt;br /&gt;})();&lt;br /&gt;&lt;br /&gt;var str = RegExp.escape('a+b/c*d$ ^{.}');&lt;br /&gt;var reg = new RegExp(str);&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://simonwillison.net/2006/Jan/20/escape"&gt;http://simonwillison.net/2006/Jan/20/escape&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2721363368298228404?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2721363368298228404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2721363368298228404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2721363368298228404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2721363368298228404'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/05/regexp-escape-function.html' title='RegExp escape function'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2638807708248969785</id><published>2009-05-13T15:21:00.000+08:00</published><updated>2009-05-13T15:22:11.550+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SpreadSheet'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Write'/><title type='text'>Write excel tool for ruby</title><content type='html'>&lt;div class="pre"&gt;require 'rubygems'&lt;br /&gt;require 'writeexcel'&lt;br /&gt;&lt;br /&gt;# Create a new Excel Workbook&lt;br /&gt;workbook = Spreadsheet::WriteExcel.new('ruby.xls')&lt;br /&gt;&lt;br /&gt;# Add worksheet(s)&lt;br /&gt;worksheet  = workbook.add_worksheet&lt;br /&gt;worksheet2 = workbook.add_worksheet&lt;br /&gt;&lt;br /&gt;# Add and define a format&lt;br /&gt;format = workbook.add_format&lt;br /&gt;format.set_bold&lt;br /&gt;format.set_color('red')&lt;br /&gt;format.set_align('right')&lt;br /&gt;&lt;br /&gt;# write a formatted and unformatted string.&lt;br /&gt;worksheet.write(1, 1, 'Hi Excel.', format)  # cell B2&lt;br /&gt;worksheet.write(2, 1, 'Hi Ruby.')           # cell B3&lt;br /&gt;&lt;br /&gt;# write a number and formula using A1 notation&lt;br /&gt;worksheet.write('B4', 3.14159)&lt;br /&gt;worksheet.write('B5', '=SIN(B4/4)')&lt;br /&gt;&lt;br /&gt;# write to file&lt;br /&gt;workbook.close&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2638807708248969785?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2638807708248969785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2638807708248969785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2638807708248969785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2638807708248969785'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/05/write-excel-tool-for-ruby.html' title='Write excel tool for ruby'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8196612821167475593</id><published>2009-05-12T16:51:00.001+08:00</published><updated>2010-10-24T23:53:05.844+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><category scheme='http://www.blogger.com/atom/ns#' term='Block'/><title type='text'>Non-blocking JavaScript</title><content type='html'>Include via DOM &lt;br /&gt;&lt;div class="pre"&gt;var js = document.createElement('script');  &lt;br /&gt;js.src = 'myscript.js';  &lt;br /&gt;var h = document.getElementsByTagName('head')[0];  &lt;br /&gt;h.appendChild(js);&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Non-blocking JavaScript &lt;br /&gt;  And what about my inline scripts? &lt;br /&gt;  Setup a collection (registry) of inline scripts &lt;br /&gt;&lt;br /&gt;Step 1 &lt;br /&gt;  Inline in the &amp;lt;head&amp;gt;: &lt;br /&gt;&lt;div class="pre"&gt;var myapp = {  &lt;br /&gt;    stuff: []  &lt;br /&gt;}; &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Step 2 &lt;br /&gt;  Add to the registry &lt;br /&gt;Instead of: &lt;br /&gt;  alert('boo!');&lt;br /&gt;Do: &lt;br /&gt;&lt;div class="pre"&gt;  myapp.stuff.push(function(){  &lt;br /&gt;      alert('boo!');  &lt;br /&gt;  );&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Step 3 &lt;br /&gt;  Execute all &lt;br /&gt;&lt;div class="pre"&gt;&lt;br /&gt;var l = myapp.stuff.length;   &lt;br /&gt;var l = myapp.stuff.length;   &lt;br /&gt;for(var i = 0, i &lt; l; i++) {  &lt;br /&gt;    myapp.stuff[i]();  &lt;br /&gt;} &lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8196612821167475593?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8196612821167475593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8196612821167475593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8196612821167475593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8196612821167475593'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/05/non-blocking-javascript.html' title='Non-blocking JavaScript'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-4415398112850716691</id><published>2009-05-12T16:05:00.000+08:00</published><updated>2009-05-12T16:06:57.575+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='Optimize'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Premature optimization</title><content type='html'>Knuth: The premature optimization is the root of all evil.&lt;br /&gt;&lt;br /&gt;Crockford: Make it right before you make it fast.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-4415398112850716691?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/4415398112850716691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=4415398112850716691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4415398112850716691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/4415398112850716691'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/05/premature-optimization.html' title='Premature optimization'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-3349170757707550182</id><published>2009-04-19T23:54:00.000+08:00</published><updated>2009-04-19T23:55:50.171+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='arithmetic'/><title type='text'>0.1+0.2!==0.3 in javascript</title><content type='html'>&lt;div class="logRow logRow-command"&gt;&lt;span class="objectBox objectBox-text"&gt;&gt;&gt;&gt; 0.1 + 0.2 !== 0.3&lt;/span&gt;&lt;/div&gt;&lt;div class="logRow"&gt;&lt;span class="objectBox objectBox-number"&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div class="logRow logRow-command"&gt;&lt;span class="objectBox objectBox-text"&gt;&gt;&gt;&gt; 0.1 + 0.2&lt;/span&gt;&lt;/div&gt;&lt;div class="logRow"&gt;&lt;span class="objectBox objectBox-number"&gt;0.30000000000000004&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-3349170757707550182?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/3349170757707550182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=3349170757707550182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3349170757707550182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/3349170757707550182'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/04/010203-in-javascript.html' title='0.1+0.2!==0.3 in javascript'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-5512836785897589432</id><published>2009-04-19T23:48:00.001+08:00</published><updated>2009-04-19T23:51:10.398+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='false'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='compare'/><category scheme='http://www.blogger.com/atom/ns#' term='undefined'/><category scheme='http://www.blogger.com/atom/ns#' term='String'/><title type='text'>javascript compare operations</title><content type='html'>'' == '0';          // false&lt;br /&gt;0 == '';            // true&lt;br /&gt;0 == '0';           // true&lt;br /&gt;false == 'false';   // false&lt;br /&gt;false == '0';       // true&lt;br /&gt;false == undefined; // false&lt;br /&gt;false == null;      // false&lt;br /&gt;null == undefined;  // true&lt;br /&gt;' \t\r\n ' == 0;    // true&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-5512836785897589432?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/5512836785897589432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=5512836785897589432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5512836785897589432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/5512836785897589432'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/04/javascript-compare-operations.html' title='javascript compare operations'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2682471933269099632</id><published>2009-04-19T23:27:00.001+08:00</published><updated>2009-04-19T23:32:46.430+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ppt'/><category scheme='http://www.blogger.com/atom/ns#' term='terms'/><category scheme='http://www.blogger.com/atom/ns#' term='concept'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>CSS 2.1 Tutorial (Basic Terms and Concepts)</title><content type='html'>&lt;div class="entry"&gt;      &lt;p&gt;CSS element basic types&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Replaced and nonreplaced&lt;/li&gt;&lt;li&gt;Inline and block-level&lt;/li&gt;&lt;li&gt;Replaced element: img/object/input，占位元素，在文档中起占位符作用，内容由元素本身决定(img)，或者元素类型可以替换（如input)。&lt;/li&gt;&lt;li&gt;Nonreplaced element: 非占位元素，其内容由浏览器渲染得到，并且内容包含于文档中。&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Block-level element&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Normal flow: The left-to-right, top-to-bottom rendering of text.&lt;/li&gt;&lt;li&gt;Root element: html&lt;/li&gt;&lt;li&gt;Block element seven properties (three width properties can be set auto)&lt;/li&gt;&lt;li&gt;“background”是指content, padding and border区域的背景&lt;/li&gt;&lt;li&gt;Margins永远是透明的(transparent)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Box Model&lt;/p&gt; &lt;ul&gt;&lt;li&gt;IE Box Model Issues&lt;/li&gt;&lt;li&gt;width in IE: border + padding + width&lt;/li&gt;&lt;li&gt;CSS box model hack&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Inline element&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Content area：nonreplaced element(font-size) and Replaced element(vertical seven properties)&lt;/li&gt;&lt;li&gt;Leading (行间空白): ‘line-height’ 减 ‘font-size’&lt;/li&gt;&lt;li&gt;(注意：行间空白只对nonreplaced元素起作用)&lt;/li&gt;&lt;li&gt;Inline box: line-height(nonreplaced) and content area(replaced)&lt;/li&gt;&lt;li&gt;Line box: 当前行中最高的inline box的顶到最低的inline box的底组成的box&lt;/li&gt;&lt;li&gt;‘line-height’, ‘vertical-align’ and ‘font-size’这三个属性会影响当前行的高度&lt;/li&gt;&lt;li&gt;inline nonreplaced element border: 由’font-size’控制其边框，而不是’line-height’，边框会环绕在content area上&lt;/li&gt;&lt;li&gt;inline replaced elements能增高line box，但是不会使line-height加高&lt;/li&gt;&lt;li&gt;为inline replaced element添加padding/border/margin可以增高inline-box&lt;/li&gt;&lt;li&gt;inline nonreplaced element的padding, borders, margin不会影响line-height，并且margin-top/margin-bottom设置了是不会生效的,但margin-left /margin-right会生效&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;display: list-item&lt;/p&gt; &lt;ul&gt;&lt;li&gt;除inline和block-level元素外，还有一个特殊的元素LI，display: list-item&lt;/li&gt;&lt;li&gt;list-item: LI此属性的默认值，该值使一个元素生成一个原始块框(principal box)和一个列表框(block box)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;About margins&lt;/p&gt; &lt;ul&gt;&lt;li&gt;margin is always transparent&lt;/li&gt;&lt;li&gt;navigate value margin for css effects&lt;/li&gt;&lt;li&gt;collapsing margins (边距重合)&lt;/li&gt;&lt;li&gt;horizontal margins never collapse.&lt;/li&gt;&lt;li&gt;Vertical margins may collapse between certain boxes.&lt;/li&gt;&lt;/ul&gt; &lt;ol&gt;&lt;li&gt;常规流向中两个或多个块框相邻的垂直边距会重合。结果的边距宽度是相邻边距宽度中较大的值。如果出现负边距，则在最大的正边距中减去绝对值最大的负边距。如果没有正边距，则从零中减去绝对值最大的负边距。&lt;/li&gt;&lt;li&gt;在一个浮动框和其它框之间的垂直边距不重合。&lt;/li&gt;&lt;li&gt;绝对和相对定位的框的边距不重合。&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Positioning&lt;/p&gt; &lt;ul&gt;&lt;li&gt;static: 默认值。无特殊定位&lt;/li&gt;&lt;li&gt;relative: 依据 left ， right ， top ， bottom 等属性在正常文档流中偏移位置，占据原来的正常文档流中的空间位置&lt;/li&gt;&lt;li&gt;absolute: 将元素从文档流中拖出，使用 left，right，top，bottom 等属性相对于其最接近的一个具有定位设置的父元素 (position非static元素)进行绝对定位。如果不存在这样的父元素，则依据 body元素&lt;/li&gt;&lt;li&gt;fixed: 与absolute一样从正常文档流中拖出，区别在于其定位的容器是屏幕窗口(viewpoint)&lt;/li&gt;&lt;li&gt;‘top’, ‘right’, ‘bottom’, ‘left’只能针对position非static元素设置&lt;/li&gt;&lt;li&gt;containing block： 为绝对定位的元素提供定位容器的，位置属性非static的元素&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Floats and Clear&lt;/p&gt; &lt;ul&gt;&lt;li&gt;float: 当该属性不等于 none 引起对象浮动时，对象将被视作块对象( block-level )，即 display 属性等于 block 。也就是说，浮动对象的 display 属性将被忽略&lt;/li&gt;&lt;li&gt;clear在布局中与float同时使用的情况较多&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;CSS specificity value&lt;/p&gt; &lt;ul&gt;&lt;li&gt;specificity值表示方法: 0,0,0,0&lt;/li&gt;&lt;li&gt;id:0,1,0,0&lt;/li&gt;&lt;li&gt;class:0,0,1,0&lt;/li&gt;&lt;li&gt;element:0,0,0,1&lt;/li&gt;&lt;li&gt;h1 {color: red;}  /* specificity = 0,0,0,1 */&lt;/li&gt;&lt;li&gt;p em {color: purple;}  /* specificity = 0,0,0,2 */&lt;/li&gt;&lt;li&gt;.grape {color: purple;}  /* specificity = 0,0,1,0 */&lt;/li&gt;&lt;li&gt;*.bright {color: yellow;}  /* specificity = 0,0,1,0 */&lt;/li&gt;&lt;li&gt;p.bright em.dark {color: maroon;}  /* specificity = 0,0,2,2 */&lt;/li&gt;&lt;li&gt;#id216 {color: blue;}  /* specificity = 0,1,0,0 */&lt;/li&gt;&lt;li&gt;div#sidebar *[href] {color: silver;}  /* specificity = 0,1,1,1 */&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Selectors&lt;/p&gt; &lt;ul&gt;&lt;li&gt;* { sRules } 通配选择符&lt;/li&gt;&lt;li&gt;*.div { text-decoration:none;&lt;/li&gt;&lt;li&gt;E { sRules } 类型选择符&lt;/li&gt;&lt;li&gt;a { text-decoration:none; }&lt;/li&gt;&lt;li&gt;E1 E2 { sRules } 包含选择符 Descendant Selectors&lt;/li&gt;&lt;li&gt;table td { font-size:14px; }&lt;/li&gt;&lt;li&gt;E1 &gt; E2 { sRules } 子对象选择符 Selecting Children (IE6 not support)&lt;/li&gt;&lt;li&gt;div ul&gt;li { font-size:14px; }&lt;/li&gt;&lt;li&gt;#ID { sRules } ID选择符&lt;/li&gt;&lt;li&gt;E.className { sRules } 类选择符&lt;/li&gt;&lt;li&gt;E1 + E2 {sRules} 相邻节点选择符 Selecting Adjacent Sibling Elements&lt;/li&gt;&lt;li&gt;h1 + p {margin-top: 0;}&lt;/li&gt;&lt;li&gt;E1 , E2 , E3 { sRules } 分组选择符 grouping selectors&lt;/li&gt;&lt;li&gt;将同样的定义应用于多个选择符&lt;/li&gt;&lt;li&gt;E : Pseudo-Classes { sRules }&lt;/li&gt;&lt;li&gt;div:first-letter { font-size:14px; }&lt;/li&gt;&lt;li&gt;a.fly :hover { font-size:14px; color:red; }&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;属性选择符&lt;/p&gt; &lt;ul&gt;&lt;li&gt;1.    E [ attr ] { sRules }&lt;/li&gt;&lt;li&gt;2.    E [ attr = value ] { sRules }&lt;/li&gt;&lt;li&gt;3.    E [ attr ~= value ] { sRules }&lt;/li&gt;&lt;li&gt;example: class partial value&lt;/li&gt;&lt;li&gt;4.    E [ attr *= value ] { sRules }&lt;/li&gt;&lt;li&gt;substring&lt;/li&gt;&lt;li&gt;5.    E [ attr ^= value ] { sRules }&lt;/li&gt;&lt;li&gt;6.    E [ attr $= value ] { sRules }&lt;/li&gt;&lt;li&gt;7.    E [ attr |= value ] { sRules } (explode by ‘-’)&lt;/li&gt;&lt;li&gt;a[href][title] {font-weight: bold;} /*multiply attributes*/&lt;/li&gt;&lt;li&gt;*[lang|="en"] {color: white;} /*en or begin with en-*/&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;About CSS classes&lt;/p&gt; &lt;ul&gt;&lt;li&gt;如果某个元素具有特殊意义，在文档中只出现一次，则可使用id，同时也有利于js操作此节点。如果有不同的元素都可能用到相同的一个css效果，如div/p/a/span等，则可使用class&lt;/li&gt;&lt;li&gt;一个元素的class的值可以是以空格间隔的一系列class名，如：&lt;/li&gt;&lt;li&gt;&amp;lt;p class=”urgent warning”&amp;gt;这个P元素有二个css class&amp;lt;/p&amp;gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Position is everything&lt;/p&gt; &lt;p&gt;Reference:&lt;br /&gt;5. Selectors&lt;br /&gt;http://www.w3.org/TR/CSS21/selector.html&lt;br /&gt;8. Box model&lt;br /&gt;http://www.w3.org/TR/CSS21/box.html&lt;br /&gt;9. Visual formatting model&lt;br /&gt;http://www.w3.org/TR/CSS21/visuren.html&lt;br /&gt;10. Visual formatting model details&lt;br /&gt;http://www.w3.org/TR/CSS21/visudet.html&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2682471933269099632?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2682471933269099632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2682471933269099632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2682471933269099632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2682471933269099632'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/04/css-21-tutorial-basic-terms-and.html' title='CSS 2.1 Tutorial (Basic Terms and Concepts)'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8165967541234100823</id><published>2009-04-14T20:37:00.000+08:00</published><updated>2009-04-14T20:38:24.970+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='Iframe'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='document'/><title type='text'>document onmousemove event differences in different browsers</title><content type='html'>当前文档document中如果有一个iframe时，当mouse滚过当前文档进入到iframe区域中时，不同的浏览器的表现形式有所不同，safari4/opera9.6中仍然能触发mouseover事件，但是在firefox3/ie中则不触发此mouseover事件，因为mouse已经离开了当前文档。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8165967541234100823?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8165967541234100823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8165967541234100823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8165967541234100823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8165967541234100823'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/04/document-onmousemove-event-differences.html' title='document onmousemove event differences in different browsers'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-6114952618475555628</id><published>2009-04-10T11:13:00.002+08:00</published><updated>2009-04-10T11:15:47.945+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hack'/><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>EmulatingFixedPositioning in IE</title><content type='html'>&lt;div class="pre"&gt;&lt;br /&gt;/* For fixed positioning savvy browsers */&lt;br /&gt;.fixed{&lt;br /&gt;    position: fixed;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#header{&lt;br /&gt;    top: 0;&lt;br /&gt;    left: 0;&lt;br /&gt;    height: 80px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#footer{&lt;br /&gt;    bottom: 0;&lt;br /&gt;    left: 0;&lt;br /&gt;    height: 30px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body{&lt;br /&gt;    padding: 80px 0 30px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* For IE for Windows \*/&lt;br /&gt;* html{&lt;br /&gt;    width: 100%;&lt;br /&gt;    height: 100%;&lt;br /&gt;    overflow: hidden;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;* html body{&lt;br /&gt;    width: 100%;&lt;br /&gt;    height: 100%;&lt;br /&gt;    overflow: auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;* html .fixed{&lt;br /&gt;    position: absolute;&lt;br /&gt;}&lt;br /&gt;/* */&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reference: &lt;a href="http://css-discuss.incutio.com/?page=EmulatingFixedPositioning"&gt;http://css-discuss.incutio.com/?page=EmulatingFixedPositioning&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-6114952618475555628?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/6114952618475555628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=6114952618475555628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6114952618475555628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/6114952618475555628'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/04/emulatingfixedpositioning-in-ie.html' title='EmulatingFixedPositioning in IE'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-821459742464164824</id><published>2009-03-16T20:56:00.001+08:00</published><updated>2009-03-16T20:57:53.336+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><category scheme='http://www.blogger.com/atom/ns#' term='Print'/><title type='text'>Test take place of print</title><content type='html'>[Martin Fowler]: Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-821459742464164824?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/821459742464164824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=821459742464164824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/821459742464164824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/821459742464164824'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/test-take-place-of-print.html' title='Test take place of print'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-1054125950400638889</id><published>2009-03-10T13:51:00.000+08:00</published><updated>2009-03-10T13:52:18.319+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='pentaho'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>pentaho2 install in ubuntu</title><content type='html'>$&gt; export JRE_HOME=/usr/lib/jvm/java-6-sun-1.6.0.10&lt;br /&gt;$&gt; cd pentaho/biserver-ce&lt;br /&gt;$&gt; chmod a+x *.sh&lt;br /&gt;$&gt; ./start-pentaho.sh&lt;br /&gt;$&gt; cd pentaho/biserver-ce/administration-console/&lt;br /&gt;$&gt; ./start.sh&lt;br /&gt;INFO: Console is now started. It can be accessed using http://localhost:8099 or http://127.0.0.1:8099&lt;br /&gt;&lt;br /&gt;update admin password to "admin", reference http://wiki.pentaho.com/display/ServerDoc2x/Configuring+Security+with+Pentaho+Administration+Console:&lt;br /&gt;$&gt; cd pentaho/biserver-ce/administration-console/&lt;br /&gt;$&gt; vi resource/config/login.properties&lt;br /&gt;admin: admin,server-administrator,content-administrator,admin&lt;br /&gt;&lt;br /&gt;Restart pentaho bi server and pentaho administrator-console server.&lt;br /&gt;Visit http://127.0.0.1:8099, and use admin/admin login administratation console(old username/password is admin/password)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-1054125950400638889?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/1054125950400638889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=1054125950400638889' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1054125950400638889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/1054125950400638889'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/pentaho2-install-in-ubuntu.html' title='pentaho2 install in ubuntu'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-2714376753526785139</id><published>2009-03-08T22:49:00.002+08:00</published><updated>2009-03-08T22:54:20.798+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='integer'/><category scheme='http://www.blogger.com/atom/ns#' term='Comparable'/><category scheme='http://www.blogger.com/atom/ns#' term='String'/><title type='text'>String compare trap in php</title><content type='html'>If string compare with an integer, php will evaluate string to integer intval() and compare it with that integer.&lt;div class="pre"&gt;if('test' != 0) {&lt;br /&gt; echo "true";&lt;br /&gt;} else {&lt;br /&gt; echo "false"; // return false&lt;br /&gt;}&lt;br /&gt;if('0test' != 0) {&lt;br /&gt; echo "true";&lt;br /&gt;} else {&lt;br /&gt; echo "false"; // return false&lt;br /&gt;}&lt;br /&gt;if('1test' != 0) {&lt;br /&gt; echo "true"; // return true&lt;br /&gt;} else {&lt;br /&gt; echo "false";&lt;br /&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-2714376753526785139?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/2714376753526785139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=2714376753526785139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2714376753526785139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/2714376753526785139'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/string-compare-trap-in-php.html' title='String compare trap in php'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8392785064031409383</id><published>2009-03-08T12:11:00.001+08:00</published><updated>2009-03-08T12:14:27.764+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='IP'/><category scheme='http://www.blogger.com/atom/ns#' term='RegExp'/><title type='text'>Regular expression of ip4</title><content type='html'>/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8392785064031409383?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8392785064031409383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8392785064031409383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8392785064031409383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8392785064031409383'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/regular-expression-of-ip4.html' title='Regular expression of ip4'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-8815396638460941498</id><published>2009-03-08T11:19:00.001+08:00</published><updated>2009-03-08T11:22:28.027+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='get_class'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Inheritance'/><category scheme='http://www.blogger.com/atom/ns#' term='Class'/><title type='text'>Using get_class() in superclass</title><content type='html'>&lt;div class="pre"&gt;&amp;lt;?php&lt;br /&gt;abstract class bar {&lt;br /&gt;    public function __construct()&lt;br /&gt;    {&lt;br /&gt;        var_dump(get_class($this));&lt;br /&gt;        var_dump(get_class());&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class foo extends bar {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;new foo;&lt;br /&gt;?&amp;gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above example will output:&lt;br /&gt;&lt;br /&gt;string(3) "foo"&lt;br /&gt;string(3) "bar"&lt;br /&gt;&lt;br /&gt;Reference: &lt;br /&gt;&lt;a href="http://cn.php.net/manual/en/function.get-class.php"&gt;http://cn.php.net/manual/en/function.get-class.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-8815396638460941498?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/8815396638460941498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=8815396638460941498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8815396638460941498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/8815396638460941498'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/using-getclass-in-superclass.html' title='Using get_class() in superclass'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26648150.post-7070564624679523617</id><published>2009-03-05T00:15:00.001+08:00</published><updated>2009-03-05T00:18:37.759+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='jar'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='sources'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Howto maven2 download java source jar package</title><content type='html'>$&gt; mvn dependency:sources -Dsilent=true filename&lt;br /&gt;dependency:sources tells Maven to resolve all dependencies and their source attachments, and displays the version.&lt;br /&gt;&lt;br /&gt;maven plugins lists page:&lt;br /&gt;http://maven.apache.org/plugins/maven-dependency-plugin/&lt;br /&gt;http://maven.apache.org/plugins/index.html&lt;br /&gt;&lt;br /&gt;Reference:&lt;br /&gt;&lt;a href="http://groups.google.com/group/maven-zh/browse_thread/thread/20494aa10d7818ba?pli=1"&gt;http://groups.google.com/group/maven-zh/browse_thread/thread/20494aa10d7818ba?pli=1&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26648150-7070564624679523617?l=yuweijun.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuweijun.blogspot.com/feeds/7070564624679523617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26648150&amp;postID=7070564624679523617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7070564624679523617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26648150/posts/default/7070564624679523617'/><link rel='alternate' type='text/html' href='http://yuweijun.blogspot.com/2009/03/howto-maven2-download-java-source-jar.html' title='Howto maven2 download java source jar package'/><author><name>俞 伟军</name><uri>http://www.blogger.com/profile/17200405397542410318</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
