<?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-36974671</id><updated>2011-12-15T08:48:15.438-05:00</updated><category term='fs'/><category term='ruby'/><category term='mail'/><category term='reflection'/><category term='javascript'/><category term='ai'/><category term='web'/><category term='encoding'/><category term='hex'/><category term='C'/><category term='latex'/><category term='locale'/><category term='iso'/><category term='rfc'/><category term='maven'/><category term='tomcat'/><category term='sofware'/><category term='eucalyptus'/><category term='api'/><category term='http'/><category term='date'/><category term='hadoop'/><category term='gnome'/><category term='bytecode'/><category term='firefox'/><category term='audio'/><category term='awk'/><category term='standard'/><category term='css'/><category term='ivy'/><category term='configuration'/><category term='shell'/><category term='python'/><category term='systems'/><category term='servlet'/><category term='windows'/><category term='unicode'/><category term='eclipse'/><category term='vim'/><category term='postscript'/><category term='linux'/><category term='apache'/><category term='xml'/><category term='java'/><category term='mysql'/><category term='php'/><category term='security'/><category term='cloundcomputing'/><category term='programming'/><category term='graphics'/><category term='r'/><category term='jsp'/><category term='ssh'/><category term='algorithm'/><category term='bash'/><category term='misc'/><category term='time'/><category term='webservice'/><category term='kindle'/><category term='matlab'/><category term='android'/><category term='terminal'/><category term='groovy'/><category term='software'/><category term='unix'/><category term='jaxp'/><category term='html'/><category term='cloudcomputing'/><category term='design'/><category term='partition'/><category term='ubuntu'/><category term='w3c'/><category term='uri'/><category term='fiddler'/><category term='google'/><category term='svn'/><title type='text'>Keeping Forward</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default?start-index=101&amp;max-results=100'/><author><name>Gerald Guo</name><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>136</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-36974671.post-3246872483008372137</id><published>2011-12-12T13:39:00.001-05:00</published><updated>2011-12-12T13:39:31.818-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>RabbIT</title><content type='html'>&lt;p&gt;Enable filter &lt;em&gt;rabbit.filter.ReverseProxy&lt;/em&gt;, by adding it to the front of &lt;em&gt;httpinfilters&lt;/em&gt; value.&lt;/p&gt;  &lt;p&gt;Configure values for sector &lt;em&gt;rabbit.filter.ReverseProxy.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Run RabbIT:&lt;/p&gt;  &lt;p&gt;&lt;code&gt;java -jar jars/rabbit4.jar -f conf/rabbit.conf&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Resource: &lt;a title="http://www.khelekore.org/rabbit/" href="http://www.khelekore.org/rabbit/"&gt;http://www.khelekore.org/rabbit/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3246872483008372137?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3246872483008372137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3246872483008372137' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3246872483008372137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3246872483008372137'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/12/rabbit.html' title='RabbIT'/><author><name>Gerald Guo</name><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-36974671.post-8015722300662997396</id><published>2011-12-02T17:31:00.001-05:00</published><updated>2011-12-02T17:32:31.908-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>Memory allocation settings in Hadoop</title><content type='html'>&lt;p&gt;Edit file conf/mapred-site.xml to change amount of memory allocated to &lt;strong&gt;&lt;font color="#ff0000"&gt;sorting&lt;/font&gt;&lt;/strong&gt;: &lt;/p&gt;  &lt;pre&gt;&amp;lt;property&amp;gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;name&amp;gt;io.sort.mb&amp;lt;/name&amp;gt;  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;value&amp;gt;300&amp;lt;/value&amp;gt;  &lt;br /&gt;&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Edit file conf/mapred-site.xml to change amount of memory allocated to &lt;strong&gt;&lt;font color="#ff0000"&gt;each map/reduce task&lt;/font&gt;&lt;/strong&gt;: &lt;/p&gt;

&lt;pre&gt;&amp;lt;property&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;name&amp;gt;mapred.child.java.opts&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;value&amp;gt;-Xmx800m&amp;lt;/value&amp;gt;  &lt;br /&gt;&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Edit file conf/hadoop-env.sh to change amount of memory allocated to Hadoop &lt;strong&gt;&lt;font color="#ff0000"&gt;daemons&lt;/font&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export HADOOP_HEAPSIZE=1000&lt;/code&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8015722300662997396?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8015722300662997396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8015722300662997396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8015722300662997396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8015722300662997396'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/12/memory-allocation-settings-in-hadoop.html' title='Memory allocation settings in Hadoop'/><author><name>Gerald Guo</name><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-36974671.post-8203703857179513018</id><published>2011-12-02T17:18:00.001-05:00</published><updated>2011-12-02T17:18:08.770-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>Change ports used by Hadoop</title><content type='html'>&lt;p&gt;Edit file conf/hdfs-site.xml to change ports used by HDFS&lt;/p&gt;  &lt;pre&gt;    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.secondary.http.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51090&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.datanode.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51010&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.datanode.http.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51075&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.datanode.https.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51475&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.datanode.ipc.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51020&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.http.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51070&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;
    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;dfs.https.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51470&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Edit file conf/mapred-site.xml o change ports used by MapReduce &lt;/p&gt;

&lt;pre&gt;    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;mapred.job.tracker.http.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51030&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;

    &amp;lt;property&amp;gt;
        &amp;lt;name&amp;gt;mapred.task.tracker.http.address&amp;lt;/name&amp;gt;
        &amp;lt;value&amp;gt;0.0.0.0:51060&amp;lt;/value&amp;gt;
    &amp;lt;/property&amp;gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8203703857179513018?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8203703857179513018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8203703857179513018' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8203703857179513018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8203703857179513018'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/12/change-ports-used-by-hadoop.html' title='Change ports used by Hadoop'/><author><name>Gerald Guo</name><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-36974671.post-7541691033566879017</id><published>2011-12-02T16:53:00.001-05:00</published><updated>2011-12-02T16:53:52.438-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>exclude directories when using GNU tar</title><content type='html'>&lt;p&gt;&lt;code&gt;tar zvcf name.tar.gz --exclude path/to/dir1 --exclude path/to/dir2 path/to/tar&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Note:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Do not include a trailing '/' in the path of excluded directories.&amp;#160; Otherwise, it won't work. &lt;/li&gt;    &lt;li&gt;Put --exclude before the directory/file to be tarred. &lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7541691033566879017?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7541691033566879017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7541691033566879017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7541691033566879017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7541691033566879017'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/12/exclude-directors-when-using-gnu-tar.html' title='exclude directories when using GNU tar'/><author><name>Gerald Guo</name><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-36974671.post-1141572917290706461</id><published>2011-11-18T23:46:00.001-05:00</published><updated>2011-11-18T23:46:27.176-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Install RPM packages with non-root account</title><content type='html'>&lt;p&gt;Recently, I need to install RPM to RedHat Linux, but I don't have root access.&amp;#160; I found this post: &lt;a href="http://ajaya.name/?p=6353"&gt;http://ajaya.name/?p=6353&lt;/a&gt;.&amp;#160; However, some commands in the command are not correct or need more clarification.&amp;#160; So I wrote down my experience below.&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;create file ~/.rpmmacros and add following line      &lt;br /&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; %_rpmlock_path lib/rpm/__db.000&lt;/code&gt; &lt;/li&gt;    &lt;li&gt;Initialize the database by running command: &lt;/li&gt; &lt;/ul&gt;  &lt;pre&gt;rpm --initdb \&lt;/pre&gt;

&lt;pre&gt;    --root /home/&amp;lt;user_name&amp;gt;/rpm-local/ \&lt;/pre&gt;

&lt;pre&gt;    --dbpath /home/&amp;lt;user_name&amp;gt;/rpm-local/lib/rpm&lt;/pre&gt;

&lt;ul&gt;
  &lt;li&gt;Check the dependence &lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;rpm --root /home/&amp;lt;user_name&amp;gt;/rpm-local/ \&lt;br /&gt;    --dbpath /home/&amp;lt;user_name&amp;gt;/rpm-local/lib/rpm \&lt;br /&gt;    -ivh package.rpm&lt;/pre&gt;

&lt;ul&gt;
  &lt;li&gt;Install package &lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;rpm --root /home/&amp;lt;user_name&amp;gt;/rpm-local \&lt;br /&gt;    --dbpath /home/&amp;lt;user_name&amp;gt;/rpm-local/lib/rpm \ 
    --relocate /usr=/home/&amp;lt;user_name&amp;gt;/rpm-local \&lt;br /&gt;    --nodeps \&lt;br /&gt;    -ivh package.rpm&lt;/pre&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a title="https://bugzilla.redhat.com/show_bug.cgi?id=222194" href="https://bugzilla.redhat.com/show_bug.cgi?id=222194"&gt;https://bugzilla.redhat.com/show_bug.cgi?id=222194&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a title="http://www.redhat.com/archives/rpm-list/2007-May/msg00037.html" href="http://www.redhat.com/archives/rpm-list/2007-May/msg00037.html"&gt;http://www.redhat.com/archives/rpm-list/2007-May/msg00037.html&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a title="https://rhn.redhat.com/errata/RHBA-2006-0440.html" href="https://rhn.redhat.com/errata/RHBA-2006-0440.html"&gt;https://rhn.redhat.com/errata/RHBA-2006-0440.html&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1141572917290706461?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1141572917290706461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1141572917290706461' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1141572917290706461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1141572917290706461'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/11/recently-i-need-to-install-rpm-to.html' title='Install RPM packages with non-root account'/><author><name>Gerald Guo</name><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-36974671.post-5744920874375153492</id><published>2011-10-27T15:18:00.001-04:00</published><updated>2011-10-27T15:18:45.916-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>Add "Edit with Vim" item to context-menu in Windows for Vim</title><content type='html'>&lt;p&gt;This post shows how to add &amp;quot;Edit with Vim&amp;quot; and &amp;quot;Tab Edit with Vim&amp;quot; items to context menu (pop out when you right click a file) in Windows.&lt;/p&gt;  &lt;p&gt;Run &lt;em&gt;&lt;font face="Courier New"&gt;regedit.exe&lt;/font&gt;&lt;/em&gt;, go to &lt;em&gt;&lt;font face="Courier New"&gt;HKEY_LOCAL_MACHINE/SOFTWARE/Classes/*/shell/&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create new key &amp;quot;&lt;font face="Courier New"&gt;Tab Edit with &amp;amp;Vim&lt;/font&gt;&amp;quot; (Right click parent entry -&amp;gt; New -&amp;gt; Key)&lt;/li&gt;    &lt;li&gt;Create new key &amp;quot;&lt;font face="Courier New"&gt;Edit with Vim&lt;/font&gt;&amp;quot;&lt;/li&gt;    &lt;li&gt;Create new key &amp;quot;&lt;font face="Courier New"&gt;command&lt;/font&gt;&amp;quot; under &amp;quot;&lt;font face="Courier New"&gt;Tab Edit with &amp;amp;Vim&lt;/font&gt;&amp;quot;&lt;/li&gt;    &lt;li&gt;Edit the entry with name &amp;quot;&lt;font face="Courier New"&gt;(Default)&lt;/font&gt;&amp;quot;, change its data to      &lt;br /&gt;&lt;font face="Courier New"&gt;&amp;lt;vim_dir&amp;gt;\gvim.exe&amp;quot; -p --remote-tab-silent &amp;quot;%1&amp;quot; &amp;quot;%*&amp;quot;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;Create new key &amp;quot;&lt;font face="Courier New"&gt;command&lt;/font&gt;&amp;quot; under &amp;quot;&lt;font face="Courier New"&gt;Edit with Vim&lt;/font&gt;&amp;quot;.&lt;/li&gt;    &lt;li&gt;Edit the entry with name &amp;quot;&lt;font face="Courier New"&gt;(Default)&lt;/font&gt;&amp;quot;, change its data to       &lt;br /&gt;&lt;font face="Courier New"&gt;&amp;lt;vim_dir&amp;gt;\gvim.exe &amp;quot;%1&amp;quot;&lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;It seems that latest versions of vim automatically create the registry entry: &lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim &lt;/font&gt;&lt;font face="Trebuchet MS"&gt;and the data of entry &lt;em&gt;&lt;font face="Courier New"&gt;path&lt;/font&gt;&lt;/em&gt; points to the vim executable.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_CLASSES_ROOT\*\shellex\ContextmenuHandlers\gvim&lt;/font&gt;. Data of the entry &lt;em&gt;&amp;quot;(Default)&lt;/em&gt;&amp;quot; is the CLSID (&lt;font face="Courier New"&gt;51EEE242-AD87-11d3-9C1E-0090278BBD99&lt;/font&gt;).      &lt;br /&gt;You can delete this entry because we have already added menu item &amp;quot;&lt;font face="Courier New"&gt;Edit with Vim&lt;/font&gt;&amp;quot;.&lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command&lt;/font&gt;. Data of the entry &amp;quot;(Default)&amp;quot; is &lt;font face="Courier New"&gt;&amp;quot;&amp;lt;vim_dir&amp;gt;\gvim.exe&amp;quot; &amp;quot;%1&amp;quot;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}&lt;/font&gt;      &lt;br /&gt;It has a key named &lt;font face="Courier New"&gt;InProcServer32&lt;/font&gt;. The data of &amp;quot;(Default)&amp;quot; is &lt;font face="Courier New"&gt;&lt;em&gt;&amp;lt;vim_dir&amp;gt;\gvimext.dll&lt;/em&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;Some other keys&lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5744920874375153492?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5744920874375153492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5744920874375153492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5744920874375153492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5744920874375153492'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/10/add-with-vim-item-to-context-menu-in.html' title='Add &amp;quot;Edit with Vim&amp;quot; item to context-menu in Windows for Vim'/><author><name>Gerald Guo</name><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-36974671.post-3597459469847462331</id><published>2011-10-17T18:03:00.000-04:00</published><updated>2011-10-17T18:38:10.575-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>Logging in Hadoop</title><content type='html'>&lt;p&gt;Hadoop uses log4j via Apache common logging.&amp;#160; The config file is &lt;em&gt;conf/log4j.properties&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Some important variables are set in the command line.&amp;#160; Following is a snippet cut from the whole command line used to launch HDFS name node.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;-D&lt;strong&gt;&lt;font color="#0000ff"&gt;hadoop.root.logger&lt;/font&gt;&lt;/strong&gt;=INFO,DRFA       &lt;br /&gt;-D&lt;strong&gt;&lt;font color="#0000ff"&gt;hadoop.log.dir&lt;/font&gt;&lt;/strong&gt;=/N/u/hdfs/programs/hadoop-0.21.0/bin/../logs       &lt;br /&gt;-D&lt;strong&gt;&lt;font color="#0000ff"&gt;hadoop.log.file&lt;/font&gt;&lt;/strong&gt;=hadoop-hdfs-namenode-b009.log       &lt;br /&gt;-Dhadoop.home.dir=/N/u/hdfs/programs/hadoop-0.21.0/bin/..       &lt;br /&gt;-Dhadoop.id.str=hdfs&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;You can see that log dir, log file, log level, logger are set.&amp;#160; DRFA is defined in &lt;em&gt;conf/log4j.properties.&lt;/em&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3597459469847462331?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3597459469847462331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3597459469847462331' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3597459469847462331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3597459469847462331'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/10/logging-in-hadoop.html' title='Logging in Hadoop'/><author><name>Gerald Guo</name><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-36974671.post-7975665419834468587</id><published>2011-10-09T11:57:00.001-04:00</published><updated>2011-10-09T11:57:10.812-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><title type='text'>pdf to eps conversion</title><content type='html'>&lt;p&gt;Currently, I need to convert pdf files to eps so that they can be included in latex files.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;p&gt;Use Acrobat Pro open the pdf file.&amp;#160; &lt;br /&gt;Click &lt;em&gt;File -&amp;gt; export -&amp;gt; PostScript -&amp;gt; Encapsulated PostScript&lt;/em&gt; or use &amp;quot;&lt;em&gt;Save As&lt;/em&gt;&amp;quot; and change &amp;quot;&lt;em&gt;Save As Type&lt;/em&gt;&amp;quot;         &lt;br /&gt;However, the bounding box is NOT correctly calculated.         &lt;br /&gt;You can use gsview to correct it.&amp;#160; Use gsview open the eps file, click &amp;quot;&lt;em&gt;File -&amp;gt; PS to EPS&lt;/em&gt;&amp;quot;, select &amp;quot;Automatically calculate Bounding Box&amp;quot; and save the output file. &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;Use ghostscript.&amp;#160; Execute following command:        &lt;br /&gt;&lt;code&gt;gswin32 -sDEVICE=epswrite -sOutputFile=&amp;lt;filename&amp;gt;.eps &amp;lt;filename&amp;gt;.pdf&lt;/code&gt;         &lt;br /&gt;This works well and bounding box is correctly calculated.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Use Xpdf (&lt;a title="http://www.foolabs.com/xpdf/download.html" href="http://www.foolabs.com/xpdf/download.html"&gt;http://www.foolabs.com/xpdf/download.html&lt;/a&gt;)       &lt;br /&gt;&lt;code&gt;pdftops -eps &amp;lt;filename&amp;gt;.pdf &amp;lt;filename&amp;gt;.eps&lt;/code&gt;       &lt;br /&gt;However, the bounding box is NOT correctly calculated. &lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7975665419834468587?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7975665419834468587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7975665419834468587' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7975665419834468587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7975665419834468587'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/10/pdf-to-eps-conversion.html' title='pdf to eps conversion'/><author><name>Gerald Guo</name><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-36974671.post-2892916058414204250</id><published>2011-10-09T11:43:00.001-04:00</published><updated>2011-10-09T11:43:51.201-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><title type='text'>Brief Latex notes for equations</title><content type='html'>&lt;p&gt;In-line: $…$&lt;/p&gt;  &lt;p&gt;Single line, without equation number: \[ … \] or \begin{equation*} … \end{equation*}&lt;/p&gt;  &lt;p&gt;Single line, with equation number: \begin{equation} … \end{equation}&lt;/p&gt;  &lt;p&gt;Multi-line, without equation number: \begin{align*} ... \end{align*}&lt;/p&gt;  &lt;p&gt;Multi-line, with equation number: \begin{align} ... \end{align}&lt;/p&gt;  &lt;p&gt;&amp;quot;a double backslash (\\) is used to separate the lines, and an ampersand symbol (&amp;amp;) is used to indicate the place at which the formulas should be aligned.&amp;quot;&lt;/p&gt;  &lt;p&gt;For &lt;em&gt;align&lt;/em&gt;, \label must be put &lt;strong&gt;in front of&lt;/strong&gt; each equation. For &lt;em&gt;equation&lt;/em&gt;, it does not matter you put it in front or in the end.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2892916058414204250?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2892916058414204250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2892916058414204250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2892916058414204250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2892916058414204250'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/10/brief-latex-notes-for-equations.html' title='Brief Latex notes for equations'/><author><name>Gerald Guo</name><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-36974671.post-973381308469436125</id><published>2011-10-08T12:02:00.001-04:00</published><updated>2011-10-08T12:03:40.515-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>Make vim-latex to generate output in a specified directory</title><content type='html'>&lt;p&gt;Recently I started to use latex to write papers.&amp;#160; I want to edit latex in my favorite editor - vim. I found the project vim-latex: &lt;a title="http://vim-latex.sourceforge.net/" href="http://vim-latex.sourceforge.net/"&gt;http://vim-latex.sourceforge.net/&lt;/a&gt;.&amp;#160; It is powerful and convenient to use.&amp;#160; &lt;/p&gt;  &lt;p&gt;However, one feature I want is to generate output files (.div, .ps, .log, etc) into a separate directory rather than the same directory as &lt;em&gt;tex&lt;/em&gt; files.&amp;#160; It turns out that vim-latex does not support it natively.&amp;#160; So I hacked into the source code to make it work on &lt;strong&gt;&lt;font color="#ff0000"&gt;Windows&lt;/font&gt;&lt;/strong&gt;.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;p&gt;&lt;strong&gt;Edit file ~/vimfiles/ftplugin/tex.vim&lt;/strong&gt;&lt;/p&gt;      &lt;p&gt;&lt;strong&gt;Add&lt;/strong&gt; following config:&lt;/p&gt;      &lt;pre&gt;  set iskeyword+=: 
  let g:Tex_Outdir='out' 
  let g:Tex_ViewRule_pdf='&amp;quot;Foxit Reader.exe&amp;quot; ' 
  let g:Tex_CompileRule_dvi='mkdir '.g:Tex_Outdir.' &amp;amp; latex -output-directory='.g:Tex_Outdir.' -src-specials --interaction=nonstopmode $*' 
  let g:Tex_CompileRule_pdf=g:Tex_CompileRule_dvi.' &amp;amp; cd '.g:Tex_Outdir.' &amp;amp; dvipdfm $*.dvi'&lt;/pre&gt;

    &lt;p&gt;Basically above config specifies &lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;output directory of latex compilation &lt;/li&gt;

      &lt;li&gt;How to view PDF files (if you don't give full path, the command needs to be in env variable PATH) &lt;/li&gt;

      &lt;li&gt;How to compile dvi: create the output directory and put output there &lt;/li&gt;

      &lt;li&gt;How to compile pdf: first compile tex to dvi, and then call &lt;em&gt;dvipdfm&lt;/em&gt; to generate pdf &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Change ~/vimfiles/ftplugin/latex-suite/compiler.vim&lt;/strong&gt;&lt;/p&gt;

    &lt;p&gt;Change line 252 to (this line adds the full path of output directory): 
      &lt;br /&gt;&amp;#160; &lt;code&gt;let execString = 'start '.s:viewer.' &amp;quot;'.&lt;font color="#0000ff"&gt;expand('%:p:h').'/'.g:Tex_Outdir.'/&lt;/font&gt;$*.'.s:target.'&amp;quot;'&lt;/code&gt; &lt;/p&gt;

    &lt;p&gt;Change line 405 to (this line adds the full path of output directory): 
      &lt;br /&gt;&lt;code&gt;let execString = 'silent! !'.viewer.' &amp;quot;'.&lt;font color="#0000ff"&gt;expand('%:p:h').'/'.g:Tex_Outdir.'/'.&lt;/font&gt;mainfnameRoot.'.'.s:target.'&amp;quot; '.line('.').' &amp;quot;'.expand('%').'&amp;quot;'&lt;/code&gt;&lt;/p&gt;
Note: the text in blue is what I added (diff against the original code) &lt;/li&gt;
&lt;/ol&gt;
Use command 'TTarget' to switch amont &lt;em&gt;dvi, ps, pdf, etc.&lt;/em&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-973381308469436125?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/973381308469436125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=973381308469436125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/973381308469436125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/973381308469436125'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/10/make-vim-latex-to-generate-output-in.html' title='Make vim-latex to generate output in a specified directory'/><author><name>Gerald Guo</name><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-36974671.post-4739717918978242557</id><published>2011-09-19T18:11:00.001-04:00</published><updated>2011-09-19T18:44:56.869-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ivy'/><title type='text'>How to publish artifacts to ivy local repository and use it in another project</title><content type='html'>&lt;h2&gt;Build artifacts that are required by another project&lt;/h2&gt;  &lt;p&gt;ivy.xml: Attributes organisation, module and revision of element ivy-module/info. &lt;/p&gt;  &lt;p&gt;1) Add a new resolver to ivy by adding following snippet to ivysettings.xml: &lt;/p&gt;  &lt;pre&gt;&amp;lt;filesystem name=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;gerald-local-ivy&lt;/font&gt;&lt;/strong&gt;&amp;quot; m2compatible=&amp;quot;false&amp;quot; force=&amp;quot;false&amp;quot; local=&amp;quot;true&amp;quot;&amp;gt;
    &amp;lt;artifact pattern=&amp;quot;${ivy.default.ivy.user.dir}/&lt;strong&gt;&lt;font color="#ff0000"&gt;local&lt;/font&gt;&lt;/strong&gt;/[organisation]/[module]/[type]s/[artifact]-[revision](-[classifier]).[ext]&amp;quot;/&amp;gt;
&amp;lt;/filesystem&amp;gt;&lt;/pre&gt;
This will create a directory &lt;code&gt;local&lt;/code&gt; under &lt;code&gt;&amp;lt;user.home&amp;gt;/.ivy2/&lt;/code&gt;. 

&lt;p&gt;2) Add following snippet to your build.xml: &lt;/p&gt;

&lt;pre&gt;&amp;lt;target name=&amp;quot;publish&amp;quot; depends=&amp;quot;jar&amp;quot; description=&amp;quot;Publish&amp;quot;&amp;gt;
    &amp;lt;!-- following property defines the version to publish --&amp;gt;&lt;br /&gt;    &amp;lt;property name=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;ivy.deliver.revision&lt;/font&gt;&lt;/strong&gt;&amp;quot; value=&amp;quot;${version}&amp;quot;/&amp;gt;
    &amp;lt;ivy:publish resolver=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;gerald-local-ivy&lt;/font&gt;&lt;/strong&gt;&amp;quot; forcedeliver=&amp;quot;true&amp;quot;
    	 &lt;font color="#0000ff"&gt;settingsRef=&amp;quot;${ant.project.name}.ivy.settings&amp;quot;&lt;/font&gt; overwrite=&amp;quot;true&amp;quot;&amp;gt;
    	&amp;lt;artifacts pattern=&amp;quot;${build.dir}/[artifact]-[revision](-[classifier]).[ext]&amp;quot; /&amp;gt;
    &amp;lt;/ivy:publish&amp;gt;
&amp;lt;/target&amp;gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;resolver&lt;/code&gt; attribute of &lt;code&gt;ivy:publish&lt;/code&gt; must match &lt;code&gt;name&lt;/code&gt; attribute specified in step 1). Change &lt;em&gt;pattern&lt;/em&gt; attribute for &lt;em&gt;artifacts&lt;/em&gt; element to match where you put the artifact.&lt;/p&gt;

&lt;p&gt;3) Use command &lt;code&gt;ant publish&lt;/code&gt; to publish your jar. &lt;/p&gt;

&lt;h2&gt;Build main project that depends on the artifacts built above.&lt;/h2&gt;

&lt;p&gt;1) Add the same resolver to ivy by adding following snippet to ivysettings.xml: &lt;/p&gt;

&lt;pre&gt;&amp;lt;filesystem name=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;gerald-local-ivy&lt;/font&gt;&lt;/strong&gt;&amp;quot; m2compatible=&amp;quot;false&amp;quot; force=&amp;quot;false&amp;quot; local=&amp;quot;true&amp;quot;&amp;gt;
    &amp;lt;artifact pattern=&amp;quot;${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[type]s/[artifact]-[revision](-[classifier]).[ext]&amp;quot;/&amp;gt;
&amp;lt;/filesystem&amp;gt;&lt;/pre&gt;

&lt;p&gt;2) Add it to your &lt;strong&gt;&lt;font color="#ff0000"&gt;effective &lt;/font&gt;&lt;/strong&gt;resolver chain.&lt;/p&gt;

&lt;p&gt;3) Add dependency declaration to ivy.xml &lt;/p&gt;

&lt;pre&gt;&amp;lt;dependency org=&amp;quot;&amp;lt;organization&amp;gt;&amp;quot; name=&amp;quot;&amp;lt;module&amp;gt;&amp;quot; &lt;/pre&gt;

&lt;pre&gt;            rev=&amp;quot;&amp;lt;version&amp;gt;&amp;quot; conf=&amp;quot;&amp;lt;common-&amp;gt;master&amp;gt;&amp;quot;&amp;gt;&lt;/pre&gt;
The attributes &lt;code&gt;org&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;rev&lt;/code&gt; must match the values specified when you built the dependency jar. 

&lt;p&gt;4) Manually remove the artifacts that exist in local cache (&amp;lt;user.home&amp;gt;/.ivy2/cache).&lt;/p&gt;

&lt;p&gt;5) Build your project&lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;p&gt;&lt;a title="http://ant.apache.org/ivy/history/2.2.0/use/publish.html" href="http://ant.apache.org/ivy/history/2.2.0/use/publish.html"&gt;http://ant.apache.org/ivy/history/2.2.0/use/publish.html&lt;/a&gt; 

  &lt;br /&gt;&lt;a title="http://ant.apache.org/ivy/history/latest-milestone/resolver/chain.html" href="http://ant.apache.org/ivy/history/latest-milestone/resolver/chain.html"&gt;http://ant.apache.org/ivy/history/latest-milestone/resolver/chain.html&lt;/a&gt; 

  &lt;br /&gt;&lt;a title="http://stackoverflow.com/questions/353336/how-does-ivypublish-work" href="http://stackoverflow.com/questions/353336/how-does-ivypublish-work"&gt;http://stackoverflow.com/questions/353336/how-does-ivypublish-work&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://mail-archives.apache.org/mod_mbox/ant-ivy-user/201002.mbox/%3C27714488.post@talk.nabble.com%3E" href="http://mail-archives.apache.org/mod_mbox/ant-ivy-user/201002.mbox/%3C27714488.post@talk.nabble.com%3E"&gt;http://mail-archives.apache.org/mod_mbox/ant-ivy-user/201002.mbox/%3C27714488.post@talk.nabble.com%3E&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4739717918978242557?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4739717918978242557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4739717918978242557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4739717918978242557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4739717918978242557'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/09/how-to-publish-artifacts-to-ivy-local.html' title='How to publish artifacts to ivy local repository and use it in another project'/><author><name>Gerald Guo</name><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-36974671.post-1131760133613390743</id><published>2011-09-18T18:58:00.001-04:00</published><updated>2011-09-18T19:28:55.096-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Configure ivy to use local Maven repository</title><content type='html'>&lt;p&gt;This post shows how to configure ivy to use specific local Maven repository.&lt;/p&gt;  &lt;p&gt;1) Add following config as a child element of tag &amp;quot;resolvers&amp;quot; in you ivy settings file:&lt;/p&gt;  &lt;pre&gt;    &amp;lt;filesystem name=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;local-maven-2&lt;/font&gt;&lt;/strong&gt;&amp;quot; m2compatible=&amp;quot;true&amp;quot; force=&amp;quot;false&amp;quot; local=&amp;quot;true&amp;quot;&amp;gt;
       &amp;lt;artifact pattern=&amp;quot;${gerald.repo.dir}/[organisation]/[module]/[revision]/[module]-[revision].[ext]&amp;quot;/&amp;gt;
       &amp;lt;ivy pattern=&amp;quot;${gerald.repo.dir}/[organisation]/[module]/[revision]/[module]-[revision].pom&amp;quot;/&amp;gt;
    &amp;lt;/filesystem&amp;gt;&lt;/pre&gt;
2) Then add it to your chain resolver config. Example:&amp;#160; &lt;pre&gt;    &amp;lt;chain name=&amp;quot;internal&amp;quot; dual=&amp;quot;true&amp;quot;&amp;gt;
      &amp;lt;resolver ref=&amp;quot;&lt;strong&gt;&lt;font color="#ff0000"&gt;local-maven-2&lt;/font&gt;&lt;/strong&gt;&amp;quot;/&amp;gt;
      &amp;lt;resolver ref=&amp;quot;apache-snapshot&amp;quot;/&amp;gt; 
      &amp;lt;resolver ref=&amp;quot;maven2&amp;quot;/&amp;gt;
    &amp;lt;/chain&amp;gt;&lt;/pre&gt;

&lt;p&gt;If you have multiple resolver chain, make sure that the correct one, which is effective for you build, is changed.&lt;/p&gt;

&lt;p&gt;3) After ivy caches the artifacts in its own local repo (the first time the dependency is resolved), it will not pick changes you made to the artifacts in the original Maven repository.&amp;#160; In other words, if you use &amp;quot;mvn clean install&amp;quot; to re-publish the artifact, the new version will NOT propagate to ivy. 
  &lt;br /&gt;You can change the default behavior by tweaking parameters: 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;checkmodified&lt;/strong&gt;, &lt;strong&gt;changingPattern&lt;/strong&gt;,&amp;#160; &lt;strong&gt;changingMatcher&lt;/strong&gt;, &lt;strong&gt;alwaysCheckExactRevision&lt;/strong&gt; 

  &lt;br /&gt;Read this article for details: &lt;a title="http://ant.apache.org/ivy/history/trunk/settings/resolvers.html" href="http://ant.apache.org/ivy/history/trunk/settings/resolvers.html"&gt;http://ant.apache.org/ivy/history/trunk/settings/resolvers.html&lt;/a&gt; 

  &lt;br /&gt;One example:&lt;/p&gt;

&lt;pre&gt;    &amp;lt;chain name=&amp;quot;default&amp;quot; dual=&amp;quot;true&amp;quot; 
	     &lt;strong&gt;&lt;font color="#ff0000"&gt;checkmodified=&amp;quot;true&amp;quot; changingPattern=&amp;quot;.*SNAPSHOT&amp;quot;&lt;/font&gt;&lt;/strong&gt;&amp;gt;
     ......
    &amp;lt;/chain&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://mail-archives.apache.org/mod_mbox/ant-ivy-user/200807.mbox/raw/%3C94bda3fa0807202250y446a818eodb527dba96c8ac93@mail.gmail.com%3E/" href="http://mail-archives.apache.org/mod_mbox/ant-ivy-user/200807.mbox/raw/%3C94bda3fa0807202250y446a818eodb527dba96c8ac93@mail.gmail.com%3E/"&gt;http://mail-archives.apache.org/mod_mbox/ant-ivy-user/200807.mbox/raw/%3C94bda3fa0807202250y446a818eodb527dba96c8ac93@mail.gmail.com%3E/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1131760133613390743?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1131760133613390743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1131760133613390743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1131760133613390743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1131760133613390743'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/09/configure-ivy-to-use-local-maven.html' title='Configure ivy to use local Maven repository'/><author><name>Gerald Guo</name><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-36974671.post-7949119912816702448</id><published>2011-09-13T00:11:00.001-04:00</published><updated>2011-09-13T10:59:12.188-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Vdbench notes</title><content type='html'>&lt;p&gt;Two types of supported testings.&amp;#160; Following table shows the configuration groups for these testings.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="631"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="266" align="center"&gt;&lt;strong&gt;Storage device testing&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="363" align="center"&gt;&lt;strong&gt;File system testing&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="266"&gt;General - optional&lt;/td&gt;        &lt;td valign="top" width="363"&gt;General - optional&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="266"&gt;Host Definition(HD) - optional&lt;/td&gt;        &lt;td valign="top" width="363"&gt;Host Definition (HD) - optional&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="266"&gt;Storage Definition(SD)&lt;/td&gt;        &lt;td valign="top" width="363"&gt;File System Definition (FSD)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="266"&gt;Workload Definition(WD)&lt;/td&gt;        &lt;td valign="top" width="363"&gt;File System Workload Definition(FSWD)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="266"&gt;Run Definition (RD)&lt;/td&gt;        &lt;td valign="top" width="363"&gt;Run Definition (RD)&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Different configuration groups may be specified in one single file or multiple files (use multiple&lt;em&gt; -f&lt;/em&gt; options to specify all of them).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Comments&lt;/strong&gt;: a line starting with '/', '#', or '*' is a comment.     &lt;br /&gt;&lt;strong&gt;Continuation&lt;/strong&gt;: end a line with a comma plus a whitespace.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Output file      &lt;br /&gt;&lt;/strong&gt;-o dirname+&amp;#160;&amp;#160; # if &lt;em&gt;dirname&lt;/em&gt; has existed, use &lt;em&gt;dirname001.&lt;/em&gt;     &lt;br /&gt;-o dirname.tod&amp;#160;&amp;#160;&amp;#160; # the directory name will be &lt;em&gt;dirname.yymmdd.hhmmss&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;General parameters&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-MOGiXGwwi1M/Tm7X-eLL84I/AAAAAAAABGo/MsboVwnV1D4/s1600-h/Vdbench_global_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_global_param" border="0" alt="Vdbench_global_param" src="http://lh5.ggpht.com/-Owj3YMnibLA/Tm7X-_2jp8I/AAAAAAAABGs/MqRNRf3aPcM/Vdbench_global_param_thumb%25255B1%25255D.png?imgmax=800" width="824" height="703" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Host definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-8eK9ioSFYXs/Tm7X_NllaKI/AAAAAAAABGw/_9dtLj1RvfI/s1600-h/Vdbench_host_def_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_host_def_param" border="0" alt="Vdbench_host_def_param" src="http://lh5.ggpht.com/-mJDz1Epyawk/Tm7X_TIZapI/AAAAAAAABG0/BfS-O6xcLcw/Vdbench_host_def_param_thumb%25255B1%25255D.png?imgmax=800" width="812" height="319" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Storage definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-zEOeL5D1ws4/Tm7X_-FxQII/AAAAAAAABG4/jv2PUdkk_rY/s1600-h/Vdbench_storage_def_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_storage_def_param" border="0" alt="Vdbench_storage_def_param" src="http://lh5.ggpht.com/-Mth9bqtZFzw/Tm7YAEM61XI/AAAAAAAABG8/sRIcHUFYYUE/Vdbench_storage_def_param_thumb%25255B1%25255D.png?imgmax=800" width="808" height="464" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Workload definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-mmOip6iSmQU/Tm7YAo0hkOI/AAAAAAAABHA/hzl8K37XzKo/s1600-h/Vdbench_workload_def%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_workload_def" border="0" alt="Vdbench_workload_def" src="http://lh5.ggpht.com/-F42MUksw7fw/Tm7YBD3y28I/AAAAAAAABHE/LJE_9_q9Hbw/Vdbench_workload_def_thumb%25255B1%25255D.png?imgmax=800" width="796" height="349" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Run definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-BFSrcHuRV_s/Tm7YBVWa1OI/AAAAAAAABHI/nFxjT-0J8Vc/s1600-h/Vdbench_run_def_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_run_def_param" border="0" alt="Vdbench_run_def_param" src="http://lh5.ggpht.com/-nhqlniAM1d8/Tm7YCBrel4I/AAAAAAAABHM/LZwgxJJFp_I/Vdbench_run_def_param_thumb%25255B1%25255D.png?imgmax=800" width="767" height="608" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;File System Definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-XrMnRVF6LgE/Tm7YCVjCd7I/AAAAAAAABHQ/I16Dv4_8GS8/s1600-h/Vdbench_filesystem_def_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_filesystem_def_param" border="0" alt="Vdbench_filesystem_def_param" src="http://lh5.ggpht.com/-M3cCHgYt9_c/Tm7YC7DXrTI/AAAAAAAABHU/buiJGH8bTL0/Vdbench_filesystem_def_param_thumb%25255B1%25255D.png?imgmax=800" width="764" height="394" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;File System Workload Definition&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-A2bQ0Qwb_xA/Tm7YDDzlfoI/AAAAAAAABHY/ZezNOeD16QM/s1600-h/Vdbench_filesystem_workload_def_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_filesystem_workload_def_param" border="0" alt="Vdbench_filesystem_workload_def_param" src="http://lh5.ggpht.com/-r-TIHIgV6FE/Tm7YDoggByI/AAAAAAAABHc/8Qw-S3fHoJg/Vdbench_filesystem_workload_def_param_thumb%25255B1%25255D.png?imgmax=800" width="773" height="463" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Run definition for file system testing&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-EXW5N6J9-ZI/Tm7akN5gWkI/AAAAAAAABHg/ZMXHYMh5X2s/s1600-h/Vdbench_run_def_fs_param%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Vdbench_run_def_fs_param" border="0" alt="Vdbench_run_def_fs_param" src="http://lh6.ggpht.com/-0jWdR3gI4M4/Tm7akXIK3QI/AAAAAAAABHk/0JW_pFEsJkQ/Vdbench_run_def_fs_param_thumb%25255B1%25255D.png?imgmax=800" width="751" height="304" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;:    &lt;br /&gt;Official doc: &lt;a title="http://downloads.sourceforge.net/project/vdbench/vdbench502.pdf?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fvdbench%2Ffiles%2F&amp;amp;ts=1315925901&amp;amp;use_mirror=superb-sea2" href="http://downloads.sourceforge.net/project/vdbench/vdbench502.pdf?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fvdbench%2Ffiles%2F&amp;amp;ts=1315925901&amp;amp;use_mirror=superb-sea2"&gt;http://downloads.sourceforge.net/project/vdbench/vdbench502.pdf?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fvdbench%2Ffiles%2F&amp;amp;ts=1315925901&amp;amp;use_mirror=superb-sea2&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7949119912816702448?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7949119912816702448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7949119912816702448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7949119912816702448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7949119912816702448'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/09/vdbench-notes.html' title='Vdbench notes'/><author><name>Gerald Guo</name><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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-Owj3YMnibLA/Tm7X-_2jp8I/AAAAAAAABGs/MqRNRf3aPcM/s72-c/Vdbench_global_param_thumb%25255B1%25255D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-6318339359415883379</id><published>2011-09-09T19:19:00.001-04:00</published><updated>2011-09-09T19:19:30.833-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='r'/><title type='text'>R notes</title><content type='html'>&lt;p&gt;Construct a list of lists&lt;/p&gt;  &lt;p&gt;a = c(1,2,3)   &lt;br /&gt;b = c(4,5,6)    &lt;br /&gt;c = list(a, b)    &lt;br /&gt;d = list(c, list(a))&amp;#160;&amp;#160;&amp;#160; # different from list(c, a)    &lt;br /&gt;e = list(d, name=&amp;quot;gerald&amp;quot;)&lt;/p&gt;  &lt;p&gt;Append to a list:&lt;/p&gt;  &lt;p&gt;mylist[[length(mylist) + 1]] = obj&lt;/p&gt;  &lt;p&gt;Append to a vector:&lt;/p&gt;  &lt;p&gt;append(vec, val)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Type information&lt;/p&gt;  &lt;p&gt;typeof(var),&amp;#160; class(var)&lt;/p&gt;  &lt;h2&gt;Resources&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://www.statmethods.net/input/datatypes.html" href="http://www.statmethods.net/input/datatypes.html"&gt;http://www.statmethods.net/input/datatypes.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6318339359415883379?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6318339359415883379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6318339359415883379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6318339359415883379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6318339359415883379'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/09/r-notes.html' title='R notes'/><author><name>Gerald Guo</name><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-36974671.post-5626307305360266322</id><published>2011-09-05T16:35:00.001-04:00</published><updated>2011-09-05T16:35:21.206-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to get network information in Linux</title><content type='html'>&lt;p&gt;Following files/dirs can be directly read:&lt;/p&gt;  &lt;p&gt;/proc/net/dev   &lt;br /&gt;/sys/class/net/&amp;lt;if_name&amp;gt;/    &lt;br /&gt;/sys/class/net/&amp;lt;if_name&amp;gt;/statistics&lt;/p&gt;  &lt;p&gt;Tool &lt;strong&gt;&lt;em&gt;netstat&lt;/em&gt;&lt;/strong&gt; is your friend to get network-related information:&lt;/p&gt;  &lt;p&gt;netstat -I&amp;#160; # display interface info   &lt;br /&gt;netstat -s&amp;#160; # display statistics info    &lt;br /&gt;netstat -r&amp;#160; # display routing info    &lt;br /&gt;netstat -tlnp&amp;#160; # display TCP listening info&lt;/p&gt;  &lt;p&gt;Other tools: sar, ifconfig, iftop&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5626307305360266322?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5626307305360266322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5626307305360266322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5626307305360266322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5626307305360266322'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/09/how-to-get-network-information-in-linux.html' title='How to get network information in Linux'/><author><name>Gerald Guo</name><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-36974671.post-9100801195651865274</id><published>2011-07-08T01:56:00.001-04:00</published><updated>2011-07-08T01:59:30.900-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to see network card and disk speed</title><content type='html'>&lt;p&gt;Sometimes, you may want to know the hardware speed limit for network interface cards and disks.&lt;/p&gt;  &lt;h2&gt;Network Interface Card&lt;/h2&gt;  &lt;p&gt;I use commands &lt;/p&gt;  &lt;pre style="margin-left: 10px"&gt;dmesg | grep -i ethernet
dmesg | grep -i infiniband&lt;/pre&gt;

&lt;p&gt;The output looks like &lt;/p&gt;

&lt;pre style="margin-left: 10px"&gt;Intel(R) Gigabit Ethernet Network Driver - version 2.1.0-k2-1
igb 0000:0b:00.0: Intel(R) Gigabit Ethernet Network Connection
igb 0000:0b:00.1: Intel(R) Gigabit Ethernet Network Connection&lt;/pre&gt;
and 

&lt;pre style="margin-left: 10px"&gt;mlx4_ib: Mellanox ConnectX InfiniBand driver v1.0 (April 4, 2008)
Registered RDS/infiniband transport&lt;/pre&gt;

&lt;p&gt;I also use command &lt;/p&gt;

&lt;pre style="margin-left: 10px"&gt;/sbin/lspci&lt;/pre&gt;
The output has following useful information 

&lt;pre style="margin-left: 10px"&gt;0b:00.0 Ethernet controller: Intel Corporation 82575EB Gigabit Network Connection (rev 02)
0b:00.1 Ethernet controller: Intel Corporation 82575EB Gigabit Network Connection (rev 02)
10:00.0 InfiniBand: Mellanox Technologies MT26418 [ConnectX VPI PCIe 2.0 5GT/s - IB DDR / 10GigE] (rev a0)&lt;/pre&gt;

&lt;h2&gt;Disk&lt;/h2&gt;

&lt;p&gt;/sbin/lspci | grep -i ata&lt;/p&gt;

&lt;h2&gt;Other useful tools&lt;/h2&gt;

&lt;p&gt;&lt;font face="Courier New"&gt;mii-tools
    &lt;br /&gt;hdparm&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;They need root privilege usually.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-9100801195651865274?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/9100801195651865274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=9100801195651865274' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9100801195651865274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9100801195651865274'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/07/how-to-see-network-card-and-disk-speed.html' title='How to see network card and disk speed'/><author><name>Gerald Guo</name><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-36974671.post-3994361164270398901</id><published>2011-05-12T10:12:00.000-04:00</published><updated>2011-05-13T16:46:34.660-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>Hadoop datanode version control</title><content type='html'>&lt;p&gt;Sometimes, when you upgrade your Hadoop, you may get following error in your namenode log:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;Incompatible build versions: namenode BV = Unknown; datanode BV = &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;./common-0.21.0/src/saveVersion.sh&lt;/font&gt; generates &lt;font face="Courier New"&gt;package-info.java&lt;/font&gt; which includes version information.&amp;#160; The content looks like&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;@HadoopVersionAnnotation(version=&amp;quot;0.21.1-SNAPSHOT&amp;quot;, revision=&amp;quot;1&amp;quot;, branch=&amp;quot;&amp;quot;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; user=&amp;quot;username&amp;quot;, date=&amp;quot;Mon Nov 15 12:28:49 EST 2010&amp;quot;,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; url=&amp;quot;your_domain/path&amp;quot;,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; srcChecksum=&amp;quot;a1aeb15b4854808d152989ba76f90fac&amp;quot;)&lt;/font&gt;    &lt;br /&gt;&lt;em&gt;&lt;font face="Courier New"&gt;saveVersion.sh&lt;/font&gt;&lt;/em&gt; is executed when you build Hadoop using ant.&amp;#160; It is specified in &lt;font face="Courier New"&gt;build.xml &lt;/font&gt;(target &amp;quot;init&amp;quot;). &lt;/p&gt;  &lt;p&gt;In Java code, class &lt;font face="Courier New"&gt;org.apache.hadoop.util.VersionInfo&lt;/font&gt; manages version.&amp;#160; It gets version information from &lt;font face="Courier New"&gt;package-info.java&lt;/font&gt; generated by &lt;font face="Courier New"&gt;saveVersion.sh&lt;/font&gt;. &lt;/p&gt;  &lt;p&gt;In class &lt;font face="Courier New"&gt;org.apache.hadoop.hdfs.server.datanode.DataNode&lt;/font&gt;, method &lt;font face="Courier New"&gt;handshake&lt;/font&gt; checks whether build version is equal.&amp;#160; How build version is calculated is shown below.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public static String getBuildVersion(){     &lt;br /&gt;&amp;#160; return VersionInfo.getVersion() +       &lt;br /&gt;&amp;#160; &amp;quot; from &amp;quot; + VersionInfo.getRevision() +      &lt;br /&gt;&amp;#160; &amp;quot; by &amp;quot; + VersionInfo.getUser() +       &lt;br /&gt;&amp;#160; &amp;quot; source checksum &amp;quot; + VersionInfo.getSrcChecksum();      &lt;br /&gt;}&lt;/font&gt;    &lt;br /&gt;So, the quick solution is that you upgrade all installations of Hadoop on different nodes.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3994361164270398901?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3994361164270398901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3994361164270398901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3994361164270398901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3994361164270398901'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/05/hadoop-datanode-version-control.html' title='Hadoop datanode version control'/><author><name>Gerald Guo</name><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-36974671.post-6957749461778004849</id><published>2011-05-12T04:16:00.000-04:00</published><updated>2011-05-13T16:46:34.400-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>How to install user-provided jars to Hadoop</title><content type='html'>&lt;p&gt;If you write a MapReduce program and compile it to a jar, you usually run it with following command:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;./bin/hadoop jar your_jar_name&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you want to your jar loaded when Hadoop is started (e.g. you add a new service which should be initiated and started by Hadoop), you can follow steps shown below. &lt;/p&gt;  &lt;p&gt;In file &lt;em&gt;&lt;font face="Courier New"&gt;bin/hadoop-config.sh&lt;/font&gt;&lt;/em&gt;, you can find following snippet:&lt;/p&gt;  &lt;pre&gt;for f in $HADOOP_COMMON_HOME/hadoop-*.jar; do
  CLASSPATH=${CLASSPATH}:$f;
done&lt;/pre&gt;

&lt;p&gt;So only jars whose names starting with &amp;quot;&lt;em&gt;hadoop-&lt;/em&gt;&amp;quot; are loaded by default.&lt;/p&gt;

&lt;p&gt;Drop your jar to the directory where Hadoop is used, and change file &lt;em&gt;&lt;font face="Courier New"&gt;bin/hadoop-config.sh&lt;/font&gt;&lt;/em&gt; to add&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;font face="Courier New"&gt;CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/your_jar_name&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6957749461778004849?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6957749461778004849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6957749461778004849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6957749461778004849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6957749461778004849'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/05/how-to-install-user-provided-jars-to.html' title='How to install user-provided jars to Hadoop'/><author><name>Gerald Guo</name><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-36974671.post-3138140427241494119</id><published>2011-04-15T01:24:00.001-04:00</published><updated>2011-04-15T01:24:38.522-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Debug/profile heap/gc in Java</title><content type='html'>&lt;h4&gt;HPROF&lt;/h4&gt;  &lt;p&gt;Profiler agent.   &lt;br /&gt;Examples:    &lt;br /&gt;java -agentlib:hprof=help    &lt;br /&gt;java -agentlib:hprof=heap=sites     &lt;br /&gt;java -agentlib:hprof=heap=dump    &lt;br /&gt;java -agentlib:hprof=cpu=samples&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot; By default, heap profiling information (sites and dump) is written out to &lt;tt&gt;java.hprof.txt&lt;/tt&gt; (in ASCII) in the current working directory. &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;The output is normally generated when the VM exits&lt;/strong&gt;, although this can be disabled by setting the “dump on exit” option to “n” ( &lt;tt&gt;doe=n&lt;/tt&gt;). In addition, a profile is generated when Ctrl-\ or Ctrl-Break (depending on platform) is pressed. On Solaris OS and Linux a profile is also generated when a QUIT signal is received ( &lt;tt&gt;kill -QUIT&lt;/tt&gt; &lt;var&gt;pid&lt;/var&gt;). If Ctrl-\ or Ctrl-Break is pressed multiple times, multiple profiles are generated to the one file.&amp;#160; &amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;jmap&lt;/h4&gt;  &lt;blockquote&gt;   &lt;p&gt;The &lt;tt&gt;jmap&lt;/tt&gt; command-line utility prints memory related statistics for a running VM or core file.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Commands:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;jmap -histo &amp;lt;pid&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #show histogram of objects     &lt;br /&gt;jmap -dump:format=b,file=&amp;lt;file&amp;gt;&amp;#160;&amp;#160;&amp;#160; #dump heap in HPROF format (can be processed by jhat)&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;jstat&lt;/h4&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;The jstat utility uses the built-in instrumentation in the HotSpot VM to provide information on performance and resource consumption of running applications. &amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;show garbage collection info, class loading info, compilation info, etc.&lt;/p&gt;  &lt;h4&gt;visualgc&lt;/h4&gt;  &lt;p&gt;GUI to show results of jstat.&lt;/p&gt;  &lt;h4&gt;Java VisualVM&lt;/h4&gt;  &lt;p&gt;&lt;a title="http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html" href="http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html"&gt;http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html&lt;/a&gt;    &lt;br /&gt;command:&amp;#160; jvisualvm&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;Java VisualVM is a tool that provides a visual interface for viewing detailed information about Java applications while they are running on a Java Virtual Machine (JVM), and for troubleshooting and profiling these applications.&amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;JConsole&lt;/h4&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;This tool is compliant with &lt;strong&gt;Java Management Extensions&lt;/strong&gt; (JMX). The tool uses the built-in JMX instrumentation in the Java Virtual Machine to provide information on the performance and resource consumption of running applications.&amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;jhat (java heap analysis tool)&lt;/h4&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;The jhat tool provides a convenient means to browse the object topology in a heap snapshot. This tool was introduced in the Java SE 6 release to replace the Heap Analysis Tool (HAT). &amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Command:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;jhat &amp;lt;hprof_file_name&amp;gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;Eclipse MAT&lt;/h4&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;jdb&lt;/h4&gt;  &lt;h4&gt;Misc.&lt;/h4&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;As of Java SE 5.0 update 7, the -XX:+HeapDumpOnOutOfMemoryError command-line option      &lt;br /&gt;tells the HotSpot VM to generate a heap dump when an OutOfMemoryError occurs (see       &lt;br /&gt;section 1.9).      &lt;br /&gt;As of Java SE 5.0 update 14, the -XX:+HeapDumpOnCtrlBreak command-line option tells the       &lt;br /&gt;HotSpot VM to generate a heap dump when a Ctrl-Break or SIGQUIT signal is received (see       &lt;br /&gt;section 1.10). &amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Resources&lt;/h3&gt;  &lt;p&gt;&lt;a title="http://www.oracle.com/technetwork/java/javase/index-137495.html" href="http://www.oracle.com/technetwork/java/javase/index-137495.html"&gt;http://www.oracle.com/technetwork/java/javase/index-137495.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3138140427241494119?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3138140427241494119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3138140427241494119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3138140427241494119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3138140427241494119'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/04/debugprofile-heapgc-in-java.html' title='Debug/profile heap/gc in Java'/><author><name>Gerald Guo</name><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-36974671.post-4464849266413122505</id><published>2011-04-14T19:05:00.001-04:00</published><updated>2011-04-14T19:05:37.847-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eucalyptus'/><title type='text'>Eucalyptus notes</title><content type='html'>&lt;p&gt;&lt;a title="https://portal.futuregrid.org/tutorials/eucalyptus" href="https://portal.futuregrid.org/tutorials/eucalyptus"&gt;https://portal.futuregrid.org/tutorials/eucalyptus&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Bundle images&lt;/h3&gt;  &lt;p&gt;&lt;a title="http://open.eucalyptus.com/participate/wiki/modifying-prepackaged-image" href="http://open.eucalyptus.com/participate/wiki/modifying-prepackaged-image"&gt;http://open.eucalyptus.com/participate/wiki/modifying-prepackaged-image&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://open.eucalyptus.com/wiki/EucalyptusImageManagement_v1.6" href="http://open.eucalyptus.com/wiki/EucalyptusImageManagement_v1.6"&gt;http://open.eucalyptus.com/wiki/EucalyptusImageManagement_v1.6&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Bundle running instance&lt;/h3&gt;  &lt;p&gt;&lt;a title="http://megam.info/2010/04/28/euca-bundle-vol-solved/" href="http://megam.info/2010/04/28/euca-bundle-vol-solved/"&gt;http://megam.info/2010/04/28/euca-bundle-vol-solved/&lt;/a&gt;     &lt;br /&gt;&lt;a title="http://open.eucalyptus.com/forum/how-create-snapshot-running-vm-instance-euca2ools-or-eucalyptus-web-interface" href="http://open.eucalyptus.com/forum/how-create-snapshot-running-vm-instance-euca2ools-or-eucalyptus-web-interface"&gt;http://open.eucalyptus.com/forum/how-create-snapshot-running-vm-instance-euca2ools-or-eucalyptus-web-interface&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Basic commands&lt;/h4&gt;  &lt;pre&gt;euca-bundle-vol  \
    --kernel &amp;lt;kernel_id&amp;gt; \
    --ramdisk &amp;lt;randisk_i&amp;gt; \
    -d &amp;lt;dir_to_put_bundled_img&amp;gt; \
    -p &amp;lt;prefix&amp;gt; \
    -r &amp;lt;arch&amp;gt;

euca-upload-bundle -b &amp;lt;bucket_name&amp;gt; -m &amp;lt;path_to_manifest_file&amp;gt;

euca-register &amp;lt;manifest_file&amp;gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Euca2tools and its dependency download&lt;/h3&gt;

&lt;p&gt;&lt;a title="http://open.eucalyptus.com/downloads" href="http://open.eucalyptus.com/downloads"&gt;http://open.eucalyptus.com/downloads&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eucalyptussoftware.com/downloads/releases/euca2ools-1.3.1-src-deps.tar.gz"&gt;http://eucalyptussoftware.com/downloads/releases/euca2ools-1.3.1-src-deps.tar.gz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eucalyptussoftware.com/downloads/releases/euca2ools-1.3.1.tar.gz"&gt;http://eucalyptussoftware.com/downloads/releases/euca2ools-1.3.1.tar.gz&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4464849266413122505?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4464849266413122505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4464849266413122505' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4464849266413122505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4464849266413122505'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/04/eucalyptus-notes.html' title='Eucalyptus notes'/><author><name>Gerald Guo</name><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-36974671.post-7688849821794532144</id><published>2011-04-08T11:43:00.001-04:00</published><updated>2011-04-08T11:48:08.040-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>How to decommission nodes/blacklist nodes</title><content type='html'>&lt;h2&gt;HDFS&lt;/h2&gt; Put following config in conf/hdfs-site.xml:   &lt;pre&gt;&amp;lt;property&amp;gt;
  &amp;lt;name&amp;gt;dfs.hosts.exclude&amp;lt;/name&amp;gt;
  &amp;lt;value&amp;gt;/full/path/of/host/exclude/file&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Use following command to ask HDFS to re-read host exclude file and decommission nodes accordingly. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;span class="pln"&gt;./bin/hadoop dfsadmin &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="pln"&gt;refreshNodes&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;MapReduce&lt;/h2&gt;

&lt;p&gt;Put following config in conf/mapred-site.xml&lt;/p&gt;

&lt;pre&gt;&amp;lt;property&amp;gt;
  &amp;lt;name&amp;gt;mapred.hosts.exclude&amp;lt;/name&amp;gt;
  &amp;lt;value&amp;gt;/full/path/of/host/exclude/file&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Use following command to ask Hadoop MapReduce to reconfigure nodes. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;span class="pln"&gt;./bin/hadoop mradmin &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="pln"&gt;refreshNodes&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;Whitelist/Recommission&lt;/h2&gt;

&lt;p&gt;Also you can &amp;quot;whitelist&amp;quot; nodes. In other words, you can specify which nodes are allowed to connect to namenode/jobtracker.&amp;#160; &lt;/p&gt;

&lt;h2&gt;HDFS&lt;/h2&gt;
Put following config in conf/hdfs-site.xml: 

&lt;pre&gt;&amp;lt;property&amp;gt;
  &amp;lt;name&amp;gt;dfs.hosts&amp;lt;/name&amp;gt;
  &amp;lt;value&amp;gt;/full/path/to/whitelisted/node/file&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Use following command to ask Hadoop to refresh node status to based on configuration. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;span class="pln"&gt;./bin/hadoop dfsadmin &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="pln"&gt;refreshNodes&lt;/span&gt;&lt;/code&gt; &lt;/p&gt;

&lt;h2&gt;MapReduce&lt;/h2&gt;

&lt;p&gt;Put following config in conf/mapred-site.xml&lt;/p&gt;

&lt;pre&gt;&amp;lt;property&amp;gt;
  &amp;lt;name&amp;gt;mapred.hosts&amp;lt;/name&amp;gt;
  &amp;lt;value&amp;gt;&amp;gt;/full/path/to/whitelisted/node/file&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;&lt;/pre&gt;

&lt;p&gt;Use following command to ask Hadoop MapReduce to reconfigure nodes. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;span class="pln"&gt;./bin/hadoop mradmin &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="pln"&gt;refreshNodes&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Support of &lt;em&gt;-mradmin&lt;/em&gt; was added in 0.21.0. See JIRA issue &lt;a title="https://issues.apache.org/jira/browse/HADOOP-5643" href="https://issues.apache.org/jira/browse/HADOOP-5643"&gt;https://issues.apache.org/jira/browse/HADOOP-5643&lt;/a&gt; for details.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7688849821794532144?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7688849821794532144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7688849821794532144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7688849821794532144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7688849821794532144'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/04/how-to-decommission-nodesblacklist.html' title='How to decommission nodes/blacklist nodes'/><author><name>Gerald Guo</name><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-36974671.post-715186294945307930</id><published>2011-03-19T01:19:00.001-04:00</published><updated>2011-03-19T01:20:39.157-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Japan earthquake GPS data visualization gadget</title><content type='html'>&lt;p&gt;I made a gadget version of QuakeSim Japan earthquake data visualization portal. It shows data (longitude, latitude and height) collected by GPS stations during Japan earthquake.&lt;/p&gt;  &lt;p&gt;You can click &lt;a href="http://www.google.com/ig/adde?synd=open&amp;amp;source=ggyp&amp;amp;moduleurl=hosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F105322631994749779353%2Fquakesim-japan.xml"&gt;http://www.google.com/ig/adde?synd=open&amp;amp;source=ggyp&amp;amp;moduleurl=hosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F105322631994749779353%2Fquakesim-japan.xml&lt;/a&gt; to add it to your iGoogle. After it is added, maximize it by clicking the icon near top right corner of the gadget&lt;/p&gt;  &lt;p&gt;Link for the gadget is&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.google.com/ig/directory?url=hosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F105322631994749779353%2Fquakesim-japan.xml"&gt;http://www.google.com/ig/directory?url=hosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F105322631994749779353%2Fquakesim-japan.xml&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Thank Xiaoming Gao for providing service pages. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-715186294945307930?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/715186294945307930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=715186294945307930' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/715186294945307930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/715186294945307930'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/03/japan-earthquake-gps-data-visualization.html' title='Japan earthquake GPS data visualization gadget'/><author><name>Gerald Guo</name><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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-8395488809892993016</id><published>2011-03-02T17:59:00.000-05:00</published><updated>2011-03-02T18:00:35.313-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Install ns2 (ns-2.33) on Ubuntu Maverick</title><content type='html'>Install prerequisite:  &lt;pre&gt;sudo apt-get install \  
    tcl tcl-dev \ 
    libotcl1 libotcl1-dev  \ 
    tclcl-dev tclcl \ 
    tk tk-dev&lt;/pre&gt;

&lt;p&gt;./configure failed complaining that some tcl, tk related files cannot be found. It turns out those packages have been installed but file locations are different than what the configure script expects. Following is a fix.&lt;/p&gt;

&lt;p&gt;You need to change two variables in file &lt;em&gt;configure&lt;/em&gt; : TCL_TCL_PLACES and &lt;em&gt;TK_TCL_PLACES&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Add 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/tcltk/tcl$TCL_VERS \

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/tcltk/tcl$TCL_HI_VERS

  &lt;br /&gt;to variable &lt;em&gt;TCL_TCL_PLACES&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Add 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/tcltk/tk$TK_HI_VERS \

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/tcltk/tk$TK_VERS&amp;quot;

  &lt;br /&gt;to variable &lt;em&gt;TK_TCL_PLACES&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;execute ./configure
  &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Official page: &lt;a title="http://www.isi.edu/nsnam/ns/ns-build.html" href="http://www.isi.edu/nsnam/ns/ns-build.html"&gt;http://www.isi.edu/nsnam/ns/ns-build.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8395488809892993016?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8395488809892993016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8395488809892993016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8395488809892993016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8395488809892993016'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2011/03/install-ns2-ns-233-on-ubuntu-maverick.html' title='Install ns2 (ns-2.33) on Ubuntu Maverick'/><author><name>Gerald Guo</name><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-36974671.post-2469949976925297462</id><published>2010-12-31T23:57:00.000-05:00</published><updated>2010-12-31T23:58:39.037-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>Hadoop tips</title><content type='html'>&lt;ul&gt;   &lt;li&gt;Change logging level &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;For each daemon, there is a service at &lt;a href="http://daemon_address:port/logLevel"&gt;&lt;font face="Courier New"&gt;&lt;em&gt;http://daemon_address:port/logLevel&lt;/em&gt;&lt;/font&gt;&lt;/a&gt; through which you can get and set logging level. &lt;/li&gt;      &lt;li&gt;Use command line        &lt;br /&gt;&amp;#160; &lt;font face="Courier New"&gt;hadoop daemonlog -getLevel daemon_address:port fullQualifiedClassName          &lt;br /&gt;hadoop daemonlog -setLevel daemon_address:port fullQualifiedClassName logLevel&lt;/font&gt; &lt;/li&gt;      &lt;li&gt;Permanent change        &lt;br /&gt;Change file &lt;em&gt;log4j.properties&lt;/em&gt;. Example         &lt;br /&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; log4j.logger.org.apache.hadoop.mapred.JobTracker=DEBUG          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; log4j.logger.org.apache.hadoop.mapred.TaskTracker=DEBUG           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG&lt;/font&gt;         &lt;br /&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Commission and decommission nodes      &lt;br /&gt;Following four config parameters are related:       &lt;br /&gt;&lt;font face="Courier New"&gt;dfs.hosts        &lt;br /&gt;dfs.hosts.exclude         &lt;br /&gt;mapreduce.jobtracker.hosts.filename (mapred.hosts for old version)         &lt;br /&gt;mapreduce.jobtracker.hosts.exclude.filename (mapred.hosts.exclude for old version)         &lt;br /&gt;&lt;/font&gt;      &lt;br /&gt;For HDFS, execute &amp;quot;hadoop dfsadmin -refreshNodes&amp;quot; after you change the include file or exclude file.       &lt;br /&gt;From the mailing list, I know &amp;quot;mradmin -refreshNodes was added in 0.21&amp;quot;.&amp;#160; So for MapReduce, you can use &amp;quot;hadoop mradmin -refreshNodes&amp;quot; after you change the include file or exclude file to commission or decommission a node respectively.       &lt;br /&gt;To permanently add or remove a node, you also need to change slave file &lt;em&gt;conf/slaves&lt;/em&gt;.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Block scanner report      &lt;br /&gt;&lt;a title=" http://datanode:50075/blockScannerReport" href="http://datanode_address:50075/blockScannerReport"&gt;http://datanode_address:50075/blockScannerReport&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;If you want to check blocks and block locations of a specific file, use following command:      &lt;br /&gt;&amp;#160; &lt;font face="Courier New"&gt;hadoop fsck file_to_check -files -blocks -locations -racks&lt;/font&gt;       &lt;br /&gt;Note: you should execute it on master node.       &lt;br /&gt;Use &amp;quot;&lt;font face="Courier New"&gt;hadoop fsck /&lt;/font&gt;&amp;quot; to check health of the whole file system. &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2469949976925297462?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2469949976925297462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2469949976925297462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2469949976925297462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2469949976925297462'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/hadoop-tips.html' title='Hadoop tips'/><author><name>Gerald Guo</name><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-36974671.post-8863374712083207337</id><published>2010-12-23T00:51:00.000-05:00</published><updated>2010-12-23T00:52:04.296-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Extract some continuous lines from a file</title><content type='html'>&lt;p&gt;Sometimes, I want to extract some continuous lines from a file, e.g. line 10 to line 100. I was thinking whether there is any linux command to do that. Unfortunately, I did not find the command in vanilla Linux distros. Suddenly, I found that it can achieved by combining commands &lt;em&gt;head&lt;/em&gt; and &lt;em&gt;tail&lt;/em&gt;. &lt;/p&gt;  &lt;p&gt;Let's say you want to extract line &lt;em&gt;min&lt;/em&gt; to line &lt;em&gt;max&lt;/em&gt;, both inclusive.     &lt;br /&gt;Calculate &lt;em&gt;nlines=(max-min+1).&lt;/em&gt; Then use following command:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;cat &amp;lt;filename&amp;gt;|head -n &amp;lt;max&amp;gt;|tail -n &amp;lt;nlines&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8863374712083207337?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8863374712083207337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8863374712083207337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8863374712083207337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8863374712083207337'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/extract-some-continuous-lines-from-file.html' title='Extract some continuous lines from a file'/><author><name>Gerald Guo</name><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-36974671.post-8114722542579853801</id><published>2010-12-17T01:00:00.001-05:00</published><updated>2010-12-17T01:00:30.293-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>vim quickfix and location list</title><content type='html'>&lt;table border="1" cellspacing="0" cellpadding="2" width="705"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="139"&gt;&lt;strong&gt;Commands&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="564"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;copen&lt;/td&gt;        &lt;td valign="top" width="564"&gt;open quickfix window&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="148"&gt;cclose&lt;/td&gt;        &lt;td valign="top" width="564"&gt;close quickfix window&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="152"&gt;cwindow&lt;/td&gt;        &lt;td valign="top" width="564"&gt;open quickfix window if its content is not empty.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="155"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="564"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="158"&gt;cc [nr]&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display error [nr]&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;cr&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display the first error.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;cfirst&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display the first error.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;clast&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display the last error.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="162"&gt;[count]cn&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display [count] next error&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="163"&gt;[count]cp&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display [count] previous error&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="164"&gt;[count]cnf&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display first error in the [count] next file&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="165"&gt;[count]cpf&lt;/td&gt;        &lt;td valign="top" width="564"&gt;display first error in the [count] previous file&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;For commands related to location list, just replace first 'c' with 'l' in above commands.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8114722542579853801?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8114722542579853801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8114722542579853801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8114722542579853801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8114722542579853801'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/vim-quickfix-and-location-list.html' title='vim quickfix and location list'/><author><name>Gerald Guo</name><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-36974671.post-2278416869617385911</id><published>2010-12-16T11:43:00.001-05:00</published><updated>2010-12-16T11:43:08.614-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Compile and Install vim on Linux</title><content type='html'>&lt;p&gt;Commands&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;wget &lt;a href="ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2"&gt;ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2&lt;/a&gt;         &lt;br /&gt;tar jvxf vim-7.3.tar.bz2         &lt;br /&gt;cd vim73         &lt;br /&gt;./configure --enable-gui=no \         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;--enable-multibyte \        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; --enable-cscope \         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; --disable-netbeans \         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; --prefix=&amp;lt;your_desired_vim_home&amp;gt;         &lt;br /&gt;make         &lt;br /&gt;make test         &lt;br /&gt;make install&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Change you environment variable &lt;em&gt;PATH&lt;/em&gt; to add vim bin path. Following commands are for &lt;em&gt;bash&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Temporary change   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font face="Courier New"&gt;export PATH=&amp;quot;&amp;lt;your_vim_home&amp;gt;/bin;$PATH&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Permanent change   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font face="Courier New"&gt;echo -e '\nexport PATH=&amp;quot;&amp;lt;your_vim_home&amp;gt;/bin;$PATH&amp;quot; ' &amp;gt;&amp;gt; ~/.bash_profile&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2278416869617385911?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2278416869617385911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2278416869617385911' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2278416869617385911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2278416869617385911'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/compile-and-install-vim-on-linux.html' title='Compile and Install vim on Linux'/><author><name>Gerald Guo</name><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-36974671.post-8890970011140496577</id><published>2010-12-15T13:53:00.001-05:00</published><updated>2010-12-16T11:44:41.413-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>Delete executables and object (.o) files</title><content type='html'>&lt;p&gt;Following two commands can delete all &lt;strong&gt;ELF&lt;/strong&gt; executables and &lt;strong&gt;ELF&lt;/strong&gt; object (.o) files. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;find ./ -executable -type f|xargs -I{} file {} | grep ELF|cut -d ':' -f 1|xargs -I{} rm {}&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;find ./ -name &amp;quot;*.o&amp;quot; -type f|xargs -I{} file {} | grep ELF|cut -d ':' -f 1|xargs -I{} rm {}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Some executables may not be found because its &amp;quot;x&amp;quot; bit is not set. Use following command to find them&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;find ./ -type f|xargs -I{} file {} | grep ELF|cut -d ':' -f 1|xargs -I{} rm {}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Note:   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;em&gt;-executable&lt;/em&gt; is not supported in old version of &lt;em&gt;find&lt;/em&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8890970011140496577?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8890970011140496577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8890970011140496577' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8890970011140496577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8890970011140496577'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/delete-executables-and-object-o-files.html' title='Delete executables and object (.o) files'/><author><name>Gerald Guo</name><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-36974671.post-3084532597550433487</id><published>2010-12-13T17:41:00.001-05:00</published><updated>2010-12-13T17:41:19.754-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>How to change hostname in Ubuntu</title><content type='html'>&lt;h2&gt;Temporary change&lt;/h2&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; hostname &amp;lt;new_host_name&amp;gt;&lt;/p&gt;  &lt;h2&gt;Permanent change&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Edit &lt;em&gt;/etc/hostname&lt;/em&gt; to specify your new hostname      &lt;br /&gt;sudoedit /etc/hostname&lt;/li&gt;    &lt;li&gt;sudo service hostname start&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3084532597550433487?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3084532597550433487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3084532597550433487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3084532597550433487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3084532597550433487'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/how-to-change-hostname-in-ubuntu.html' title='How to change hostname in Ubuntu'/><author><name>Gerald Guo</name><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-36974671.post-6468146576025659061</id><published>2010-12-13T17:35:00.001-05:00</published><updated>2010-12-13T17:38:08.442-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu init scripts and upstart jobs</title><content type='html'>&lt;h2&gt;Init script&lt;/h2&gt;  &lt;p&gt;Those scripts are located in directory &lt;em&gt;/etc/init.d&lt;/em&gt;. Note: some of them have been converted to upstart jobs (see next section) and they should not be invoked directly.&amp;#160; To check whether it's a upstart job, check directory whether file &lt;em&gt;/etc/init/&amp;lt;job&amp;gt;.conf&lt;/em&gt; exists for a specific job&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;h2&gt;upstart jobs&lt;/h2&gt;  &lt;p&gt;&lt;a title="http://upstart.ubuntu.com/" href="http://upstart.ubuntu.com/"&gt;http://upstart.ubuntu.com/&lt;/a&gt;&amp;#160; &lt;strong&gt;&lt;font color="#ff0000"&gt;Use &amp;quot;man 5 init&amp;quot; to see the syntax of the conf file&lt;/font&gt;&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Each upstart job has a conf file in directory &lt;em&gt;/etc/init/&amp;lt;job&amp;gt;.conf&lt;/em&gt;. You should not directly invoke the init script to start/stop the job. You should use commands &lt;em&gt;initctl&lt;/em&gt; to do that. E.g. &lt;em&gt;initctl restart hostname&lt;/em&gt;.&amp;#160; &lt;br /&gt;&lt;em&gt;initctl list&lt;/em&gt; will list upstart jobs that are running.&lt;/p&gt;  &lt;h2&gt;service&lt;/h2&gt;  &lt;p&gt;It can be used to interact with the init scripts, no matter they are upstart jobs or regular init script. For upstart jobs, it does not run &lt;em&gt;/etc/init.d/&amp;lt;job&amp;gt;&lt;/em&gt; . Instead it runs &amp;quot;&lt;em&gt;start &amp;lt;job&amp;gt;&lt;/em&gt;&amp;quot; directly. &lt;/p&gt;  &lt;p&gt;E.g.&amp;#160;&amp;#160; &lt;em&gt;service hostname status&lt;/em&gt;&lt;/p&gt;  &lt;h2&gt;invoke-rc.d&lt;/h2&gt;  &lt;p&gt;Another tool to start/stop init jobs. In my opinion you should use command &lt;em&gt;service&lt;/em&gt; because &lt;em&gt;invoke-rc.d&lt;/em&gt; does NOT detect whether the job is a upstart job or regular init job. Usually, this is not a big deal because upstart job shell script automatically calls &lt;em&gt;initctrl&lt;/em&gt; related commands (&lt;em&gt;start, stop, reload&lt;/em&gt;, etc) . &lt;/p&gt;  &lt;h2&gt;Example - network&lt;/h2&gt;  &lt;p&gt;I will give an example about how network interfaces are managed by init daemon. &lt;/p&gt;  &lt;p&gt;As you may know, &lt;em&gt;ifup&lt;/em&gt; and &lt;em&gt;ifdown&lt;/em&gt; can be used to bring up or down network interfaces. &lt;/p&gt;  &lt;p&gt;/etc/network/interfaces are used by &lt;em&gt;ifup&lt;/em&gt; and &lt;em&gt;ifdown&lt;/em&gt; to know how you want your system to connect to the network. &lt;/p&gt;  &lt;p&gt;Sample file&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;# interfaces &lt;em&gt;lo&lt;/em&gt; and &lt;em&gt;eth0&lt;/em&gt; should be started when &lt;em&gt;ifup -a&lt;/em&gt; is invoked.         &lt;br /&gt;auto lo eth0         &lt;br /&gt;# eth1 is allowed to be brought up by subsystem &lt;em&gt;hotplug&lt;/em&gt;.         &lt;br /&gt;allow-hotplug eth1         &lt;br /&gt;# For interface &lt;em&gt;lo&lt;/em&gt;, it should use &lt;em&gt;internet&lt;/em&gt; protocol and it is a &lt;em&gt;loopback&lt;/em&gt; device.         &lt;br /&gt;iface lo inet loopback         &lt;br /&gt;# Interface &lt;em&gt;eth1&lt;/em&gt; uses internet protocol and dhcp for configuration         &lt;br /&gt;iface eth1 inet dhcp         &lt;br /&gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;li&gt;For upstart job &lt;em&gt;networking&lt;/em&gt;, its config file is /etc/init/networking.conf: &lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;description &amp;quot;configure virtual network devices&amp;quot;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;start on (local-filesystems        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; and stopped udevtrigger)&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;task&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;pre-start exec mkdir -p /var/run/network&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;exec ifup -a&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Notice the last line? Yes, it invoke &lt;em&gt;ifup&lt;/em&gt; to bring up those interfaces that are marked as &amp;quot;auto&amp;quot; in file &lt;em&gt;/etc/network/interfaces. &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;li&gt;Job &lt;em&gt;network-interface&lt;/em&gt; is used when a network interface is added or removed. Its config file is &lt;em&gt;/etc/init/network-interface.conf&lt;/em&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;description &amp;quot;configure network device&amp;quot;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;start on net-device-added        &lt;br /&gt;stop on net-device-removed INTERFACE=$INTERFACE&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;instance $INTERFACE&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;pre-start script        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if [ &amp;quot;$INTERFACE&amp;quot; = lo ]; then         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; # bring this up even if /etc/network/interfaces is broken         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ifconfig lo 127.0.0.1 up || true         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; initctl emit -n net-device-up \         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IFACE=lo LOGICAL=lo ADDRFAM=inet METHOD=loopback || true         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; fi         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; mkdir -p /var/run/network         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; exec ifup --allow auto $INTERFACE         &lt;br /&gt;end script&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;post-stop exec ifdown --allow auto $INTERFACE&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Line &amp;quot;&lt;font face="Courier New"&gt;exec ifup --allow auto $INTERFACE&lt;/font&gt;&amp;quot; bring up the newly added interface if it is set to be brought up automatically.&amp;#160; The trigger event is &amp;quot;&lt;em&gt;net-device-added&lt;/em&gt;&amp;quot; or &amp;quot;&lt;em&gt;net-device-removed&lt;/em&gt;&amp;quot; which is sent by &lt;em&gt;upstart-udev-bridge.&lt;/em&gt; It basically forwards events received from udev to &lt;em&gt;init&lt;/em&gt; daemon. &lt;strong&gt;When your network interface (e.g. eth0) is detected by udev, finally a &lt;em&gt;net-device-added&lt;/em&gt; event is sent to &lt;em&gt;network-interface&lt;/em&gt; upstart job which runs &lt;em&gt;ifup&lt;/em&gt; to bring it up.&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;upstart job &lt;em&gt;hostname&lt;/em&gt;. (/etc/init/hostname.conf). It includes following line:       &lt;br /&gt;&amp;#160; &lt;font face="Courier New"&gt;exec hostname -b -F /etc/hostname        &lt;br /&gt;&lt;/font&gt;Now you should know how to change hostname.       &lt;br /&gt;Edit file &lt;em&gt;/etc/hostname&lt;/em&gt;, run command &amp;quot;&lt;em&gt;sudo service start hostname&lt;/em&gt;&amp;quot;, &amp;quot;&lt;em&gt;sudo start hostname&lt;/em&gt;&amp;quot;, or &amp;quot;&lt;em&gt;sudo initctl start hostname&lt;/em&gt;&amp;quot;. &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6468146576025659061?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6468146576025659061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6468146576025659061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6468146576025659061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6468146576025659061'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/ubuntu-init-script.html' title='Ubuntu init scripts and upstart jobs'/><author><name>Gerald Guo</name><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-36974671.post-1313953573320790231</id><published>2010-12-13T13:16:00.000-05:00</published><updated>2010-12-13T13:23:56.978-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Recover corrupted partition table</title><content type='html'>&lt;p&gt;Partition table of my linux drive was corrupted recently.&amp;#160; I could not start up my Ubuntu. &lt;/p&gt;  &lt;p&gt;I burned a Ubuntu CD. But when I tried to boot into the liveCD, it always gave me errors. It seems to be a CD burning/CD drive problem. Then I made a live USB drive which worked great. Following two tools can be used to &amp;quot;guess&amp;quot; the partition table.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;gpart       &lt;br /&gt;&lt;/strong&gt;This program is kind of old and is not maintained any longer. It can just recognizes some file systems (ext3, ext4, etc are not recognized correctly)&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;testdisk       &lt;br /&gt;&lt;/strong&gt;This is a great tool which a text UI. You can find information &lt;a href="http://www.cgsecurity.org/wiki/TestDisk" target="_blank"&gt;here&lt;/a&gt;. You just follow the instructions. Check the &amp;quot;guessed&amp;quot; partition table match your real partition table(if you have backup, you are lucky.).&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Run &lt;strong&gt;fsck&lt;/strong&gt; to check integrity of your file system.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Afterthoughts&lt;/strong&gt;:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Back up your partition table!&lt;/li&gt;    &lt;li&gt;USB drive is more stable than CD in this case. &lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1313953573320790231?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1313953573320790231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1313953573320790231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1313953573320790231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1313953573320790231'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/12/recover-corrupted-partition-table.html' title='Recover corrupted partition table'/><author><name>Gerald Guo</name><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-36974671.post-6525386882646321890</id><published>2010-11-28T16:33:00.001-05:00</published><updated>2010-11-28T16:36:44.129-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>printf cheatsheet</title><content type='html'>&lt;h2&gt;Format string&lt;/h2&gt;  &lt;p&gt;&amp;#160; % [flag]* [minimum_field_width] [precision] [length_modifier] &amp;lt;conversion_specifier&amp;gt;&lt;/p&gt;  &lt;h2&gt;Flags&lt;/h2&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="769"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="76" align="center"&gt;&lt;strong&gt;Flag&lt;/strong&gt;&lt;/td&gt;        &lt;td width="533" align="center"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;        &lt;td width="159" align="center"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="76" align="center"&gt;#&lt;/td&gt;        &lt;td valign="top" width="533"&gt;The value should be converted to an &amp;quot;alternate form&amp;quot;. &lt;/td&gt;        &lt;td valign="top" width="158"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="76" align="center"&gt;0&lt;/td&gt;        &lt;td valign="top" width="533"&gt;zero padded. By default, blank padded&lt;/td&gt;        &lt;td valign="top" width="157"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="76" align="center"&gt;-&lt;/td&gt;        &lt;td valign="top" width="533"&gt;left adjusted&lt;/td&gt;        &lt;td valign="top" width="157"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="76" align="center"&gt;' '&lt;/td&gt;        &lt;td valign="top" width="533"&gt;(A single space) A blank should be left before a positive number (or empty&amp;#160; string)&amp;#160; produced by a signed conversion.&lt;/td&gt;        &lt;td valign="top" width="156"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="76" align="center"&gt;+&lt;/td&gt;        &lt;td valign="top" width="533"&gt;A sign is always placed before a number produced by &lt;strong&gt;a signed conversion&lt;/strong&gt;.&lt;/td&gt;        &lt;td valign="top" width="157"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Minimum Field Width&lt;/h2&gt;  &lt;p&gt;&amp;quot;a decimal digit string (with&amp;#160; non-zero first digit). If the value has fewer characters, it will be padded.&amp;#160; In no case does a nonexistent or small field width cause truncation of a field.&amp;quot;&lt;/p&gt;  &lt;h2&gt;Precision&lt;/h2&gt;  &lt;p&gt;a period ('.')&amp;#160; followed by an optional decimal digit string. It has different meanings for different conversions.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="782"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="133" align="center"&gt;&lt;strong&gt;Precision&lt;/strong&gt;&lt;/td&gt;        &lt;td width="409" align="center"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;        &lt;td width="238" align="center"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="133"&gt;d, i, o, u, x, and X&lt;/td&gt;        &lt;td valign="top" width="409"&gt;minimum number of digits to appear&lt;/td&gt;        &lt;td valign="top" width="238"&gt;printf(&amp;quot;%.2d&amp;quot;, 1) ==&amp;gt; &amp;quot;01&amp;quot;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="133"&gt;a, A, e, E, f, and F&lt;/td&gt;        &lt;td valign="top" width="409"&gt;number of digits to appear after&amp;#160; the radix&amp;#160; character&lt;/td&gt;        &lt;td valign="top" width="238"&gt;printf(&amp;quot;%.2f&amp;quot;,0.1) ==&amp;gt; &amp;quot;0.10&amp;quot;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="133"&gt;g and G&lt;/td&gt;        &lt;td valign="top" width="409"&gt;maximum number of significant digits&lt;/td&gt;        &lt;td valign="top" width="238"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="133"&gt;s and S&lt;/td&gt;        &lt;td valign="top" width="409"&gt;maximum number of characters to be printed from a string&lt;/td&gt;        &lt;td valign="top" width="238"&gt;printf(&amp;quot;%.2s&amp;quot;,&amp;quot;hello&amp;quot;) ==&amp;gt; &amp;quot;he&amp;quot;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Length Modifier&lt;/h2&gt;  &lt;p&gt;For each conversion specifier, there is expected argument type. For example, for conversion &lt;em&gt;d,&lt;/em&gt;&amp;#160; and &lt;em&gt;i&lt;/em&gt;, type of arguments should be &lt;em&gt;int&lt;/em&gt;. Length Modifiers can be used to specify argument types rather than expected type by default. &lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="595"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="104" align="center"&gt;&lt;strong&gt;Modifier&lt;/strong&gt;&lt;/td&gt;        &lt;td width="174" align="center"&gt;&lt;strong&gt;Conversion&lt;/strong&gt;&lt;/td&gt;        &lt;td width="317" align="center"&gt;&lt;strong&gt;Argument types&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td rowspan="2" width="104" align="center"&gt;hh&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;signed char or unsigned char&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;n&lt;/td&gt;        &lt;td valign="top" width="317"&gt;signed char*&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td rowspan="2" width="104" align="center"&gt;h&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;short int or unsigned short int&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;b&lt;/td&gt;        &lt;td valign="top" width="317"&gt;short int*&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td rowspan="4" width="104" align="center"&gt;l&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;long int, or unsigned long int&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;n&lt;/td&gt;        &lt;td valign="top" width="317"&gt;long int*&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;c&lt;/td&gt;        &lt;td valign="top" width="317"&gt;wint_t&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;s&lt;/td&gt;        &lt;td valign="top" width="317"&gt;wchar_t&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td rowspan="2" width="104" align="center"&gt;ll&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;long long int, or unsigned long long int&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;n&lt;/td&gt;        &lt;td valign="top" width="317"&gt;long long int*&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="104" align="center"&gt;L&lt;/td&gt;        &lt;td valign="top" width="174"&gt;a, A, e, E, f, F, g, or G&lt;/td&gt;        &lt;td valign="top" width="317"&gt;long double&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="104" align="center"&gt;j&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;intmax_t, uintmax_t&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="104" align="center"&gt;z&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;size_t, ssize_t&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="104" align="center"&gt;t&lt;/td&gt;        &lt;td valign="top" width="174"&gt;d, i, o, u, x, or X&lt;/td&gt;        &lt;td valign="top" width="317"&gt;ptrdiff_t&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Conversion specifier&lt;/h2&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="809"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="79" align="center"&gt;&lt;strong&gt;conversion&lt;/strong&gt;&lt;/td&gt;        &lt;td width="105" align="center"&gt;&lt;strong&gt;arguments&lt;/strong&gt;&lt;/td&gt;        &lt;td width="470" align="center"&gt;&lt;strong&gt;notation&lt;/strong&gt;&lt;/td&gt;        &lt;td width="158" align="center"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;d, i&lt;/td&gt;        &lt;td width="105"&gt;int argument&lt;/td&gt;        &lt;td valign="top" width="470"&gt;signed decimal notation&lt;/td&gt;        &lt;td valign="top" width="156"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;o, u, x, X&lt;/td&gt;        &lt;td width="105"&gt;unsigned int&lt;/td&gt;        &lt;td valign="top" width="470"&gt;unsigned octal, unsigned decimal, unsigned hexdec notation&lt;/td&gt;        &lt;td valign="top" width="155"&gt;abcedf are used for x.          &lt;br /&gt;ABCDEF are used for X.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;e, E&lt;/td&gt;        &lt;td width="105"&gt;double&lt;/td&gt;        &lt;td valign="top" width="470"&gt;rounded and converted in the style [-]d.ddde±dd&lt;/td&gt;        &lt;td valign="top" width="155"&gt;precision is 6 by default.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;f, F&lt;/td&gt;        &lt;td width="105"&gt;double&lt;/td&gt;        &lt;td valign="top" width="470"&gt;rounded&amp;#160; and&amp;#160; converted&amp;#160; to&amp;#160; decimal&amp;#160; notation in the style [-]ddd.ddd&lt;/td&gt;        &lt;td valign="top" width="155"&gt;precision is 6 by default.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;g, G&lt;/td&gt;        &lt;td width="105"&gt;double&lt;/td&gt;        &lt;td valign="top" width="470"&gt;converted in style f or e (or F or E for G&amp;#160; conversions).          &lt;br /&gt;Style e&amp;#160; is&amp;#160; used&amp;#160; if the&amp;#160; exponent from its conversion is less than -4 or greater than or equal to the precision. &lt;/td&gt;        &lt;td valign="top" width="154"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;a, A&lt;/td&gt;        &lt;td width="105"&gt;double&lt;/td&gt;        &lt;td valign="top" width="470"&gt;converted to hexadecimal notation.          &lt;br /&gt;for a, (using the letters abcdef) in the style [-]0xh.hhhhp±d;&lt;/td&gt;        &lt;td valign="top" width="154"&gt;C99;&amp;#160; not in SUSv2&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;c&lt;/td&gt;        &lt;td width="105"&gt;int&lt;/td&gt;        &lt;td valign="top" width="470"&gt;converted to an unsigned char, and the resulting character is written&lt;/td&gt;        &lt;td valign="top" width="154"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;s&lt;/td&gt;        &lt;td width="105"&gt;const char*&lt;/td&gt;        &lt;td valign="top" width="470"&gt;Characters from the array are written.&lt;/td&gt;        &lt;td valign="top" width="154"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;p&lt;/td&gt;        &lt;td width="105"&gt;void *&lt;/td&gt;        &lt;td valign="top" width="470"&gt;printed in hexadecimal (as if by %#x or %#lx)&lt;/td&gt;        &lt;td valign="top" width="153"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="79" align="center"&gt;n&lt;/td&gt;        &lt;td width="105"&gt;int *&lt;/td&gt;        &lt;td valign="top" width="470"&gt;The number of characters written so far is stored into the integer&amp;#160; indicated&amp;#160; by&amp;#160; the int * (or variant) pointer argument.&lt;/td&gt;        &lt;td valign="top" width="155"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6525386882646321890?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6525386882646321890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6525386882646321890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6525386882646321890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6525386882646321890'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/printf-cheatsheet.html' title='printf cheatsheet'/><author><name>Gerald Guo</name><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-36974671.post-4414293478953816985</id><published>2010-11-28T01:37:00.000-05:00</published><updated>2010-11-28T20:54:25.505-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Some Hard Drive and File System benchmark tools</title><content type='html'>&lt;h2&gt;IOMeter&lt;/h2&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;iozone&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.iozone.org/"&gt;&lt;font size="3"&gt;http://www.iozone.org&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Document: &lt;/font&gt;&lt;a href="http://www.iozone.org/docs/IOzone_msword_98.pdf"&gt;&lt;font size="3"&gt;http://www.iozone.org/docs/IOzone_msword_98.pdf&lt;/font&gt;&lt;/a&gt;     &lt;br /&gt;&lt;font size="3"&gt;Manual: &lt;/font&gt;&lt;a href="http://linux.die.net/man/1/iozone"&gt;&lt;font size="3"&gt;http://linux.die.net/man/1/iozone&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Read, write, re-read, re-write, read backwards, read strided, fread, fwrite, random read/write, pread/pwrite variants&lt;/p&gt;  &lt;p&gt;iozone -a | tee result.txt&lt;/p&gt;  &lt;p&gt;iozone supports bunch of command line options. I summarized them in following table&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="991"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="129" align="center"&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/td&gt;        &lt;td width="504" align="center"&gt;&lt;strong&gt;Options&lt;/strong&gt;&lt;/td&gt;        &lt;td width="356" align="center"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Auto mode&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-a: record size 4k - 16M, file size 64k - 512M.          &lt;br /&gt;-z: Used in conjunction with &lt;b&gt;-a&lt;/b&gt; to test all possible record sizes. (Normally &lt;b&gt;Iozone&lt;/b&gt; omits testing of small record sizes for very large files when used in full automatic mode. )           &lt;br /&gt;-A: more coverage &lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Test file&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-f filename: the name for temporary file under test.          &lt;br /&gt;-F fn1 fn2: # of files should be equal to # of processors/threads&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Output&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-b filename: output of an Excel compatible file          &lt;br /&gt;-R: Generate Excel report. &lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Record size&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-r #: record size          &lt;br /&gt;-y #: minimum record size for auto mode           &lt;br /&gt;-q #: maximum record size for auto mode&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;File size&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-s #: size of the file to test          &lt;br /&gt;-g #: maximum file size for auto mode           &lt;br /&gt;-n #: minimum file size for auto mode&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;tests&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-i #: specifies which test to run          &lt;br /&gt;0=write/rewrite, 1=read/re-read, 2=random-read/write, 3=Read-backwards, 4=Re-write-record, 5=stride-read, 6=fwrite/re-fwrite, 7=fread/Re-fread, &lt;strong&gt;8=mixed workload&lt;/strong&gt;, 9=pwrite/Re-pwrite, 10=pread/Re-pread, 11=pwritev/Re-pwritev, 12=preadv/Re-preadv&lt;/td&gt;        &lt;td valign="top" width="356"&gt;One will always need to specify 0 so that any of the following tests will have a file to measure. This means -I 0 creates files used by following tests.          &lt;br /&gt;&lt;b&gt;-i # -i # -i #&lt;/b&gt; is also supported so that one may select more than one test. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-+p percent_reads: the percentage of threads/processes that will perform read testing in the mixed workload test case&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-+B: sequential mixed workload testing&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;throughput tests&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-t #: Run &lt;b&gt;Iozone&lt;/b&gt; in a throughput mode.           &lt;br /&gt;-T: Use POSIX pthreads for throughput tests&lt;/td&gt;        &lt;td valign="top" width="356"&gt;This option allows the user to specify how many threads or processes to have active during the measurement. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;processes/threads&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-l #: lower limit on number of processes to run          &lt;br /&gt;-u #: upper limit on number of processes to run&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Timing&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-c: include close() in timing calculation          &lt;br /&gt;-e: include fflush(), fsync() in timing calculation&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;Other control&lt;/td&gt;        &lt;td valign="top" width="504"&gt;-H #: Use POSIX async I/O with # async operations          &lt;br /&gt;-k #: Use POSIX async I/O (no bcopy) with # async operations.           &lt;br /&gt;-I: use direct I/O if possible           &lt;br /&gt;-m: use multiple buffers internally           &lt;br /&gt;-o: Writes are &lt;strong&gt;synchronously&lt;/strong&gt; written to disk           &lt;br /&gt;-p: purges the &lt;strong&gt;processor cache&lt;/strong&gt; before each file operation.           &lt;br /&gt;-W Lock file when reading or writing.           &lt;br /&gt;-K:&amp;#160; Inject some &lt;strong&gt;random accesses&lt;/strong&gt; in the testing. &lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="129" align="center"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="504"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Examples&lt;/h3&gt;  &lt;p&gt;It's important to use &lt;font face="Courier New"&gt;-I&lt;/font&gt; option to turn on DIRECT I/O. Otherwise, linux's page caches (buffer cache) may give you ridiculous fast read speed. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;h4&gt;Auto Mode&lt;/h4&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;iozone -a -n 512m -g 1g        &lt;br /&gt;&lt;/li&gt;      &lt;li&gt;       &lt;br /&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;     &lt;h4&gt;Single Test&lt;/h4&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Sequential write, Sequential reads       &lt;br /&gt;iozone -r 64k -s 1g -b excel.xls -R -i 0 -i 1 -I&lt;/li&gt;      &lt;li&gt;Use two processes to test sequential writes, sequential reads       &lt;br /&gt;iozone -r 64k -s 1g -b excel.xls -R -i 0 -i 1 -I -l 2 -u 2&lt;/li&gt;      &lt;li&gt;Use one and two processes to tests (two runs. In first run, one process is created. In second run, two processes are created)       &lt;br /&gt;&lt;font face="Courier New"&gt;iozone -r 64k -s 1g -b excel.xls -R -i 0 -i 1 -I -l 1 -u 2&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;Random writes, Random reads       &lt;br /&gt;iozone -r 64k -s 1g -b excel.xls-R -i 0 -i 1 -K -I&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;     &lt;h4&gt;Throughput Test&lt;/h4&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font face="Courier New"&gt;iozone -t 2         &lt;br /&gt;&lt;/font&gt;roughly equivalent to &amp;quot;&lt;font face="Courier New"&gt;iozone -l 2 -u 2&lt;/font&gt;&amp;quot;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;     &lt;h4&gt;Mixed Workload Test&lt;/h4&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;iozone -r 64k -s 1g -b excel.xls -R -i 0 -i 8 -+p 50&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;h3&gt;Result visualization&lt;/h3&gt;  &lt;p&gt;./Generate_Graphs&amp;#160; result.txt&lt;/p&gt;  &lt;p&gt;It will a directory for each operation (e.g. read, write, fread, fwrite). In each directory, there are two files generated - &lt;em&gt;iozone_gen_out.gnuplot&lt;/em&gt; and &lt;em&gt;&amp;lt;operation&amp;gt;.ps &lt;/em&gt;(this file is generated after you view the corresponding result using gnuplot).&amp;#160; Under the hood, it uses &lt;em&gt;gnu3d.dem &lt;/em&gt;to render the data using Gnuplot after those data files are generated for all tested operations. You can call it directly without regenerating separate data files.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;gnuplot gnu3d.dem&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There are two more scripts that can be used for visualization - &lt;em&gt;report.pl&lt;/em&gt; and &lt;em&gt;iozone_visualization.pl&lt;/em&gt;.     &lt;br /&gt;When I tried to run them in Linux (using command ./&lt;em&gt;report.pl result.txt&lt;/em&gt;), I had following error:&lt;/p&gt;  &lt;p&gt;&lt;font color="#333333" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; -bash: ./iozone_visualizer.pl: /usr/bin/perl^M: bad interpreter: No such file or directory&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;You can use command &lt;em&gt;perl report.pl result.txt&lt;/em&gt; to run it successfully.     &lt;br /&gt;The solution is to change those two files from dos type to unix type (mainly the new line character conversion).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#666666" face="Courier New"&gt;sudo aptitude install tofrodos        &lt;br /&gt;fromdos report.pl         &lt;br /&gt;fromdos iozone_visualizer.pl&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now, you should be able to &lt;em&gt;report.pl&lt;/em&gt; and &lt;em&gt;iozone_visualization.pl&lt;/em&gt; directly. When they are run, a directory named '&lt;em&gt;report_result&lt;/em&gt;' is created. In the directory are Gnuplot scripts (&lt;em&gt;*.do&lt;/em&gt; files) and PNG images for all tested operations. Those PNG images are generated by running those Gnuplot scripts. For example, &lt;em&gt;read.png&lt;/em&gt; is generated by running &amp;quot;&lt;em&gt;gnuplot read.do&lt;/em&gt;&amp;quot;. A HTML page (index.html) is generated by &lt;em&gt;iozone_visualization.pl&lt;/em&gt; which contains all of those PNG images in the same page. &lt;/p&gt;  &lt;h2&gt;Bonnie&lt;/h2&gt;  &lt;p&gt;&lt;font size="3"&gt;http://www.textuality.com/bonnie/&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;h3&gt;Bonnie64&lt;/h3&gt;      &lt;p&gt;&lt;a href="http://code.google.com/p/bonnie-64"&gt;&lt;font size="3"&gt;http://code.google.com/p/bonnie-64&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;h3&gt;Bonnie++&lt;/h3&gt; After you download the source, just execute following commands to build and run.       &lt;br /&gt;&amp;#160;&lt;font face="Courier New"&gt; ./configure --prefix=installation_dir        &lt;br /&gt;&amp;#160; ./make         &lt;br /&gt;&amp;#160; ./make install         &lt;br /&gt;&amp;#160; cd &amp;lt;installation_dir&amp;gt;/sbin/         &lt;br /&gt;&amp;#160; ./bonnie++&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;     &lt;p&gt;&lt;a href="http://www.coker.com.au/bonnie++/"&gt;&lt;font size="3"&gt;http://www.coker.com.au/bonnie++/&lt;/font&gt;&lt;/a&gt;         &lt;br /&gt;&lt;font size="3"&gt;Manual: &lt;/font&gt;&lt;a href="http://linux.die.net/man/8/bonnie++"&gt;&lt;font size="3"&gt;http://linux.die.net/man/8/bonnie++&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Resources&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://fsbench.filesystems.org/"&gt;&lt;font size="3"&gt;http://fsbench.filesystems.org/&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.benchmarkhq.ru/english.html?/be_hdd.html"&gt;&lt;font size="3"&gt;http://www.benchmarkhq.ru/english.html?/be_hdd.html&lt;/font&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4414293478953816985?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4414293478953816985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4414293478953816985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4414293478953816985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4414293478953816985'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/some-hard-drive-and-file-system.html' title='Some Hard Drive and File System benchmark tools'/><author><name>Gerald Guo</name><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-36974671.post-8286177703265744164</id><published>2010-11-25T16:57:00.001-05:00</published><updated>2010-11-25T16:57:42.127-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><title type='text'>Permission of authorized_keys and private key file</title><content type='html'>&lt;p&gt;~/.ssh/authorized_keys: should be 600&lt;/p&gt;  &lt;p&gt;~/.ssh/id_dsa, ~/.ssh/id_rsa: must be 600&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If permissions are not set correctly, the login process may fail without giving any useful information!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8286177703265744164?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8286177703265744164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8286177703265744164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8286177703265744164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8286177703265744164'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/permission-of-authorizedkeys-and.html' title='Permission of authorized_keys and private key file'/><author><name>Gerald Guo</name><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-36974671.post-4805244099497678392</id><published>2010-11-25T11:24:00.000-05:00</published><updated>2010-11-25T15:09:24.654-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>awk/gawk notes</title><content type='html'>&lt;table border="1" cellspacing="0" cellpadding="2" width="914"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="89"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="127"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="572"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="94"&gt;RS&lt;/td&gt;        &lt;td valign="top" width="124"&gt;Record Separator&lt;/td&gt;        &lt;td valign="top" width="126"&gt;single character&lt;/td&gt;        &lt;td valign="top" width="568"&gt;That character separates the records.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="99"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="126"&gt;regular expression&lt;/td&gt;        &lt;td valign="top" width="565"&gt;Text in input matches reg exp separates records.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="103"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="123"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="125"&gt;null string&lt;/td&gt;        &lt;td valign="top" width="562"&gt;Records are separated by blank lines. The&amp;#160; newline character always acts as a field separator, in addition to whatever value &lt;em&gt;FS&lt;/em&gt; may have.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="106"&gt;NR&lt;/td&gt;        &lt;td valign="top" width="123"&gt;number of records seen so far&lt;/td&gt;        &lt;td valign="top" width="125"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="560"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="109"&gt;FNR&lt;/td&gt;        &lt;td valign="top" width="123"&gt;The input record number in the current input file&lt;/td&gt;        &lt;td valign="top" width="125"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="558"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="111"&gt;ORS&lt;/td&gt;        &lt;td valign="top" width="123"&gt;output record separator&lt;/td&gt;        &lt;td valign="top" width="125"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="556"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;FS&lt;/td&gt;        &lt;td valign="top" width="123"&gt;Field separator&lt;/td&gt;        &lt;td valign="top" width="125"&gt;single character&lt;/td&gt;        &lt;td valign="top" width="555"&gt;Fields are separated by that character&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="115"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="125"&gt;single space&lt;/td&gt;        &lt;td valign="top" width="554"&gt;fields are separated by runs of spaces&amp;#160; and/or&amp;#160; tabs&amp;#160; and/or&amp;#160; newlines.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="116"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;Null string&lt;/td&gt;        &lt;td valign="top" width="553"&gt;each individual character becomes a separate field.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="117"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;regular expression&lt;/td&gt;        &lt;td valign="top" width="552"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="118"&gt;OFS&lt;/td&gt;        &lt;td valign="top" width="122"&gt;output field separator&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="552"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="119"&gt;FIELDWIDTHS&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;a space separated list of numbers&lt;/td&gt;        &lt;td valign="top" width="551"&gt;each field is expected to have fixed width. The value&amp;#160; of&amp;#160; FS&amp;#160; is ignored.&amp;#160; Assigning a new value to FS overrides the use of FIELDWIDTHS, and restores the default behavior.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;NF&lt;/td&gt;        &lt;td valign="top" width="122"&gt;number of fields&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="550"&gt;Decrementing NF causes the values of fields past the new value to be lost, and the value of $0 to be recomputed&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;IGNORECASE&lt;/td&gt;        &lt;td valign="top" width="122"&gt;Controls the case-sensitivity of all regular expression&amp;#160; and&amp;#160; string&amp;#160; operations.&lt;/td&gt;        &lt;td valign="top" width="124"&gt;non-zero         &lt;br /&gt;zero&lt;/td&gt;        &lt;td valign="top" width="550"&gt;non-zero: ignore case&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="550"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;Field Reference&lt;/td&gt;        &lt;td valign="top" width="122"&gt;How to reference a field&lt;/td&gt;        &lt;td valign="top" width="124"&gt;$1, $2, … $NF&lt;/td&gt;        &lt;td valign="top" width="550"&gt;Access a field. Assigning&amp;#160; a value to an existing field causes the whole record to be rebuilt when $0 is referenced. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;$-1, $-2&lt;/td&gt;        &lt;td valign="top" width="550"&gt;fatal error&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;non-existent fields&lt;/td&gt;        &lt;td valign="top" width="550"&gt;For read, produce null-string. For write, 1)increase NF 2) create intervening fields with null string 3) $0 is recomputed&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;$0&lt;/td&gt;        &lt;td valign="top" width="550"&gt;whole record.&amp;#160; assigning a value to $0 causes the record to be&amp;#160; resplit,&amp;#160; creating&amp;#160; new values for the fields.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;CONVFMT&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="550"&gt;         &lt;p&gt;A number is converted to a string by using the value&amp;#160; of&amp;#160; CONVFMT&amp;#160; as&amp;#160; a&amp;#160; format&amp;#160; string&amp;#160; for&amp;#160; sprintf(3), with the numeric value of the variable as the argument.&amp;#160; However, even though all numbers in AWK are floating-point, integral values are always converted as&amp;#160; integers. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="120"&gt;OFMT&lt;/td&gt;        &lt;td valign="top" width="122"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="124"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="550"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt; All arrays in AWK are associative, i.e. indexed by string values.   &lt;br /&gt;  &lt;p&gt;i = &amp;quot;A&amp;quot;; j = &amp;quot;B&amp;quot;; k = &amp;quot;C&amp;quot;   &lt;br /&gt;x[i, j, k] = &amp;quot;hello, world\n&amp;quot;&lt;/p&gt;  &lt;p&gt;key is &amp;quot;A\034B\034C&amp;quot; and value is &amp;quot;hello, world\n&amp;quot;. Key test: val in array. for(val in array)…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4805244099497678392?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4805244099497678392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4805244099497678392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4805244099497678392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4805244099497678392'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/awkgawk-notes.html' title='awk/gawk notes'/><author><name>Gerald Guo</name><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-36974671.post-8809124320737921501</id><published>2010-11-14T17:59:00.003-05:00</published><updated>2010-11-14T17:59:52.588-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><title type='text'>XLink</title><content type='html'>&lt;p&gt;&amp;#160;&lt;a title="http://www.xml.com/lpt/a/1038" href="http://www.xml.com/lpt/a/1038"&gt;http://www.xml.com/lpt/a/1038&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Can be transformed to RDF?&lt;/p&gt;  &lt;p&gt;One RDF use &lt;em&gt;include&lt;/em&gt; to include other RDFs.&lt;/p&gt;  &lt;p&gt;XLink and HLink: &lt;a title="http://www.xml.com/lpt/a/1038" href="http://www.xml.com/lpt/a/1038"&gt;http://www.xml.com/lpt/a/1038&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Enhancements to html link&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;When to actuate the link      &lt;br /&gt;In current html link impl, the link is actuated when it is clicked. In XLink and HLink, a link can be actuated when the page containing the link is loaded &lt;/li&gt;    &lt;li&gt;More effects when a link is actuated.      &lt;br /&gt;embed, new, replace, etc. &lt;/li&gt;    &lt;li&gt;HLink supports creation of arbitrary link element.      &lt;pre&gt;&amp;lt;hlink namespace=&amp;quot;http://www.example.com/markup&amp;quot;
       element=&amp;quot;home&amp;quot;
       locator=&amp;quot;/&amp;quot;
       effect=&amp;quot;replace&amp;quot;
       actuate=&amp;quot;onRequest&amp;quot;/&amp;gt;
&amp;lt;hlink namespace=&amp;quot;http://www.example.com/markup&amp;quot;
       element=&amp;quot;home&amp;quot;
       locator=&amp;quot;/icons/home.png&amp;quot;
       effect=&amp;quot;embed&amp;quot;
       actuate=&amp;quot;onLoad&amp;quot;/&amp;gt;

&amp;lt;home/&amp;gt;&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;XLink supports creation of links among more than two resources. &lt;/li&gt;

  &lt;li&gt;Add more metadata to links &lt;/li&gt;

  &lt;li&gt;Links can be specified outside the linked resources. 
    &lt;br /&gt;In HTML, users can only specify links within the source resource. 

    &lt;br /&gt;When you write 

    &lt;pre&gt; &amp;lt;a href=”destination.resource”&amp;gt;source&amp;lt;/a&amp;gt;&lt;/pre&gt;
this piece of code must be located in the source html. In other words, the user cannot specify links among external resources. 

    &lt;br /&gt;XLink adds this support. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;METS, DIDL, ORE&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.oreillynet.com/xml/blog/2008/06/oaiore_compound_documents_draf.html" href="http://www.oreillynet.com/xml/blog/2008/06/oaiore_compound_documents_draf.html"&gt;http://www.oreillynet.com/xml/blog/2008/06/oaiore_compound_documents_draf.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.oreillynet.com/xml/blog/2008/05/bad_xml.html" href="http://www.oreillynet.com/xml/blog/2008/05/bad_xml.html"&gt;http://www.oreillynet.com/xml/blog/2008/05/bad_xml.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.dehora.net/journal/2008/06/18/dates-in-atom/" href="http://www.dehora.net/journal/2008/06/18/dates-in-atom/"&gt;http://www.dehora.net/journal/2008/06/18/dates-in-atom/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://dret.net/netdret/docs/wilde-cacm2008-xml-fever.html" href="http://dret.net/netdret/docs/wilde-cacm2008-xml-fever.html"&gt;http://dret.net/netdret/docs/wilde-cacm2008-xml-fever.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.tbray.org/ongoing/When/200x/2006/01/09/On-XML-Language-Design" href="http://www.tbray.org/ongoing/When/200x/2006/01/09/On-XML-Language-Design"&gt;http://www.tbray.org/ongoing/When/200x/2006/01/09/On-XML-Language-Design&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8809124320737921501?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8809124320737921501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8809124320737921501' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8809124320737921501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8809124320737921501'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/xlink.html' title='XLink'/><author><name>Gerald Guo</name><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-36974671.post-5694845441375746532</id><published>2010-11-14T17:57:00.001-05:00</published><updated>2010-11-14T17:58:13.226-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google AppEngine mail test</title><content type='html'>&lt;h2&gt;Mail&lt;/h2&gt;  &lt;p&gt;How to test: &lt;a title="http://aralbalkan.com/1311" href="http://aralbalkan.com/1311"&gt;http://aralbalkan.com/1311&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Two bugs:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.google.com/p/googleappengine/issues/detail?id=626"&gt;http://code.google.com/p/googleappengine/issues/detail?id=626&lt;/a&gt;     &lt;br /&gt;For this bug, you can upgrade your python to new version (2.5.4 and up).&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.google.com/p/googleappengine/issues/detail?id=1061" href="http://code.google.com/p/googleappengine/issues/detail?id=1061"&gt;http://code.google.com/p/googleappengine/issues/detail?id=1061&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://groups.google.com/group/app-engine-patch/browse_thread/thread/1662f95d9cacee24" href="http://groups.google.com/group/app-engine-patch/browse_thread/thread/1662f95d9cacee24"&gt;http://groups.google.com/group/app-engine-patch/browse_thread/thread/1662f95d9cacee24&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5694845441375746532?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5694845441375746532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5694845441375746532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5694845441375746532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5694845441375746532'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/google-appengine-mail-test.html' title='Google AppEngine mail test'/><author><name>Gerald Guo</name><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-36974671.post-6873125388216444020</id><published>2010-11-14T17:56:00.001-05:00</published><updated>2010-11-14T17:56:51.398-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Deb package manipulation notes (deb make, view, install, etc)</title><content type='html'>&lt;p&gt;Directory &lt;em&gt;/var/lib/dpkg/info/ &lt;/em&gt;contains package related files. For each package, its conffiles, md5sums, preinst, postinst, prerm, postrm, list of installed files, etc are kept there.&lt;/p&gt; &lt;h2&gt;dpkg-dev&lt;/h2&gt; &lt;p&gt;debian/files: "The&amp;nbsp; list&amp;nbsp; of&amp;nbsp; generated files which are part of the upload being prepared."&lt;/p&gt; &lt;p&gt;.changes: upload control file&lt;/p&gt; &lt;p&gt;dpkg-buildpackage &lt;br&gt;build binary or source packages from sources&lt;/p&gt; &lt;p&gt;dpkg-architecture: set and determine the architecture for package building&lt;/p&gt; &lt;p&gt;dpkg-checkbuilddeps: check build dependencies and conflicts. By default, debian/control is read.&lt;/p&gt; &lt;p&gt;dpkg-distaddfile: adds an entry for a named file to debian/files. &lt;br&gt;dpkg-genchanges: &lt;br&gt;dpkg-gencontrol:&amp;nbsp; generate Debian control files &lt;br&gt;dpkg-gensymbols:&lt;/p&gt; &lt;p&gt;dpkg-name &lt;br&gt;dpkg-scanpackages: create Packages index files &lt;br&gt;dpkg-scansources: create Sources index files &lt;br&gt;dpkg-shlibdeps &lt;br&gt;dpkg-source: packs and unpacks Debian source archives. &lt;br&gt;dpkg-vendor: query vendor information &lt;br&gt;dpkg-parsechangelog: get changelog information&lt;/p&gt; &lt;p&gt;Vendor&lt;/p&gt; &lt;p&gt;/etc/dpkg/origins/default&lt;/p&gt; &lt;h2&gt;devscripts&lt;/h2&gt; &lt;p&gt;debchange&lt;/p&gt; &lt;h2&gt;debhelper&lt;/h2&gt; &lt;h2&gt;dh-make&lt;/h2&gt; &lt;p&gt;This package is useful when you have a regular source package (not debian source package) and want to debianlize it.&lt;br&gt;dh_make must be invoked within a directory containing the source code, which must be named &amp;lt;packagename&amp;gt;-&amp;lt;version&amp;gt;. The &amp;lt;packagename&amp;gt; must&amp;nbsp; be&amp;nbsp; all lowercase, digits and dashes.&lt;br&gt;As I mentioned, there are two types of debian source packages – native and non-native.&lt;br&gt;For non-native package, obviously you need the original source tree. The reason is that the original source tree is needed to deb tools to generate diff. dh_make makes sure original source tarball(&lt;em&gt;&amp;lt;packagename&amp;gt;_&amp;lt;version&amp;gt;.orig.tar.gz&lt;/em&gt;) exists. &lt;br&gt;Option –&lt;em&gt;f&lt;/em&gt; can be used to specify location of the tarball. &lt;br&gt;If –&lt;em&gt;f&lt;/em&gt; is not given, dh_make searches parent directory for file &lt;em&gt;&amp;lt;packagename&amp;gt;_&amp;lt;version&amp;gt;.orig.tar.gz&lt;/em&gt; and directory &lt;em&gt;&amp;lt;packagename&amp;gt;_&amp;lt;version&amp;gt;.orig&lt;/em&gt;. If either of them exists, it will be fine. If neither exists, dh_make will complain and exit.&lt;br&gt;If you want to create a original source tarball based on the code in current directory, use option "—createorig". Then current directory is copied to &lt;em&gt;&amp;lt;packagename&amp;gt;_&amp;lt;version&amp;gt;.orig&lt;/em&gt; in parent directory.&lt;/p&gt; &lt;p&gt;key: public key &lt;br&gt;secret: private key&lt;/p&gt; &lt;p&gt;Trusted pub keys are stored in file /etc/apt/trusted.gpg (not /etc/apt/trustdb.gpg)&lt;/p&gt; &lt;p&gt;apt-key list&lt;/p&gt; &lt;p&gt;gpg --recv-keys --keyserver keyserver.ubuntu.com key_ID_here; &lt;br&gt;gpg --export --armor key_ID_here | sudo apt-key add -&lt;/p&gt; &lt;p&gt;&lt;a title="http://wiki.debian.org/SecureApt" href="http://wiki.debian.org/SecureApt"&gt;http://wiki.debian.org/SecureApt&lt;/a&gt; &lt;br&gt;&lt;a title="https://help.ubuntu.com/community/SecureApt" href="https://help.ubuntu.com/community/SecureApt"&gt;https://help.ubuntu.com/community/SecureApt&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Downloaded deb packages are stored at /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.&lt;/p&gt; &lt;h2&gt;Low-level understanding&lt;/h2&gt; &lt;h3&gt;Deb binary package format&lt;/h3&gt;man deb &lt;br&gt;The manual describes debian binary package format &lt;br&gt;deb package is &lt;em&gt;ar&lt;/em&gt; archive. So you can read content of a deb package using command: &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ar tf pkg_name.deb &lt;br&gt;On my machine, the output is &lt;pre&gt;    debian-binary 
    control.tar.gz 
    data.tar.gz &lt;/pre&gt;
&lt;p&gt;Extract content of a deb pkg using command: &lt;br&gt;&amp;nbsp; ar xof pkg_name.deb&lt;/p&gt;
&lt;h3&gt;Deb control&lt;/h3&gt;
&lt;p&gt;control.tar.gz is a control file. Its format is deb-control. &lt;br&gt;"It is a gzipped tar&amp;nbsp; archive&amp;nbsp; containing the&amp;nbsp; package&amp;nbsp; control&amp;nbsp; information,&amp;nbsp; as a series of plain files, of which the file control is mandatory and contains the core control information." &lt;br&gt;Use command &lt;em&gt;tar zvxf control.tar.gz&lt;/em&gt; to extract control files. The most important file is &lt;em&gt;control&lt;/em&gt;. The format of the file is described in &lt;em&gt;man deb-control&lt;/em&gt;.&lt;br&gt;conffiles: this file lists all configuration files used by this package.&lt;br&gt;control: &lt;br&gt;md5sums&amp;nbsp; &lt;br&gt;postinst &lt;br&gt;postrm&amp;nbsp;&amp;nbsp; &lt;br&gt;preinst&amp;nbsp; &lt;br&gt;prerm &lt;/p&gt;
&lt;h3&gt;Deb data&lt;/h3&gt;
&lt;p&gt;"It contains the filesystem as a tar archive, either not compressed".&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;High-level understanding&lt;/h2&gt;
&lt;p&gt;Ubuntu provides some tools to make it more convenient to manipulate deb package so that users don't need to use &lt;em&gt;ar,&lt;/em&gt; &lt;em&gt;tar&lt;/em&gt;, etc to extract files/information manually.&lt;/p&gt;
&lt;p&gt;First, command dpkg-deb comes really handy&lt;/p&gt;&lt;pre&gt;    dpkg-deb –I: provides information of a deb pkg. (Extracts info from file control) 
    dpkg-deb –c: list content of the package. (Extracts info from data.tar.gz)
    dpkg-deb –x: extract a deb archive 
    dpkg-deb –X: extract a deb archive and print list of extracted files. 
    dpkg-deb –e: extract control information to DEBIAN directory if not specified.
                 (Extract files from control.tar.gz)&lt;/pre&gt;
&lt;h2&gt;Deb Source Package&lt;/h2&gt;
&lt;p&gt;Format of source package is described in section "&lt;strong&gt;SOURCE PACKAGE FORMATS&lt;/strong&gt;" within manual "man dpkg-source". &lt;br&gt;Also read &lt;a title="http://www.debian.org/doc/debian-policy/ch-source.html" href="http://www.debian.org/doc/debian-policy/ch-source.html"&gt;http://www.debian.org/doc/debian-policy/ch-source.html&lt;/a&gt; for more info.&lt;/p&gt;
&lt;p&gt;There are two types of source packages: native and non-native.&lt;br&gt;Layout of native package&lt;/p&gt;&lt;pre&gt;  .dsc: includes package info and md5 checksum for the package content.&lt;br&gt;  .tar.gz&lt;/pre&gt;Layout of non-native package:&lt;pre&gt;  .dsc: debian source control &lt;br&gt;  .orig.tar.gz: source code&lt;br&gt;  .diff.gz: 1)patches applied to the source code; 2) debian package (debain/ dir)&lt;/pre&gt;

&lt;p&gt;Download a source package instead of binary packge:&lt;/p&gt;&lt;pre&gt;  apt-get source pkg_name     #Download and unpack&lt;br&gt;  apt-get source --download-only pkg_name    #only download&lt;/pre&gt;
&lt;p&gt;Then command &lt;em&gt;dpkg-source&lt;/em&gt; comes handy to manipulate source package.&lt;/p&gt;&lt;pre&gt;  dpkg-source –x pkg_name.dsc&amp;nbsp;&amp;nbsp;&amp;nbsp; # Extract a source package. &lt;/pre&gt;
&lt;p&gt;If you use command "&lt;em&gt;apt-get source pkg_name&lt;/em&gt;", the package has been download and extracted. So you don't need to execute this command. If you use command "&lt;em&gt;apt-get source --download pkg_name&lt;/em&gt;", you can use this command to extract the downloaded package and apply the patch. &lt;br&gt;If you don't want the patch to be applied, add option &lt;em&gt;--skip-debianization&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;If the directory where you execute command "&lt;em&gt;dpkg-source –x&lt;/em&gt;" is different from the directory where downloaded source package is stored, option "&lt;em&gt;-su, –sp, sn&lt;/em&gt;" can be used to specify where source tarball will be copied to current direcotory. &lt;/p&gt;
&lt;p&gt;In all cases any existing original source tree will be removed! So be sure to backup your code if it is in current directory. &lt;/p&gt;&lt;pre&gt;  dpkg-source –sn –x pkg_name.src    #original source tarball is not copied to current directory. But source tree is unpacked to current dir and patch is applied
  dpkg-source –sp –x pkg_name.src    #source tarball is copied to current directory, unpacked, and patch is applied
  dpkg-source –su –x pkg_name.src    #Copy source tarball to current directory, both original source tree and patched source tree are extracted.&lt;/pre&gt;
&lt;p&gt;If you want the original source is extracted also, use command "dpkg-source –su –x pkg_name.dsc".&lt;br&gt;When I extracted the source package, I got following warning:&lt;br&gt;gpgv: Can't check signature: public key not found&lt;br&gt;dpkg-source: warning: failed to verify signature on ./pkg_name.dsc&lt;/p&gt;

&lt;p&gt;This means public key has not been found which is needed to verify signature of the package. The &lt;em&gt;dpkg-source&lt;/em&gt; manaul can tell you more: &lt;pre&gt;--no-check
  Do not check signatures and checksums before unpacking.
--require-valid-signature
  Refuse to unpack  the source package if it doesn't contain an OpenPGP signature that can be verified either with the user's trustedkeys.gpg keyring, one of the vendor-specific  keyrings,  or  one of the official Debian keyrings (/usr/share/keyrings/debiankeyring.gpg and /usr/share/keyrings/debianmaintainers.gpg).
&lt;/pre&gt;

&lt;p&gt;debian/ direcotory&lt;/p&gt;
&lt;p&gt;Version:&lt;br&gt;&lt;a title="https://wiki.ubuntu.com/PackagingGuide/Complete#changelog" href="https://wiki.ubuntu.com/PackagingGuide/Complete#changelog"&gt;https://wiki.ubuntu.com/PackagingGuide/Complete#changelog&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;changelog&lt;/h3&gt;
&lt;p&gt;Default file is located at &lt;em&gt;debian/changelog&lt;/em&gt;. Changelog contains a list of changes. Note: it has a specific format. Command &lt;em&gt;debchange&lt;/em&gt; can be used to edit the file.&lt;/p&gt;
&lt;p&gt;debchange –a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #append a changelog entry at current version&lt;br&gt;debchange –i&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #increase release number for non-native packages (2.4-1ubuntu1 –&amp;gt; 2.4-1ubuntu2).&lt;br&gt;debchange –v&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #create a changelog entry for a arbitrary new version.&lt;br&gt;debchange --create&amp;nbsp; #create a new changelog file&lt;br&gt;debchange –c changelogfile&amp;nbsp; #edit a specified changelog file instead of default one.&lt;/p&gt;
&lt;p&gt;Read &lt;a title="http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog" href="http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog"&gt;http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog&lt;/a&gt; for more info.&lt;/p&gt;
&lt;p&gt;dpkg-source –b&amp;nbsp;&amp;nbsp; # build source package&lt;br&gt;man deb-version &lt;br&gt;Debian package version number format&lt;/p&gt;
&lt;p&gt;Export: &lt;br&gt;gpg --export-secret-keys keyID &lt;br&gt;gpg --export keyID&amp;nbsp;&amp;nbsp;&amp;nbsp; #export public key &lt;br&gt;gpg --gen-key &lt;br&gt;gpg –k&amp;nbsp;&amp;nbsp; #list pub keys &lt;br&gt;gpg –K&amp;nbsp;&amp;nbsp; #list secret keys&lt;/p&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;h3&gt;copyright&lt;/h3&gt;
&lt;p&gt;Read this: &lt;a title="https://wiki.ubuntu.com/PackagingGuide/Basic#Copyright%20Information" href="https://wiki.ubuntu.com/PackagingGuide/Basic#Copyright%20Information"&gt;https://wiki.ubuntu.com/PackagingGuide/Basic#Copyright%20Information&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;control&lt;/h2&gt;
&lt;p&gt;&lt;a title="https://wiki.ubuntu.com/PackagingGuide/Complete#control" href="https://wiki.ubuntu.com/PackagingGuide/Complete#control"&gt;https://wiki.ubuntu.com/PackagingGuide/Complete#control&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;rules&lt;br&gt;It specifies how to compile, install the app and create the .deb package.&lt;br&gt;&lt;a title="https://wiki.ubuntu.com/PackagingGuide/Complete#rules" href="https://wiki.ubuntu.com/PackagingGuide/Complete#rules"&gt;https://wiki.ubuntu.com/PackagingGuide/Complete#rules&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;DEBFULLNAME: &lt;br&gt;DEBEMAIL:&lt;/p&gt;
&lt;h1&gt;Package build&lt;/h1&gt;
&lt;h2&gt;Binary package&lt;/h2&gt;
&lt;p&gt;dpkg-buildpackage&lt;br&gt;debuild: wrap dpkg-buildpackage and some other tools. Or you can set variable &lt;em&gt;DEBSIGN_KEYID&lt;/em&gt; to the key id.&lt;br&gt;Use &lt;em&gt;debuild –kKEYID&lt;/em&gt; to specify the key used to sign the package.&lt;br&gt;If you want to pass parameters to dpkg-buildpackage, set variable DEBUILD_DPKG_BUILDPACKAGE_OPTS.&lt;/p&gt;
&lt;p&gt;debsign –kkeyID&lt;br&gt;debsign –m'LastName FirstName (Comment) &amp;lt;email_address&amp;gt;'&lt;/p&gt;
&lt;p&gt;Source package: debuild –S&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;lintian&lt;br&gt;Debian package checker&lt;br&gt;&amp;nbsp; lintian -Ivai *.dsc&lt;/p&gt;
&lt;p&gt;sudo pbuilder build pkg_name.dsc&lt;/p&gt;&lt;pre&gt;dpkg-query –s pkg_name    #conf files are listed&lt;/pre&gt;
&lt;p&gt;&lt;a title="https://wiki.ubuntu.com/PackagingGuide/Complete" href="https://wiki.ubuntu.com/PackagingGuide/Complete"&gt;https://wiki.ubuntu.com/PackagingGuide/Complete&lt;/a&gt;&lt;br&gt;&lt;a title="https://wiki.ubuntu.com/DebootstrapChroot" href="https://wiki.ubuntu.com/DebootstrapChroot"&gt;https://wiki.ubuntu.com/DebootstrapChroot&lt;/a&gt;&lt;br&gt;&lt;a title="https://wiki.ubuntu.com/PackagingGuide/Basic" href="https://wiki.ubuntu.com/PackagingGuide/Basic"&gt;https://wiki.ubuntu.com/PackagingGuide/Basic&lt;/a&gt;&lt;br&gt;&lt;a title="https://wiki.ubuntu.com/PbuilderHowto" href="https://wiki.ubuntu.com/PbuilderHowto"&gt;https://wiki.ubuntu.com/PbuilderHowto&lt;/a&gt;&lt;br&gt;&lt;a title="https://help.ubuntu.com/community/GnuPrivacyGuardHowto" href="https://help.ubuntu.com/community/GnuPrivacyGuardHowto"&gt;https://help.ubuntu.com/community/GnuPrivacyGuardHowto&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html" href="http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html"&gt;http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.debian.org/doc/manuals/maint-guide/index.en.html" href="http://www.debian.org/doc/manuals/maint-guide/index.en.html"&gt;http://www.debian.org/doc/manuals/maint-guide/index.en.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.debian.org/doc/debian-policy/" href="http://www.debian.org/doc/debian-policy/"&gt;http://www.debian.org/doc/debian-policy/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6873125388216444020?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6873125388216444020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6873125388216444020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6873125388216444020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6873125388216444020'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/deb-package-manipulation-notes-deb-make.html' title='Deb package manipulation notes (deb make, view, install, etc)'/><author><name>Gerald Guo</name><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-36974671.post-7380021286780854367</id><published>2010-11-14T02:13:00.000-05:00</published><updated>2010-11-14T17:53:21.351-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><category scheme='http://www.blogger.com/atom/ns#' term='hadoop'/><title type='text'>How to build Hadoop in Eclipse</title><content type='html'>&lt;h2&gt;Subclipse&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Install SVN      &lt;br /&gt;I installed &amp;quot;Slik-SVN&amp;quot; because it provides JavaHL lib for 64bit Windows.&lt;/li&gt;    &lt;li&gt;Install Subclipse plugin to Eclipse.&lt;/li&gt;    &lt;li&gt;Change eclipse.ini to add following parameters after &lt;em&gt;-vmargs&lt;/em&gt;:      &lt;br /&gt;-Djava.library.path=/usr/share/jni/lib (For linux)      &lt;br /&gt;-Djava.library.path=&amp;lt;svn_install_dir&amp;gt;/bin (For Windows)&lt;/li&gt;    &lt;li&gt;Start eclipse&lt;/li&gt;    &lt;li&gt;Goto WIndow --&amp;gt; Preference --&amp;gt; Team --&amp;gt; SVN     &lt;br /&gt;In section &amp;quot;SVN Interface&amp;quot;, it should say something like &amp;quot;JavaHL (JNI) … SlikSvn&amp;quot;. If it says &amp;quot;JavaHL(JNI) not available&amp;quot;, it means subclipse cannot find JavaHL library. Check step 3).&lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Code checkout&lt;/h2&gt;  &lt;p&gt;Example: svn co &lt;a href="http://svn.apache.org/repos/asf/hadoop/common/tags/release-0.21.0/"&gt;http://svn.apache.org/repos/asf/hadoop/common/tags/release-0.21.0/&lt;/a&gt;    &lt;br /&gt;You can also check out code within Eclipse using Subclipse plugin.&lt;/p&gt;  &lt;h2&gt;Install Ant and Ivy&lt;/h2&gt;  &lt;p&gt;Read &lt;a title="http://ant.apache.org/" href="http://ant.apache.org/"&gt;http://ant.apache.org/&lt;/a&gt; for how to install Ant.&lt;/p&gt;  &lt;p&gt;Download ivy jar and put it into directory ANT_HOME/lib/. If ANT_HOME is not specified explicitly, it is the installation directory.&lt;/p&gt;  &lt;h2&gt;IvyDE&lt;/h2&gt;  &lt;p&gt;Hadoop is managed by ivy. You need IvyIDE Eclipse plugin. Read &lt;a title="http://ant.apache.org/ivy/ivyde/" href="http://ant.apache.org/ivy/ivyde/"&gt;http://ant.apache.org/ivy/ivyde/&lt;/a&gt; for more info. IvyDE includes ivy jar file itself. So it does not use the ivy jar you installed in last step. Also it seems that ANT_HOME variable is set to &lt;em&gt;&amp;lt;eclipse_dir&amp;gt;\plugins\org.apache.ant_1.7.1.v20090120-1145 &lt;/em&gt;(version number may vary for you).&lt;/p&gt;  &lt;h2&gt;Shell and Unix commands on Windows&lt;/h2&gt;  &lt;p&gt;Hadoop build file invokes &lt;em&gt;sh&lt;/em&gt; and some other linux commands such as &lt;em&gt;tr, sed&lt;/em&gt; to build the project. Of course those commands don't exist on Windows.&lt;/p&gt;  &lt;p&gt;Following two projects port linux tools to Windows:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a title="http://sourceforge.net/projects/win-bash/files/win-bash/" href="http://sourceforge.net/projects/win-bash/files/win-bash/"&gt;http://sourceforge.net/projects/win-bash/files/win-bash/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://unxutils.sourceforge.net/" href="http://unxutils.sourceforge.net/"&gt;http://unxutils.sourceforge.net/&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I use the first one. You just download the tarball and decompress it to a directory. This directory must be passed to Ant. The usual way is you put it into environment variable &amp;quot;PATH&amp;quot;. Ant will pick it up automatically. It's true for command line use of Ant. It does not work well for Ant within Eclipse. Following sections include instructions about how to pass PATH to Ant in Eclipse.    &lt;br /&gt;For command line use, try command &amp;quot;ant compile&amp;quot;. &lt;/p&gt;  &lt;h2&gt;Create Eclipse Project for Hadoop&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;New --&amp;gt; Java Project     &lt;br /&gt;Select &amp;quot;Create project from existing source&amp;quot;. Then select the directory where code is located.      &lt;br /&gt;Click &amp;quot;Next&amp;quot;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;CHANGE OUTPUT DIRECTORY&lt;/font&gt;&lt;/strong&gt; TO &amp;lt;workspace_name&amp;gt;/&lt;strong&gt;build&lt;/strong&gt;.       &lt;br /&gt;The default directory &lt;strong&gt;bin&lt;/strong&gt; is used by Hadoop for different purposes.       &lt;br /&gt;Click &amp;quot;Finish&amp;quot;&lt;/li&gt;    &lt;li&gt;Add JDK's &lt;em&gt;tools.jar&lt;/em&gt; to build path.&amp;#160; It is not included in JRE. &lt;/li&gt;    &lt;li&gt;Change source directories to tell Eclipse which directories include Java source code.     &lt;br /&gt;Right click project name --&amp;gt; Build Path --&amp;gt; Configure Build Path… --&amp;gt; Source&lt;/li&gt;    &lt;li&gt;Make IvyDE to manage ivy dependencies.      &lt;br /&gt;Right click project name --&amp;gt; Build Path --&amp;gt; Configure Build Path… --&amp;gt; Libraries --&amp;gt; Add Library --&amp;gt; IvyDE Managed Dependencies --&amp;gt; Next --&amp;gt; (couple of&amp;#160; IvyDE setting steps) --&amp;gt; OK.      &lt;br /&gt;It may take some time for IvyDE to resolve dependencies.&lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Create Run Configuration&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Right click &amp;quot;build.xml&amp;quot; --&amp;gt; Run As --&amp;gt; Ant Build … (not &amp;quot;Ant Build&amp;quot;)&lt;/li&gt;    &lt;li&gt;A dialog should pop up&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;Switch to &amp;quot;Targets&amp;quot; tab: select corresponding target (e.g. compile) you want to execute.&lt;/li&gt;      &lt;li&gt;Switch to &amp;quot;JRE&amp;quot; tab: select &amp;quot;separate JRE&amp;quot;&lt;/li&gt;      &lt;li&gt;&lt;strong&gt;This step is for Windows users.         &lt;br /&gt;&lt;/strong&gt;Switch to Environment Tab: set PATH. (to include where those linux tools are included on Window)        &lt;br /&gt;You can click &amp;quot;Select&amp;quot; and choose variable &amp;quot;Path&amp;quot;. But in my case, its value does NOT include all of the content of the variable (use &amp;quot;path&amp;quot; command in command line). probably, Eclipse has some restriction about length of value of environment variable. If it's too long, it will be truncated.&lt;/li&gt;      &lt;li&gt;Click &amp;quot;Run&amp;quot;&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;See Console for messages.&lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Customize project builder&lt;/h2&gt;  &lt;p&gt;It's more convenient to use &amp;quot;Builder&amp;quot; than right click &amp;quot;build.xml&amp;quot; --&amp;gt; Run As --&amp;gt; Ant Build … --&amp;gt; Run. Following steps tell you how to use ant as default builder. Then you can use &amp;quot;Project--&amp;gt;Build Project&amp;quot; to build your project (same as any regular native Eclipse Java project).&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Right click project name --&amp;gt; Properties --&amp;gt; Builder --&amp;gt; New --&amp;gt; Ant Builder&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;Select the build file (usually &amp;quot;build.xml&amp;quot;).&lt;/li&gt;      &lt;li&gt;Switch to &amp;quot;Targets&amp;quot; tab.&amp;#160; Specify which targets are executed when the project is built or cleaned.&lt;/li&gt;      &lt;li&gt;&lt;strong&gt;This step is for Windows users.         &lt;br /&gt;&lt;/strong&gt;Switch to &amp;quot;Environment&amp;quot; tab. Add PATH environment variable if needed. (to include where those linux tools are included on Window)&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;Deselect default java builder.&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7380021286780854367?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7380021286780854367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7380021286780854367' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7380021286780854367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7380021286780854367'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/svn-subclipse.html' title='How to build Hadoop in Eclipse'/><author><name>Gerald Guo</name><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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-3482656224687505776</id><published>2010-11-10T18:13:00.001-05:00</published><updated>2010-11-10T18:13:41.752-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>package installation log on Ubuntu (dpkg, apt-get, aptitude)</title><content type='html'>&lt;h2&gt;Dpkg log&lt;/h2&gt;  &lt;p&gt;All deb package operations must go through deb system. So no matter you use &lt;em&gt;apt-get install&lt;/em&gt; or &lt;em&gt;deb -I&lt;/em&gt;, it will be logged in &lt;em&gt;/var/log/dpkg.log&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;lesspipe can show content of .gz files directly. But it cannot show normal text file &lt;img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://lh6.ggpht.com/_qiIXUonGAyk/TNsnJIRaMLI/AAAAAAAAA-g/r41CDTeasGU/wlEmoticon-sadsmile%5B2%5D.png?imgmax=800" /&gt;. &lt;/p&gt;  &lt;p&gt;Show install and upgrade history for &lt;em&gt;dkg.log.#.gz&lt;/em&gt; files: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;ls /var/log/dpkg.log*|sort -r|xargs -I{} lesspipe {}|egrep &amp;quot;^[0-9\-]+[[:space:]][0-9:]+[[:space:]](install|upgrade)[[:space:]]&amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Show install and upgrade history for &lt;em&gt;dkg.log&lt;/em&gt; and &lt;em&gt;dpkg.log.#&lt;/em&gt; files: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;ls /var/log/dpkg.log*|sort -r|grep -v &amp;quot;.gz&amp;quot;|xargs -I{} cat {}|egrep &amp;quot;^[0-9\-]+[[:space:]][0-9:]+[[:space:]](install|upgrade)[[:space:]]&amp;quot;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;apt-get log&lt;/h2&gt;  &lt;p&gt;apt-get logges to /var/log/apt/term.log &lt;/p&gt;  &lt;h2&gt;aptitude&lt;/h2&gt;  &lt;p&gt;/var/log/aptitude&lt;/p&gt;  &lt;h2&gt;Resources&lt;/h2&gt;  &lt;p&gt;&lt;a title="http://superuser.com/questions/6338/how-do-you-track-which-packages-were-installed-on-ubuntu-linux" href="http://superuser.com/questions/6338/how-do-you-track-which-packages-were-installed-on-ubuntu-linux"&gt;http://superuser.com/questions/6338/how-do-you-track-which-packages-were-installed-on-ubuntu-linux&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;As far as logs, &lt;code&gt;apt-get&lt;/code&gt; notoriously doesn't have one;       &lt;br /&gt;&lt;code&gt;dpkg&lt;/code&gt; does (at &lt;em&gt;/var/log/dpkg.log&lt;/em&gt;) but it's famously hard to parse and can only be read with root privileges;       &lt;br /&gt;&lt;code&gt;aptitude&lt;/code&gt; has one at &lt;em&gt;/var/log/aptitude&lt;/em&gt; and you can page through it with regular user privileges.&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3482656224687505776?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3482656224687505776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3482656224687505776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3482656224687505776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3482656224687505776'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/package-installation-log-on-ubuntu-dpkg.html' title='package installation log on Ubuntu (dpkg, apt-get, aptitude)'/><author><name>Gerald Guo</name><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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_qiIXUonGAyk/TNsnJIRaMLI/AAAAAAAAA-g/r41CDTeasGU/s72-c/wlEmoticon-sadsmile%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-7195304975094977521</id><published>2010-11-10T01:13:00.001-05:00</published><updated>2010-11-10T01:13:58.877-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>paratrac on Ubuntu</title><content type='html'>&lt;h1&gt;Compile ftrack&lt;/h1&gt;  &lt;h2&gt;Dependencies&lt;/h2&gt;  &lt;p&gt;Depends on: fuse-dev, glib-dev, gthread-dev&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; sudo apt-get install libfuse-dev&amp;#160; libglib2.0-dev&lt;/p&gt;  &lt;p&gt;Use following commands to check whether they are installed successfully&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; pkg-config --libs --cflags glib-2.0   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; pkg-config --libs --cflags fuse&lt;/p&gt;  &lt;h2&gt;Build&lt;/h2&gt;  &lt;p&gt;cd fuse/ftrac/   &lt;br /&gt;./configure prefix=your_prefix    &lt;br /&gt;make    &lt;br /&gt;make install&lt;/p&gt;  &lt;p&gt;Add ftrack to PATH:   &lt;br /&gt;&amp;#160; export PATH=your_prefix/bin:$PATH    &lt;br /&gt;&amp;#160; which ftrac&lt;/p&gt;  &lt;h1&gt;Use fusetrac.py&lt;/h1&gt;  &lt;p&gt; add &lt;strong&gt;&lt;font color="#ff0000"&gt;parent directory of paratrac&lt;/font&gt;&lt;/strong&gt; to PYTHONPATH&lt;/p&gt;  &lt;p&gt;&amp;#160; python fusetrac.py -t /tmp/fuse/&lt;/p&gt;  &lt;p&gt;FUSE FS is mounted and a monitoring page is shown. From now on, when you access &lt;em&gt;/tmp/fuse&lt;/em&gt;, data on monitoring page will be changed.&lt;/p&gt;  &lt;p&gt;&amp;#160; cd /tmp/fuse&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7195304975094977521?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7195304975094977521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7195304975094977521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7195304975094977521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7195304975094977521'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/paratrac-on-ubuntu.html' title='paratrac on Ubuntu'/><author><name>Gerald Guo</name><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-36974671.post-5212441606924952146</id><published>2010-11-09T19:38:00.001-05:00</published><updated>2010-11-09T19:38:58.950-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Python in Ubuntu/Debian</title><content type='html'>&lt;p&gt;&lt;a title="http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html" href="http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html"&gt;http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;site module&lt;/h2&gt;  &lt;p&gt;&lt;a title="http://docs.python.org/library/site.html" href="http://docs.python.org/library/site.html"&gt;http://docs.python.org/library/site.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I assume &lt;em&gt;sys.prefix&lt;/em&gt; and &lt;em&gt;sys.exec_prefix&lt;/em&gt; are &lt;em&gt;/usr&lt;/em&gt;. It may be different on your machine. &lt;/p&gt;  &lt;p&gt;/usr/lib/pythonX.Y/site-packages&lt;/p&gt;  &lt;p&gt;/usr/lib/site-python&lt;/p&gt;  &lt;p&gt;&amp;quot;It sees if it refers to an existing directory, and if so, adds it to sys.path and also inspects the newly added path for configuration files.&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;Note: sub-directories are not added&lt;/strong&gt;&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;If &lt;em&gt;.pth&lt;/em&gt; files exist in those directories, its contents are additional items (one per line) to be added to sys.path. &lt;/p&gt;  &lt;h2&gt;local admin&lt;/h2&gt;  &lt;p&gt;A special directory is dedicated to public Python modules installed by the &lt;strong&gt;&lt;font color="#ff0000"&gt;local&lt;/font&gt;&lt;/strong&gt; administrator, &lt;strong&gt;&lt;font color="#ff0000"&gt;/usr/local/lib/pythonX.Y/dist-packages&lt;/font&gt;&lt;/strong&gt; for python2.6 and later, and &lt;strong&gt;&lt;font color="#ff0000"&gt;/usr/local/lib/pythonX.Y/site-packages&lt;/font&gt;&lt;/strong&gt; for python2.5 and earlier. For a local installation by the administrator of python2.6 and later, a special directory is reserved to Python modules which should only be available to this Python, &lt;strong&gt;&lt;font color="#ff0000"&gt;/usr/local/lib/pythonX.Y/site-packages&lt;/font&gt;&lt;/strong&gt;. Unfortunately, for python2.5 and earlier this directory is also visible to the system Python. Additional information on appending site-specific paths to the module search path is available in the official documentation of the site module. &lt;/p&gt;  &lt;h2&gt;Central repository&lt;/h2&gt;  &lt;p&gt;It seems all (not all?) modules are installed into directory &lt;em&gt;/usr/share/pyshared&lt;/em&gt;. It's a central module repository for python. Python modules in other system directories are symbolic references to files in this directory. &lt;/p&gt;  &lt;p&gt;/usr/lib/pyshared/python2.6/: .so python extensions?&lt;/p&gt;  &lt;h2&gt;python-central&lt;/h2&gt;  &lt;p&gt;python-central is a tool for Python module management.&lt;/p&gt;  &lt;p&gt;pycentral:&amp;#160; register and build utility for Python packages. It manages python modules you installed.&lt;/p&gt;  &lt;p&gt;pyversions&amp;#160; prints&amp;#160; information&amp;#160; about installed, supported python runtimes,&lt;/p&gt;  &lt;p&gt;py_compilefiles: compiles Python .py source files into .pyc or .pyo bytecode format.&lt;/p&gt;  &lt;p&gt;It adds hooks for runtime change:&lt;/p&gt;  &lt;p&gt;/usr/share/python/runtime.d/pycentral.rtinstall    &lt;br /&gt;/usr/share/python/runtime.d/pycentral.rtremove     &lt;br /&gt;/usr/share/python/runtime.d/pycentral.rtupdate&lt;/p&gt;  &lt;h2&gt;python-support&lt;/h2&gt;  &lt;p&gt;python-central is another tool for Python module management.&lt;/p&gt;  &lt;p&gt;modules managed by python-support are installed in another directory which is added to the sys.path using the .pth mechanism. The .pth mechanism is documented in the Python documentation of the site module.&amp;#160; &lt;/p&gt;  &lt;p&gt;During installation, it adds a file &lt;em&gt;/usr/lib/python2.6/dist-packages/python-support.pth&lt;/em&gt; which contains &lt;em&gt;/usr/lib/pymodules/pythonX.Y/&lt;/em&gt;. This directory also contains the byte-compiled modules for version pythonX.Y.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;update-python-modules&lt;/em&gt; can be used to rebuild those modules.&lt;/p&gt;  &lt;p&gt;It also adds hooks for runtime change:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/python/runtime.d/python-support.rtinstall    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/python/runtime.d/python-support.rtremove     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /usr/share/python/runtime.d/python-support.rtupdate&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5212441606924952146?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5212441606924952146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5212441606924952146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5212441606924952146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5212441606924952146'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/python-in-ubuntudebian.html' title='Python in Ubuntu/Debian'/><author><name>Gerald Guo</name><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-36974671.post-1828881003416431432</id><published>2010-11-06T18:37:00.001-04:00</published><updated>2010-11-06T18:37:55.297-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cloudcomputing'/><title type='text'>euca2tools</title><content type='html'>&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://wiki.debian.org/euca2ools" href="http://wiki.debian.org/euca2ools"&gt;http://wiki.debian.org/euca2ools&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://open.eucalyptus.com/wiki/Euca2oolsUsing" href="http://open.eucalyptus.com/wiki/Euca2oolsUsing"&gt;http://open.eucalyptus.com/wiki/Euca2oolsUsing&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you choose to use REST APIs, following options are necessary:&lt;/p&gt;  &lt;p&gt;-U: endpoint to which requests are sent&lt;/p&gt;  &lt;p&gt;-a: access key ID&lt;/p&gt;  &lt;p&gt;-s: secret key&lt;/p&gt;  &lt;p&gt;Note: for some tools, access key ID is specified via option&lt;em&gt; &lt;strong&gt;&amp;quot;-A&amp;quot;&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; &lt;/strong&gt;instead of &amp;quot;-a&amp;quot;, &amp;quot;-S&amp;quot; instead of &amp;quot;-s&amp;quot;. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1828881003416431432?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1828881003416431432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1828881003416431432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1828881003416431432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1828881003416431432'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/euca2tools.html' title='euca2tools'/><author><name>Gerald Guo</name><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-36974671.post-2138816756857808212</id><published>2010-11-06T18:10:00.000-04:00</published><updated>2010-11-06T18:11:14.730-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Install a package from Debian repository for Ubuntu</title><content type='html'>&lt;p&gt;You can directly use Debian repository. But Debian packages may or may not be compatible with Ubuntu. So you take your own risks by doing so. Another way is to download source and build the package, which is described below. &lt;/p&gt;  &lt;p&gt;1) Add a line to &lt;em&gt;/etc/apt/sources.list&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; deb-src repo-url&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;2) Update package index&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; sudo apt-get update&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;3) Install dependencies: (These dependencies are downloaded from Ubuntu repository, not Debian repository)&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; sudo apt-get build-dep pkg_name&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;4) Download source and build package&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; apt-get -b source pkg_name&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Now you should have a &lt;em&gt;pkg_name.deb&lt;/em&gt; file generated in current directory. &lt;/p&gt;  &lt;p&gt;5) Install the package&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; sudo dpkg -I pkg_name.deb&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;6) Revert &lt;em&gt;/etc/apt/sources.list&lt;/em&gt; file by removing the line added in step 1).&lt;/p&gt;  &lt;p&gt;7) Rebuild package index&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; sudo apt-get update&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You are done!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2138816756857808212?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2138816756857808212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2138816756857808212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2138816756857808212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2138816756857808212'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/install-package-from-debian-repository.html' title='Install a package from Debian repository for Ubuntu'/><author><name>Gerald Guo</name><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-36974671.post-3744229705958447778</id><published>2010-11-03T23:42:00.001-04:00</published><updated>2010-11-03T23:42:45.605-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>"Twitter is over capacity"</title><content type='html'>&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_qiIXUonGAyk/TNIrs35SSWI/AAAAAAAAA-Y/CkMIlMJjAjs/s1600-h/twitter_over_capacity%5B3%5D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="twitter_over_capacity" border="0" alt="twitter_over_capacity" src="http://lh6.ggpht.com/_qiIXUonGAyk/TNIrtLdXpAI/AAAAAAAAA-c/jetUNPpjoGA/twitter_over_capacity_thumb%5B1%5D.png?imgmax=800" width="782" height="563" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3744229705958447778?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3744229705958447778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3744229705958447778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3744229705958447778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3744229705958447778'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/11/is-over-capacity.html' title='&amp;quot;Twitter is over capacity&amp;quot;'/><author><name>Gerald Guo</name><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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_qiIXUonGAyk/TNIrtLdXpAI/AAAAAAAAA-c/jetUNPpjoGA/s72-c/twitter_over_capacity_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-6346193460972478512</id><published>2010-10-30T11:08:00.001-04:00</published><updated>2010-11-29T00:02:17.722-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>Arrays in Bash (Cheatsheet)</title><content type='html'>&lt;table border="1" cellspacing="0" cellpadding="2" width="903"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="237"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="308"&gt;&lt;strong&gt;Indexed array&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="356"&gt;&lt;strong&gt;Associative array&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="238"&gt;Declare an array&lt;/td&gt;        &lt;td valign="top" width="308"&gt;declare -a array&lt;/td&gt;        &lt;td valign="top" width="356"&gt;declare -A array &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Assignment&lt;/td&gt;        &lt;td valign="top" width="308"&gt;array=(value1 value2 … valuen)&lt;/td&gt;        &lt;td valign="top" width="356"&gt;array=([sub1]=value1 … [subN]=valueN)          &lt;br /&gt;&lt;font color="#ff0000"&gt;Note:You must declare it first&lt;/font&gt; you can use           &lt;br /&gt;declare -A array=([sub1]=value1 … [subN]=valueN)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Expand to all values&lt;/td&gt;        &lt;td valign="top" width="308"&gt;${array[@]}&amp;#160; or ${array[*]}&lt;/td&gt;        &lt;td valign="top" width="356"&gt;${array[@]}&amp;#160; or ${array[*]}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Expand to all keys&lt;/td&gt;        &lt;td valign="top" width="308"&gt;${!array[@]}&amp;#160; or ${!array[*]}&lt;/td&gt;        &lt;td valign="top" width="356"&gt;${!array[@]}&amp;#160; or ${!array[*]}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;length of an array&lt;/td&gt;        &lt;td valign="top" width="308"&gt;${#array[@]} or ${#array[*]}&lt;/td&gt;        &lt;td valign="top" width="356"&gt;${#array[@]} or ${#array[*]}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Remove entire array&lt;/td&gt;        &lt;td valign="top" width="308"&gt;unset array or unset array[@] or unset array[*]&lt;/td&gt;        &lt;td valign="top" width="356"&gt;unset array or unset array[@] or unset array[*]&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Remove an element&lt;/td&gt;        &lt;td valign="top" width="308"&gt;unset array[index]&lt;/td&gt;        &lt;td valign="top" width="356"&gt;unset array[index]&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Array join&lt;/td&gt;        &lt;td valign="top" width="308"&gt;array1+=(${array2[@]}) or array1+=(v1 v2 … vN)&lt;/td&gt;        &lt;td valign="top" width="356"&gt;array1+=([sub1]=v1 [sub2]=v2 … [subN]=vN)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="239"&gt;Length of an element: &lt;/td&gt;        &lt;td valign="top" width="308"&gt;${#array[index]}&lt;/td&gt;        &lt;td valign="top" width="356"&gt;${#array[index]}&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://tldp.org/LDP/abs/html/arrays.html" href="http://tldp.org/LDP/abs/html/arrays.html"&gt;http://tldp.org/LDP/abs/html/arrays.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6346193460972478512?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6346193460972478512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6346193460972478512' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6346193460972478512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6346193460972478512'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/arrays-in-bash.html' title='Arrays in Bash (Cheatsheet)'/><author><name>Gerald Guo</name><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-36974671.post-5293277614649415209</id><published>2010-10-29T16:17:00.001-04:00</published><updated>2010-10-29T16:17:09.288-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>Bash config file loading order</title><content type='html'>&lt;table border="1" cellspacing="0" cellpadding="2" width="774"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="112" align="center"&gt;&lt;strong&gt;interactive&lt;/strong&gt;&lt;/td&gt;        &lt;td width="63" align="center"&gt;&lt;strong&gt;login&lt;/strong&gt;&lt;/td&gt;        &lt;td width="426" align="center"&gt;&lt;strong&gt;files sourced&lt;/strong&gt;&lt;/td&gt;        &lt;td width="184" align="center"&gt;&lt;strong&gt;Related option&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="112" align="center"&gt;Y&lt;/td&gt;        &lt;td width="63" align="center"&gt;Y&lt;/td&gt;        &lt;td rowspan="2" width="426" align="center"&gt;         &lt;p&gt;/etc/profile, {~/.bash_profile| ~/.bash_login| ~/.profile }            &lt;br /&gt;Only one of the files in brackets will be executed.&lt;/p&gt;       &lt;/td&gt;        &lt;td rowspan="2" width="179" align="center"&gt;--noprofile&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="112" align="center"&gt;N&lt;/td&gt;        &lt;td width="63" align="center"&gt;Y&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="112" align="center"&gt;Y&lt;/td&gt;        &lt;td width="63" align="center"&gt;N&lt;/td&gt;        &lt;td width="426" align="center"&gt;/etc/bash.bashrc, ~/.bashrc&lt;/td&gt;        &lt;td width="178" align="center"&gt;--norc&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="112" align="center"&gt;&amp;#160;&lt;/td&gt;        &lt;td width="63" align="center"&gt;&amp;#160;&lt;/td&gt;        &lt;td width="426" align="center"&gt;&amp;#160;&lt;/td&gt;        &lt;td width="181" align="center"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5293277614649415209?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5293277614649415209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5293277614649415209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5293277614649415209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5293277614649415209'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/bash-config-file-loading-order.html' title='Bash config file loading order'/><author><name>Gerald Guo</name><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-36974671.post-4324022493803291846</id><published>2010-10-29T11:14:00.001-04:00</published><updated>2010-10-29T23:43:11.877-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kindle'/><title type='text'>Kindle 3rd generation</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I got problems when I tried to read some books in Chinese.&lt;/p&gt;  &lt;p&gt;I will basically investigate following questions&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;What encodings are supported by Kindle &lt;/li&gt;    &lt;li&gt;What fonts are supported &lt;/li&gt;    &lt;li&gt;If the fonts used in the PDF cannot be found, how Kindle handles it. &lt;/li&gt;    &lt;li&gt;What formats are supported?&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4324022493803291846?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4324022493803291846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4324022493803291846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4324022493803291846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4324022493803291846'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/kindle-3rd-generation.html' title='Kindle 3rd generation'/><author><name>Gerald Guo</name><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-36974671.post-1745328168500343815</id><published>2010-10-27T00:28:00.001-04:00</published><updated>2010-10-27T00:53:49.370-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome'/><title type='text'>GNOME notes</title><content type='html'>&lt;p&gt;GDM&lt;/p&gt;  &lt;p&gt;/etc/init.d/gdm, /etc/init/gdm.conf: these two files are used to start gdm (actually gdm-binary).&lt;/p&gt;  &lt;p&gt;Default display manager is stored here: /etc/X11/default-display-manager &lt;/p&gt;  &lt;p&gt;GDM configuration: &lt;a title="http://library.gnome.org/admin/gdm/2.32/gdm.html#configuration" href="http://library.gnome.org/admin/gdm/2.32/gdm.html#configuration"&gt;http://library.gnome.org/admin/gdm/2.32/gdm.html#configuration&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Tools: gdmsetup&lt;/p&gt;  &lt;p&gt;/etc/gdm&lt;/p&gt;  &lt;p&gt;/user/share/gdm/&lt;/p&gt;  &lt;p&gt;After the user logins in, gnome-session is invoked.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://library.gnome.org/admin/system-admin-guide/stable/sessions-1.html.en" href="http://library.gnome.org/admin/system-admin-guide/stable/sessions-1.html.en"&gt;http://library.gnome.org/admin/system-admin-guide/stable/sessions-1.html.en&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;man gnome-session&lt;/p&gt;  &lt;p&gt;Default session is specified at /desktop/gnome/session/default_session.&lt;/p&gt;  &lt;p&gt;Use gconf-editor to view value of /desktop/gnome/session/default_session. In my case the value is &amp;quot;gnome-settings-daemon&amp;quot;.    &lt;br /&gt;/usr/lib/gnome-settings-daemon/gnome-settings-daemon --gconf-prefix=/apps/gdm/simple-greeter/settings-manager-plugins. The description of option &amp;quot;--gconf-prefix&amp;quot; is &amp;quot;GConf prefix from which to load plugin settings&amp;quot;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Some resources:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://live.gnome.org/SessionManagement/GnomeSession" href="http://live.gnome.org/SessionManagement/GnomeSession"&gt;http://live.gnome.org/SessionManagement/GnomeSession&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://standards.freedesktop.org/desktop-entry-spec/latest/" href="http://standards.freedesktop.org/desktop-entry-spec/latest/"&gt;http://standards.freedesktop.org/desktop-entry-spec/latest/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Autostart-spec:&amp;#160; &lt;a title="http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html" href="http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html"&gt;http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://lists.freedesktop.org/archives/xdg/2007-January/007436.html" href="http://lists.freedesktop.org/archives/xdg/2007-January/007436.html"&gt;http://lists.freedesktop.org/archives/xdg/2007-January/007436.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Autostart apps are specified in directory /etc/xdg/autostart/, ~/.config/autostart/&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;tt&gt;Use /usr/bin/gnome-session-properties to set session properties (e.g. autostart programs). Those changes are specific to a user.&lt;/tt&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1745328168500343815?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1745328168500343815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1745328168500343815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1745328168500343815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1745328168500343815'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/gnome-notes.html' title='GNOME notes'/><author><name>Gerald Guo</name><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-36974671.post-8327449140968588236</id><published>2010-10-26T00:51:00.000-04:00</published><updated>2010-10-26T01:10:17.644-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>JAASRealm + SSL</title><content type='html'>&lt;p&gt;&lt;a title="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm" href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm"&gt;http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This is a good article on the topic: &lt;a title="http://blog.frankel.ch/custom-loginmodule-in-tomcat" href="http://blog.frankel.ch/custom-loginmodule-in-tomcat"&gt;http://blog.frankel.ch/custom-loginmodule-in-tomcat&lt;/a&gt;. Some of following code is borrowed from the article.&lt;/p&gt;  &lt;p&gt;Following steps are listed on the official tomcat doc. I will elaborate each of them.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&amp;quot;Write your own LoginModule, User and Role classes based on JAAS (see &lt;a href="http://java.sun.com/j2se/1.4.1/docs/guide/security/jaas/tutorials/GeneralAcnOnly.html"&gt;the JAAS Authentication Tutorial&lt;/a&gt; and &lt;a href="http://java.sun.com/j2se/1.4.1/docs/guide/security/jaas/JAASLMDevGuide.html"&gt;the JAAS Login Module Developer's Guide&lt;/a&gt;) to be managed by the JAAS Login Context (javax.security.auth.login.LoginContext) When developing your LoginModule, note that JAASRealm's built-in CallbackHandler only recognizes the NameCallback and PasswordCallback at present. &amp;quot;       &lt;pre class="brush:java;"&gt;package test;

import java.io.IOException;
import java.util.Map;

import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;

/**
 * Login module that simply matches name and password to perform authentication.
 * If successful, set principal to name and credential to &amp;quot;AuthorizedUser&amp;quot;.
 *
 * @author Nicolas Fränkel. Modified by Gerald Guo.
 * @since 2 avr. 2009
 */
public class PlainLoginModule implements LoginModule {

    /** Callback handler to store between initialization and authentication. */
    private CallbackHandler handler;

    /** Subject to store. */
    private Subject subject;

    /** Login name. */
    private String login;

    /**
     * This implementation always return false.
     *
     * @see javax.security.auth.spi.LoginModule#abort()
     */
    @Override
    public boolean abort() throws LoginException {

        return false;
    }

    /**
     * This is where, should the entire authentication process succeeds,
     * principal would be set.
     *
     * @see javax.security.auth.spi.LoginModule#commit()
     */
    @Override
    public boolean commit() throws LoginException {

        try {

            PlainUserPrincipal user = new PlainUserPrincipal(login);
            PlainRolePrincipal role = new PlainRolePrincipal(&amp;quot;AuthorizedUser&amp;quot;);

            subject.getPrincipals().add(user);
            subject.getPrincipals().add(role);

            return true;

        } catch (Exception e) {

            throw new LoginException(e.getMessage());
        }
    }

    /**
     * This implementation ignores both state and options.
     *
     * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject,
     *      javax.security.auth.callback.CallbackHandler, java.util.Map,
     *      java.util.Map)
     */
    @Override
    public void initialize(Subject aSubject, CallbackHandler aCallbackHandler, Map aSharedState, Map aOptions) {

        handler = aCallbackHandler;
        subject = aSubject;
    }

    /**
     * This method checks whether the name and the password are the same.
     *
     * @see javax.security.auth.spi.LoginModule#login()
     */
    @Override
    public boolean login() throws LoginException {

        Callback[] callbacks = new Callback[2];
        callbacks[0] = new NameCallback(&amp;quot;login&amp;quot;);
        callbacks[1] = new PasswordCallback(&amp;quot;password&amp;quot;, true);

        try {

            handler.handle(callbacks);

            String name = ((NameCallback) callbacks[0]).getName();
            String password = String.valueOf(((PasswordCallback) callbacks[1]).getPassword());

            if (!name.equals(password)) {

                throw new LoginException(&amp;quot;Authentication failed&amp;quot;);
            }

            login = name;

            return true;

        } catch (IOException e) {

            throw new LoginException(e.getMessage());

        } catch (UnsupportedCallbackException e) {

            throw new LoginException(e.getMessage());
        }
    }

    /**
     * Clears subject from principal and credentials.
     *
     * @see javax.security.auth.spi.LoginModule#logout()
     */
    @Override
    public boolean logout() throws LoginException {

        try {

            PlainUserPrincipal user = new PlainUserPrincipal(login);
            PlainRolePrincipal role = new PlainRolePrincipal(&amp;quot;admin&amp;quot;);

            subject.getPrincipals().remove(user);
            subject.getPrincipals().remove(role);

            return true;

        } catch (Exception e) {

            throw new LoginException(e.getMessage());
        }
    }
}&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;&amp;quot;Although not specified in JAAS, you should create seperate classes to distinguish between users and roles, extending javax.security.Principal, so that Tomcat can tell which Principals returned from your login module are users and which are roles (see org.apache.catalina.realm.JAASRealm). Regardless, the first Principal returned is always treated as the user Principal. &amp;quot; 
    &lt;br /&gt;Also read the API doc &lt;a title="http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html" href="http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html"&gt;http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html&lt;/a&gt;. If authentication succeeds, your LoginModule must attach at least a user principal and a user role to subject. 

    &lt;pre class="brush:java;"&gt;package test;

import java.security.Principal;

public class PlainRolePrincipal implements Principal {

    String roleName;
    
    public PlainRolePrincipal(String name) {
        roleName = name;
    }
    public String getName() {
        return roleName;
    }
    
    public String toString() {
        return (&amp;quot;RolePrincipal: &amp;quot; + roleName);
    }   

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }   
        if (obj instanceof PlainRolePrincipal) {
            PlainRolePrincipal other = (PlainRolePrincipal) obj;
            return roleName.equals(other.roleName);
        }   
        return false;
    }   

    public int hashCode() {
        return roleName.hashCode();
    }   
}&lt;/pre&gt;
You get the idea, you can implement class &lt;em&gt;PlainUserPrincipal&lt;/em&gt; in a similar way. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&amp;quot;Place the compiled classes on Tomcat's classpath &amp;quot; 
    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&amp;quot;Set up a login.config file for Java (see &lt;a href="http://java.sun.com/j2se/1.4.1/docs/guide/security/jaas/tutorials/LoginConfigFile.html"&gt;JAAS LoginConfig file&lt;/a&gt;) and tell Tomcat where to find it by specifying its location to the JVM, for instance by setting the environment variable: JAVA_OPTS=$JAVA_OPTS -Djava.security.auth.login.config==$CATALINA_BASE/conf/jaas.config &amp;quot;

    &lt;br /&gt;Create a JAAS config file:

    &lt;br /&gt;-----------------------------

    &lt;br /&gt;

    &lt;pre&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;CertBasedCustomLogin&lt;/strong&gt;&lt;/font&gt; {
    test.CertBasedLoginModule
    sufficient;
};&lt;/pre&gt;
-----------------------------

    &lt;br /&gt;When you launch tomcat, use&amp;#160; &lt;em&gt;-Djava.security.auth.login.config=&lt;/em&gt; to specify where the config file is stored.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&amp;quot;Configure your security-constraints in your web.xml for the resources you want to protect&amp;quot; 
    &lt;br /&gt;The goal of the whole process is to protect some resources. This step specifies which resources should be protected. 

    &lt;pre class="brush:xml;"&gt;&amp;lt;security-constraint&amp;gt;
    &amp;lt;web-resource-collection&amp;gt;
        &amp;lt;web-resource-name&amp;gt;Secure Content&amp;lt;/web-resource-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/cert-protected-users/*&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/web-resource-collection&amp;gt;
    &amp;lt;auth-constraint&amp;gt;
        &amp;lt;role-name&amp;gt;AuthorizedUser&amp;lt;/role-name&amp;gt;
    &amp;lt;/auth-constraint&amp;gt;
    &amp;lt;user-data-constraint&amp;gt;
        &amp;lt;transport-guarantee&amp;gt;NONE&amp;lt;/transport-guarantee&amp;gt;
    &amp;lt;/user-data-constraint&amp;gt;
&amp;lt;/security-constraint&amp;gt;
&amp;lt;!-- ... --&amp;gt;
&amp;lt;login-config&amp;gt;
    &amp;lt;auth-method&amp;gt;CLIENT-CERT&amp;lt;/auth-method&amp;gt;
    &amp;lt;realm-name&amp;gt;The Restricted Zone&amp;lt;/realm-name&amp;gt;
&amp;lt;/login-config&amp;gt;
&amp;lt;!-- ... --&amp;gt;
&amp;lt;security-role&amp;gt;
    &amp;lt;description&amp;gt;The role required to access restricted content &amp;lt;/description&amp;gt;
    &amp;lt;role-name&amp;gt;AuthorizedUser&amp;lt;/role-name&amp;gt;
&amp;lt;/security-role&amp;gt;&lt;/pre&gt;
Basically, it says only users with role &amp;quot;AuthorizedUser&amp;quot; can access the resources &lt;em&gt;cert-protected-users/*&lt;/em&gt;. 

    &lt;br /&gt;Note:&lt;em&gt;role-name&lt;/em&gt; must match the role attached to subject in step 1) (&amp;quot;AuthorizedUser&amp;quot; in our case) for successful access. &lt;/li&gt;

  &lt;li&gt;&amp;quot;Configure the JAASRealm module in your server.xml&amp;quot; 
    &lt;br /&gt;Actually, to put web app specific context config into server.xml is not recommended. Instead, I put a file named &lt;em&gt;context.xml&lt;/em&gt; under directory &lt;em&gt;META-INF&lt;/em&gt;. 

    &lt;pre class="brush:java;"&gt;&amp;lt;Context&amp;gt;
    &amp;lt;Realm className=&amp;quot;org.apache.catalina.realm.JAASRealm&amp;quot; appName=&amp;quot;CertBasedCustomLogin&amp;quot;
        userClassNames=&amp;quot;test.PlainUserPrincipal&amp;quot;
        roleClassNames=&amp;quot;test.PlainRolePrincipal&amp;quot;&amp;gt;
    &amp;lt;/Realm&amp;gt;
&amp;lt;/Context&amp;gt;&lt;/pre&gt;
The value of &lt;em&gt;appName&lt;/em&gt; must match the name specified in step 4. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Add &amp;quot;&lt;em&gt;-Dsun.security.ssl.allowUnsafeRenegotiation=true&lt;/em&gt;&amp;quot; for renegotiation support. (Read &lt;a title="http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html" href="http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html"&gt;http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html&lt;/a&gt; for more information)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Note&lt;/h3&gt;

&lt;p&gt;Some versions of Tomcat have problems to support JAASRealm + SSL mutual auth (&lt;a title="https://issues.apache.org/bugzilla/show_bug.cgi?id=45576" href="https://issues.apache.org/bugzilla/show_bug.cgi?id=45576"&gt;https://issues.apache.org/bugzilla/show_bug.cgi?id=45576&lt;/a&gt;).&amp;#160; I tried 6.0.18, 6.0.20 and 6.0.29. Only 6.0.20 works for me. 6.0.29 gave errors when I tried. &lt;/p&gt;

&lt;h3&gt;More resources:&lt;/h3&gt;

&lt;p&gt;&lt;a title="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm" href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm"&gt;http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JAASRealm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html" href="http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html"&gt;http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/JAASRealm.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://wiki.metawerx.net/wiki/Web.xml.AuthConstraint" href="http://wiki.metawerx.net/wiki/Web.xml.AuthConstraint"&gt;http://wiki.metawerx.net/wiki/Web.xml.AuthConstraint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="https://issues.apache.org/bugzilla/show_bug.cgi?id=45576" href="https://issues.apache.org/bugzilla/show_bug.cgi?id=45576"&gt;https://issues.apache.org/bugzilla/show_bug.cgi?id=45576&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html" href="http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html"&gt;http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8327449140968588236?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8327449140968588236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8327449140968588236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8327449140968588236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8327449140968588236'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/jaasrealm.html' title='JAASRealm + SSL'/><author><name>Gerald Guo</name><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-36974671.post-6208415890383983232</id><published>2010-10-25T14:59:00.001-04:00</published><updated>2010-10-25T14:59:56.048-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>web.xml schema (simplified)</title><content type='html'>&lt;pre class="brush:xml;"&gt;  &amp;lt;xsd:complexType name=&amp;quot;web-appType&amp;quot;&amp;gt;

    &amp;lt;xsd:choice minOccurs=&amp;quot;0&amp;quot; maxOccurs=&amp;quot;unbounded&amp;quot;&amp;gt;
      &amp;lt;xsd:group ref=&amp;quot;j2ee:descriptionGroup&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;distributable&amp;quot; type=&amp;quot;j2ee:emptyType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;context-param&amp;quot; type=&amp;quot;j2ee:param-valueType&amp;quot;&amp;gt;
        &amp;lt;xsd:annotation&amp;gt;
          &amp;lt;xsd:documentation&amp;gt; 
            The context-param element contains the declaration
            of a web application's servlet context
            initialization parameters.  
          &amp;lt;/xsd:documentation&amp;gt;
        &amp;lt;/xsd:annotation&amp;gt;
      &amp;lt;/xsd:element&amp;gt;

      &amp;lt;xsd:element name=&amp;quot;filter&amp;quot; type=&amp;quot;j2ee:filterType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;filter-mapping&amp;quot; type=&amp;quot;j2ee:filter-mappingType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;listener&amp;quot; type=&amp;quot;j2ee:listenerType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;servlet&amp;quot; type=&amp;quot;j2ee:servletType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;servlet-mapping&amp;quot; type=&amp;quot;j2ee:servlet-mappingType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;session-config&amp;quot; type=&amp;quot;j2ee:session-configType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;mime-mapping&amp;quot; type=&amp;quot;j2ee:mime-mappingType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;welcome-file-list&amp;quot; type=&amp;quot;j2ee:welcome-file-listType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;error-page&amp;quot; type=&amp;quot;j2ee:error-pageType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;jsp-config&amp;quot; type=&amp;quot;j2ee:jsp-configType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;security-constraint&amp;quot; type=&amp;quot;j2ee:security-constraintType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;login-config&amp;quot; type=&amp;quot;j2ee:login-configType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;security-role&amp;quot; type=&amp;quot;j2ee:security-roleType&amp;quot;/&amp;gt;
      &amp;lt;xsd:group ref=&amp;quot;j2ee:jndiEnvironmentRefsGroup&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;message-destination&amp;quot; type=&amp;quot;j2ee:message-destinationType&amp;quot;/&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;locale-encoding-mapping-list&amp;quot; type=&amp;quot;j2ee:locale-encoding-mapping-listType&amp;quot;/&amp;gt;
    &amp;lt;/xsd:choice&amp;gt;

    &amp;lt;xsd:attribute name=&amp;quot;version&amp;quot; type=&amp;quot;j2ee:web-app-versionType&amp;quot; use=&amp;quot;required&amp;quot;/&amp;gt;
    &amp;lt;xsd:attribute name=&amp;quot;id&amp;quot; type=&amp;quot;xsd:ID&amp;quot;/&amp;gt;
  &amp;lt;/xsd:complexType&amp;gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6208415890383983232?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6208415890383983232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6208415890383983232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6208415890383983232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6208415890383983232'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/webxml-schema-simplified.html' title='web.xml schema (simplified)'/><author><name>Gerald Guo</name><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-36974671.post-8946917511675937075</id><published>2010-10-22T23:05:00.000-04:00</published><updated>2010-11-25T15:14:55.378-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Apache SSL + SVN notes</title><content type='html'>&lt;p&gt;Recently I started to use Apache http server again. I am trying to build a SVN repository which can be accessed through HTTPS.&lt;/p&gt;  &lt;h2&gt;Environment&lt;/h2&gt;  &lt;p&gt;Ubuntu    &lt;br /&gt;Apache 2.2.17 source&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Doc&lt;/strong&gt;: &lt;a title="http://httpd.apache.org/docs/2.2/" href="http://httpd.apache.org/docs/2.2/"&gt;http://httpd.apache.org/docs/2.2/&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Build&lt;/h2&gt;  &lt;p&gt;&amp;#160; ./configure --prefix=/home/gerald/servers/httpd-2.2.17 --enable-ssl --enable-dav --enable-so    &lt;br /&gt;&amp;#160; make     &lt;br /&gt;&amp;#160; make install&lt;/p&gt;  &lt;p&gt;add &lt;em&gt;bin&lt;/em&gt; directory to your PATH&lt;/p&gt; add man pages:   &lt;pre&gt;function addManPath() { 
    if (($# != 1)); then return 0; fi

    path=&amp;quot;$1&amp;quot; 
    if [ &amp;quot;x$MANPATH&amp;quot; == &amp;quot;x&amp;quot; ]; then 
        export MANPATH=&amp;quot;$(manpath):$path&amp;quot; 
    else 
        export MANPATH=&amp;quot;${MANPATH}:$path&amp;quot; 
    fi  
}

addManPath &amp;quot;~/servers/httpd-2.2.17/bin/man&amp;quot;&lt;/pre&gt;

&lt;p&gt;start up apache server: apachectl start&lt;/p&gt;

&lt;p&gt;benchmarking: ab -n 10000 -c 100 &lt;a href="http://localhost:80/"&gt;http://localhost:80/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Show modules: 
  &lt;br /&gt;&amp;#160; httpd -M&amp;#160; //show all loaded modules 

  &lt;br /&gt;&amp;#160; httpd -S&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // show parsed virtual host settings 

  &lt;br /&gt;&amp;#160; httpd -l&amp;#160;&amp;#160;&amp;#160; //listed compiled in modules 

  &lt;br /&gt;&amp;#160; httpd -L&amp;#160;&amp;#160; //list available configuration directives 

  &lt;br /&gt;&amp;#160; httpd -V&amp;#160; //show compile settings (not settings for compiling the whole package, the settings for compiling the server - httpd).&lt;/p&gt;

&lt;h2&gt;Configure SSL&lt;/h2&gt;

&lt;p&gt;Prepare your certificate and private key. 
  &lt;br /&gt;Uncomment line &amp;quot;Include conf/extra/httpd-ssl.conf&amp;quot; in httpd.conf. 

  &lt;br /&gt;Change file &amp;quot;conf/extra/httpd-ssl.conf&amp;quot;. The most important directives are &lt;em&gt;SSLCertificateFile &lt;/em&gt;and &lt;em&gt;SSLCertificateKeyFile&lt;/em&gt;. 

  &lt;br /&gt;Test whether you can access your website through HTTPS.&lt;/p&gt;

&lt;h2&gt;SSL + SVN&lt;/h2&gt;

&lt;h3&gt;Get modules dav_svn and authz_svn&lt;/h3&gt;

&lt;p&gt;wget &lt;a href="http://altruistic.lbl.gov/mirrors/ubuntu/pool/universe/s/subversion/libapache2-svn_1.6.5dfsg-1ubuntu1_i386.deb"&gt;http://altruistic.lbl.gov/mirrors/ubuntu/pool/universe/s/subversion/libapache2-svn_1.6.5dfsg-1ubuntu1_i386.deb&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;dpkg-deb -x libapache2-svn_1.6.5dfsg-1ubuntu1_i386.deb&lt;/p&gt;

&lt;p&gt;copy two module (.so files) to apache &lt;em&gt;modules&lt;/em&gt; directory.&lt;/p&gt;

&lt;h3&gt;Configure modules&lt;/h3&gt;

&lt;p&gt;Edit file &lt;em&gt;&amp;lt;Apache&amp;gt;/conf/extra/dav_svn.load&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&amp;#160;&amp;#160; LoadModule dav_svn_module modules/mod_dav_svn.so 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; LoadModule authz_svn_module modules/mod_authz_svn.so&lt;/p&gt;

&lt;p&gt;Edit file &lt;em&gt;&amp;lt;Apache&amp;gt;/conf/extra/httpd.conf&lt;/em&gt;, add following two lines&lt;/p&gt;

&lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Include conf/extra/dav_svn.load 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Include conf/extra/dav_svn.conf&lt;/p&gt;

&lt;p&gt;Edit file &amp;lt;Apache&amp;gt;/conf/extra/dav_svn.conf&lt;/p&gt;

&lt;pre class="brush:xml;"&gt;&amp;lt;Location /svn/&amp;gt; &amp;lt;!-- trailing / is necessary!! --&amp;gt;
  DAV svn
  &lt;br /&gt;  SSLRequireSSL  # enforce use of HTTPS
  #SVNPath /var/lib/svn
  SVNParentPath /home/svn/projects
  SVNListParentPath on 
  
  AuthType Basic
  AuthName &amp;quot;Subversion Repository&amp;quot;
  AuthUserFile Apache_Dir/conf/dav_svn.passwd

  # To enable authorization via mod_authz_svn
  AuthzSVNAccessFile Apache_Dir/conf/dav_svn.authz

  Require valid-user
&amp;lt;/Location&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;a title="http://stackoverflow.com/questions/488778/how-do-i-list-all-repositories-with-the-svnparentpath-directive-on-apachesvn" href="http://stackoverflow.com/questions/488778/how-do-i-list-all-repositories-with-the-svnparentpath-directive-on-apachesvn"&gt;http://stackoverflow.com/questions/488778/how-do-i-list-all-repositories-with-the-svnparentpath-directive-on-apachesvn&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Create authentication and authorization files&lt;/h3&gt;

&lt;p&gt;Create password file: &lt;code&gt;htpassword -cm &amp;lt;Apache&amp;gt;/conf/dav_svn.passwd gerald&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Edit file &amp;lt;Apache&amp;gt;/conf/dav_svn.authz&lt;/p&gt;

&lt;pre&gt;[groups]
admin=gerald
guests=guest

[/]
@admin=rw

[repository_name:/directory]
@admin=rw&lt;/pre&gt;

&lt;h2&gt;Test&lt;/h2&gt;

&lt;p&gt;Restart Apache httpd server. &lt;script type="text/javascript"&gt;
SyntaxHighlighter.config.bloggerMode = true;
&lt;/script&gt;

  &lt;br /&gt;Go to &lt;a title="https://wave1.zhenhua.info/svn/" href="https://your_ip/svn/"&gt;https://your_ip/svn/&lt;/a&gt; (note: the trailing / is necessary!)&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Permission Problem&lt;/h2&gt;

&lt;p&gt;If you see following error when you try to commit some code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;svn: Commit failed (details follow): 
    &lt;br /&gt;svn: Can't open file '/path/to/your/repo/db/txn-current-lock': Permission denied&lt;/p&gt;
&lt;/blockquote&gt;
follow these steps: 

&lt;ol&gt;
  &lt;li&gt;Execute command: &lt;em&gt;ps -wwf $(pgrep httpd)&lt;/em&gt; 

    &lt;br /&gt;You should say one of the processes is run as &lt;em&gt;root&lt;/em&gt;. All other processes are run as &lt;em&gt;daemon&lt;/em&gt; (in my case). &lt;/li&gt;

  &lt;li&gt;To make httpd able to access(read/write) your svn repository, you should set the file permissions of svn repository correctly. 
    &lt;br /&gt;&lt;em&gt;chown -R gerald:daemon /path/to/svn/repo 
      &lt;br /&gt;chmod -R 770 /path/to/svn/repo&lt;/em&gt; &lt;/li&gt;
&lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8946917511675937075?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8946917511675937075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8946917511675937075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8946917511675937075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8946917511675937075'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/apache-ssl-svn-notes.html' title='Apache SSL + SVN notes'/><author><name>Gerald Guo</name><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-36974671.post-5742946050030062671</id><published>2010-10-15T14:31:00.000-04:00</published><updated>2010-10-15T14:32:25.077-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Replace token using ant in Maven 2</title><content type='html'>&lt;pre class="brush:xml;"&gt;&amp;lt;plugin&amp;gt;
    &amp;lt;artifactid&amp;gt;maven-antrun-plugin&amp;lt;/artifactid&amp;gt;
    &amp;lt;executions&amp;gt;
      &amp;lt;execution&amp;gt;
        &amp;lt;id&amp;gt;Copy and filter af file&amp;lt;/id&amp;gt;
        &amp;lt;goals&amp;gt;&amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;&amp;lt;/goals&amp;gt;
        &amp;lt;phase&amp;gt;prepare-package&amp;lt;/phase&amp;gt;
        &amp;lt;configuration&amp;gt;
          &amp;lt;tasks&amp;gt; 
            &amp;lt;copy file=&amp;quot;source_file&amp;quot; filtering=&amp;quot;true&amp;quot; failonerror=&amp;quot;true&amp;quot; overwrite=&amp;quot;true&amp;quot; tofile=&amp;quot;dest_file&amp;quot;&amp;gt;
              &amp;lt;filterset&amp;gt;
                &amp;lt;filter value=&amp;quot;${variable_name}&amp;quot; token=&amp;quot;token_to_be_replaced&amp;quot; /&amp;gt;
                &amp;lt;filter value=&amp;quot;value&amp;quot; token=&amp;quot;token_to_be_replaced&amp;quot; /&amp;gt;
               &amp;lt;/filterset&amp;gt;
            &amp;lt;/copy&amp;gt;
          &amp;lt;/tasks&amp;gt;
        &amp;lt;/configuration&amp;gt;
      &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5742946050030062671?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5742946050030062671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5742946050030062671' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5742946050030062671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5742946050030062671'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/10/replace-token-using-ant-in-maven-2.html' title='Replace token using ant in Maven 2'/><author><name>Gerald Guo</name><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-36974671.post-6481639692329081170</id><published>2010-09-15T13:16:00.001-04:00</published><updated>2010-09-15T13:16:29.971-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>XAuth!</title><content type='html'>&lt;p&gt;Meebo and some other supporters just released XAuth. The video on page &lt;a title="http://xauth.org/info/" href="http://xauth.org/info/"&gt;http://xauth.org/info/&lt;/a&gt; is really informative. XAuth provides front-end solution for registration of various web service sessions. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If you are authenticated to a service, the service puts a registry entry into XAuth local storage.&lt;/li&gt;    &lt;li&gt;Other mashup apps/publisher websites can ask XAuth for a list of web services that the user has been authenticated to. Then the app can adjust UI according to the retrieved data.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In current reference implementation, it requires HTML5 features – postMessage and local storage.&lt;/p&gt;  &lt;p&gt;Javascript code: &lt;a title="http://github.com/xauth/xauth" href="http://github.com/xauth/xauth"&gt;http://github.com/xauth/xauth&lt;/a&gt;    &lt;br /&gt;Official web site: &lt;a title="http://xauth.org/" href="http://xauth.org/"&gt;http://xauth.org/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6481639692329081170?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6481639692329081170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6481639692329081170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6481639692329081170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6481639692329081170'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/09/xauth.html' title='XAuth!'/><author><name>Gerald Guo</name><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-36974671.post-1366896568560863209</id><published>2010-09-12T21:42:00.001-04:00</published><updated>2010-09-12T21:42:31.401-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='systems'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Numbers Everyone Should Know</title><content type='html'>&lt;p&gt;LADIS2009 keynote slides: &lt;a href="http://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf"&gt;http://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Following numbers are excerpted from the above slides.&lt;/p&gt;  &lt;table style="border-collapse: collapse" border="0" cellspacing="0" cellpadding="0" width="409"&gt;&lt;colgroup&gt;&lt;col style="width: 196pt; mso-width-source: userset; mso-width-alt: 9545" width="261" /&gt;&lt;col style="width: 88pt; mso-width-source: userset; mso-width-alt: 4278" width="117" /&gt;&lt;/colgroup&gt;&lt;tbody&gt;     &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;L1 cache reference&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;0.5 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Branch mispredict&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;5 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;L2 cache reference&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;7 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Mutex lock/unlock&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;25 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Main memory reference&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;100 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Compress 1K bytes with Zippy&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;3,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Send 2K bytes over 1 Gbps network&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;20,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Read 1 MB sequentially from memory&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;250,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Round trip within same datacenter&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;500,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Disk seek&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;10,000,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="height: 15pt" height="20" width="281"&gt;Read 1 MB sequentially from disk&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;        &lt;td width="126"&gt;20,000,000 ns&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1366896568560863209?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1366896568560863209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1366896568560863209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1366896568560863209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1366896568560863209'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/09/numbers-everyone-should-know.html' title='Numbers Everyone Should Know'/><author><name>Gerald Guo</name><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-36974671.post-3363669054102462870</id><published>2010-06-26T01:20:00.001-04:00</published><updated>2010-06-26T01:20:32.692-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Clear memory cache in Linux</title><content type='html'>&lt;p&gt;Read this article&lt;/p&gt;  &lt;p&gt;&lt;a title="http://linux-mm.org/Drop_Caches" href="http://linux-mm.org/Drop_Caches"&gt;http://linux-mm.org/Drop_Caches&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Basically, run commands    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; sync     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; sudo echo 3 &amp;gt; /proc/sys/vm/drop_caches&lt;/p&gt;  &lt;p&gt;If you want to control &amp;quot;swappiness&amp;quot; (to what extent apps are swapped), read following posts:   &lt;br /&gt;&lt;a title="http://kerneltrap.org/node/3000" href="http://kerneltrap.org/node/3000"&gt;http://kerneltrap.org/node/3000&lt;/a&gt;    &lt;br /&gt;&lt;a title="http://lwn.net/Articles/92892/" href="http://lwn.net/Articles/92892/"&gt;http://lwn.net/Articles/92892/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Basic command: sudo echo 0-100 &amp;gt; /proc/sys/vm/swappiness&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3363669054102462870?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3363669054102462870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3363669054102462870' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3363669054102462870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3363669054102462870'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/06/clear-memory-cache-in-linux.html' title='Clear memory cache in Linux'/><author><name>Gerald Guo</name><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-36974671.post-6692364740697008987</id><published>2010-06-06T16:24:00.001-04:00</published><updated>2010-06-06T16:54:01.118-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='systems'/><title type='text'>Steve Huffman talks about lessons learned at Reddit</title><content type='html'>&lt;p&gt;Very interesting talk. Helpful to those who want to build scalable distributed systems. &lt;/p&gt;  &lt;p&gt;Video: &lt;a title="http://vimeo.com/10506751" href="http://vimeo.com/10506751"&gt;http://vimeo.com/10506751&lt;/a&gt;    &lt;br /&gt;Transcript is here: &lt;a title="http://carsonified.com/blog/dev/steve-huffman-on-lessons-learned-at-reddit/" href="http://carsonified.com/blog/dev/steve-huffman-on-lessons-learned-at-reddit/"&gt;http://carsonified.com/blog/dev/steve-huffman-on-lessons-learned-at-reddit/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One interesting lesson is lesson 3: open schema.   &lt;br /&gt;They combined relational data model and key-value store. Relational data model is powerful (in some sense) and can naturally represent real-world data models. However, as data set size grows, it seems that relational databases cannot scale up easily. As a result, many large companies develop their own storage systems - Amazon's Dynamo, Google's BigTable, Cassandra, etc. Some use key-value model which seems to be able to scale better than relational model. To change schema does NOT incur much overhead. Different rows/entities can have different number of columns/attributes. &lt;/p&gt;  &lt;p&gt;Another post on caching in web app: &lt;a title="http://www.mysqlperformanceblog.com/2010/05/19/beyond-great-cache-hit-ratio/" href="http://www.mysqlperformanceblog.com/2010/05/19/beyond-great-cache-hit-ratio/"&gt;http://www.mysqlperformanceblog.com/2010/05/19/beyond-great-cache-hit-ratio/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6692364740697008987?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6692364740697008987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6692364740697008987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6692364740697008987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6692364740697008987'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/06/steve-huffman-talks-about-lessons.html' title='Steve Huffman talks about lessons learned at Reddit'/><author><name>Gerald Guo</name><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-36974671.post-6018311656213771629</id><published>2010-03-27T00:56:00.000-04:00</published><updated>2010-03-27T00:57:06.396-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Create a file of a given size on linux</title><content type='html'>&lt;p&gt;Let's say you want to create a file whose size is 1K. You can achieve that by using either of following two commands:&lt;/p&gt;  &lt;pre&gt;    dd if=/dev/zero of=file bs=1024 count=1

    dd of=file bs=1024 count=0 seek=1&lt;/pre&gt;

&lt;p&gt;In my test, the generated files are different. The second command generates a file with holes. You can try command &lt;em&gt;stat file. &lt;/em&gt;The output in my machine is:&lt;/p&gt;

&lt;pre&gt;  File: `bigfile'
  Size: 1024            &lt;strong&gt;&lt;font color="#ff0000"&gt;Blocks: 0&lt;/font&gt;&lt;/strong&gt;          IO Block: 4096   regular file&lt;/pre&gt;

&lt;p&gt;The number of allocated blocks is 0 although size of the file is 1024. 
  &lt;br /&gt;Note: if sparse file is not supported, it &lt;strong&gt;may&lt;/strong&gt; write 1024K zeros to the file.&lt;/p&gt;

&lt;p&gt;As a user, you don't need to worry about whether the file is sparse or not. It will grow as needed.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6018311656213771629?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6018311656213771629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6018311656213771629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6018311656213771629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6018311656213771629'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/03/create-file-of-given-size-on-linux.html' title='Create a file of a given size on linux'/><author><name>Gerald Guo</name><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-36974671.post-746410329299099862</id><published>2010-03-25T03:42:00.000-04:00</published><updated>2010-03-25T03:43:09.162-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu package downgrade</title><content type='html'>&lt;p&gt;I tried to use some Karmic sources for my Intrepid. Of course, this is bad. The reason I had to do it was the package of new version I needed only exist in Karmic repository.    &lt;br /&gt;After installing a package, suddenly I got the following error when I tried to use gvim     &lt;br /&gt;&lt;strong&gt;&amp;quot;gvim: error while loading shared library: libgailutil.so.18: cannot open shared object file: No such file or directory&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Obviously, the old libgail18 was removed which is needed by Intrepid. Because I used unmatched sources, the apt-get did not detect any problem. &lt;/p&gt;  &lt;p&gt;I tried to install libgail18 using command    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;sudo apt-get install libgail18&lt;/strong&gt;     &lt;br /&gt;It did not work and the error message is &lt;/p&gt;  &lt;pre&gt;Package libgail18 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libgtk2.0-0
E: Package libgail18 has no installation candidate&lt;/pre&gt;

&lt;p&gt;Finally, I figured out the cause is package &lt;em&gt;libgtk2.0-0, libgtk2.0-0-common, etc&lt;/em&gt;. These packages are too new for Intrepid. They are for Karmic. So I tried to remove these packages using command 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;sudo apt-get remove libgtk2.0-0 libgtk2.0-0-common etc&lt;/strong&gt; 

  &lt;br /&gt;However, apt-get always gave error messages which told me those packages were needed by lots of other packages. It is obviously true. Also I tried command 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;sudo apt-get install --reinstall libgtk2.0-0&lt;/strong&gt; 

  &lt;br /&gt;It also did not work. The error message is the package cannot be found. Again the cause I think was the those installed packages were too new and did not match version of ubuntu. 

  &lt;br /&gt;

  &lt;br /&gt;It turned out that I need to use dpkg command 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;dpkg --remove –-depends libgtk2.0-0 libgtk2.0-0-common etc&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then use following command to fix the broken dependencies: 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;sudo apt-get install –f&lt;/strong&gt; 

  &lt;br /&gt;libgtk2.0-0, libgtk2.0-0-common of correct versions are downloaded and installed.&lt;/p&gt;

&lt;p&gt;Probably following commands are needed to clean up: 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; sudo dpkg --configure –a 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; dpkg-reconfigure&lt;/p&gt;

&lt;p&gt;One big difficult I encountered was it was hard to collect detailed log about which files are created/updated/removed by which package during installation. It makes much easier to locate those packages which remove needed files.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-746410329299099862?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/746410329299099862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=746410329299099862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/746410329299099862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/746410329299099862'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/03/ubuntu-package-downgrade.html' title='Ubuntu package downgrade'/><author><name>Gerald Guo</name><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-36974671.post-55558406198370868</id><published>2010-03-25T03:12:00.001-04:00</published><updated>2010-03-25T03:12:56.006-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>SSH, XAuth and X11 Forward after user switch at remote site</title><content type='html'>&lt;h2&gt;Problem&lt;/h2&gt;  &lt;p&gt;User A connects to server S using ssh. X11 forward is enabled using –Y option. Then X11 should work smoothly.    &lt;br /&gt;User A connects to server S using ssh. X11 forward is enabled. Then user A switches to another User B (using command &lt;em&gt;su B&lt;/em&gt; or &lt;em&gt;ssh localhost –l B&lt;/em&gt;). After that, X11 forward won't work. The error should look like     &lt;br /&gt;&amp;quot;SSH gateway: X11 authentication failed. Error: Can't open display:&amp;quot; or     &lt;br /&gt;&amp;quot;Error: Can't open display:&amp;quot;.     &lt;br /&gt;Readers may ask why user A does not directly connect to server S as user B given user A knows password of user B. The reason is that sometimes user B is a restricted user account so that he cannot log in remotely. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Run command      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; echo ${DISPLAY}       &lt;br /&gt;Sample result:       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; localhost:11.0 &lt;/li&gt;    &lt;li&gt;Command: xauth list      &lt;br /&gt;The output should be like:&amp;#160;&amp;#160;&amp;#160; &lt;pre&gt;your_host_name/unix:11  MIT-MAGIC-COOKIE-1  d1e63de6fd7bc3800d868c3b64ca4531
your_host_name/unix:0  MIT-MAGIC-COOKIE-1  e044d47b672dcade1362cd632236f919
your_host_name/unix:10  MIT-MAGIC-COOKIE-1  2aa3bc47d1c209fd06577f4b45f83383&lt;/pre&gt;
Pick the entry with the same display number as the output in step 1) 

    &lt;br /&gt;In this example, display number is 11, so the entry we pick is 

    &lt;pre&gt;your_host_name/unix:11  MIT-MAGIC-COOKIE-1  d1e63de6fd7bc3800d868c3b64ca4531&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;switch to another user using either of the following ways 
    &lt;br /&gt;1) su user_name 

    &lt;br /&gt;or su – user_name 

    &lt;br /&gt;read &amp;quot;man su&amp;quot; for difference between these two commands. 

    &lt;br /&gt;2) ssh localhost –l user_name &lt;/li&gt;

  &lt;li&gt;In step 3), if you ran command &amp;quot;su – user_name&amp;quot; or &amp;quot;ssh localhost –l user_name&amp;quot;, you should run command 
    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; export DISPLAY=localhost:11.0 

    &lt;br /&gt;Value of DISPLAY should be the same as the output in step 1). 

    &lt;br /&gt;

    &lt;br /&gt;add the entry obtained in step 2) to the .Xauthority file. You can either add it manually to the file or use tool &lt;em&gt;xauth&lt;/em&gt; to do it. The way to use xauth to add an entry: 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xauth add :11 . d1e63de6fd7bc3800d868c3b64ca4531 

    &lt;br /&gt;The cookie string (long string) must match the one in step 2). The display number (:11) must match the result in step 1) &lt;/li&gt;

  &lt;li&gt;Try command 
    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xclock &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Or you can combine step 1), 2), 3) and 4) into one long command:&lt;/p&gt;

&lt;p&gt;&amp;#160;&amp;#160;&amp;#160; (tmpfile=/tmp/xauth_tmp_entry; \ 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xauth extract ${tmpfile} :$(echo $DISPLAY|cut -d : -f 2 ); \ 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; chmod a+r ${tmpfile}; \ 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; su user_name -c &amp;quot;xauth merge ${tmpfile}&amp;quot;; \ 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; rm ${tmpfile} )&lt;/p&gt;

&lt;p&gt;Note: replace &lt;em&gt;user_name&lt;/em&gt; with the real target user name.&lt;/p&gt;

&lt;h2&gt;Disadvantage&lt;/h2&gt;

&lt;p&gt;Each time the user reconnects the remote machine using ssh, the whole process described above must be redone :-( The reason is that sshd may choose another display number and cookie value. &lt;/p&gt;

&lt;h2&gt;How SSH X authorization works?&lt;/h2&gt;

&lt;p&gt;From ssh manual:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&amp;quot;ssh will also automatically set up Xauthority data on the server machine.&amp;#160; For this purpose, it 
    &lt;br /&gt;will generate a random authorization cookie, store it in Xauthority on the server, and verify 

    &lt;br /&gt;that any forwarded connections carry this cookie and replace it by the real cookie when the 

    &lt;br /&gt;connection is opened.&amp;#160; The real authentication cookie is never sent to the server machine (and 

    &lt;br /&gt;no cookies are sent in the plain).&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a title="http://blogs.gnome.org/markmc/2005/02/25/ssh-x-forwarding-and-xauth/" href="http://blogs.gnome.org/markmc/2005/02/25/ssh-x-forwarding-and-xauth/"&gt;http://blogs.gnome.org/markmc/2005/02/25/ssh-x-forwarding-and-xauth/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every time a user connects to a remote server using ssh, a proxy X server is created. And that X server is used by the sshd process (a new process is forked each time a new connection comes in). The process is like:&lt;/p&gt;

&lt;pre&gt;  user ---&amp;gt; server ---&amp;gt; fork a new process, &lt;br /&gt;                        create a proxy X server&lt;br /&gt;                        create pseudo terminal, etc.
                                       |&lt;/pre&gt;

&lt;pre&gt;                                       |&lt;/pre&gt;

&lt;pre&gt;                                       V&lt;/pre&gt;

&lt;pre&gt;                        a program that needs X is used&lt;/pre&gt;

&lt;pre&gt;                                       |&lt;/pre&gt;

&lt;pre&gt;                                       |&lt;/pre&gt;

&lt;pre&gt;                                       V&lt;/pre&gt;

&lt;pre&gt;  local display &amp;lt;--- verify &amp;lt;--- the X output is forwarded by sshd to client&lt;/pre&gt;

&lt;p&gt;It seems that after a user connects to a remote server using ssh, another proxy X server is not created when the user ssh to localhost or 127.0.0.1.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-55558406198370868?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/55558406198370868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=55558406198370868' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/55558406198370868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/55558406198370868'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/03/ssh-xauth-and-x11-forward-after-user.html' title='SSH, XAuth and X11 Forward after user switch at remote site'/><author><name>Gerald Guo</name><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-36974671.post-2963607286615508276</id><published>2010-02-21T20:05:00.001-05:00</published><updated>2010-02-21T20:05:40.393-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android Development Tips</title><content type='html'>&lt;h2&gt;Logging&lt;/h2&gt;  &lt;p&gt;&lt;a title="http://groups.google.com/group/android-ndk/browse_thread/thread/d6c5e8f25f1ee543" href="http://groups.google.com/group/android-ndk/browse_thread/thread/d6c5e8f25f1ee543"&gt;http://groups.google.com/group/android-ndk/browse_thread/thread/d6c5e8f25f1ee543&lt;/a&gt;&lt;/p&gt;  &lt;pre class="brush:c"&gt;#include &amp;lt;android/log.h&amp;gt; 
__android_log_print(ANDROID_LOG_INFO, &amp;quot;your_tag&amp;quot;, &amp;quot;fmt string&amp;quot;, parameter1, parameter2);&lt;/pre&gt;

&lt;p&gt;Then you will see it in logcat output.&lt;/p&gt;

&lt;p&gt;Read file &lt;code&gt;build/platforms/android-1.5/common/include/android/log.h&lt;/code&gt; in ndk for more info.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2963607286615508276?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2963607286615508276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2963607286615508276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2963607286615508276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2963607286615508276'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/02/android-development-tips.html' title='Android Development Tips'/><author><name>Gerald Guo</name><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-36974671.post-4719358983990926204</id><published>2010-02-21T19:57:00.000-05:00</published><updated>2010-02-21T20:00:05.801-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Syntax Highlighter syntax conversion</title><content type='html'>&lt;p&gt;&lt;a title="http://alexgorbatchev.com/wiki/SyntaxHighlighter" href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;http://alexgorbatchev.com/wiki/SyntaxHighlighter&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I found that usage pattern was changed in recent releases.&lt;/p&gt;  &lt;p&gt;Original sample usage:&lt;/p&gt;  &lt;pre class="brush:html"&gt;&amp;lt;pre class=&amp;quot;java:nocontrols&amp;quot; name=&amp;quot;code&amp;quot;&amp;gt;
    your code
&amp;lt;/pre&amp;gt;&lt;/pre&gt;

&lt;p&gt;New sample usage: &lt;/p&gt;

&lt;pre class="brush:html"&gt;&amp;lt;pre class=&amp;quot;brush:java&amp;quot;&amp;gt;
    your code
&amp;lt;/pre&amp;gt;&lt;/pre&gt;

&lt;br /&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Change your posts to use new version of Syntax Highlighter:&lt;/p&gt;

&lt;p&gt;Invoke following command in vim: 
  &lt;br /&gt;&lt;code&gt;%s/&amp;lt;pre \(.*\)class=&amp;quot;\(\w\+\)*\(:\w\+\)*&amp;quot; \(.*\)&amp;gt;/&amp;lt;pre class=&amp;quot;brush:\2&amp;quot; \1 \4&amp;gt;/g&lt;/code&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4719358983990926204?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4719358983990926204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4719358983990926204' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4719358983990926204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4719358983990926204'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/02/syntax-highlighter-syntax-conversion.html' title='Syntax Highlighter syntax conversion'/><author><name>Gerald Guo</name><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-36974671.post-3607376858663663906</id><published>2010-02-21T19:55:00.000-05:00</published><updated>2010-02-21T19:56:34.309-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google Blogger/Blogspot line break conversion</title><content type='html'>&lt;h2&gt;Google Blogger/Blogspot new line conversion&lt;/h2&gt;  &lt;p&gt;Google blogger/blogspot provides an option to let users decide whether hard-returns in the post are converted to &amp;lt;br/&amp;gt;&lt;/p&gt;  &lt;p&gt;Set it by clicking:    &lt;br /&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; Your blog admin page –&amp;gt; Settings -&amp;gt; Formatting -&amp;gt; Convert line breaks &lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Originally, I set it to &amp;quot;&lt;em&gt;yes&lt;/em&gt;&amp;quot;. Latter I decided to manually insert &lt;em&gt;&amp;lt;br/&amp;gt;&lt;/em&gt; instead of using automatical hard-return conversion. So I set the option to &amp;quot;&lt;em&gt;no&lt;/em&gt;&amp;quot;. As a result, my previous posts were messed up because different lines were concatenated into a single line.&lt;/p&gt;  &lt;p&gt;I used vim to convert those posts to new format.&lt;/p&gt;  &lt;p&gt;Append &amp;lt;br/&amp;gt; to each line    &lt;br /&gt;&lt;code&gt;&amp;#160;&amp;#160;&amp;#160; %s/$/&amp;lt;br\/&amp;gt;/g &lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Sometimes, you don't want to append new lines to block-level elements such as &lt;code&gt;div&lt;/code&gt;, &lt;code&gt;ol&lt;/code&gt;.     &lt;br /&gt;Use following vim commands: &lt;/p&gt;  &lt;pre&gt;    %s/\(&amp;lt;\/div&amp;gt;\s*\)\@&amp;lt;!$/&amp;lt;br\/&amp;gt;/g 
    %s/\(&amp;lt;\/ul&amp;gt;\s*\)\@&amp;lt;!$/&amp;lt;br\/&amp;gt;/g 
    %s/\(&amp;lt;\/ol&amp;gt;\s*\)\@&amp;lt;!$/&amp;lt;br\/&amp;gt;/g 
    %s/\(&amp;lt;\/dl&amp;gt;\s*\)\@&amp;lt;!$/&amp;lt;br\/&amp;gt;/g
    ......&lt;/pre&gt;

&lt;p&gt;Vim regular expression: &lt;a title="http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern-overview" href="http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern-overview"&gt;http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern-overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another option is to write a script to download posts, adjust returns/newlines, and publish them.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3607376858663663906?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3607376858663663906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3607376858663663906' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3607376858663663906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3607376858663663906'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/02/google-bloggerblogspot-line-break.html' title='Google Blogger/Blogspot line break conversion'/><author><name>Gerald Guo</name><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-36974671.post-8762861817873254480</id><published>2010-01-11T02:29:00.002-05:00</published><updated>2010-01-11T02:31:10.203-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cloundcomputing'/><category scheme='http://www.blogger.com/atom/ns#' term='eucalyptus'/><title type='text'>Eucalyptus Code Reading</title><content type='html'>&lt;div&gt;&lt;br&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;font size="5"&gt;Some notes on Eucalyptus source&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;p style="text-align: left;"&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="writely-toc" id="WritelyTableOfContents" toctype="none+none"&gt;&lt;ol class="writely-toc-none"&gt;&lt;li&gt;&lt;a target="_self" href="#Architecture_7827256964035527_3946620597992492"&gt;Architecture&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Clound_Controller_CLC_43824834"&gt;Clound Controller (CLC)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Cluster_Controller_CC_65178286"&gt;Cluster Controller (CC)&lt;/a&gt;&lt;ol style="margin-left: 0pt;" class="writely-toc-subheading writely-toc-none"&gt;&lt;li&gt;&lt;a target="_self" href="#client_6643335926308884_7985673764003758"&gt;client&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#server_2741577828993069_9147729618891193"&gt;server&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Storage_Controller_84324483708"&gt;Storage Controller&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Node_Controller_NC_96499065951"&gt;Node Controller (NC)&lt;/a&gt;&lt;ol style="margin-left: 0pt;" class="writely-toc-subheading writely-toc-none"&gt;&lt;li&gt;&lt;a target="_self" href="#Server_39773022526706514_1676472834864463"&gt;Server&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Client_18157063150531194_6026529739154901"&gt;Client&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#Misc__3709791169994058"&gt;Misc.&lt;/a&gt;&lt;ol style="margin-left: 0pt;" class="writely-toc-subheading writely-toc-none"&gt;&lt;li&gt;&lt;a target="_self" href="#network_6114071587340731"&gt;network&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#gatherlog_7509516426442727"&gt;gatherlog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#util_33965406592712455"&gt;util&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_self" href="#tools_7713613382670601"&gt;tools&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br&gt;&lt;h1&gt;&lt;a id="Architecture_7827256964035527_3946620597992492" name="Architecture_7827256964035527_3946620597992492"&gt;&lt;/a&gt;Architecture&lt;/h1&gt;See: http://open.eucalyptus.com/wiki/EucalyptusInstall_v1.6&lt;br&gt;&lt;br&gt;&lt;h1&gt;&lt;a id="Clound_Controller_CLC_43824834" name="Clound_Controller_CLC_43824834"&gt;&lt;/a&gt;Clound Controller (CLC)&lt;br&gt;&lt;/h1&gt;The most complex component in terms of implementation and nuber of lines of code. Implemented in Java and code is located under directory *clc*. It seems it supports both ant and maven build. &lt;br&gt;&lt;br&gt;Packages used:&lt;br&gt;&lt;ul&gt;&lt;li&gt;mule&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;Modules:&lt;br&gt;&lt;ul&gt;&lt;li&gt;authentication&lt;/li&gt;&lt;li&gt;bootstrap&lt;br&gt;Built to generate an executable named eucalyptus-cloud which can be used to start up the cloud.&lt;br&gt;&lt;/li&gt;&lt;li&gt;cloud&lt;/li&gt;&lt;li&gt;cluster-manager&lt;br&gt;/edu/ucsb/eucalyptus/cloud/cluster&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;Allocator.java&lt;br&gt;ClusterAllocator.java&lt;br&gt;ClusterEndpoint.java&lt;br&gt;ClusterEnvelope.java&lt;br&gt;&lt;br&gt;QueuedEvent.java&lt;br&gt;QueuedLogEvent.java&lt;br&gt;&lt;br&gt;Reservation.java&lt;br&gt;Reservations.java&lt;br&gt;VmInstance.java&lt;br&gt;VmInstances.java&lt;br&gt;&lt;br&gt;VmAllocationTransaction.java&lt;br&gt;VmTypeAvailability.java&lt;br&gt;VmTypeVerify.java&lt;br&gt;VmTypes.java&lt;br&gt;&lt;br&gt;&lt;b&gt;Callbacks&lt;/b&gt;&lt;br&gt;UnassignAddressCallback.java&lt;br&gt;AssignAddressCallback.java&lt;br&gt;
ConfigureNetworkCallback.java&lt;br&gt;
ConsoleOutputCallback.java&lt;br&gt;

MultiClusterCallback.java&lt;br&gt;


QueuedEventCallback.java&lt;br&gt;



RebootCallback.java&lt;br&gt;StartNetworkCallback.java&lt;br&gt;StopNetworkCallback.java&lt;br&gt;TerminateCallback.java&lt;br&gt;VmRunCallback.java&lt;br&gt;VolumeAttachCallback.java&lt;br&gt;VolumeDetachCallback.java&lt;br&gt;&lt;/div&gt;&lt;br&gt;/edu/ucsb/eucalyptus/cloud/cluster&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;AddressManager.java&lt;br&gt;CreateVmInstances.java&lt;br&gt;StateSnapshot.java&lt;br&gt;SystemState.java&lt;br&gt;VmAdmissionControl.java&lt;br&gt;VmControl.java&lt;br&gt;VmMetadata.java&lt;br&gt;VmReplyTransform.java&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/div&gt;/com/eucalyptus/cluster&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;Cluster.java&lt;br&gt;ClusterBootstrapper.java&lt;br&gt;ClusterMessageQueue.java&lt;br&gt;ClusterNodeState.java&lt;br&gt;ClusterState.java&lt;br&gt;ClusterThreadGroup.java&lt;br&gt;Clusters.java&lt;br&gt;Networks.java&lt;br&gt;&lt;br&gt;&lt;/div&gt;/com/eucalyptus/cluster/handlers&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;AbstractClusterMessageDispatcher.java&lt;br&gt;AddressStateHandler.java&lt;br&gt;ClusterCertificateHandler.java&lt;br&gt;LogStateHandler.java&lt;br&gt;NetworkStateHandler.java&lt;br&gt;ResourceStateHandler.java&lt;br&gt;VmStateHandler.java&lt;/div&gt;&lt;/li&gt;&lt;li&gt;configuration&lt;/li&gt;&lt;li&gt;core&lt;br&gt;edu/ucsb/eucalyptus/cloud/entities: Includes basic beans which represent various objects in the system (e.g. vmtype, user, bucket, image)&lt;br&gt;&lt;/li&gt;&lt;li&gt;distribution&lt;/li&gt;&lt;li&gt;dns&lt;/li&gt;&lt;li&gt;group-manager&lt;/li&gt;&lt;li&gt;image-manager&lt;/li&gt;&lt;li&gt;interface&lt;/li&gt;&lt;li&gt;key-manager&lt;/li&gt;&lt;li&gt;msgs&lt;br&gt;com/eucalyptus/bootstrap:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;Depends, Provides, Resource&lt;br&gt;Component: each component has a resource provider.&lt;br&gt;ResourceProvider&lt;br&gt;Bootstrapper&lt;br&gt;SystemBootstrapper: includes methods to load and start all bootstrappers contained in jars.&lt;br&gt;BootstrapFactory: provides static methods to initialize bootstrappers, configuration resources and resource providers. &lt;br&gt;&lt;/div&gt;com/eucalyptus/event&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;AbstractNamedRegistry.java&lt;br&gt;ClockTick.java: clock tick event&lt;br&gt;Event.java: event abstraction&lt;br&gt;EventListener.java: event listener abstration&lt;br&gt;GenericEvent.java: adds message to an event&lt;br&gt;ListenerRegistry.java: a event listener registry&lt;br&gt;ReentrantListenerRegistry.java&lt;br&gt;StateEvent.java: represents an event that has state.&lt;br&gt;StatefulNamedRegistry.java&lt;br&gt;SystemClock.java: periodically triggers clocktick event.&lt;br&gt;&lt;/div&gt;com/eucalyptus/util&lt;br&gt;&lt;br&gt;edu/ucsb/eucalyptus/msgs/&lt;br&gt;Files under this directory defines various message types.&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;Configuration.groovy&lt;br&gt;DNS.groovy&lt;br&gt;EventRecord.java&lt;br&gt;Messages.groovy&lt;br&gt;StorageController.groovy&lt;br&gt;Unimplemented.groovy&lt;br&gt;VPN.groovy&lt;br&gt;VmAddresses.groovy&lt;br&gt;VmBlockDevice.groovy&lt;br&gt;VmControl.groovy&lt;br&gt;VmImages.groovy&lt;br&gt;VmKeys.groovy&lt;br&gt;VmLocation.groovy&lt;br&gt;VmNetwork.groovy&lt;br&gt;VmSecurity.groovy&lt;br&gt;Walrus.groovy&lt;br&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;storage-common&lt;br&gt;edu/ucsb/eucalyptus/cloud/ws:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;ChunkedDataFile.java&lt;br&gt;CompressedChunkedFile.java&lt;br&gt;&lt;/div&gt;&lt;br&gt;edu/ucsb/eucalyptus/storage&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;StorageManager.java: interface for S3?&lt;br&gt;&lt;/div&gt;&lt;br&gt;edu/ucsb/eucalyptus/storage/fs:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;FileIO.java&lt;br&gt;FileReader.java&lt;br&gt;FileSystemStorageManager.java: impl of StorageManager. &lt;br&gt;FileWriter.java&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;storage-controller&lt;br&gt;com/eucalyptus/bootstrap&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;BlockStorageBootstrapper: bootstrappers for block storage.&lt;br&gt;&lt;/div&gt;edu/ucsb/eucalyptus/cloud/ws&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;BlockStorage: EBS (to read). It uses StorageManager from storage-common as underlying impl.&lt;br&gt;StorageEventListener&lt;br&gt;&lt;/div&gt;/edu/ucsb/eucalyptus/storage/&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;AOEManager.java: implements StorageExportManager&lt;br&gt;BlockStorageChecker.java&lt;br&gt;BlockStorageManagerFactory.java: factory for LVM2Manager.&lt;br&gt;LVM2Manager.java: impls LogicalStorageManager&lt;br&gt;LogicalStorageManager.java: interface for logical volume management&lt;br&gt;StorageExportManager.java: interface for export of volume&lt;br&gt;&lt;/div&gt;/edu/ucsb/eucalyptus/ic&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;StorageController.java: handles messages.&lt;br&gt;&lt;/div&gt;&lt;div style="margin-left: 40px;"&gt;&lt;br&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;walrus (S3 impl)&lt;br&gt;edu/ucsb/eucalyptus/cloud/ws:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;ObjectReader.java&lt;br&gt;TorrentClient.java&lt;br&gt;TorrentCreator.java&lt;br&gt;Torrents.java&lt;br&gt;Tracker.java&lt;br&gt;WalrusControl.java&lt;br&gt;WalrusEventListener.java: event listener. Currently, listens to StopComponentEvent.&lt;br&gt;WalrusImageManager.java&lt;br&gt;WalrusManager.java&lt;br&gt;WalrusBlockStorageManager.java&lt;br&gt;WalrusStatistics.java&lt;br&gt;&lt;/div&gt;edu/ucsb/eucalyptus/ic:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;Walrus.java: handles messages.&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;wsstack&lt;/li&gt;&lt;li&gt;www&lt;br&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;&lt;a id="Cluster_Controller_CC_65178286" name="Cluster_Controller_CC_65178286"&gt;&lt;/a&gt;Cluster Controller (CC)&lt;/h1&gt;It interacts with two parts: cloud controller and node controllers. Its interface is described in file wsdl/eucalyptus_cc.wsdl. Axis2/C is used to generate C stub functions from wsdl. &lt;br&gt;It has two parts in the code: client and server. It provides services using SOAP-based web service.&lt;br&gt;&lt;h2&gt;&lt;a id="client_6643335926308884_7985673764003758" name="client_6643335926308884_7985673764003758"&gt;&lt;/a&gt;client&lt;/h2&gt;It relies on&lt;br&gt;&lt;ul&gt;&lt;li&gt;generated CC client stub functions from *wsdl/eucalyptus_cc.wsdl*&lt;/li&gt;&lt;/ul&gt;Code: &lt;br&gt;&lt;div style="margin-left: 40px;"&gt;cluster/CCclient.c&lt;br&gt;cluster/cc-client-marshal-adb.c (main file)&lt;br&gt;cluster/cc-client-marshal.h&lt;br&gt;&lt;/div&gt;Client functions make use of stub functions generated from wsdl using axis2/C to construct SOAP request messages. The generated tool (by make) can be used to interact with cluster controller services.&lt;br&gt;&lt;h2&gt;&lt;a id="server_2741577828993069_9147729618891193" name="server_2741577828993069_9147729618891193"&gt;&lt;/a&gt;server&lt;/h2&gt;When you build this part, a shared object is generated and deployed to Axis2/C environment. The axis2/C service name is "EucalyptusCC". &lt;br&gt;To fulfill the requests, sometimes it needs to interact with node controller (e.g. get information of the instances running on a specific node). So this part relies on generated stubs from both wsdl/eucalyptus_cc.wsdl and wsdl/eucalyptus_nc.wsdl. It acts as a server to provide services for external parties while it also acts as a service client to interact with other services. &lt;br&gt;So, it relies on &lt;br&gt;&lt;ul&gt;&lt;li&gt;generated NC client stub functions *wsdl/eucalyptus_nc.wsdl*&lt;/li&gt;&lt;li&gt;generated CC server stub functions *wsdl/eucalyptus_cc.wsdl*&lt;/li&gt;&lt;/ul&gt;Code:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;cluster/handlers.c&lt;br&gt;cluster/handlers.h&lt;br&gt;cluster/server-marshal.c&lt;br&gt;cluster/server-marshal.h&lt;br&gt;&lt;/div&gt;Functions in *handlers.c* do the real work when a service request is received. If necessary, it sends service requests to node controller. &lt;br&gt;File *server-marshal.c* extracts the request parameters using generated stub functions and invokes corresponding functions in file *handlers.c*. So it acts like a mediator which converts web service request to function name and parameters. &lt;br&gt;&lt;h1&gt;&lt;a id="Storage_Controller_84324483708" name="Storage_Controller_84324483708"&gt;&lt;/a&gt;Storage Controller&lt;/h1&gt;Provides storage services for other parts. However, the form is not web service, just functions. Other parts directly call storage controller functions.&lt;br&gt;Code&lt;br&gt;&lt;ul&gt;&lt;li&gt;storage/walrus.c, storage/walrus.h&lt;br&gt;Provides functions:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;int walrus_object_by_url (const char * url, const char * outfile, const int do_compress);&lt;br&gt;int walrus_object_by_path (const char * path, const char * outfile, const int do_compress);&lt;br&gt;int walrus_image_by_manifest_url (const char * url, const char * outfile, const int do_compress);&lt;br&gt;int walrus_image_by_manifest_path (const char * manifest_path, const char * outfile, const int do_compress);&lt;br&gt;int walrus_verify_digest (const char * url, const char * digest_path);&lt;br&gt;&lt;/div&gt;These functions are used to interact with walrus services (using REST interfaces instead of SOAP-based interfaces). &lt;br&gt;&lt;/li&gt;&lt;li&gt;storage/storage.c, storage/storage.h&lt;br&gt;provides higher-level abstraction which eases interaction of application with storage system.&lt;br&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;It is used by Node Controller and Cluster controller(? it is included as header file, but seems none of its functions are used).&lt;/span&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;A executable named Wclient is generated when you "make all". &lt;br&gt;&lt;div&gt;&lt;div&gt;&lt;br&gt;&lt;h1&gt;&lt;a id="Node_Controller_NC_96499065951" name="Node_Controller_NC_96499065951"&gt;&lt;/a&gt;Node Controller (NC)&lt;br&gt;&lt;/h1&gt;Node controller manages the instances running on a physical machine. It also provides services in the form of web services. &lt;br&gt;Its interface is described in file wsdl/eucalyptus_nc.wsdl&lt;br&gt;&lt;h2&gt;&lt;a id="Server_39773022526706514_1676472834864463" name="Server_39773022526706514_1676472834864463"&gt;&lt;/a&gt;Server&lt;/h2&gt;Provides various services to other parts.&lt;br&gt;Code:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;node/handlers.c&lt;br&gt;node/handlers_default.c&lt;br&gt;node/handlers.h&lt;br&gt;node/handlers_kvm.c&lt;br&gt;node/handlers_xen.c&lt;br&gt;node/server-marshal.c&lt;br&gt;node/server-marshal.h&lt;br&gt;&lt;/div&gt;Similar to implementation of cluster controller, files *handlers.c* does the real work to interact with virtual machine monitoring. Currently, both kvm and xen are supported. The concrete work involved to interact with a specific type of virtualization implementation is delegated to functions in file handlers_kvm.c, handlers_xen.c or handlers_default.c based on the user configuration. Under the hood, libvirt is used to interact with virtualization implementation. &lt;br&gt;server-marshal.c just extracts information from the incoming service requests and invokes corresponding functions in file *handlers.c*.&lt;br&gt;When a service needs to interact with storage system (e.g. download an image, create an image), it makes use of Storage Controller.&lt;br&gt;&lt;h2&gt;&lt;a id="Client_18157063150531194_6026529739154901" name="Client_18157063150531194_6026529739154901"&gt;&lt;/a&gt;Client&lt;/h2&gt;Access services provided by NC server.&lt;br&gt;Code:&lt;br&gt;&lt;div style="margin-left: 40px;"&gt;node/client-marshal-adb.c&lt;br&gt;node/client-marshal.h&lt;br&gt;node/client-marshal-local.c&lt;br&gt;node/NCclient.c&lt;br&gt;&lt;/div&gt;NCclient.c contains the main function. It parses the command and dispatch the requests to corresponding functions in file *client-marshal-adb.c* or *client-marshal-local.c*.&lt;br&gt;If the service is not local, client-marshal-adb.c is used. Basically the request is transformed to SOAP message and sent to remote NC service.&lt;br&gt;If the service is local, client-marshal-local.c is used. The corresponding implementation functions are directly invoked without hassle of web service stuff. &lt;br&gt;&lt;br&gt;&lt;h1&gt;&lt;a id="Misc__3709791169994058" name="Misc__3709791169994058"&gt;&lt;/a&gt;Misc.&lt;/h1&gt;&lt;h2&gt;&lt;a id="network_6114071587340731" name="network_6114071587340731"&gt;&lt;/a&gt;network&lt;/h2&gt;See http://open.eucalyptus.com/wiki/EucalyptusNetworking_v1.6 for networking configuration.&lt;br&gt;In managed mode, &lt;br&gt;Manipulates the dhcpd configuration file and use "brctl" command from package *bridge-utils*. Also it supports VLAN.&lt;br&gt;&lt;h2&gt;&lt;a id="gatherlog_7509516426442727" name="gatherlog_7509516426442727"&gt;&lt;/a&gt;gatherlog&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;Another sets of services described in file wsdl/eucalyptus_gl.wsdl. Code is located under directory *gatherlog*.&lt;br&gt;&lt;h2&gt;&lt;a id="util_33965406592712455" name="util_33965406592712455"&gt;&lt;/a&gt;util&lt;/h2&gt;&lt;h2&gt;&lt;a id="tools_7713613382670601" name="tools_7713613382670601"&gt;&lt;/a&gt;tools&lt;/h2&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8762861817873254480?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8762861817873254480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8762861817873254480' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8762861817873254480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8762861817873254480'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/01/eucalyptus-code-reading.html' title='Eucalyptus Code Reading'/><author><name>Gerald Guo</name><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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-8502076280943249871</id><published>2010-01-08T11:49:00.000-05:00</published><updated>2010-01-08T11:50:06.902-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Do you know Windows 7 GodMode?</title><content type='html'>&lt;p&gt;See this post for details:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.osnews.com/story/22691/Activate_Windows_7_s_Hidden_God_Mode_" href="http://www.osnews.com/story/22691/Activate_Windows_7_s_Hidden_God_Mode_"&gt;http://www.osnews.com/story/22691/Activate_Windows_7_s_Hidden_God_Mode_&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Just try:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create a new folder &lt;/li&gt;    &lt;li&gt;Name it: &lt;code&gt;GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}&lt;/code&gt;&lt;/li&gt;    &lt;li&gt;That's it&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8502076280943249871?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8502076280943249871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8502076280943249871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8502076280943249871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8502076280943249871'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/01/do-you-know-windows-7-godmode.html' title='Do you know Windows 7 GodMode?'/><author><name>Gerald Guo</name><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-36974671.post-6924899872722865019</id><published>2010-01-06T16:26:00.001-05:00</published><updated>2010-01-06T16:26:50.085-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Random Ubuntu console notes</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Turn off beeps: &lt;a title="http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/" href="http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/"&gt;http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Framebuffer&lt;/p&gt;  &lt;p&gt;&lt;a href="http://tldp.org/HOWTO/Framebuffer-HOWTO.html"&gt;http://tldp.org/HOWTO/Framebuffer-HOWTO.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.mat.univie.ac.at/~gerald/laptop/vesafb.txt" href="http://www.mat.univie.ac.at/~gerald/laptop/vesafb.txt"&gt;http://www.mat.univie.ac.at/~gerald/laptop/vesafb.txt&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Change resolution: &lt;a title="http://ubuntuforums.org/showthread.php?t=215566" href="http://ubuntuforums.org/showthread.php?t=215566"&gt;http://ubuntuforums.org/showthread.php?t=215566&lt;/a&gt;     &lt;br /&gt;&lt;a title="http://www.mepis.org/node/2992" href="http://www.mepis.org/node/2992"&gt;http://www.mepis.org/node/2992&lt;/a&gt;     &lt;br /&gt;&lt;a title="http://en.wikipedia.org/wiki/VESA_BIOS_Extensions#Linux_video_mode_numbers" href="http://en.wikipedia.org/wiki/VESA_BIOS_Extensions#Linux_video_mode_numbers"&gt;http://en.wikipedia.org/wiki/VESA_BIOS_Extensions#Linux_video_mode_numbers&lt;/a&gt;     &lt;br /&gt;&lt;a title="http://www.linuxquestions.org/questions/ubuntu-63/console-session-very-large-text-font-598857/" href="http://www.linuxquestions.org/questions/ubuntu-63/console-session-very-large-text-font-598857/"&gt;http://www.linuxquestions.org/questions/ubuntu-63/console-session-very-large-text-font-598857/&lt;/a&gt;     &lt;br /&gt;&lt;a title="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/246269" href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/246269"&gt;https://bugs.launchpad.net/ubuntu/+source/linux/+bug/246269&lt;/a&gt;     &lt;br /&gt;&lt;a title="http://ubuntuforums.org/showthread.php?p=5400183" href="http://ubuntuforums.org/showthread.php?p=5400183"&gt;http://ubuntuforums.org/showthread.php?p=5400183&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;vga=ask&amp;#160;&amp;#160; to ask the user to choose mode&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Solution: &lt;a title="http://ubuntuforums.org/showthread.php?p=3826742" href="http://ubuntuforums.org/showthread.php?p=3826742"&gt;http://ubuntuforums.org/showthread.php?p=3826742&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Setup console: &lt;a title="http://ubuntuforums.org/showthread.php?t=329369&amp;amp;highlight=boot+console+font" href="http://ubuntuforums.org/showthread.php?t=329369&amp;amp;highlight=boot+console+font"&gt;http://ubuntuforums.org/showthread.php?t=329369&amp;amp;highlight=boot+console+font&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;console-setup&lt;/h2&gt;  &lt;p&gt;Install fonts, script and services&lt;/p&gt;  &lt;p&gt;fonts are installed to /usr/share/consolefonts/    &lt;br /&gt;script: /bin/setupconm /usr/bin/ckbcomp     &lt;br /&gt;services: /etc/init.d/console-setup, /etc/init.d/keyboard-setup (they are installed to rcS.d)&lt;/p&gt;  &lt;p&gt;Configuration:    &lt;br /&gt;1) $HOME/console-setup     &lt;br /&gt;2) /etc/default/console-setup     &lt;br /&gt;Note: if 1) exists, 2) will not be executed at all!!!&lt;/p&gt;  &lt;h3&gt;console-tools vs. kbd&lt;/h3&gt;  &lt;p&gt;console-tools provides consolechars. However consolechars cannot recognize some fontfaces provided by console-setup.    &lt;br /&gt;console-tools installs service console-screen.sh, makes dumpkeys process file /etc/console-tools/remap     &lt;br /&gt;update-rc.d console-screen remove     &lt;br /&gt;For example, I tried     &lt;br /&gt;consolechars –v –f /usr/share/consolefonts/Uni3-Terminus20x10.psf.gz --tty=/dev/tty5&lt;/p&gt;  &lt;p&gt;It gives error&lt;/p&gt;  &lt;pre&gt;Cannot (yet) load a non-seekable RAW file
read_simple_font(): Invalid argument&lt;/pre&gt;

&lt;p&gt;I found this post &lt;a title="http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg154310.html" href="http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg154310.html"&gt;http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg154310.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I installed kbd (sudo apt-get install kbd). console-tools is automatically removed when you install kbd. Then I tried&lt;/p&gt;

&lt;p&gt;setfont –v /usr/share/consolefonts/Uni3-Terminus20x10.psf.gz&lt;/p&gt;

&lt;p&gt;It works!!.&lt;/p&gt;

&lt;p&gt;kbd installs bunch of commands, &lt;/p&gt;

&lt;p&gt;configuration: /etc/kbd/config, /etc/kbd/remap 
  &lt;br /&gt;kbd installs service console-screen.kbd.sh (installed to rcS.d)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: for both of console-tools and kbd, the installed services won’t be run if setupcon is present. In other words, if console-setup is installed, services installed by console-tools or kbd don’t run.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, usually you should edit file /etc/default/console-setup to change configuration!!! Or copy it to your home directory. 
  &lt;br /&gt;Then use command 

  &lt;br /&gt;setupcon 

  &lt;br /&gt;to make it take effect immediately.&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.robodesign.ro/mihai/blog/customize-your-linux-terminal" href="http://www.robodesign.ro/mihai/blog/customize-your-linux-terminal"&gt;http://www.robodesign.ro/mihai/blog/customize-your-linux-terminal&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;apt-get install hwinfo &lt;br /&gt;&lt;/pre&gt;

&lt;pre&gt;sudo dpkg-reconfigure console-setup&lt;/pre&gt;

&lt;pre&gt;consolechars&lt;/pre&gt;

&lt;pre&gt;setupcon&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;apt-get remove pkgname&lt;/p&gt;

&lt;p&gt;dpkg –purge pkgname&lt;/p&gt;

&lt;p&gt;apt-get purge pkgname&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6924899872722865019?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6924899872722865019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6924899872722865019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6924899872722865019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6924899872722865019'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/01/random-ubuntu-console-notes.html' title='Random Ubuntu console notes'/><author><name>Gerald Guo</name><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-36974671.post-4829667001179435049</id><published>2010-01-04T23:19:00.000-05:00</published><updated>2010-01-05T11:28:46.192-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Firefox private key/certificate import/export</title><content type='html'>&lt;p&gt;Recently I am dealing with X.509 related stuff. The browser I am using is Firefox 3.5.3.&lt;/p&gt;  &lt;h2&gt;Generation and Import&lt;/h2&gt;  &lt;p&gt;The steps of generating and importing private key and certificate consist of:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Public/private key pair generation      &lt;br /&gt;You can use standalone utility (e.g. openssl) to generate them. &lt;/li&gt;    &lt;li&gt;Then you generate a self-signed certificate for the public key generated in the first step.      &lt;br /&gt;Also, you can generate a Certificate Request message and send it to an external CA to apply for a certificate. &lt;/li&gt;    &lt;li&gt;Now you have both private key and the associated certificate. &lt;/li&gt;    &lt;li&gt;You need to put both of them into a single pkcs12 file which can be recognized by Firefox. &lt;/li&gt;    &lt;li&gt;Then you can import the pkcs12 file into Firefox by clicking      &lt;br /&gt;Tools –&amp;gt; Options –&amp;gt; Advanced –&amp;gt; Encryption –&amp;gt; View Certificates –&amp;gt; Your Certificates –&amp;gt; Import… &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If you use javascript, you can use &lt;a href="https://developer.mozilla.org/en/JavaScript_crypto" target="_blank"&gt;crypto&lt;/a&gt; object to generate them.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Use &lt;a href="https://developer.mozilla.org/en/GenerateCRMFRequest" target="_blank"&gt;crypto.generateCRMFRequest&lt;/a&gt; to       &lt;br /&gt;generate a key pair and create a Certificate Request message &lt;/li&gt;    &lt;li&gt;Send the generated Certificate Request message to remote server      &lt;br /&gt;“The string found by accessing crmfObject.request is the base-64 encoded CRMF message to be sent to the CA/RA” &lt;/li&gt;    &lt;li&gt;After your certificate request is approved, you will get a public key certificate &lt;/li&gt;    &lt;li&gt;You can import the certificate into your browser. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Note: In this case, you don’t need to import the private key because it is imported automatically when function &lt;a href="https://developer.mozilla.org/en/GenerateCRMFRequest" target="_blank"&gt;crypto.generateCRMFRequest&lt;/a&gt; is called. &lt;/p&gt;  &lt;h2&gt;Export&lt;/h2&gt;  &lt;p&gt;Export your &lt;strong&gt;private key and certificate&lt;/strong&gt; from Firefox:&lt;/p&gt;  &lt;p&gt;Tools –&amp;gt; Options –&amp;gt; Advanced –&amp;gt; Encryption –&amp;gt; View Certificates –&amp;gt; Your Certificates –&amp;gt; Backup…   &lt;br /&gt;Note: the keystore format supported is pkcs12. &lt;/p&gt;  &lt;p&gt;Export trusted certificates from Firefox:&lt;/p&gt;  &lt;p&gt;Tools –&amp;gt; Options –&amp;gt; Advanced –&amp;gt; Encryption –&amp;gt; View Certificates –&amp;gt; {corresponding tab} –&amp;gt;Export   &lt;br /&gt;Note: Firefox supports couple of different formats including PEM, PKCS#7, etc.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4829667001179435049?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4829667001179435049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4829667001179435049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4829667001179435049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4829667001179435049'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/01/firefox-private-keycertificate.html' title='Firefox private key/certificate import/export'/><author><name>Gerald Guo</name><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-36974671.post-1005232622331475619</id><published>2010-01-04T15:13:00.001-05:00</published><updated>2010-01-04T15:13:34.666-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='encoding'/><title type='text'>Chinese Character Encoding</title><content type='html'>&lt;p&gt;GB2312, GBK, GB18030&lt;/p&gt;  &lt;p&gt;GBK IANA registration page: &lt;a title="http://www.iana.org/assignments/charset-reg/GBK" href="http://www.iana.org/assignments/charset-reg/GBK"&gt;http://www.iana.org/assignments/charset-reg/GBK&lt;/a&gt;    &lt;br /&gt;From the page, I finally know that windows codepage 936 corresponds to GBK.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1005232622331475619?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1005232622331475619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1005232622331475619' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1005232622331475619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1005232622331475619'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2010/01/chinese-character-encoding.html' title='Chinese Character Encoding'/><author><name>Gerald Guo</name><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-36974671.post-8577032413019958174</id><published>2009-12-25T13:41:00.001-05:00</published><updated>2009-12-25T13:44:42.448-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>JEE 6 has been approved!</title><content type='html'>&lt;p&gt;See the ballot here: &lt;a title="http://jcp.org/en/jsr/results?id=5025" href="http://jcp.org/en/jsr/results?id=5025"&gt;http://jcp.org/en/jsr/results?id=5025&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;ASF voted against the proposal. The comment ASF gave is:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;The Apache Software Foundation's vote is based on the point of view that this spec lead - Sun - is in violation of the JSPA &lt;/p&gt;    &lt;p&gt;&lt;a href="http://www.apache.org/jcp/sunopenletter.html"&gt;http://www.apache.org/jcp/sunopenletter.html&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;and therefore shouldn't be allowed to lead other JSRs until the above matter is resolved. &lt;/p&gt;    &lt;p&gt;This vote is not a comment on the technical merits of the JSR.&amp;#160; If not for the issue of the spec lead, the ASF would have otherwise voted &amp;quot;yes&amp;quot;.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I read &lt;a title="http://www.apache.org/jcp/sunopenletter.html" href="http://www.apache.org/jcp/sunopenletter.html"&gt;http://www.apache.org/jcp/sunopenletter.html&lt;/a&gt;. It seems the dispute originates from license of JCK (Java Compatibility Kit) which is needed to demonstrate compatibility of Java SE spec. Also IBM voted for the proposal but stated that it wants an open licensing model, etc. Interesting relationships among those vendors and foundations.&lt;/p&gt;  &lt;p&gt;The problem has been there for several years, and it still has not been solved. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8577032413019958174?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8577032413019958174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8577032413019958174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8577032413019958174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8577032413019958174'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/12/jee-6-has-been-approved.html' title='JEE 6 has been approved!'/><author><name>Gerald Guo</name><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-36974671.post-2526833868153030233</id><published>2009-12-24T16:39:00.001-05:00</published><updated>2009-12-24T16:39:32.819-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><title type='text'>A ball probability question</title><content type='html'>&lt;p&gt;I was looking for a solution to a ball probability question which is described below. I found this page which exactly describes the same question: &lt;a title="http://www.isibang.ac.in/~statmath/problems/august.html" href="http://www.isibang.ac.in/~statmath/problems/august.html"&gt;http://www.isibang.ac.in/~statmath/problems/august.html&lt;/a&gt;. However, it seems the page is not accessible now. So I copied the page and pasted it here. If this incurs any term/license problem, I am more than glad to remove the content.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="10" width="90%" bgcolor="#ffffff"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;Suppose Farrah gives you two bags. Bag A, contains 50 Red balls and Bag B, contains 50 Black Balls. She leaves the room asking you to rearrange the balls between the bags in any way you want without discarding any of the balls. She then returns and chooses a bag at random and then from the chosen bag, chooses a ball at random.          &lt;p&gt;&lt;b&gt;Question:&lt;/b&gt; Can you find the rearrangement that maximises her chance of choosing a black ball ? &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;br /&gt;  &lt;br /&gt;  &lt;table border="0" cellspacing="0" cellpadding="10" width="90%" bgcolor="#ffffff"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;&lt;font color="#008000" size="+1" face="Helvetica, Arial"&gt;           &lt;p&gt;Solution provided by Winners :&lt;/p&gt;         &lt;/font&gt;          &lt;li&gt;&lt;font color="#008000" size="+1" face="Helvetica, Arial"&gt;Soumya bhattacharya &lt;/font&gt;            &lt;br /&gt;Clearly,if one bag contains only black balls and the other bag atleast one black ball along with the red balls,then the prabability that Farrah choses a black ball is more than half.             &lt;p&gt;Again if any of the bags contain equal no. of black and red balls ,then the other bag also contains them in equal number and (if none of them is an empty bag,in which case the probability of Farrah's chosing a black ball is only 1/4) the probability that Farrah choses a black ball is half.As we already have seen an example in which the probability of chosing a black ball is more than half,hence this case can't be the solution. &lt;/p&gt;            &lt;p&gt;So,if an optimal case exist,in that each of the bags must contain unequal numbers of black and red balls.And hence,(as the total no. of black balls= the total no. of the red balls) the proportion of black balls in a bag will be more than half in one bag and less than half,in the other. let 'b' and 'd' denote the total no. of balls in 2 bags and 'a' and 'c' denote the total no. of black balls in them respectively. &lt;/p&gt;            &lt;p&gt;W.L.O.G.,let us assume that a/b &amp;lt; 1/2 and c/d &amp;gt; 1/2.Now if we take out a black and a red ball from the 2nd bag and put them in the first,the probability of chosing a black ball changes from (1/2)*(a/b + c/d) to (1/2)*((a+1)/(b+2) + (c-1)/ (d-2)). Again as a/b &amp;lt; 1/2,hence we have (a+1)/(b+2) &amp;gt; a/b. And as c/d &amp;gt; 1/2, (c-1)/(d-2) &amp;gt; c/d. &lt;/p&gt;            &lt;p&gt;Therefore, by this rearrangement,the probability of chosing a black ball increases.So we do it untill there is no red ball in the bag,which was initially containing d balls.( as there were more black balls initially in this,and we shift equal no. of red and black balls to the other bag.) Now, clearly if we shift all the black balls,leaving only one in the first bag to the bag that contains red balls also,then the ratio of blacks to reds increases in the 2nd bag ,whereas that in the 1st bag remains constant, in effect increasing the probability of chosing a black ball by Farrah. &lt;/p&gt;            &lt;p&gt;So,starting with any arbitrary case we have reached the state of rearrangement, which has the probability of chosing a black ball more than or equal to that arbitrary case.So, we conclude that ,the rearrangement of the balls in which one bag contains only 1 black ball and the other bag contains the rest of the balls is maximum (0.7474). &lt;/p&gt;         &lt;/li&gt;          &lt;li&gt;&lt;font color="#008000" size="+1" face="Helvetica, Arial"&gt;Subhroshekhar Ghosh&lt;/font&gt;             &lt;p&gt;First of all, we claim that the required arrangement is : one black ball in one of the jars and all the other balls in the other jar, when the probability p of getting a black ball turns out to be 1/2*1 + 1/2 * 49/99. &lt;/p&gt;            &lt;p&gt;To, see this, we eliminate the cases 1.all the balls are in one jar (p=1/4) 2.there are equal no. of red and black balls in one jar (and hence in the other jar) (p=1/2). &lt;/p&gt;            &lt;p&gt;We observe that for any labelling of the jars as 1 and 2, p=1/2*p(1)+1/2*p(2) where p(i) is the conditional probability of getting a black ball having chosen the ith jar. Also, as there are equal no. of red and black balls, in any configuration there will be exactly one jar in which no. of red balls &amp;gt;= no. of black balls, hence the conditional probability for that jar &amp;lt;= 1/2. Since we have eliminated cases 1 and 2, we will have it &amp;lt; 1/2. &lt;/p&gt;            &lt;p&gt;Without loss of generality, we call this jar 1 and let it have r red and b black balls. Then p(1)=b/(r+b), b&lt;r r,b="" ;&gt;0. We have p(1)&amp;lt;1/2, so we consider 1/2 - p(1) = 1/2 * {(r-b)/(r+b)}. The restrictions imply (r-b)&amp;gt;= 1 and r+b &amp;lt;=99. Therefore, 1/2 - p(1) &amp;gt;= 1/2 * 1/99, so p(1) &amp;lt;= 49/99, equality holds if there are 50 red and 49 black balls in jar 1. The other conditional probability p(2) &amp;lt;= 1, equality holds if all balls in jar 2 are black. Hence, p will be maximised if both of these upper bounds are attained. But they are attained by the configuration mentioned in the beginning. In fact, it is clear from the equality conditions that this configuration is the only one that attains the upper bound.&lt;/p&gt;         &lt;/li&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2526833868153030233?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2526833868153030233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2526833868153030233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2526833868153030233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2526833868153030233'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/12/ball-probability-question.html' title='A ball probability question'/><author><name>Gerald Guo</name><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-36974671.post-8279699253352523919</id><published>2009-12-22T16:13:00.000-05:00</published><updated>2009-12-22T16:14:05.505-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Interesting “Epigrams on Programming”</title><content type='html'>&lt;p&gt;Recently I found this&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Epigrams on Programming&lt;/strong&gt;: &lt;a title="http://www.pam1.bcs.uwa.edu.au/~michaelw/Perlis_Epigrams.html" href="http://www.pam1.bcs.uwa.edu.au/~michaelw/Perlis_Epigrams.html"&gt;http://www.pam1.bcs.uwa.edu.au/~michaelw/Perlis_Epigrams.html&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Really interesting, terse and helpful. Among those epigrams, I like following ones a lot&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Programming is an unnatural act.&lt;/li&gt;    &lt;li&gt;Computer Science is embarrassed by the computer.&lt;/li&gt;    &lt;li&gt;In man-machine symbiosis, it is man who must adjust: The machines can't.&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8279699253352523919?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8279699253352523919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8279699253352523919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8279699253352523919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8279699253352523919'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/12/interesting-epigrams-on-programming.html' title='Interesting “Epigrams on Programming”'/><author><name>Gerald Guo</name><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-36974671.post-3396487273559776518</id><published>2009-11-07T15:57:00.000-05:00</published><updated>2009-11-07T16:00:08.626-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rfc'/><title type='text'>Simplest RFC?</title><content type='html'>&lt;p&gt;Which is the simplest RFC? Maybe this one: &lt;a title="http://tools.ietf.org/html/rfc863" href="http://tools.ietf.org/html/rfc863"&gt;http://tools.ietf.org/html/rfc863&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;DISCARD: the server just discards all received messages.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3396487273559776518?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3396487273559776518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3396487273559776518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3396487273559776518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3396487273559776518'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/11/simplest-rfc.html' title='Simplest RFC?'/><author><name>Gerald Guo</name><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-36974671.post-8874082142163699703</id><published>2009-11-06T22:57:00.001-05:00</published><updated>2009-11-06T22:57:40.285-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Windows7 7 Sins</title><content type='html'>&lt;p&gt;An interesting web site: &lt;a title="http://en.windows7sins.org" href="http://en.windows7sins.org"&gt;http://en.windows7sins.org&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8874082142163699703?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8874082142163699703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8874082142163699703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8874082142163699703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8874082142163699703'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/11/windows7-7-sins.html' title='Windows7 7 Sins'/><author><name>Gerald Guo</name><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-36974671.post-5185429098289491927</id><published>2009-09-26T14:28:00.000-04:00</published><updated>2009-09-26T14:55:21.898-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Classloaders, shared directory and endorsed directory of Tomcat 5.5 and 6.0</title><content type='html'>&lt;p&gt;Tomcat 5.5 Class Loader: &lt;a title="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html" href="http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html"&gt;http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html&lt;/a&gt;     &lt;br /&gt;Tomcat 6.0 Class Loader: &lt;a title="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html" href="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html"&gt;http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Tomcat 5.5&lt;/h3&gt;  &lt;p&gt;Class loader hierarchy    &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_qiIXUonGAyk/Sr5d6Qe7gkI/AAAAAAAAAtY/arn04G3sbC4/s1600-h/image%5B5%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="157" alt="image" src="http://lh5.ggpht.com/_qiIXUonGAyk/Sr5d6qmIjZI/AAAAAAAAAtc/EVmoq01vMOU/image_thumb%5B3%5D.png?imgmax=800" width="242" border="0" /&gt;&lt;/a&gt;&amp;#160; (from &lt;a href="http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html" target="_blank"&gt;tomcat 5.5 document&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Class loaders: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Boostrap, System&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Common: &lt;/strong&gt;      &lt;br /&gt;visible to both Tomcat &lt;strong&gt;&lt;font color="#ff0000"&gt;internal classes&lt;/font&gt;&lt;/strong&gt; and to &lt;strong&gt;&lt;font color="#ff0000"&gt;all web applications&lt;/font&gt;&lt;/strong&gt;.       &lt;br /&gt;Related directories       &lt;ul&gt;       &lt;li&gt;classes and resources in: $CATALINA_HOME/common/classes &lt;/li&gt;        &lt;li&gt;jar files in: $CATALINA_HOME/commons/endorsed, $CATALINA_HOME/commons/i18n and $CATALINA_HOME/common/lib &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Catalina&lt;/strong&gt;       &lt;br /&gt;include all classes and resources required to implement Tomcat 5 itself. These classes and resources are &lt;strong&gt;&lt;font color="#ff0000"&gt;TOTALLY invisible to web applications&lt;/font&gt;&lt;/strong&gt;.       &lt;br /&gt;Related directories:       &lt;ul&gt;       &lt;li&gt;classes and resources in: $CATALINA_HOME/server/classes &lt;/li&gt;        &lt;li&gt;jars in: $CATALINA_HOME/server/lib &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Shared&lt;/strong&gt;       &lt;br /&gt;Shared resources are shared across all web applications. (They are not used by Tomcat internal classes).       &lt;br /&gt;Related directories       &lt;ul&gt;       &lt;li&gt;classes and resources in: $CATALINA_BASE/shared/classes &lt;/li&gt;        &lt;li&gt;jars in: $CATALINA_BASE/shared/lib &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;WebappX&lt;/strong&gt;       &lt;br /&gt;Load web app specific resources and jars.       &lt;br /&gt;Related directories       &lt;ul&gt;       &lt;li&gt;classes and resources: &amp;lt;web-app-dir&amp;gt;/WEB-INF/classes &lt;/li&gt;        &lt;li&gt;jars: &amp;lt;web-app-dir&amp;gt;/WEB-INF/lib &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Note: $CATALINA_BASE (not $CATALINA_HOME) is used class loader “Shared”. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff"&gt;#&amp;#160;&amp;#160; CATALINA_HOME&amp;#160;&amp;#160; May point at your Catalina &amp;quot;build&amp;quot; directory.        &lt;br /&gt;#         &lt;br /&gt;#&amp;#160;&amp;#160; CATALINA_BASE&amp;#160;&amp;#160; (Optional) Base directory for resolving dynamic portions         &lt;br /&gt;#&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; of a Catalina installation.&amp;#160; If not present, resolves to         &lt;br /&gt;#&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; the same directory that CATALINA_HOME points to.&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Tomcat 6.0&lt;/h3&gt;  &lt;p&gt;Class loader hierarchy    &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_qiIXUonGAyk/Sr5d66oMbAI/AAAAAAAAAtg/c0UAa5lAdlM/s1600-h/image%5B9%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="146" alt="image" src="http://lh5.ggpht.com/_qiIXUonGAyk/Sr5d7Ac6RxI/AAAAAAAAAtk/j6Hf_FGhkLg/image_thumb%5B5%5D.png?imgmax=800" width="238" border="0" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; (from &lt;a href="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html" target="_blank"&gt;tomcat 6.6 document&lt;/a&gt;)     &lt;br /&gt;Similar to the hierarchy in tomcat 5.5.&amp;#160; &lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;The difference is that class loaders Catalina and Shared are not present in tomcat 6.6.&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;For Class loader &lt;strong&gt;Common&lt;/strong&gt;, the related directories are different. &lt;strong&gt;&lt;font color="#ff0000"&gt;In tomcat 6, classes, resources and jars under directory $CATALINA_HOME/lib (in tomcat 5.5, the directory is $CATALINA_HOME/common/classes, $CATALINA_HOME/common/lib, etc) are loaded by class loader Common.&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;These directories under which classes and resources are searched for can be changed by modifying configuration file $CATALINA_HOME/conf/catalina.properties.    &lt;br /&gt;Default values for class loader search directories are:&lt;/p&gt;  &lt;pre&gt;common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
server.loader=
:shared.loader=&lt;/pre&gt;

&lt;p&gt;If you still want to use shared directory in the way specified in tomcat 5.5, you can change value of property &lt;strong&gt;&lt;em&gt;shared.loader&lt;/em&gt;&lt;/strong&gt;. 

  &lt;br /&gt;For example: &lt;tt&gt;shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar &lt;/tt&gt;&lt;/p&gt;

&lt;h3&gt;Endorsed directory&lt;/h3&gt;

&lt;p&gt;Tomcat 5.5&lt;/p&gt;

&lt;blockquote&gt;“Tomcat utilizes this mechanism by including the system property setting 
  &lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;-Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed&lt;/font&gt;&lt;/strong&gt; in the command line that starts the container. Therefore, you can replace the parser that is installed in this directory, and it will get used even on a JDK 1.4 system.” &lt;/blockquote&gt;

&lt;p&gt;Tomcat 6.0 &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Tomcat utilizes this mechanism by including the system property setting 
    &lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS&lt;/font&gt;&lt;/strong&gt; in the command line that starts the container.&lt;/p&gt;
&lt;/blockquote&gt;
Variable &lt;strong&gt;JAVA_ENDORSED_DIRS&lt;/strong&gt; is specified in file &lt;em&gt;setclasspath.sh:&amp;#160; &lt;br /&gt;&lt;tt&gt;&amp;#160;&amp;#160;&amp;#160; JAVA_ENDORSED_DIRS=&amp;quot;$BASEDIR&amp;quot;/endorsed&lt;/tt&gt; 

  &lt;br /&gt;&lt;/em&gt;

&lt;p&gt;Variable &lt;strong&gt;BASEDIR&lt;/strong&gt; is specified in file &lt;em&gt;catalina.sh: &lt;/em&gt;

  &lt;br /&gt;&lt;tt&gt;&amp;#160;&amp;#160;&amp;#160; BASEDIR=&amp;quot;$CATALINA_HOME&amp;quot;&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;In other words, 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; in tomcat 5.5, the default endorsed directory is &lt;strong&gt;&lt;font color="#ff0000"&gt;$CATALINA_HOME/common/endorsed&lt;/font&gt;

    &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; in tomcat 6.0, the default endorsed directory is &lt;strong&gt;&lt;font color="#ff0000"&gt;$CATALINA_HOME/endorsed&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5185429098289491927?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5185429098289491927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5185429098289491927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5185429098289491927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5185429098289491927'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/09/classloaders-and-shared-directory-of.html' title='Classloaders, shared directory and endorsed directory of Tomcat 5.5 and 6.0'/><author><name>Gerald Guo</name><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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_qiIXUonGAyk/Sr5d6qmIjZI/AAAAAAAAAtc/EVmoq01vMOU/s72-c/image_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-4486684213412914506</id><published>2009-09-24T23:11:00.000-04:00</published><updated>2009-09-24T23:12:05.934-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Apache ten years</title><content type='html'>&lt;p&gt;Some really nice articles/interviews about Apache Software Foundation:   &lt;br /&gt;&lt;a title="http://dev.day.com/microsling/content/blogs/main/apachebirthday.html" href="http://dev.day.com/microsling/content/blogs/main/apachebirthday.html"&gt;http://dev.day.com/microsling/content/blogs/main/apachebirthday.html&lt;/a&gt;    &lt;br /&gt;ASF highlights: 1999-2009 &lt;a title="http://www.apache.org/press/highlights.html" href="http://www.apache.org/press/highlights.html"&gt;http://www.apache.org/press/highlights.html&lt;/a&gt;    &lt;br /&gt;Details about how ASF works: &lt;a title="http://www.apache.org/foundation/how-it-works.html" href="http://www.apache.org/foundation/how-it-works.html"&gt;http://www.apache.org/foundation/how-it-works.html&lt;/a&gt;    &lt;br /&gt;eWeek: 11 Apache Technologies that Have Changed Computing in the Last 10 Years    &lt;br /&gt;&lt;a title="http://www.eweek.com/c/a/Application-Development/11-Apache-Technologies-that-Have-Changed-Computing-in-the-Last-10-Years-469693/" href="http://www.eweek.com/c/a/Application-Development/11-Apache-Technologies-that-Have-Changed-Computing-in-the-Last-10-Years-469693/"&gt;http://www.eweek.com/c/a/Application-Development/11-Apache-Technologies-that-Have-Changed-Computing-in-the-Last-10-Years-469693/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4486684213412914506?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4486684213412914506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4486684213412914506' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4486684213412914506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4486684213412914506'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/09/apache-ten-years.html' title='Apache ten years'/><author><name>Gerald Guo</name><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-36974671.post-1688765589343375889</id><published>2009-09-12T14:09:00.000-04:00</published><updated>2009-09-12T14:21:19.530-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><category scheme='http://www.blogger.com/atom/ns#' term='sofware'/><title type='text'>SVN: exclude some files out of version control (using svn:ignore)</title><content type='html'>&lt;p class="MsoNormal"&gt;Sometimes, you don’t want SVN to include all you files in the source code directory because they may be temporary files generated by developers or tools (vimcreates .swp file when a file is opened in vim). &lt;br&gt;SVN book: &lt;a href="http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.ignore.html"&gt;http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.ignore.html&lt;/a&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-size: 14pt"&gt;Two ways&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Global change: it is applied to all svn operations performed using the runtime configuration. In other words, it changes the configuration of svn application (not a specific directory/file under control of svn)&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Bind configuration to a specific version tree using &lt;i style="mso-bidi-font-style: normal"&gt;svn:ignore&lt;/i&gt; property.&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The ignore pattern checking is applied only during adding of unversioned directories/files to svn control.&lt;br&gt;“&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;Once an object is under Subversion's control, the ignore pattern mechanisms no longer apply to it.&lt;/span&gt;&lt;/b&gt; In other words, don't expect Subversion to avoid committing changes you've made to a versioned file”&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Its value contains a list of &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;NEWLINE-delimited&lt;/span&gt;&lt;/b&gt; file pattern&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;They &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;don’t override&lt;/span&gt;&lt;/b&gt; global &lt;i style="mso-bidi-font-style: normal"&gt;global-&lt;/i&gt;ignores configuration, but &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;append&lt;/span&gt;&lt;/b&gt; to the list&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;“the patterns found in the svn:ignore&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;property apply only to the directory on which that property is set, and &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;not to any of its subdirectories&lt;/span&gt;&lt;/b&gt;.”&lt;br&gt;Use switch &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: red"&gt;–R&lt;/span&gt;&lt;/i&gt;&lt;/b&gt; if you want to apply it recursively.&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Usage&lt;br&gt;svn propset svn:ignore -F file-contains-ignore-patterns path-ignore-to-be-applied&lt;br&gt;Examples:&lt;br&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;svn propset svn:ignore -F .svn-ignore .&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #recursive. If you change the direcotry tree after this command is run, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #you need to return following command to make the newly created directories/files controlled also by ignore pattern.&lt;br&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;svn -R propset svn:ignore -F .svn-ignore .&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # edit a property&lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; svn propedit svn:ignore .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #edit the ignore patterns using the preconfigured editor.&lt;br&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Note: &lt;br&gt;&amp;nbsp; *)&amp;nbsp; If you use a file to specify ignore patterns, you must rerun the command &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; "svn propset svn:ignore -F your-patter-file ." &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; to make svn reread the file after the pattern file is changed. &lt;br&gt;&amp;nbsp; *)&amp;nbsp; One alternative is to use &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;em&gt;svn propedit svn:ignore .&lt;/em&gt;"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to edit the property configuration. Then the change you made immediately takes effect. However, the new property value will not be written back to the original pattern file. You can use command &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;em&gt;svn propget svn:ignore . &amp;gt;&amp;nbsp; pattern-file&lt;/em&gt;"&lt;br&gt;to export the new value to your pattern file.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;File Pattern&lt;br&gt;*: match any sequence of characters&lt;br&gt;?: match single character&lt;br&gt;[char-set]: match the specified char set.&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Command “svn add”&lt;br&gt;When you use wildcards, you should be careful because it may make svn bypass the ignores check.&lt;br&gt;See http://svnbook.red-bean.com/trac/ticket/115.&lt;br&gt;Basically, “&lt;strong&gt;&lt;i style="mso-bidi-font-style: normal"&gt;svn add *&lt;/i&gt;”&lt;/strong&gt; bypasses the ignores system. &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: red"&gt;However, it has been fixed&lt;/span&gt;&lt;/b&gt;. So if you are using a latest svn version, it should not be a problem.&lt;br&gt;Anyway, use “&lt;strong&gt;&lt;i style="mso-bidi-font-style: normal"&gt;svn add --force .&lt;/i&gt;”&lt;/strong&gt; when you can (it makes svn check the whole specified directory tree).&lt;/p&gt; &lt;p style="text-indent: -0.25in; margin-left: 0.75in; mso-add-space: auto; mso-list: l0 level2 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: ignore"&gt;o&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: en-us; mso-fareast-language: zh-cn; mso-bidi-language: ar-sa; mso-bidi-font-size: 10.0pt"&gt;Command “&lt;i style="mso-bidi-font-style: normal"&gt;&lt;strong&gt;svn status&lt;/strong&gt;&lt;/i&gt;” won’t list ignored directories/files. &lt;br&gt;Use “&lt;i style="mso-bidi-font-style: normal"&gt;&lt;strong&gt;svn status --no-ignore&lt;/strong&gt;&lt;/i&gt;” to list status of all files including ignored ones.&lt;br style="mso-special-character: line-break"&gt;&lt;br style="mso-special-character: line-break"&gt;&lt;/p&gt;&lt;/span&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1688765589343375889?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1688765589343375889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1688765589343375889' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1688765589343375889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1688765589343375889'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/09/svn-exclude-some-files-out-of-version.html' title='SVN: exclude some files out of version control (using svn:ignore)'/><author><name>Gerald Guo</name><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-36974671.post-1681585214654709975</id><published>2009-09-08T22:10:00.001-04:00</published><updated>2009-09-08T22:10:06.410-04:00</updated><title type='text'>test</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Hello, worl&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-1681585214654709975?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/1681585214654709975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=1681585214654709975' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1681585214654709975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/1681585214654709975'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/09/test.html' title='test'/><author><name>Gerald Guo</name><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-36974671.post-2288991430009524</id><published>2009-08-20T19:46:00.000-04:00</published><updated>2009-11-10T22:19:49.690-05:00</updated><title type='text'></title><content type='html'>test post from linux using blogtk 1.1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2288991430009524?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2288991430009524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2288991430009524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2288991430009524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2288991430009524'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/08/test-post-from-linux-using-blogtk-1.html' title=''/><author><name>Gerald Guo</name><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-36974671.post-2512338358603369527</id><published>2009-07-09T17:31:00.000-04:00</published><updated>2009-07-09T17:32:04.441-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Install local .deb packages</title><content type='html'>&lt;p&gt;Ususally, &lt;em&gt;apt-get&lt;/em&gt; is used to install/update/remove packages. It is preferred because it can automatically resolve package dependency.&lt;/p&gt; &lt;p&gt;However, sometimes you must download a .deb package file and install it from local disk. &lt;em&gt;dpkg&lt;/em&gt; can do this task.&lt;br&gt;&lt;code&gt;dpkg -i package_name_here&lt;/code&gt;&lt;br&gt;However, &lt;em&gt;dpkg&lt;/em&gt; does NOT resolve package dependency. So it is likely that the installed program won't work.&lt;br&gt;You can fix it by using command&lt;br&gt;&lt;code&gt;apt-get -f install&lt;/code&gt; &lt;/p&gt; &lt;p&gt;Another solution is documented here:&lt;br&gt;&lt;a title="http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html#s-dpkg-scanpackages" href="http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html#s-dpkg-scanpackages"&gt;http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html#s-dpkg-scanpackages&lt;/a&gt;.&lt;br&gt;The idea is to build a tarball (Packages.gz) that can be recognized by &lt;em&gt;apt&lt;/em&gt; tools. Then you can install the program by using &lt;em&gt;apt-get&lt;/em&gt; command. (In other words, &lt;em&gt;.deb&lt;/em&gt; does not contain enough information which is required by &lt;em&gt;apt&lt;/em&gt; tools).&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;br&gt;APT HOWTO: &lt;a title="http://www.debian.org/doc/manuals/apt-howto/" href="http://www.debian.org/doc/manuals/apt-howto/"&gt;http://www.debian.org/doc/manuals/apt-howto/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2512338358603369527?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2512338358603369527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2512338358603369527' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2512338358603369527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2512338358603369527'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/07/install-local-deb-packages.html' title='Install local .deb packages'/><author><name>Gerald Guo</name><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-36974671.post-3500830799671099245</id><published>2009-07-09T15:05:00.001-04:00</published><updated>2009-07-09T15:05:35.751-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Some linux notes about hardware inspection</title><content type='html'>&lt;h2&gt;PCI (Peripheral Component Interconnec)&lt;/h2&gt; &lt;p&gt;PCI is the dominant bus standard. In linux, its device files are located at /proc/bus/pci.&lt;br&gt;Command &lt;em&gt;lspci&lt;/em&gt; can be used to list your PCI devices. It can display &amp;lt;[&lt;em&gt;domain id&lt;/em&gt;]:&lt;em&gt;bus id&lt;/em&gt;:&lt;em&gt;device id&lt;/em&gt;.&lt;em&gt;function number&lt;/em&gt;&amp;gt; in addition to &lt;em&gt;device type&lt;/em&gt;. You can use &lt;em&gt;-v&lt;/em&gt; switch to get verbose information. Switch &lt;em&gt;-k&lt;/em&gt; is useful to get corresponding kernel modules. &lt;br&gt;Resource: &lt;a href="http://tldp.org/LDP/tlk/dd/pci.html"&gt;http://tldp.org/LDP/tlk/dd/pci.html&lt;/a&gt;&lt;/p&gt; &lt;h2&gt;DMI (Desktop Management Interface)&lt;/h2&gt; &lt;p&gt;From wiki&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;"Essentially, to the user, it is a table provided by the personal computer BIOS which can be parsed and which gives information about the BIOS and the computer system in a standardized way."&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;em&gt;dmidecode&lt;/em&gt; is a tool on linux that can be used to get computer information (motherboard, BIOS, ...)via DMI. &lt;br&gt;DMI is part of &lt;a href="http://en.wikipedia.org/wiki/SMBIOS"&gt;SMBIOS&lt;/a&gt;. &lt;br&gt;Resources: http://en.wikipedia.org/wiki/Desktop_Management_Interface &lt;/p&gt; &lt;h2&gt;USB&lt;/h2&gt; &lt;p&gt;Command &lt;em&gt;lsus&lt;/em&gt;&lt;em&gt;b&lt;/em&gt; can be used to list your USB devices. &lt;/p&gt; &lt;h2&gt;Resources&lt;/h2&gt; &lt;dl&gt; &lt;dt&gt;TLDP (The linux document project: &lt;a href="http://en.tldp.org/"&gt;http://en.tldp.org/&lt;/a&gt;)  &lt;dd&gt;This web site contains a lots of useful HOWTO articles. Also it has in-depth articiles to introduce internal knowledge of linux kernel. Almost every aspect of linux is included.&lt;br&gt;A great PCI article: &lt;a href="http://tldp.org/LDP/tlk/dd/pci.html"&gt;http://tldp.org/LDP/tlk/dd/pci.html&lt;/a&gt;  &lt;dt&gt;RedHat enterprise linux 5 Release Notes  &lt;dd&gt;&lt;a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/singles/relnotesU2-x86.html"&gt;http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/singles/relnotesU2-x86.html&lt;/a&gt;  &lt;dt&gt;RedHat linux deployment guide  &lt;dd&gt;&lt;a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/index.html"&gt;http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/index.html&lt;/a&gt;&lt;br&gt;Although it contains some RedHat linux specific stuff, you still can find lots of common knowledge that is shared by other linux distros.  &lt;dt&gt;Linux devide list  &lt;dd&gt;&lt;a href="http://www.lanana.org/docs/device-list/"&gt;http://www.lanana.org/docs/device-list/&lt;/a&gt;  &lt;dt&gt;Linux Foundation  &lt;dd&gt;Its publication includes some interesting papers which can be accessed &lt;a href="http://www.linuxfoundation.org/collaborate/publications/"&gt;http://www.linuxfoundation.org/collaborate/publications/&lt;/a&gt;. &lt;/dd&gt;&lt;/dl&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-3500830799671099245?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/3500830799671099245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=3500830799671099245' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3500830799671099245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/3500830799671099245'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/07/some-linux-notes-about-hardware.html' title='Some linux notes about hardware inspection'/><author><name>Gerald Guo</name><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-36974671.post-2329394680948278801</id><published>2009-07-09T14:38:00.001-04:00</published><updated>2009-07-09T14:38:42.759-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Synergy bugs - left and down keys don't repeat</title><content type='html'>&lt;p&gt;I am using Synergy to share keyboard and mouse between two machines. &lt;/p&gt; &lt;p&gt;However, the left and down keys don't repeat. Here is the reported bug:&lt;br&gt;&lt;a title="https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546" href="https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546"&gt;https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546&lt;/a&gt;&lt;br&gt;Also a workaround is given (&lt;a title="https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546/comments/5" href="https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546/comments/5"&gt;https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546/comments/5&lt;/a&gt;). &lt;br&gt;The idea is basically to set the two keys 'autorepeat' using following commands:&lt;pre&gt;xset r 116 #for down key
xset r 113 #for left key&lt;/pre&gt;
&lt;p&gt;You should replace with keycodes of your keyboard.&lt;br&gt;Some information about this bug is included in &lt;a title="http://ubuntuforums.org/showthread.php?t=965393" href="http://ubuntuforums.org/showthread.php?t=965393"&gt;http://ubuntuforums.org/showthread.php?t=965393&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-2329394680948278801?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/2329394680948278801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=2329394680948278801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2329394680948278801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/2329394680948278801'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/07/synergy-bugs-left-and-down-keys-don.html' title='Synergy bugs - left and down keys don&amp;#39;t repeat'/><author><name>Gerald Guo</name><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-36974671.post-5611837735371450641</id><published>2009-03-01T19:01:00.000-05:00</published><updated>2009-03-01T21:25:20.309-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><title type='text'>Non-Ascii characters in MIME headers</title><content type='html'>&lt;p&gt;Message Header Extensions for Non-ASCII Text: &lt;a title="http://tools.ietf.org/html/rfc2047" href="http://tools.ietf.org/html/rfc2047"&gt;http://tools.ietf.org/html/rfc2047&lt;/a&gt;&lt;br&gt;The text is encoded in this ways:&lt;pre&gt;   encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
   charset = token    ; 
   encoding = token   ; 
   token = 1*&amp;lt;Any CHAR except SPACE, CTLs, and especials&amp;gt;
   especials = "(" / ")" / "&amp;lt;" / "&amp;gt;" / "@" / "," / ";" / ":" / "
               &amp;lt;"&amp;gt; / "/" / "[" / "]" / "?" / "." / "="
   encoded-text = 1*&amp;lt;Any printable ASCII character other than "?" or SPACE&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Supported encodings&amp;nbsp; include "Q"(similar to quoted-printable) and "B" (Base64).&lt;br&gt;&lt;/p&gt;
&lt;p&gt;For example,&lt;pre&gt;=?gb2312?Q?[CSDN]=C2=DB=CC=B3=D3=C3=BB=A7=BC=A4=BB=EE=CD=A8=D6=AA?=&lt;/pre&gt;represents text "[CSDN]论坛用户激活通知". &lt;br&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Note&lt;/font&gt;&lt;/strong&gt;: SPACE and TAB are not allowed in encoded text. SPACE must be encoded using "&lt;em&gt;=20&lt;/em&gt;".   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5611837735371450641?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5611837735371450641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5611837735371450641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5611837735371450641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5611837735371450641'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/03/non-ascii-characters-in-email-and-http.html' title='Non-Ascii characters in MIME headers'/><author><name>Gerald Guo</name><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-36974671.post-9217887833143846518</id><published>2009-03-01T14:38:00.000-05:00</published><updated>2009-03-01T14:39:28.905-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>How to organize scientific papers?</title><content type='html'>&lt;p&gt;I have hundreds of papers to organize and the number is increasing. And then I found this post &lt;a title="http://stochastix.wordpress.com/2007/10/02/how-to-organize-scientific-papers/" href="http://stochastix.wordpress.com/2007/10/02/how-to-organize-scientific-papers/"&gt;http://stochastix.wordpress.com/2007/10/02/how-to-organize-scientific-papers/&lt;/a&gt; which is quite helpful.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt;&lt;br&gt;Zotero: &lt;a title="http://www.zotero.org/" href="http://www.zotero.org/"&gt;http://www.zotero.org/&lt;/a&gt; It is a FireFox extension.&lt;br&gt;Jabref: &lt;a title="http://jabref.sourceforge.net/" href="http://jabref.sourceforge.net/"&gt;http://jabref.sourceforge.net/&lt;/a&gt; open source reference manager&lt;br&gt;CiteULike: &lt;a title="http://www.citeulike.org" href="http://www.citeulike.org"&gt;http://www.citeulike.org&lt;/a&gt; online reference manager&lt;br&gt;Evernote: Online note management (&lt;a href="http://www.evernote.com"&gt;www.evernote.com&lt;/a&gt;)&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Commercial ones&lt;/strong&gt;&lt;br&gt;Reference Manager&lt;br&gt;EndNote&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/36974671-9217887833143846518?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/9217887833143846518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=9217887833143846518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9217887833143846518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9217887833143846518'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/03/how-to-organize-scientific-papers.html' title='How to organize scientific papers?'/><author><name>Gerald Guo</name><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-36974671.post-9221171065156350498</id><published>2009-01-30T19:48:00.000-05:00</published><updated>2009-02-01T23:17:32.256-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>Vim advanced topics</title><content type='html'>&lt;p&gt;As I am using vim frequently, gradually I find it necessary to grasp some advanced vim topics. Sometimes, search engines don't return the useful posts/resources in the first page. &lt;/p&gt; &lt;p&gt;Vim built-in functions, internal variables, data structures, etc. &lt;a title="http://vimdoc.sourceforge.net/htmldoc/eval.html" href="http://vimdoc.sourceforge.net/htmldoc/eval.html"&gt;http://vimdoc.sourceforge.net/htmldoc/eval.html&lt;/a&gt;&lt;br&gt;Filetype &lt;a title="http://www.vim.org/htmldoc/filetype.html" href="http://www.vim.org/htmldoc/filetype.html"&gt;http://www.vim.org/htmldoc/filetype.html&lt;/a&gt;&lt;br&gt;Command line mode &lt;a title="http://vimdoc.sourceforge.net/htmldoc/cmdline.html" href="http://vimdoc.sourceforge.net/htmldoc/cmdline.html"&gt;http://vimdoc.sourceforge.net/htmldoc/cmdline.html&lt;/a&gt;&lt;br&gt;Options and commands: &lt;br&gt;&lt;a title="http://vimdoc.sourceforge.net/htmldoc/options.html" href="http://vimdoc.sourceforge.net/htmldoc/options.html"&gt;http://vimdoc.sourceforge.net/htmldoc/options.html&lt;/a&gt;&lt;br&gt;&lt;a title="http://vimdoc.sourceforge.net/htmldoc/various.html" href="http://vimdoc.sourceforge.net/htmldoc/various.html"&gt;http://vimdoc.sourceforge.net/htmldoc/various.html&lt;/a&gt;&lt;br&gt;Configuration: &lt;a title="http://peox.net/articles/vimconfig.html" href="http://peox.net/articles/vimconfig.html"&gt;http://peox.net/articles/vimconfig.html&lt;/a&gt;&lt;br&gt;Other topics (FAQs): &lt;a title="http://www.cs.utah.edu/~kad/vim/vimnotes.shtml#17" href="http://www.cs.utah.edu/~kad/vim/vimnotes.shtml#17"&gt;http://www.cs.utah.edu/~kad/vim/vimnotes.shtml#17&lt;/a&gt;&lt;br&gt;Vim Buffer Resources&lt;br&gt;&lt;a title="http://www.vim.org/htmldoc/windows.html" href="http://www.vim.org/htmldoc/windows.html"&gt;http://www.vim.org/htmldoc/windows.html&lt;/a&gt;&lt;br&gt;&lt;a title="http://vim.wikia.com/wiki/Vim_buffer_FAQ" href="http://vim.wikia.com/wiki/Vim_buffer_FAQ"&gt;http://vim.wikia.com/wiki/Vim_buffer_FAQ&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;File manipulation commands:&lt;/strong&gt;  &lt;table cellspacing="0" cellpadding="3" width="825" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="193" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Information getting&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="198"&gt;Ctrl+g, :f, :file&lt;/td&gt; &lt;td valign="top" width="626"&gt;print some info of current file in command line&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="202"&gt;:ls, :buffers, :files&lt;/td&gt; &lt;td valign="top" width="622"&gt;list &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="206"&gt;{count}Ctrl+g&lt;/td&gt; &lt;td valign="top" width="619"&gt;1Ctrl+g: print current file name with full path&lt;br&gt;2Ctrl+g: currentbuffer number is printed also&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="209"&gt;g Ctrl+g&lt;/td&gt; &lt;td valign="top" width="617"&gt; &lt;p&gt;print cursor position in 5 ways:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column, Line, Word, Character and Byte.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="211"&gt;{Visual} g Ctrl+g&lt;/td&gt; &lt;td valign="top" width="615"&gt; &lt;p&gt;print Word, Character, Line, and Byte counts of selected text&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="213" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Editing switch&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="215"&gt;:view {file}&lt;/td&gt; &lt;td valign="top" width="612"&gt;same as :edit, except the file is opened in readonly mode.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="216"&gt;:file name&lt;/td&gt; &lt;td valign="top" width="611"&gt;set current file name to &lt;em&gt;name&lt;/em&gt;. The old name becomes alternate file name.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="217"&gt;:0file&lt;/td&gt; &lt;td valign="top" width="610"&gt;Remove the name of the current buffer.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="218"&gt;:edit[!]&lt;/td&gt; &lt;td valign="top" width="609"&gt;Re-load current file. Useful when the file is modified outside of vim.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:edit[!] {file}&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit a new file.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;Ctrl + ^&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit alternate file(equivalent to ":e #").By default, the alternate file is the previously edited file&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{count} Ctrl + ^&lt;/td&gt; &lt;td valign="top" width="609"&gt;go to a specific buffer&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:edit #[count]&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit the [count]th buffer &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:b[uffer] [count]&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit the [count]th buffer &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:enew[!]&lt;/td&gt; &lt;td valign="top" width="609"&gt;edit a new unnamed buffer&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Find and Edit&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:find[!] {file}&lt;/td&gt; &lt;td valign="top" width="609"&gt;Find {file} in &lt;em&gt;path&lt;/em&gt; and then edit&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{count}find[!] {file}&lt;/td&gt; &lt;td valign="top" width="609"&gt;Find {count}-th {file} in &lt;em&gt;path&lt;/em&gt; and then edit&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;[count] gf&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit the [count]-th file in &lt;em&gt;path&lt;/em&gt; whose name is under the cursor. If [count] is omitted, just get the first match. &lt;strong&gt;The file in opened in current window.&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;[count] Ctrl-w gf&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit the [count]-th file in &lt;em&gt;path&lt;/em&gt; whose name is under the cursor. &lt;strong&gt;It is opened in a new tab.&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;[count] Ctrl-w f&lt;/td&gt; &lt;td valign="top" width="609"&gt;Edit the [count]-th file in &lt;em&gt;path&lt;/em&gt; whose name is under the cursor. &lt;strong&gt;It is opened in a newly split window in current tab.&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;{Visual}[count]gf&lt;/td&gt; &lt;td valign="top" width="609"&gt;selected text is used as filename to search &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;[count]gF&lt;/td&gt; &lt;td valign="top" width="609"&gt;Similar to the commands above. If a number follows the filename, after opening the file, cursor would be moved to the specified position.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;{Visual}[count]gF&lt;/td&gt; &lt;td valign="top" width="609"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Writing&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:w[rite][!]&lt;/td&gt; &lt;td valign="top" width="609"&gt;write current buffer to current file.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{range}w[rite][!]&lt;/td&gt; &lt;td valign="top" width="609"&gt;write specified lines to current file&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{range}w[rite][!] {file}&lt;/td&gt; &lt;td valign="top" width="609"&gt;write specified lines (or whole buffer) to {file}&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{range}w[rite][!] &amp;gt;&amp;gt;&lt;/td&gt; &lt;td valign="top" width="609"&gt;append specified lines to current file&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{range}w[rite][!] &amp;gt;&amp;gt; {file}&lt;/td&gt; &lt;td valign="top" width="609"&gt;append specified lines to {file}&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:[range]w[rite] !{cmd}&lt;/td&gt; &lt;td valign="top" width="609"&gt;feed specified lines into {cmd} as standard input&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Insert a file&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:r[ead] [file]&lt;/td&gt; &lt;td valign="top" width="609"&gt;insert file {file} after the cursor&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:{range}r[ead] {name}&lt;/td&gt; &lt;td valign="top" width="609"&gt;insert file {file} below the specified line&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="219"&gt;:[range]r[ead] !{cmd}&lt;/td&gt; &lt;td valign="top" width="609"&gt;Execute {cmd} and insert its standard output after the cursor or below the specified line. E.g. :read !ls&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Window manipulation&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;&lt;/p&gt; &lt;table cellspacing="0" cellpadding="3" width="866" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" align="middle" width="220"&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="644"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="223"&gt;Ctrl-w s, Ctrl-w Ctrl-s&lt;br&gt;:[N]sp[lit] [file]&lt;/td&gt; &lt;td valign="top" width="641"&gt;Split current window into two horizontally.Option &lt;em&gt;splitbelow&lt;/em&gt; controls where to put newly created window.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="226"&gt;Ctrl-w v, Ctrl-w Ctrl-v&lt;br&gt;:[N]vsp[lit] [file]&lt;/td&gt; &lt;td valign="top" width="639"&gt;Split current window into two vertically. Option &lt;em&gt;splitright&lt;/em&gt; controls where to put newly created window.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="228"&gt;Ctrl-w n, Ctrl-w Ctrl-n&lt;br&gt;:[N]new [file]&lt;/td&gt; &lt;td valign="top" width="638"&gt;Create a new window with an empty file in it or with the specified file. split horizontally&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="229"&gt;:[N]vnew [file]&lt;/td&gt; &lt;td valign="top" width="637"&gt;Create a new window with an empty file in it or with the specified file. split vertically.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="230"&gt;:[N]sv[iew] {file}&lt;/td&gt; &lt;td valign="top" width="636"&gt;same as :split, but set 'readonly' option&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:[N]sf[find] {file}&lt;/td&gt; &lt;td valign="top" width="636"&gt;same as :split, search for {file} in &lt;em&gt;path&lt;/em&gt;.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w Ctrl-^, Ctrl-w ^&lt;/td&gt; &lt;td valign="top" width="636"&gt;Does ":split #". Split window into two and edit alternate file. &lt;br&gt;When a count is given, it is equivalent to ":split #N". Split and edit buffer N&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Explictly set position of window&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:vertical {cmd}&lt;/td&gt; &lt;td valign="top" width="636" rowspan="5"&gt;Explicitly set position of a newly created window which is generated by invoking {cmd}&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:leftabove {cmd}&lt;br&gt;:aboveleft {cmd}&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:rightbelow {cmd}&lt;br&gt;:belowright {cmd}&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:topleft&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;:botright&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" colspan="2"&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Cursor movement and window movement&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w k&lt;br&gt;Ctrl-w j&lt;br&gt;Ctrl-w h&lt;br&gt;Ctrl-w l&lt;/td&gt; &lt;td valign="top" width="636"&gt;Move cursor to &lt;em&gt;N&lt;/em&gt;th window above current one.&lt;br&gt;Move cursor to &lt;em&gt;N&lt;/em&gt;th window below current one&lt;br&gt;Move cursor to &lt;em&gt;N&lt;/em&gt;th window left of current one&lt;br&gt;Move cursor to &lt;em&gt;N&lt;/em&gt;th window right of current one&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w w&lt;br&gt;Ctrl-w W&lt;br&gt;Ctrl-w t&lt;br&gt;Ctrl-w b&lt;br&gt;Ctrl-w p&lt;/td&gt; &lt;td valign="top" width="636"&gt;move cursor to window below/right of current one.&lt;br&gt;move cursor to window above/left of current one.&lt;br&gt;move cursor to top-left window&lt;br&gt;move cursor to bottom-right window&lt;br&gt;move cursor to previous window&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w K&lt;br&gt;Ctrl-w J&lt;br&gt;Ctrl-w H&lt;br&gt;Ctrl-w L&lt;/td&gt; &lt;td valign="top" width="636"&gt;move window to be at the very top, with full width of screen&lt;br&gt;at the very bottom, with full width of screen&lt;br&gt;at the far left, with full height of screen&lt;br&gt;at the far right, with full height of screen&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w r&lt;br&gt;Ctrl-w R&lt;/td&gt; &lt;td valign="top" width="636"&gt;rotate windows downwards/rightwards&lt;br&gt;upwards, leftwards&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w x&lt;/td&gt; &lt;td valign="top" width="636"&gt;exchange current window with next one or with &lt;em&gt;N&lt;/em&gt;th window if count is given. The two exchanged windows must be located in the same row or column.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="231"&gt;Ctrl-w T&lt;/td&gt; &lt;td valign="top" width="636"&gt;Move current window to a new tab&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff" size="3"&gt;Buffer&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;A buffer is a file loaded into memory for editing.&lt;br&gt;Unlisted buffer: It means it exists, but it is not listed in buffer list. &lt;br&gt;active buffer:&amp;nbsp; (1) displayed in a window (2) loaded&lt;br&gt;hidden buffer:&amp;nbsp; (1) is not displayed in a window, (2) loaded into memory&lt;br&gt;inactive buffer:(1) is not displayed (2) not loaded (3) Options are remembered. &lt;br&gt;unlisted buffer: some buffers are not listed in buffer list. when you apply :bdelete or :bwipeout to a buffer, it would be deleted from buffer list. &lt;br&gt;hidden buffer -&amp;gt; unhidden buffer: start to edit it with any command or delete it with :bdelete command.&lt;/p&gt; &lt;p&gt;:q[uit] [!]&amp;nbsp; quit current window. The buffer becomes inactive.&lt;br&gt;&lt;strong&gt;For following three commands, modified buffers are never abandoned (never becomes inactive).&lt;/strong&gt;&lt;br&gt;:close [!]&amp;nbsp;&amp;nbsp; close current window. (1) if 'hidden' is set, the buffer becomes hidden&amp;nbsp; (2) else abandon it (becomes inactive).&lt;br&gt;:hid[e]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Quite current window and state of the buffer depends on option &lt;em&gt;bufhidden&lt;/em&gt;.&lt;br&gt;:only[!]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Make the current window the only one in current tab. All other windows are closed.&lt;br&gt;&lt;/p&gt; &lt;p&gt;Direct buffer editing command &lt;pre style="color: #aa7711"&gt;# Remove association between a buffer and a file. The buffer is now just a buffer without any content.&lt;br&gt;:bd[elete][!] [N]      Unload buffer [N] (default: current buffer) and delete it from buffer list.
:bdelete[!] {bufname}  Unload and delete buffer corresponding to {bufname}
:bdelete[!] N1 N2 ...  Unload and delete buffer N1, N2, ...
:N,Mbdelete[!]         Unload and delete all buffers in range N to M

&lt;br&gt;&lt;/pre&gt;&lt;pre style="color: #aa7711"&gt;# The buffer is removed thoroughly which means the buffer does not exist any more.&lt;br&gt;&lt;br&gt;:[N]bwipout[!]             Like :bdelete, but really delete the buffer. 
:bw[ipeout][!] {bufname}   Everything releated to the buffer is lost.
:N,Mbw[ipeout][!]
:bw[ipeout][!] N1 N2 ...

&lt;/pre&gt;&lt;pre style="color: #aa7711"&gt;# memory is freed. When you switch to that buffer later, the content would be read from the file.&lt;br&gt;:[N]bun[load][!]       The memory allocated for those specified
:bun[load][!] [N]      buffers is freed. But the buffers remain in the
:bunload[!]{bufname}   buffer list.
:N,Mbunload[!]
:bunload[!] N1 N2 ...
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Important options:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;hidden&lt;/strong&gt;: off - a buffer is unloaded when it is abandoned. &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; When (1) the buffer is modified and&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;&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; (2) 'autowrite' is off or writing is not possible&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;&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; (3) the '!' flag was used.&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a buffer becomes hidden even if hidden option is off.&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; on&amp;nbsp; - a buffer becomes hidden when it is abandoned.&lt;br&gt;&lt;strong&gt;bufhidden&lt;/strong&gt;: what happens when a buffer becomes hidden.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;empty&amp;gt; - follow &lt;em&gt;hidden&lt;/em&gt; option&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hide&amp;nbsp; - the buffer becomes hidden (not unloaded)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unload&amp;nbsp; - unload the buffer&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete -&amp;nbsp; delete the buffer from buffer list (like using :bdelete)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wipe - wipe out buffer from buffer list (like using :bwipeout)&lt;br&gt;&lt;strong&gt;When "unload", "delete" or "wipe" is used, changes in a buffer are load without any warning.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Usually, if option &lt;em&gt;hidden &lt;/em&gt;is on, the operations of buffer manipulation commands depend on option &lt;em&gt;bufhidden&lt;/em&gt;.&lt;br&gt;If option &lt;em&gt;hidden&lt;/em&gt; is off, buffer is unloaded&lt;/p&gt;
&lt;p&gt;&lt;br&gt;A list of &lt;strong&gt;buffer/arg switch&lt;/strong&gt; command from vim help doc:&lt;/p&gt;&lt;pre style="color: #aa7711"&gt;args list		       buffer list	   meaning ~
1. :[N]argument [N]	11. :[N]buffer [N]	to arg/buf N
2. :[N]next [file ..]	12. :[N]bnext [N]	to Nth next arg/buf
3. :[N]Next [N]		13. :[N]bNext [N]	to Nth previous arg/buf
4. :[N]previous	[N]	14. :[N]bprevious [N]	to Nth previous arg/buf
5. :rewind / :first	15. :brewind / :bfirst	to first arg/buf
6. :last		16. :blast		to last arg/buf
7. :all			17. :ball		edit all args/buffers
			18. :unhide		edit all loaded buffers
			19. :[N]bmod [N]	to Nth modified buf

  split &amp;amp; args list	  split &amp;amp; buffer list	   meaning ~
21. :[N]sargument [N]   31. :[N]sbuffer [N]	split + to arg/buf N
22. :[N]snext [file ..] 32. :[N]sbnext [N]      split + to Nth next arg/buf
23. :[N]sNext [N]       33. :[N]sbNext [N]      split + to Nth previous arg/buf
24. :[N]sprevious [N]   34. :[N]sbprevious [N]  split + to Nth previous arg/buf
25. :srewind / :sfirst	35. :sbrewind / :sbfirst split + to first arg/buf
26. :slast		36. :sblast		split + to last arg/buf
27. :sall		37. :sball		edit all args/buffers
			38. :sunhide		edit all loaded buffers
			39. :[N]sbmod [N]	split + to Nth modified buf

40. :args		list of arguments
41. :buffers		list of buffers&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;More Misc. commands&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;:scriptnames&amp;nbsp;&amp;nbsp;&amp;nbsp; a list of sourced script files in the order they were first sourced.&lt;br&gt;:verbose set [option]&lt;br&gt;:verbose map&lt;br&gt;:echo g:colors_name&lt;br&gt;:Ctrl-w T&lt;br&gt;:read !{cmd}&lt;br&gt;:tab {cmd}&amp;nbsp;&amp;nbsp;&amp;nbsp; execute the external command and open the result file in a new tab. E.g. :tab split&lt;br&gt;:tab split filename&lt;br&gt;:tabedit filename&lt;br&gt;:tab ball&amp;nbsp;&amp;nbsp;&amp;nbsp; open all buffers, each in a separate tab page.&lt;br&gt;:tabnew |r !dir&amp;nbsp;&amp;nbsp;&amp;nbsp; execute command &lt;em&gt;dir&lt;/em&gt; and redirect its output to a file opened in a new tab page.&lt;br&gt;:tabnew |:E&lt;br&gt;:echo functionname(argument)&amp;nbsp; call an internal function and returns the output&lt;br&gt;:call functionname(argument)&amp;nbsp;&amp;nbsp;&amp;nbsp; call an internal function and returned value is discarded.&lt;br&gt;:exe string_expr&amp;nbsp;&amp;nbsp;&amp;nbsp; execute the commands contained in the string in Ex mode.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Windows file association&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;For example, if you want to associate .txt files with vim, use following commands:&lt;/p&gt;&lt;pre&gt;	ftype VIM="e:\program files\vim\vim72\gvim.exe" --remote-tab-silent "%1"
	assoc .txt=VIM&lt;/pre&gt;Replace the path with your own vim installation directory..&lt;br&gt;If you want to maximize the window, use &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;&amp;nbsp; ftype VIM="e:\program files\vim\vim72\gvim.exe" &lt;strong&gt;-c "simalt ~x"&lt;/strong&gt; --remote-tab-silent "%1"  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-9221171065156350498?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/9221171065156350498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=9221171065156350498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9221171065156350498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/9221171065156350498'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/vim-advanced-topics.html' title='Vim advanced topics'/><author><name>Gerald Guo</name><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-36974671.post-8580901379073358381</id><published>2009-01-26T22:39:00.000-05:00</published><updated>2009-01-26T22:41:14.142-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>More VIM text editing command</title><content type='html'>&lt;p&gt;The more I use VIM, the more it surprises me.&lt;br&gt;Here, I list some useful commands in everyday text editing. I have known some of them for long time. But others were learnt recently.&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2" width="914" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" align="middle" width="106"&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="382"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="425"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106" colspan="3"&gt;&lt;strong&gt;Delete&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;cc&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete current lines and change to insert mode&lt;/td&gt; &lt;td valign="top" width="424"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;dd&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete current lines&lt;/td&gt; &lt;td valign="top" width="424"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;c{motion}&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete until the character {motion} moves to and change to insert mode.&lt;/td&gt; &lt;td valign="top" width="423"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;d{motion}&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete until the character {motion} moves to &lt;/td&gt; &lt;td valign="top" width="422"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;C&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete characters until the end of the line. Then change to insert mode&lt;/td&gt; &lt;td valign="top" width="421"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;D&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete characters until the end of the line. &lt;/td&gt; &lt;td valign="top" width="420"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;s&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete [count] characters and change to insert mode&lt;/td&gt; &lt;td valign="top" width="418"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;x&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete [count] characters under and after the cursor&lt;/td&gt; &lt;td valign="top" width="418"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;:[range]d&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete those lines in the range&lt;/td&gt; &lt;td valign="top" width="417"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;S&lt;/td&gt; &lt;td valign="top" width="382"&gt;delete [count] lines and change to insert mode&lt;/td&gt; &lt;td valign="top" width="416"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106" colspan="3"&gt;&lt;strong&gt;Replace&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;R&lt;/td&gt; &lt;td valign="top" width="382"&gt;Enter Replace mode&lt;/td&gt; &lt;td valign="top" width="416"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;gR&lt;/td&gt; &lt;td valign="top" width="382"&gt;&amp;nbsp;&lt;/td&gt; &lt;td valign="top" width="415"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106" colspan="3"&gt;&lt;strong&gt;Line joining&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;[range]J&lt;/td&gt; &lt;td valign="top" width="382"&gt;join [count] lines&lt;/td&gt; &lt;td valign="top" width="415" rowspan="3"&gt; &lt;p&gt;Steps of execution of these commands&lt;br&gt;(1) delete leading white space on the next line,&lt;br&gt;(2) if there is trailing white space for current line the next line starts with a ')',&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete &amp;lt;EOL&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if the 'joinspaces' option is on and current line ends up with a '.', '!' or '?'&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace &amp;lt;EOL&amp;gt; with two spaces&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace &amp;lt;EOL&amp;gt; with one space &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;{Visual}J&lt;/td&gt; &lt;td valign="top" width="382"&gt;join the selected lines&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;:[range]j[!]&lt;/td&gt; &lt;td valign="top" width="382"&gt;join range lines. With !, the join doesn't insert/remove any spaces.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;[range]gJ&lt;/td&gt; &lt;td valign="top" width="382"&gt;join [count] lines&lt;/td&gt; &lt;td valign="top" width="415" rowspan="2"&gt;Don't insert or delete any spaces.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="106"&gt;{VIsual}gJ&lt;/td&gt; &lt;td valign="top" width="382"&gt;join the selected lines&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;Some commands useful in source code editing&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2" width="454" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" align="middle" width="136"&gt;&lt;strong&gt;Commands&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="316"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;&amp;lt;{motion}&lt;/td&gt; &lt;td valign="top" width="316"&gt;shift covered lines leftwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;&amp;gt;{motion}&lt;/td&gt; &lt;td valign="top" width="316"&gt;shift covered lines rightwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;{Visual}[count]&amp;lt;&lt;/td&gt; &lt;td valign="top" width="316"&gt;shift selected lines leftwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;{Visual}[count]&amp;gt;&lt;/td&gt; &lt;td valign="top" width="316"&gt;shift selected lines rightwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;[range]&amp;lt; &lt;/td&gt; &lt;td valign="top" width="316"&gt;shift selected lines leftwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;[range]&amp;gt;&lt;/td&gt; &lt;td valign="top" width="316"&gt;shift selected lines rightwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;&amp;lt;&amp;lt;&lt;/td&gt; &lt;td valign="top" width="316"&gt;shit current line leftwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="136"&gt;&amp;gt;&amp;gt;&lt;/td&gt; &lt;td valign="top" width="316"&gt;shit current line rightwards by 1 &lt;em&gt;shiftwidth&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;Resource&lt;/strong&gt;&lt;br&gt;&lt;a title="http://www.vim.org/htmldoc/change.html" href="http://www.vim.org/htmldoc/change.html"&gt;http://www.vim.org/htmldoc/change.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8580901379073358381?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8580901379073358381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8580901379073358381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8580901379073358381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8580901379073358381'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/more-vim-text-editing-command.html' title='More VIM text editing command'/><author><name>Gerald Guo</name><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-36974671.post-5780358260881236823</id><published>2009-01-26T13:39:00.000-05:00</published><updated>2009-01-26T13:49:24.510-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>Text formatting in VIM</title><content type='html'>&lt;p&gt;&lt;strong&gt;How to set options for VIM?&lt;/strong&gt;  &lt;div style="margin-left: 1em"&gt;using &lt;em&gt;set&lt;/em&gt; command.&lt;br&gt;Examples:  &lt;table cellspacing="0" cellpadding="3" width="614" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" align="middle" width="193"&gt;&lt;strong&gt;Setting&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="419"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="196"&gt;set paste&lt;/td&gt; &lt;td valign="top" width="419"&gt;set options for commands that don't need parameters.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="199"&gt;set filetype=java&lt;/td&gt; &lt;td valign="top" width="419"&gt;Directly set options for commands that accept parameters.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="201"&gt;set guioptions-=option&lt;/td&gt; &lt;td valign="top" width="419"&gt;Remove a specific option from the configuration of a command.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="202"&gt;set guioptions+=option&lt;/td&gt; &lt;td valign="top" width="419"&gt;Add a specific option to the configuration of a command.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Basic concept&lt;/strong&gt; &lt;br&gt;Sentence/Paragraph/Section: &lt;a href="http://www.vim.org/htmldoc/motion.html#sentence" target="_blank"&gt;http://www.vim.org/htmldoc/motion.html#sentence&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Text format&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;&lt;a title="http://www.vim.org/htmldoc/change.html#formatting" href="http://www.vim.org/htmldoc/change.html#formatting"&gt;http://www.vim.org/htmldoc/change.html#formatting&lt;/a&gt;&lt;br&gt;&lt;strong&gt;Alignment&lt;/strong&gt;&lt;br&gt;&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2" width="586" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" align="middle" width="204"&gt;&lt;strong&gt;Setting&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="279"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt; &lt;td valign="top" align="middle" width="102"&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="203"&gt;&lt;tt&gt;:[range]ce[nter] [width]&lt;/tt&gt;&lt;/td&gt; &lt;td valign="top" width="279"&gt;center lines&lt;/td&gt; &lt;td valign="top" width="102"&gt;:.,+3 center 80&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="201"&gt;&lt;tt&gt;:[range]ri[ght] [width]&lt;/tt&gt;&lt;/td&gt; &lt;td valign="top" width="279"&gt;right alignment&lt;/td&gt; &lt;td valign="top" width="102"&gt;:% right&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="200"&gt;&lt;tt&gt;:[range]le[ft] [indent]&lt;/tt&gt;&lt;/td&gt; &lt;td valign="top" width="279"&gt;left alignment.(Unit of identation is space)&lt;/td&gt; &lt;td valign="top" width="102"&gt;:left 4&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;Format&lt;/strong&gt;&lt;br&gt;&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2" width="589" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="75"&gt; &lt;p align="center"&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="266"&gt; &lt;p align="center"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="77"&gt; &lt;p align="center"&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="165"&gt; &lt;p align="center"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="75"&gt;gq{motion}&lt;/td&gt; &lt;td valign="top" width="266"&gt;Format lines that {motion} moves over.&lt;br&gt;Cursor is put where {motion} moves to&lt;/td&gt; &lt;td valign="top" width="80"&gt;gqap&lt;br&gt;format a paragraph&lt;/td&gt; &lt;td valign="top" width="166" rowspan="2"&gt;Motion:&lt;br&gt;&lt;a title="http://www.vim.org/htmldoc/motion.html#object-motions" href="http://www.vim.org/htmldoc/motion.html#obtions"&gt;http://www.vim.org/&lt;br&gt;htmldoc/motion.html&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="75"&gt;gw{motion}&lt;/td&gt; &lt;td valign="top" width="266"&gt;Format lines that {motion} moves over.&lt;br&gt;Put cursor back to the original position.&lt;/td&gt; &lt;td valign="top" width="82"&gt;gwj&lt;/td&gt; &lt;tr&gt; &lt;td valign="top" width="75"&gt;gqgq&lt;br&gt;gqq&lt;/td&gt; &lt;td valign="top" width="266"&gt;Format current line&lt;/td&gt; &lt;td valign="top" width="84"&gt;&amp;nbsp;&lt;/td&gt; &lt;td valign="top" width="166"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="75"&gt;{Visual}gq&lt;/td&gt; &lt;td valign="top" width="266"&gt;Format highlighted text&lt;/td&gt; &lt;td valign="top" width="86"&gt;&amp;nbsp;&lt;/td&gt; &lt;td valign="top" width="166"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;How to control formatting setting of &lt;em&gt;gq&lt;/em&gt; command?&lt;/strong&gt;&lt;br&gt;Formatting does not change &lt;strong&gt;empty&lt;/strong&gt; lines, but it changes lines only containing white spaces. &lt;/p&gt; &lt;p&gt;(1) textwidth&lt;br&gt;This option controls length of every formatted line.&lt;br&gt;If option &lt;em&gt;textwidth&lt;/em&gt; is 0, the formatted line length is the screen width (max value is 79).&lt;/p&gt; &lt;p&gt;(2) autoindent&lt;br&gt;If this option is on, Vim uses indent of the first line for the following lines.&lt;/p&gt; &lt;p&gt;(3) joinspaces (boolean)&lt;br&gt;Used when lines are joined together. By default, it is on. Use &lt;em&gt;set nojoinspaces&lt;/em&gt; to turn it off.&lt;/p&gt; &lt;p&gt;(4) formatprg&lt;br&gt;Set an external program to format text. In this case, the &lt;em&gt;textwidth&lt;/em&gt; and other options have no effect on text formatting.&lt;/p&gt; &lt;p&gt;(5) formatoptions&lt;br&gt;Most useful options:&lt;br&gt;&lt;strong&gt;t&lt;/strong&gt;: Auto-wrap text using &lt;em&gt;textwidth&lt;/em&gt;. (does not apply to comments)&lt;br&gt;&lt;strong&gt;c&lt;/strong&gt;: Auto-wrap commens using &lt;em&gt;textwidth&lt;/em&gt;. &lt;br&gt;&lt;strong&gt;q&lt;/strong&gt;: Allow formatting of comments with &lt;em&gt;gq&lt;/em&gt; command. When using &lt;em&gt;gq&lt;/em&gt; command in comments, blank lines and lines only with comment leaders and white spaces are considered as paragraph delimiters. &lt;br&gt;&lt;strong&gt;r&lt;/strong&gt;: auto insert comment leader after hitting 'Enter' in Insert mode.&lt;br&gt;&lt;strong&gt;o&lt;/strong&gt;: auto insert comment leader after hitting 'o' or 'O'.&lt;br&gt;&lt;strong&gt;a&lt;/strong&gt;: auto format paragraphs when text is inserted or deleted. &lt;br&gt;&lt;strong&gt;w&lt;/strong&gt;: A trailing non white space ends a paragraph. &lt;br&gt;&lt;strong&gt;&lt;font style="color: #ff0000"&gt;Note: Formatting would be applied anyway no matter whether the paragraphs are delimited correctly.&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;You can use &lt;em&gt;set formatoptions-=a&lt;/em&gt; to disable automatic formatting. &lt;br&gt;More options: &lt;a title="http://www.vim.org/htmldoc/change.html#fo-table" href="http://www.vim.org/htmldoc/change.html#fo-table"&gt;http://www.vim.org/htmldoc/change.html#fo-table&lt;/a&gt;&lt;/p&gt; &lt;p&gt;(6) comments&lt;br&gt;This option controls how to format comments (usually in source code).&lt;br&gt;Default value is&amp;nbsp; &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:&amp;gt;,fb:-"&lt;/pre&gt;&lt;strong&gt;s&lt;/strong&gt;: start of a three-piece comment&lt;br&gt;&lt;strong&gt;s{digit}:&lt;/strong&gt; add extra indent to middle part. Unit is space (not tab).&lt;br&gt;&lt;strong&gt;s-{digit}:&lt;/strong&gt; remove extra indent to middle part. Unit is space (not tab).&lt;br&gt;&lt;strong&gt;m:&lt;/strong&gt; middle part of a three-piece comment. Middle part is left adjusted with start part of the comment by default. This is controlled by option &lt;em&gt;&lt;strong&gt;l&lt;/strong&gt;&lt;/em&gt;. &lt;br&gt;&lt;strong&gt;b&lt;/strong&gt;: blanks required after the specified string. &lt;br&gt;&lt;strong&gt;e&lt;/strong&gt;: end of a three-piece comment&lt;br&gt;&lt;strong&gt;x&lt;/strong&gt;: In C++ comment, just type &lt;em&gt;/&lt;/em&gt; to end a comment when middle-comment string is inserted. The space between middle-part and / would be removed automatically. &lt;br&gt;&lt;strong&gt;n&lt;/strong&gt;: recognize numbered list(see below for details)&lt;br&gt;More options: &lt;a title="http://www.vim.org/htmldoc/change.html#format-comments" href="http://www.vim.org/htmldoc/change.html#format-comments"&gt;http://www.vim.org/htmldoc/change.html#format-comments&lt;/a&gt; &lt;br&gt;My setting is&lt;pre&gt;set textwidth=79
set formatoptions=tcqron&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to format numbered lists?&lt;/strong&gt;&lt;br&gt;This sometimes is really tricky. &lt;br&gt;See this post: &lt;a title="http://objectmix.com/editors/332035-vim-how-create-bullet-list-numbered-list.html" href="http://objectmix.com/editors/332035-vim-how-create-bullet-list-numbered-list.html"&gt;http://objectmix.com/editors/332035-vim-how-create-bullet-list-numbered-list.html&lt;/a&gt;&lt;br&gt;Usually, &lt;em&gt;textwidth&lt;/em&gt; must be set and &lt;em&gt;formatoptions&lt;/em&gt; must include &lt;em&gt;nwt&lt;/em&gt;. &lt;br&gt;Also see option &lt;a href="http://vimdoc.sourceforge.net/htmldoc/options.html#'formatlistpat'" target="_blank"&gt;formatlistpat(flp)&lt;/a&gt; for how to set list header. That is used by vim to recognize numbered lists. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5780358260881236823?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5780358260881236823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5780358260881236823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5780358260881236823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5780358260881236823'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/text-formatting-in-vim.html' title='Text formatting in VIM'/><author><name>Gerald Guo</name><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-36974671.post-7230394843385767593</id><published>2009-01-22T16:46:00.000-05:00</published><updated>2009-01-22T16:47:17.872-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rfc'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>MyProxy and proxy certificate</title><content type='html'>&lt;p&gt;All of following discussion is based on PKI (public key infrastructure).&lt;/p&gt; &lt;p&gt;&lt;strong&gt;What's important in terms of security?&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;integrity&lt;/font&gt;&lt;/strong&gt; of the user's identity credential(certificate + public/private key pair).&lt;br&gt;Note: What is important is not just a single part of the credential, but also integrity of different parts. If a certain component is compromised, the whole credential is not secure any more. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;how to protect private key?&lt;/strong&gt;&lt;br&gt;(1) Store it in desktop&lt;br&gt;May not be a good idea because usaually desktop is not protected professionally. It is vulnerable to keystrok loggers, trojan ...&lt;br&gt;(2) Smart card&lt;br&gt;A specific piece of hardware provides improved security for key storage. &lt;br&gt;Pros: allows keys to be used for signing and encryption without allowing the keys to be exported from the card's protected memory.&lt;br&gt;Cons: cost and support&lt;br&gt;(3) Virtual smart card&lt;br&gt;Similar to the physical smart card approach. It is a software system which protects private keys on secure servers without allowing the keys to be exported.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Grid computing&lt;/strong&gt;&lt;br&gt;Usually, the user has a certificate issued by a CA and it has long life time (maybe several years). Before successul running of a task, the certificate must be authenticated by grid infrastructure. Tasks may be submitted and launched from different hosts. &lt;br&gt;(*) So it is not convenient to ask users to copy their credentials manually across different machines. &lt;br&gt;(*) It is not secure to put long-term credentials to many hosts in the grid. &lt;br&gt;It would be great if users can obtain a short-time(hours or days) credential which can be used for authentication during execution of a task. &lt;br&gt;There are two solutions:&lt;br&gt;(1) Online CA&lt;br&gt;Every time the user needs a short-time credential, he/she just sends certificate request to CA and CA returns the newly created certificate. &lt;br&gt;Drawback: cost. Adding a new CA needs a lot of extra work in terms of time, money, negotiating policies...&lt;br&gt;(2) Online credential repository&lt;br&gt;This solution makes use of X.509 proxy certificate described below.&amp;nbsp; &lt;br&gt;MyProxy uses the third approach. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff" size="4"&gt;Proxy Certificate&lt;/font&gt; (&lt;a href="http://www.faqs.org/rfcs/rfc3820.html" target="_blank"&gt;RFC 3820&lt;/a&gt;)&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;Key idea&lt;/strong&gt;: An entity delegates its rights or a subset of its rights to another entity which can behave on behalf of the original entity. &lt;br&gt;Security&lt;br&gt;Restrictions can be placed on the PC be means of policies. &lt;br&gt;&lt;strong&gt;Terminology&lt;/strong&gt;&lt;br&gt;EEC(End Entity Certificate): an X.509 Public Key Certificate issued to an end entity by a CA.&lt;br&gt;PC(Proxy Certificate): can be issued by EEC or another PC.&lt;br&gt;PI(Proxy Issuer): an entity with an EEC or PC that issues a PC. The issued PC is signed using the corresponding private key. &lt;br&gt;&lt;strong&gt;Properties of PC&lt;/strong&gt;&lt;br&gt;(*) Signed by EEC or PC&lt;br&gt;(*) It can sign another PC. Cannot sign EEC&lt;br&gt;(*) Its public/private key pair is different from that of the proxy issuer.&lt;br&gt;(*) Its identity is derived from identity of the original ECC that signed the PC. &lt;br&gt;Note: its identity is unique so that it can be used as an independent identity. &lt;br&gt;(*) It contains a new X.509 extension to indicate that it is a PC and to place restrictions on use of the PC. &lt;br&gt;&lt;strong&gt;Procedure&lt;/strong&gt;&lt;br&gt;If an entity A wants to delegate its rights to entity B, the procedure is&lt;br&gt;(1) Entity B creates a private/public key pair&lt;br&gt;(2) Entity B creates a request for a PC and sends it to entity A&lt;br&gt;(3) Entity A creates a PC, singed by the private key of A's certificate (EEC or another PC). &lt;br&gt;In this process, restrictions can be placed on the newly created PC. For example, validity period...&lt;br&gt;(4) Entity A sends the certificate back to entity B. &lt;br&gt;&lt;font color="#ff0000"&gt;Note: the private key of entity A is stored on the local file system.&lt;/font&gt; &lt;br&gt;&lt;strong&gt;Significant advantages&lt;/strong&gt;&lt;br&gt;Private keys are never transferred over the internet.&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="4"&gt;How MyProxy works?&lt;/font&gt;&lt;br&gt;&lt;strong&gt;Proxy storing&lt;/strong&gt;&lt;br&gt;This is similar to the procedure described above in section &amp;lt;Proxy Certificate&amp;gt; / &amp;lt;Procedure&amp;gt;. Entity A is the end user and entity B is MyProxy server. In step (4), end user sends both the newly created Proxy Certificate and the entire certificate chain to the server. Also access control can be imposed by means described below. &lt;br&gt;&lt;strong&gt;Proxy retrieval&lt;/strong&gt;&lt;br&gt;Similar to proxy storing, except in reverse. Access control policies must be checked to see whether the client is allowed to retrieve the certificate. &lt;br&gt;&lt;strong&gt;Access Control&lt;/strong&gt;&lt;br&gt;Server administrator can control who can store/retrieve credentials by:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1) Requiring client-side TLS authentication&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2) Configuring a regular expression that must match the client certificate's subject for storage requests&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (3) Configuring a regular expression that must match the client certificate's subject for retrieval requests&lt;br&gt;Credential owner can control access to their certificates by : &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1) setting a password when storing the certificates &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The password is not stored in the server. It is used to encrypt server's private key which would be used to sign the proxy certificates. &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2) settting regular expression on the client certificate's subject that would retrieve the certificate.&lt;br&gt;&lt;strong&gt;Renewal&lt;/strong&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; to be filled soon&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff" size="4"&gt;To be investigated in the future&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;MyProxy and OGSI (Open Grid Services Infrastructure):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyProxy is encapsulated as web services.&lt;br&gt;MyProxy and WS-Resource Framework&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7230394843385767593?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7230394843385767593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7230394843385767593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7230394843385767593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7230394843385767593'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/myproxy-and-proxy-certificate.html' title='MyProxy and proxy certificate'/><author><name>Gerald Guo</name><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-36974671.post-6027059160869550924</id><published>2009-01-21T23:56:00.001-05:00</published><updated>2009-03-01T17:08:06.307-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='rfc'/><category scheme='http://www.blogger.com/atom/ns#' term='uri'/><title type='text'>Uniform Resource Identifier(URI) and Uniform Resource Locators (URL) - (RFC 1738 and RFC 3986)</title><content type='html'>&lt;p&gt;&lt;font color="#0000ff" size="4"&gt;Character Escape&lt;/font&gt;&lt;br&gt;URI consists of a set of characters.&lt;br&gt;uric = reserved | unreserved | escaped&lt;/p&gt;&lt;strong&gt;Reserved characters&lt;/strong&gt;&lt;br&gt;Principle: a character is reserved if the semantics of the URI &lt;strong&gt;changes&lt;/strong&gt; if the character is replaced with its escaped escaped encoding. &lt;br&gt;&lt;pre&gt;    gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
    sub-delims  = "!" / "$" / "&amp;amp;" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="&lt;/pre&gt;
&lt;p&gt;&lt;font color="#008000"&gt;&lt;/font&gt;&lt;br&gt;Their usage within URI component is limited to their reserved purpose. If the data would conflict with the reserved purpose, it must be escaped. &lt;br&gt;&lt;font color="#ff0000"&gt;Characters in the "reserved" set are NOT reserved in all contexts.&lt;/font&gt; The reserved characters in a URI component is defined by that specific component. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unreserved characters&lt;/strong&gt;&lt;br&gt;a-z A-z 0-9 "-" "_" "." "~"&lt;br&gt;These characters can be escaped WITHOUT changing the semantics of the URI. &lt;br&gt;But this should NOT be done UNLESS the escape is necessary. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disallowed characters&lt;/strong&gt;&lt;br&gt;Some characters are disallowed for various reasons. To use those characters, they MUST be escaped. &lt;br&gt;Disallowed US-ASCII Characters:&lt;br&gt;control:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;US-ASCII coded characters 0x00-0x1F and 0x7F&amp;gt;&lt;br&gt;space:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;US-ASCII coded character 0x20&amp;gt;&lt;br&gt;delimiters:&amp;nbsp; &amp;lt; &amp;gt; # % "&lt;br&gt;unwise:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { } | \ ^ [ ] ` &lt;/p&gt;&lt;strong&gt;When to escape?&lt;/strong&gt;&lt;br&gt;When a character does not have a representation using an &lt;strong&gt;unreserved&lt;/strong&gt; character, it must be escaped. It includes:&lt;br&gt;(1) data that does not correspond to printable characters (ANSII coding)&lt;br&gt;(2) disallowed characters&lt;br&gt;Note: here, whether a character is &lt;strong&gt;&lt;em&gt;unreserved&lt;/em&gt;&lt;/strong&gt; is context-specific. 
&lt;p&gt;&lt;strong&gt;Escape sequences:&lt;/strong&gt;&lt;br&gt;A "%" followed by hex representation of the character.&lt;br&gt;escaped = "%" hex hex&lt;br&gt;E.g. %20 %35 &lt;br&gt;Uppercase hexadecimal digits should be used in percent-encoding!&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="4"&gt;Syntax&lt;/font&gt;&lt;strong&gt;&lt;br&gt;Generic URI syntax:&lt;/strong&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;scheme&amp;gt;:&amp;lt;scheme-specific-part&amp;gt;&lt;br&gt;Interpretation of &lt;em&gt;scheme-specific-part&lt;/em&gt; depends on the &lt;em&gt;scheme&lt;/em&gt;. &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;scheme&amp;gt;://&amp;lt;authority&amp;gt;&amp;lt;path&amp;gt;?&amp;lt;query&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;scheme&lt;/strong&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alpha *( alpha | digit | "+" | "-" | "." )&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;authority&lt;/strong&gt;&lt;br&gt;URI component &lt;em&gt;authority&lt;/em&gt; can be internet-based server or a scheme-specific registry. &lt;br&gt;authority (server based) = username@host:port&lt;br&gt;userinfo = *( unreserved | escaped |";" | ":" | "&amp;amp;" | "=" | "+" | "$" | "," )&lt;br&gt;About domain label:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;"The rightmost domain label of a fully qualified domain name will &lt;strong&gt;never&lt;/strong&gt; start with a digit, thus syntactically distinguishing domain names from IPv4 addresses, and may be followed by a single "." if it is necessary to distinguish between the complete domain name and any local domain."&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Query&lt;/strong&gt;&lt;br&gt;query = *uric&lt;br&gt;Within a query component, the characters ";", "/", "?", ":", "@", "&amp;amp;", "=", "+", ",", and "$" are reserved.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fragment&lt;/strong&gt;&lt;br&gt;&lt;font color="#ff0000"&gt;Fragment is not part of a URI&lt;/font&gt;, but is often used in conjunction with a URI.&lt;br&gt;URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;from RFC 2396:&lt;br&gt;"The semantics of a fragment identifier is a property of the data resulting from a retrieval action, &lt;strong&gt;regardless&lt;/strong&gt; of the type of URI used in the reference.&lt;br&gt;&amp;nbsp;&amp;nbsp; A fragment identifier is only meaningful when a URI reference is intended for retrieval and the result of that retrieval is a document for which the identified fragment is consistently defined."&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Relative URI reference&lt;/strong&gt;&lt;br&gt;to be continued in the future.&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="4"&gt;Specific schemes&lt;/font&gt;&lt;br&gt;&lt;/p&gt;
&lt;table cellspacing="0" cellpadding="2" width="926" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" align="middle" width="107"&gt;&lt;strong&gt;scheme&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" align="middle" width="219"&gt;&lt;strong&gt;syntax&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" align="middle" width="324"&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" align="middle" width="269"&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="110"&gt;file&lt;/td&gt;
&lt;td valign="top" width="219"&gt;file://&amp;lt;host&amp;gt;/&amp;lt;path&amp;gt;&lt;/td&gt;
&lt;td valign="top" width="324"&gt;Access a file on a specific host.&lt;br&gt;&amp;lt;host&amp;gt; can be "localhost" or empty to indicate local host. E.g. file:///usr/home&lt;/td&gt;
&lt;td valign="top" width="268"&gt;Unlike http and ftp, It does &lt;strong&gt;not&lt;/strong&gt; specify an internet protocol to access the files.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="113"&gt;ftp&lt;/td&gt;
&lt;td valign="top" width="219"&gt;&lt;font size="2"&gt;ftp://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&lt;br&gt;&amp;lt;cwd1&amp;gt;/&amp;lt;cwd2&amp;gt;/.../&amp;lt;cwdN&amp;gt;/&lt;br&gt;&amp;lt;name&amp;gt;;type=&amp;lt;typecode&amp;gt;&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="324"&gt;&amp;lt;cwd1&amp;gt; through &amp;lt;cwdN&amp;gt; are strings and &amp;lt;typecode&amp;gt; can be "a", "i" or "d". If &amp;lt;typecode&amp;gt; is "d", &amp;lt;name&amp;gt; is used as the argument of NLIST command.&lt;/td&gt;
&lt;td valign="top" width="265"&gt;Within the &amp;lt;name&amp;gt; or a CWD component, / and ; must be escaped. E.g. ftp://test.com/%2Froot/a.txt&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="115"&gt;mailto&lt;/td&gt;
&lt;td valign="top" width="219"&gt;mailto:&amp;lt;mail-address&amp;gt;&lt;/td&gt;
&lt;td valign="top" width="324"&gt;RFC 2822 specifies the format of internet messages. &lt;/td&gt;
&lt;td valign="top" width="264"&gt;Usually, "%" must be escaped.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="117"&gt;http&lt;/td&gt;
&lt;td valign="top" width="219"&gt;http://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&lt;br&gt;&amp;lt;path&amp;gt;?&amp;lt;query&amp;gt;&lt;/td&gt;
&lt;td valign="top" width="324"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td valign="top" width="264"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&lt;font color="#0000ff" size="3"&gt;&lt;strong&gt;Resources&lt;br&gt;&lt;/strong&gt;&lt;/font&gt;URI working group: &lt;a title="http://labs.apache.org/webarch/uri/" href="http://labs.apache.org/webarch/uri/"&gt;http://labs.apache.org/webarch/uri/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6027059160869550924?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6027059160869550924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6027059160869550924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6027059160869550924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6027059160869550924'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/uniform-resource-identifieruri-and.html' title='Uniform Resource Identifier(URI) and Uniform Resource Locators (URL) - (RFC 1738 and RFC 3986)'/><author><name>Gerald Guo</name><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-36974671.post-8859214009550025244</id><published>2009-01-14T01:21:00.001-05:00</published><updated>2009-01-14T01:21:18.457-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ai'/><title type='text'>Some resources of symbolic learning and connectionist</title><content type='html'>&lt;p&gt;This post &lt;a title="http://www.cs.indiana.edu/classes/c661/sym-subsym.html" href="http://www.cs.indiana.edu/classes/c661/sym-subsym.html"&gt;http://www.cs.indiana.edu/classes/c661/sym-subsym.html&lt;/a&gt; gives some breif introduction and comparison of these two methods. It is pretty good.&lt;/p&gt; &lt;p&gt;Also I found this paper - &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.3613" target="_blank"&gt;&lt;strong&gt;Comparing connectionist and symbolic learning method&lt;/strong&gt;&lt;/a&gt; which compares these two methods based on some experimental results. It is an old paper but I think maybe it is worth reading. &lt;/p&gt; &lt;p&gt;After searching on web, I found this book: Perspectives of Neural-Symbolic Integration(&lt;a title="http://www.neural-symbolic.org/" href="http://www.neural-symbolic.org/"&gt;http://www.neural-symbolic.org/&lt;/a&gt;). Its name seems to imply that this book will introduction the combination of these two methods. I have not read it yet.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8859214009550025244?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8859214009550025244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8859214009550025244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8859214009550025244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8859214009550025244'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/some-resources-of-symbolic-learning-and.html' title='Some resources of symbolic learning and connectionist'/><author><name>Gerald Guo</name><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-36974671.post-6940001248398062552</id><published>2009-01-07T17:27:00.000-05:00</published><updated>2009-01-07T17:30:53.158-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>MySQL error 1045(28000): Access denied for user ...</title><content type='html'>&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;I have a database called &lt;em&gt;hibernate&lt;/em&gt; in my MySQL server and I grant privileges to a user using this command&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;code&gt;&amp;gt; grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';&lt;/code&gt;&lt;br&gt;Wildchar &lt;em&gt;%&lt;/em&gt; means no matter where the user logs in mysql server from, the access should be allowed for further checking/verification.&lt;br&gt;When I tried to log in as the newly created user from local host, I got this error:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;tt&gt;ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES)&lt;/tt&gt;&lt;br&gt;Also I tried some suggested solutions:&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;code&gt;&amp;gt; FLUSH PRIVILEGES:&lt;/code&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;code&gt;&amp;gt; SET PASSWORD FOR 'testuser'@'%'='testuser';&lt;/code&gt;&lt;br&gt;None of them works.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;My solution:&lt;/strong&gt;&lt;br&gt;Using following two commands:&lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;gt; grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';&lt;/code&gt;&lt;code&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;gt; grant all on hibernate.* to 'testuser'@'localhost' identified by 'testuser';&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Theoretically, wildchar &lt;em&gt;%&lt;/em&gt; should have included all hosts. But it may not cover &lt;em&gt;localhost&lt;/em&gt;. Who knows.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6940001248398062552?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6940001248398062552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6940001248398062552' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6940001248398062552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6940001248398062552'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/mysql-error-104528000-access-denied-for.html' title='MySQL error 1045(28000): Access denied for user ...'/><author><name>Gerald Guo</name><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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-4824036714755602403</id><published>2009-01-07T14:59:00.000-05:00</published><updated>2009-01-07T14:59:09.880-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Install and Configure MySQL as a non-root user on Linux</title><content type='html'>&lt;p&gt;Recently, I want to install MySQL on a server in my lab. It should not be difficult considering the wide usage of MySQL. I must install MySQL as a non-root user. This results in difficulties of installation. &lt;br&gt;My target OS is Red Hat Enterprise Linux Server release 5.2. &lt;br&gt;My username is &lt;em&gt;gerald&lt;/em&gt; and my home directory is &lt;em&gt;/home/gerald&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;MySQL website provides a binary package(rpm) for RedHat. I downloaded package &lt;em&gt;MySQL-server-community-5.0.67-0.rhel5.i386.rpm&lt;/em&gt;.&lt;br&gt;After executing command&lt;br&gt;&lt;code&gt;&amp;gt; rpm -q -p MySQL-server-community-5.0.67-0.rhel5.i386.rpm -i&lt;/code&gt;&lt;br&gt;I got following output:&lt;pre&gt;Name        : MySQL-server-community       &lt;strong&gt;&lt;font color="#ff0000"&gt;Relocations: (not relocatable)&lt;/font&gt;&lt;/strong&gt;
Version     : 5.0.67                       Vendor: MySQL AB
Release     : 0.rhel5                      Build Date: Mon 04 Aug 2008 03:31:42 PM EDT
Install Date: (not installed)              Build Host: blade11.mysql.com
Group       : Applications/Databases       Source RPM: MySQL-community-5.0.67-0.rhel5.src.rpm
Size        : 42294654                     License: GPL
Signature   : DSA/SHA1, Wed 06 Aug 2008 05:36:22 AM EDT, Key ID 8c718d3b5072e1f5
Packager    : MySQL Product Engineering Team &amp;lt;build@mysql.com&amp;gt;
URL         : http://www.mysql.com/
Summary     : @COMMENT@ for Red Hat Enterprise Linux 5&lt;/pre&gt;See the red text above? &lt;br&gt;So It did not work because the rpm package should be installed as root. 
&lt;p&gt;As a result, I must install MySQL from source. Steps:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;(1) Download and untar MySQL-5.1.30. Then Change location into the top-level directory of the unpacked distribution.&lt;br&gt;(2) Configure&lt;br&gt;&lt;code&gt;CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ; \ &lt;br&gt;./configure --prefix=/home/gerald/share/mysql \&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; &lt;/code&gt;&lt;code&gt;--enable-assembler \&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; --with-mysqld-ldflags=-all-static \&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; --with-client-ldflags=-all-static \&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; --with-mysqld-user=gerald \&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; --with-unix-socket-path=/home/gerald/share/mysql/tmp/mysql.sock \&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; --localstatedir=/home/gerald/share/mysql/data &lt;/code&gt;&lt;br&gt;--localstatedir: overrides the default location for database directories (normally /usr/local/var for installation from source) &lt;br&gt;--with-unix-socket-path: where unix socket file would be stored. (must be accessible)&lt;br&gt;--with-mysqld-ldflags=-all-static: compile statically linked daemon programs&lt;br&gt;--with-client-ldflags=-all-static: compile statically linked mysql client programs&lt;br&gt;--enable-assembler: Use assembler versions of some string functions if available&lt;br&gt;--prefix: Install architecture-independent files in the specified directory.&lt;/p&gt;
&lt;p&gt;Values of some of options above should be replaced with your own paths. &lt;br&gt;Also this option &lt;code&gt;--enable-thread-safe-client&lt;/code&gt; may should be applied in your case if your client programs use multi-thread.&lt;br&gt;Description of all available configuration options is here &lt;a title="http://dev.mysql.com/doc/refman/5.1/en/configure-options.html " href="http://dev.mysql.com/doc/refman/5.1/en/configure-options.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/configure-options.html&lt;/a&gt;. &lt;br&gt;(3) make&lt;br&gt;(4) make install&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Post-installation&lt;/strong&gt;&lt;br&gt;&lt;a title="http://dev.mysql.com/doc/refman/5.1/en/unix-post-installation.html" href="http://dev.mysql.com/doc/refman/5.1/en/unix-post-installation.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/unix-post-installation.html&lt;/a&gt;&lt;br&gt;(5) Create and edit configuration file (also called option file) &lt;em&gt;my.cnf&lt;/em&gt;.&lt;br&gt;&lt;a title="http://dev.mysql.com/doc/refman/5.1/en/option-files.html" href="http://dev.mysql.com/doc/refman/5.1/en/option-files.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/option-files.html&lt;/a&gt;&lt;br&gt;My &lt;em&gt;my.cnf&lt;/em&gt; file looks like this:&lt;pre&gt;[mysqld]
user=gerald
basedir=/home/gerald/share/mysql
datadir=/home/gerald/share/mysql/data
port=3307
socket=/home/gerald/share/mysql/tmp/mysql.sock

[mysqld_safe]
log-error=/home/gerald/share/mysql/log/mysqld.log
pid-file=/home/gerald/share/mysql/mysqld.pid

[client]
port=3307
user=gerald
socket=/home/gerald/share/mysql/tmp/mysql.sock

[mysqladmin]
user=root
port=3307
socket=/home/gerald/share/mysql/tmp/mysql.sock

[mysql]
port=3307
socket=/home/gerald/share/mysql/tmp/mysql.sock

[mysql_install_db]
user=gerald
port=3307
basedir=/home/gerald/share/mysql
datadir=/home/gerald/share/mysql/data
socket=/home/gerald/share/mysql/tmp/mysql.sock&lt;/pre&gt;
&lt;p&gt;On Unix, MySQL programs read startup option file from the following files: &lt;/p&gt;&lt;a class="indexterm" name="id4574191"&gt;&lt;/a&gt;
&lt;div class="informaltable"&gt;
&lt;table border="1"&gt;
&lt;colgroup&gt;
&lt;col&gt;
&lt;col&gt;&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;span class="bold"&gt;Filename&lt;/span&gt;&lt;/td&gt;
&lt;td width="489"&gt;&lt;span class="bold"&gt;Purpose&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="filename"&gt;/etc/my.cnf&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;Global options&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="filename"&gt;/etc/mysql/my.cnf&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;Global options (as of MySQL 5.1.15)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="filename"&gt;&lt;em class="replaceable"&gt;&lt;code&gt;SYSCONFDIR&lt;/code&gt;&lt;/em&gt;/my.cnf&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;Global options&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="filename"&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;$MYSQL_HOME/my.cnf&lt;/font&gt;&lt;/strong&gt;&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;Server-specific options&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="literal"&gt;defaults-extra-file&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;The file specified with &lt;code class="option"&gt;--defaults-extra-file=&lt;em class="replaceable"&gt;&lt;code&gt;path&lt;/code&gt;&lt;/em&gt;&lt;/code&gt;, if any&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="192"&gt;&lt;code class="filename"&gt;~/.my.cnf&lt;/code&gt;&lt;/td&gt;
&lt;td width="489"&gt;User-specific options&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;I use the fourth option. So I set environment variable MYSQL_HOME using this command:&lt;br&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; export MYSQL_HOME=/home/gerald/share/mysql&lt;/em&gt;&lt;br&gt;This environment variable contains the directory where mysql is installed.&lt;br&gt;If you don't want to manually set the environment variable every time you start up the mysql daemon, you can add it to file &lt;em&gt;~/.bash_profile&lt;/em&gt;(if you are using bash)&lt;em&gt;. &lt;/em&gt;&lt;br&gt;Then copy the option file to the directory specified by MYSQL_HOME.&lt;br&gt;&lt;strong&gt;Note&lt;/strong&gt;: options specified in &lt;em&gt;my.cnf&lt;/em&gt; can also be supplied on the command line when you execute a mysql program.&lt;br&gt;(6) Change location to the directory where mysql is installed (in my case, it is &lt;em&gt;/home/gerald/share/mysql&lt;/em&gt;). &lt;br&gt;(7) Initialize system tables using command&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;em&gt;bin/mysql_install_db&lt;/em&gt;&lt;br&gt;Options of this command are specified in our option file &lt;em&gt;$MYSQL_HOME/my.cnf&lt;/em&gt;. Of course, you can specify the options in command line. But I think using the option file is more convenient. &lt;br&gt;I got a warning: [Warning] Ignoring user change to 'gerald' because the user was set to 'mysql' earlier on the command line. I don't know how to fix it now. But mysql seems to work well despite the warning.&lt;br&gt;Note: If you install MySQL using a binary package, usually this step is automatically done when you install the package. &lt;br&gt;(8) mkdir log &lt;br&gt;create log directory under which log files are saved. This must match the configuration of option &lt;em&gt;log-error &lt;/em&gt;in &lt;em&gt;my.cnf&lt;/em&gt;. &lt;br&gt;In my case, &lt;em&gt;log-error&lt;/em&gt; is set to &lt;em&gt;/home/gerald/share/mysql/log/mysqld.log&lt;/em&gt;&lt;br&gt;(9) Start up mysql using command&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; &lt;em&gt;bin/mysqld_safe &amp;amp;&lt;/em&gt;&lt;br&gt;(10) Verify that mysql daemon runs well. Use any of following commands: &lt;pre&gt;&amp;gt; bin/mysqladmin version
&amp;gt; bin/mysqladmin ping
&amp;gt; bin/mysqladmin status
&amp;gt; bin/mysqladmin variables&lt;/pre&gt;Show the created databases &lt;br&gt;&lt;code&gt;&amp;gt; bin/mysqlshow&lt;/code&gt;&lt;tt&gt; &lt;br&gt;Output:&lt;br&gt;+--------------------+ &lt;br&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Databases&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | &lt;br&gt;+--------------------+ &lt;br&gt;| information_schema | &lt;br&gt;| test&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; | &lt;br&gt;+--------------------+ &lt;/tt&gt;&lt;br&gt;&lt;code&gt;&amp;gt; bin/mysqlshow-u root&lt;/code&gt;&lt;br&gt;&lt;tt&gt;Output:&lt;br&gt;+--------------------+ &lt;br&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Databases&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | &lt;br&gt;+--------------------+ &lt;br&gt;| information_schema | &lt;br&gt;| mysql&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;| test&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; | &lt;br&gt;+--------------------+&lt;/tt&gt;&lt;br&gt;(11) shut down mysql daemon&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;gt; &lt;code&gt;bin/mysqladmin -u root shutdown&lt;/code&gt;&lt;br&gt;
&lt;p&gt;&lt;strong&gt;Initial Account Security&lt;/strong&gt;&lt;br&gt;&lt;a title="http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html" href="http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html&lt;/a&gt;&lt;br&gt;By default, password of root user is empty. In other words, anyone who can access the host can also access information of your mysql database. You can set password of root user using&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; &lt;code&gt;mysqladmin -u root password newpwd&lt;/code&gt;&lt;br&gt;or&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;code&gt;&amp;gt; mysqladmin -u root -h host_name password newpwd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Account management statements&lt;/strong&gt;&lt;br&gt;&lt;a title="http://dev.mysql.com/doc/refman/5.1/en/account-management-sql.html" href="http://dev.mysql.com/doc/refman/5.1/en/account-management-sql.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/account-management-sql.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Privilege system&lt;/strong&gt;&lt;br&gt;&lt;a title="http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html" href="http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html&lt;/a&gt;&lt;br&gt;Usually, you need to check table &lt;em&gt;mysql.user&lt;/em&gt;:&lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; select * from mysql.user;&lt;/code&gt;&lt;br&gt;&lt;strong&gt;&lt;span style="color: #008000"&gt;How can you know the indentity used by mysql?&lt;/span&gt;&lt;/strong&gt;&lt;br&gt;&lt;/font&gt;After running &lt;em&gt;mysql&lt;/em&gt; successfully, use command &lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; select CURRENT_USER();&lt;/code&gt;&lt;br&gt;&lt;strong&gt;Set password of a user:&lt;/strong&gt;&lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; SET PASSWORD FOR 'someuser'@'somehost' = PASSWORD('newpass');&lt;/code&gt;&lt;br&gt;&lt;strong&gt;Grant privileges:&lt;br&gt;&lt;/strong&gt;Usually, commands are like this:&lt;br&gt;&lt;pre&gt;    &amp;gt; GRANT ALL ON mydb.* TO 'someuser'@'somehost';
    &amp;gt; GRANT ALL ON mydb.mytbl TO 'someuser'@'somehost';
    &amp;gt; GRANT SELECT (col1), INSERT (col1,col2) ON mydb.mytbl TO 'someuser'@'somehost'; &lt;/pre&gt;&lt;strong&gt;Revoke privileges:&lt;/strong&gt;&lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; revoke all on mydb.* from 'someuser'@'somehost';&lt;/code&gt;&lt;br&gt;&lt;strong&gt;Remove user:&lt;/strong&gt;&lt;br&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; drop user 'someuser'@'somehost' &lt;/code&gt;
&lt;p&gt;&lt;strong&gt;Resources&lt;br&gt;&lt;/strong&gt;Related environment variables:&lt;br&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/environment-variables.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/environment-variables.html&lt;/a&gt;&lt;br&gt;List of programs/tools in the mysql package:&lt;br&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/programs.html"&gt;http://dev.mysql.com/doc/refman/5.1/en/programs.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4824036714755602403?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4824036714755602403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4824036714755602403' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4824036714755602403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4824036714755602403'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/install-and-configure-mysql-as-non-root.html' title='Install and Configure MySQL as a non-root user on Linux'/><author><name>Gerald Guo</name><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>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-36974671.post-7311769527631387626</id><published>2009-01-05T13:37:00.000-05:00</published><updated>2009-01-05T13:38:03.285-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu error "I've detected a panel already running"</title><content type='html'>&lt;p&gt;Prerequisite: I use GNOME, not KDE.&lt;br&gt;I want to install Nvidia driver to my old Ubuntu machine. However, it prompts that a X server is running and the installation can not proceed. Obviously, X server must be killed to install the driver. To press &lt;em&gt;Ctrl+Alt + Backspace&lt;/em&gt; does NOT do the work because it RESTARTS the X server instead of kills it. &lt;br&gt;After searching online, I found that following command worked for me:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;sudo /etc/init.d/gdm stop&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;After I installed the driver, I used command &lt;em&gt;startx&lt;/em&gt; to start GNOME. At that time the error "I've detected a panel already running ..." came out. I found this command worked:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;killall gnome-panel&lt;br&gt;killall gdm&lt;br&gt;startx&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;In other words, the processing &lt;em&gt;gnome-panel&lt;/em&gt; is not terminated even if you press &lt;em&gt;Ctrl+Alt+Backspace&lt;/em&gt; to kill the X server. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-7311769527631387626?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/7311769527631387626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=7311769527631387626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7311769527631387626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/7311769527631387626'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/ubuntu-error-detected-panel-already.html' title='Ubuntu error &amp;quot;I&amp;#39;ve detected a panel already running&amp;quot;'/><author><name>Gerald Guo</name><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-36974671.post-8304031298305944627</id><published>2009-01-03T20:34:00.000-05:00</published><updated>2009-01-03T20:36:15.716-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><title type='text'>Version matching of JSP, JSTL and Servlet</title><content type='html'>&lt;p&gt;Working with JSP, JSTL, Servlet and Container is not an easy job if you download and configure every part by yourself. The most important problem is version matching. Also &lt;i&gt;web.xml&lt;/i&gt; must be correctly configured to make use of the right version of Servlet/JSP. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Web app descriptor (web.xml)&lt;/b&gt;&lt;br&gt;To make use of correct version of JSP/JSTL/EL, you should read following posts which give detailed information you need to know to write &lt;i&gt;&lt;b&gt;web.xml&lt;/b&gt;&lt;/i&gt;:&lt;br&gt;&lt;a href="http://faq.javaranch.com/java/ServletsWebXml"&gt;http://faq.javaranch.com/java/ServletsWebXml&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Some useful &lt;b&gt;resources&lt;/b&gt; I found:&lt;br&gt;&lt;a href="http://faq.javaranch.com/java/ElOrJstlNotWorkingAsExpected"&gt;http://faq.javaranch.com/java/ElOrJstlNotWorkingAsExpected&lt;/a&gt; &lt;br&gt;&lt;a href="http://forum.springframework.org/archive/index.php/t-19866.html"&gt;http://forum.springframework.org/archive/index.php/t-19866.html&lt;/a&gt; &lt;br&gt;&lt;a href="http://blog.csdn.net/eviliw/archive/2007/12/17/1944270.aspx"&gt;http://blog.csdn.net/eviliw/archive/2007/12/17/1944270.aspx&lt;/a&gt;&lt;a href="http://faq.javaranch.com/java/JstlTagLibDefinitions"&gt;&lt;br&gt;http://faq.javaranch.com/java/JstlTagLibDefinitions&lt;/a&gt;&lt;/p&gt; &lt;p&gt;On Sun's website, it is so hard to find a download link for JSTL 1.2. Usually you will be directed to the JSTL spec site. &lt;br&gt;You can download JSTL 1.2 from here: &lt;a href="https://maven-repository.dev.java.net/repository/jstl/jars/"&gt;https://maven-repository.dev.java.net/repository/jstl/jars/&lt;/a&gt;.&lt;br&gt;&lt;span style="color: rgb(255,0,0)"&gt;Note for JSTL 1.2 there is just one jar file instead of two.&lt;/span&gt;&lt;br&gt;&lt;span style="color: rgb(255,0,0)"&gt;In JSTL 1.1/1.0, there are two jars&lt;/span&gt; : jstl.jar and standard.jar.&lt;br&gt;You can download JSTL 1.1 from here &lt;a href="http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi" rel="nofollow"&gt;http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi&lt;/a&gt; and JSTL 1.0 from &lt;a href="http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi" rel="nofollow"&gt;http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Version match&lt;/b&gt;&lt;br&gt;JSTL 1.0 : Servlet 2.3 : JSP 1,2 (tomcat 4)&lt;br&gt;JSTL 1.1 : Servlet 2.4 : JSP 2.0 (tomcat 5)&lt;br&gt;JSTL 1.2 : Servlet 2.5 : JSP 2.1 (tomcat 6)&lt;br&gt;In old versions of JSP, EL is not enabled by default!! You can enable EL manually by using JSP &lt;i&gt;page&lt;/i&gt; directory.&lt;br&gt;&lt;b style="color: rgb(255,0,0)"&gt;JSTL&amp;nbsp; jars are not included in tomcat distributions&lt;/b&gt; so far. You need to download and deploy JSTL by yourself.&lt;/p&gt; &lt;p&gt;&lt;b&gt;JSTL 1.0&lt;/b&gt; specifies a set of custom tag libraries based on the JSP 1.2 API. There are four separate tag libraries, each containing custom actions targeting a specific functional area. This table lists each library with its recommended tag prefix and default URI: &lt;/p&gt; &lt;table border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;Description&lt;/th&gt; &lt;th&gt;Prefix&lt;/th&gt; &lt;th&gt;Default URI&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Core&lt;/td&gt; &lt;td&gt;&lt;code&gt;c&lt;/code&gt;&lt;/td&gt; &lt;td&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/core"&gt;http://java.sun.com/jstl/core&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;XML Processing&lt;/td&gt; &lt;td&gt;&lt;code&gt;x&lt;/code&gt;&lt;/td&gt; &lt;td&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/xml"&gt;http://java.sun.com/jstl/xml&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;I18N &amp;amp; Formatting&lt;/td&gt; &lt;td&gt;&lt;code&gt;fmt&lt;/code&gt;&lt;/td&gt; &lt;td&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/fmt"&gt;http://java.sun.com/jstl/fmt&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Database Access&lt;/td&gt; &lt;td&gt;&lt;code&gt;sql&lt;/code&gt;&lt;/td&gt; &lt;td&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/sql"&gt;http://java.sun.com/jstl/sql&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;&lt;b&gt;JSTL 1.1&lt;/b&gt; specifies a set of custom tag libraries based on the JSP 2.0 API. There are five separate tag libraries, each containing custom actions targeting a specific functional area. This table lists each library with its recommended tag prefix and default URI:  &lt;table height="114" width="581" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th width="157"&gt;Description&lt;/th&gt; &lt;th width="65"&gt;Prefix&lt;/th&gt; &lt;th width="345"&gt;Default URI&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td width="157"&gt;Core&lt;/td&gt; &lt;td width="65"&gt;&lt;code&gt;c&lt;/code&gt;&lt;/td&gt; &lt;td width="347"&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/core"&gt;http://java.sun.com/jsp/jstl/core&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td width="157"&gt;XML Processing&lt;/td&gt; &lt;td width="65"&gt;&lt;code&gt;x&lt;/code&gt;&lt;/td&gt; &lt;td width="349"&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/xml"&gt;http://java.sun.com/jsp/jstl/xml&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td width="157"&gt;I18N &amp;amp; Formatting&lt;/td&gt; &lt;td width="65"&gt;&lt;code&gt;fmt&lt;/code&gt;&lt;/td&gt; &lt;td width="350"&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/fmt"&gt;http://java.sun.com/jsp/jstl/fmt&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td width="157"&gt;Database Access&lt;/td&gt; &lt;td width="65"&gt;&lt;code&gt;sql&lt;/code&gt;&lt;/td&gt; &lt;td width="351"&gt;&lt;code&gt;&lt;a href="http://java.sun.com/jstl/sql"&gt;http://java.sun.com/jsp/jstl/sql&lt;br&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;One missed tag in the table is "&lt;i&gt;&lt;b&gt;functions&lt;/b&gt;&lt;/i&gt;".&lt;br&gt;It seems that you also can use tag URI like this: &lt;i&gt;&lt;b&gt;&lt;a href="http://java.sum.com/jstl/"&gt;http://java.sum.com/jstl/&lt;/a&gt;&lt;span style="color: rgb(255,0,0)"&gt;core_rt&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;. And it works in my application. However, I have not investigated what's going on behind the scene. So this may or may not work generally. Instead, you should always use the new tag URI.&lt;/p&gt; &lt;p&gt;Prefixes and URL of &lt;b&gt;JSTL 1.2&lt;/b&gt; Tag Libraries are the same as that of JSTL 1.1.&lt;br&gt;&lt;br&gt;&lt;b&gt;Troubleshooting&lt;/b&gt;&lt;br&gt;&lt;b&gt;(1)&lt;/b&gt; If you get following error "&lt;i&gt;&lt;b&gt;According&amp;nbsp; to TLD or attribute directive in tag file, attribute test does not accept any expressions&lt;/b&gt;&lt;/i&gt;", it is possible that you don't specify tag prefix and URI correctly. You may be using JSTL 1.2 while you specify tag URI of JSTL 1.0 wrongly. Take &lt;i&gt;Core&lt;/i&gt; as an example, tag URI in JSTL 1.1/1.2 is &lt;i style="color: rgb(255,0,0)"&gt;&lt;b&gt;&lt;a href="http://java.sun.com/jsp/jstl/core"&gt;http://java.sun.com/jsp/jstl/core&lt;/a&gt;&lt;/b&gt;&lt;/i&gt; while tag URI in JSTL 1.0 is &lt;b style="color: rgb(255,0,0)"&gt;&lt;a href="http://java.sun.com/jstl/core"&gt;http://java.sun.com/jstl/core&lt;/a&gt;&lt;/b&gt;.&lt;br&gt;&lt;b&gt;(2) &lt;/b&gt;If your EL/JSP is displayed directly without evaluation. it is highly possible that your &lt;i&gt;web.xml&lt;/i&gt; file specifies wrong JSP version. See this post &lt;a href="http://faq.javaranch.com/java/ServletsWebXml"&gt;http://faq.javaranch.com/java/ServletsWebXml&lt;/a&gt;. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-8304031298305944627?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/8304031298305944627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=8304031298305944627' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8304031298305944627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/8304031298305944627'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2009/01/version-matching-of-jsp-jstl-and.html' title='Version matching of JSP, JSTL and Servlet'/><author><name>Gerald Guo</name><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-36974671.post-4726817702268546777</id><published>2008-12-29T22:02:00.000-05:00</published><updated>2008-12-29T22:03:06.023-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>HTML table cell text wrap</title><content type='html'>&lt;p&gt;By default, if you set width of table cell, words would be wrapped automatically.&amp;nbsp; A single word would not be split into pieces. Usually, an English word is not so long. But, some "words" may be very long. For example, &lt;strong&gt;URL&lt;/strong&gt;s without word delimiter would be considered as a single word. &lt;br&gt;CSS property &lt;em&gt;&lt;a href="http://www.css3.com/css-word-break/" target="_blank"&gt;word-break&lt;/a&gt;&lt;/em&gt; can be used to force split a long word into more than one line.&lt;br&gt;usage: &lt;em&gt;work-break:break-all&lt;/em&gt;&lt;br&gt;Unfortunately, that does not work on FireFox :-( I searched the internet and found that FireFox does not support that property. Besides, there is no equivalent in FireFox. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-4726817702268546777?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/4726817702268546777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=4726817702268546777' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4726817702268546777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/4726817702268546777'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2008/12/html-table-cell-text-wrap.html' title='HTML table cell text wrap'/><author><name>Gerald Guo</name><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-36974671.post-5702627705480641024</id><published>2008-12-26T03:30:00.001-05:00</published><updated>2010-03-30T15:21:25.269-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>How to use Maven2</title><content type='html'>Download and install maven: &lt;a title="http://maven.apache.org/download.html" href="http://maven.apache.org/download.html"&gt;http://maven.apache.org/download.html&lt;/a&gt;.   &lt;p&gt;&lt;font size="4" face="Courier New"&gt;&lt;strong&gt;Running Maven&lt;/strong&gt;&lt;/font&gt;    &lt;br /&gt;&lt;a title="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html" href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html"&gt;http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html&lt;/a&gt;    &lt;br /&gt;&lt;a title="http://maven.apache.org/guides/getting-started/index.html" href="http://maven.apache.org/guides/getting-started/index.html"&gt;http://maven.apache.org/guides/getting-started/index.html&lt;/a&gt;    &lt;br /&gt;Generally the local repository is provided in USER_HOME/.m2/repository. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;font size="4"&gt;Configuration&lt;/font&gt;          &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;a title="http://maven.apache.org/guides/mini/guide-configuring-maven.html" href="http://maven.apache.org/guides/mini/guide-configuring-maven.html"&gt;http://maven.apache.org/guides/mini/guide-configuring-maven.html&lt;/a&gt;     &lt;br /&gt;Three levels: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;i&gt;Project&lt;/i&gt; - most static configuration occurs in &lt;tt&gt;pom.xml&lt;/tt&gt;.      &lt;br /&gt;There should be a project configuration for every project. The configuration in &lt;tt&gt;pom.xml&lt;/tt&gt; overrides the same configuration in other two levels. A user does not need to specify every aspect of the configuration. Those unspecified aspects are inherited from Maven's default &lt;a href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM" target="_blank"&gt;Super POM&lt;/a&gt;.      &lt;br /&gt;Introduction to POM: &lt;a title="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM" href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM"&gt;http://maven.apache.org/guides/introduction/introduction-to-the-pom.html&lt;/a&gt;.      &lt;br /&gt;POM reference: &lt;a title="http://maven.apache.org/pom.html" href="http://maven.apache.org/pom.html"&gt;http://maven.apache.org/pom.html&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;i&gt;Installation&lt;/i&gt; - this is configuration added once for a Maven installation      &lt;br /&gt;This configuration file is generally located in M2_HOME/conf/settings.xml.       &lt;br /&gt;NOTE: This location can be overridden with the system property:      &lt;br /&gt;&lt;tt&gt;-Dorg.apache.maven.global-settings=/path/to/global/settings.xml&lt;/tt&gt;       &lt;br /&gt;Guide: &lt;a title="http://maven.apache.org/guides/mini/guide-configuring-maven.html" href="http://maven.apache.org/guides/mini/guide-configuring-maven.html"&gt;http://maven.apache.org/guides/mini/guide-configuring-maven.html&lt;/a&gt;      &lt;br /&gt;Reference: &lt;a title="http://maven.apache.org/ref/2.0.8/maven-settings/settings.html" href="http://maven.apache.org/ref/2.0.8/maven-settings/settings.html"&gt;http://maven.apache.org/ref/2.0.8/maven-settings/settings.html&lt;/a&gt;      &lt;br /&gt;Detailed reference: &lt;a title="http://maven.apache.org/settings.html" href="http://maven.apache.org/settings.html"&gt;http://maven.apache.org/settings.html&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;i&gt;User&lt;/i&gt; - this is configuration specific to a particular user       &lt;br /&gt;This configuration file is generally located in USER_HOME/.m2/settings.xml.      &lt;br /&gt;NOTE: This location can be overridden with the system property:      &lt;br /&gt;&lt;tt&gt;-Dorg.apache.maven.user-settings=/path/to/user/settings.xml&lt;/tt&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font size="4"&gt;&lt;strong&gt;Build&lt;/strong&gt;&lt;/font&gt; your own private/internal repository:&lt;/font&gt;    &lt;br /&gt;This article introduces how to create a repository using Artifactory: &lt;a title="http://www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository" href="http://www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository"&gt;http://www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository&lt;/a&gt;. In addition, the author also compares some mainstream maven remote repository managers including Standard maven proxy, Dead simple Maven Proxy, Proximity and Artifactory.    &lt;br /&gt;In my case, I also use Artifactory and deploy it to tomcat. It has a nice web-based interface. Artifactory uses database(derby I think) to store various repository data so a user can not know the repository content by directly looking at the directory.     &lt;br /&gt;    &lt;br /&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;font size="4"&gt;Deploy&lt;/font&gt;&lt;/strong&gt; your artifacts to remote repository by using maven-deploy plugin:&lt;/font&gt;    &lt;br /&gt;&lt;a title="http://maven.apache.org/plugins/maven-deploy-plugin/usage.html" href="http://maven.apache.org/plugins/maven-deploy-plugin/usage.html"&gt;http://maven.apache.org/plugins/maven-deploy-plugin/usage.html&lt;/a&gt;    &lt;br /&gt;(1) If the artifacts are built by using Maven, you should use &lt;em&gt;deploy:deploy&lt;/em&gt; Mojo.    &lt;br /&gt;In your pom.xml, element &lt;tt&gt;&amp;lt;distributionManagement/&amp;gt;&lt;/tt&gt; should be inserted to tell Maven how to deploy current package. If your repository is secured, you may also want to configure your &lt;tt&gt;settings.xml&lt;/tt&gt; file to define corresponding &lt;tt&gt;&amp;lt;server/&amp;gt;&lt;/tt&gt; entries which provides authentication information.    &lt;br /&gt;Command: &lt;em&gt;mvn deploy.&lt;/em&gt;    &lt;br /&gt;(2) If the artifacts are &lt;strong&gt;NOT&lt;/strong&gt; built by using Maven, you should use &lt;em&gt;deploy:deploy-file&lt;/em&gt; Mojo.    &lt;br /&gt;Sample command:    &lt;br /&gt;mvn deploy:deploy-file -Dpackaging=jar -Durl=file:/grids/c2/www/htdocs/maven2&amp;#160; &lt;br /&gt;-Dfile=./junit.jar -DgroupId=gridshib -DartifactId=junit -Dversion=GTLAB    &lt;br /&gt;    &lt;br /&gt;&lt;font size="5" face="Courier New"&gt;&lt;strong&gt;FAQ:&lt;/strong&gt;&lt;/font&gt;    &lt;br /&gt;(1) What does maven standard directory layout look like?    &lt;br /&gt;&lt;a title="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html" href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html"&gt;http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html&lt;/a&gt;    &lt;br /&gt;(1) How to specify parent artifact in &lt;tt&gt;pom.xml&lt;/tt&gt;?    &lt;br /&gt;Read &lt;a title="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM" href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html"&gt;http://maven.apache.org/guides/introduction/introduction-to-the-pom.html&lt;/a&gt;.    &lt;br /&gt;(2) If a dependent package can not be download from central Maven repository, three methods can be used to deal with it:&lt;/p&gt;  &lt;blockquote&gt;&amp;quot;    &lt;ol style="padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px"&gt;     &lt;li&gt;Install the dependency locally using the install plugin. The method is the simplest recommended method. For example:        &lt;pre&gt;mvn install:install-file -Dfile=non-maven-proj.jar -DgroupId=some.group -DartifactId=non-maven-proj -Dversion=1&lt;/pre&gt;

      &lt;p&gt;Notice that an address is still required, only this time you use the command line and the install plugin will create a POM for you with the given address.&lt;/p&gt;
    &lt;/li&gt;

    &lt;li&gt;Create your own repository and deploy it there. This is a favorite method for companies with an intranet and need to be able to keep everyone in synch. There is a Maven goal called &lt;tt&gt;deploy:deploy-file&lt;/tt&gt; which is similar to the &lt;tt&gt;install:install-file&lt;/tt&gt; goal (read the plugin's goal page for more information). &lt;/li&gt;

    &lt;li&gt;Set the dependency scope to &lt;tt&gt;system&lt;/tt&gt; and define a &lt;tt&gt;systemPath&lt;/tt&gt;. This is not recommended, however, but leads us to explaining the following elements: &lt;/li&gt;
  &lt;/ol&gt;
&amp;quot;&lt;/blockquote&gt;
(2) How to add new repository?

&lt;br /&gt;Put following code snippet into &lt;em&gt;pom.xml&lt;/em&gt; or &lt;em&gt;settings.xml&lt;/em&gt;.

&lt;pre&gt;&amp;lt;repository&amp;gt;
  &amp;lt;id&amp;gt;your-new-repository-id&amp;lt;/id&amp;gt;
  &amp;lt;name&amp;gt;New Maven Repository &amp;lt;/name&amp;gt;
  &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;
  &amp;lt;url&amp;gt;Address of the new repository&amp;lt;/url&amp;gt;
  &amp;lt;snapshots&amp;gt;
    &amp;lt;enabled&amp;gt;enable-it?&amp;lt;/enabled&amp;gt;
  &amp;lt;/snapshots&amp;gt;
  &amp;lt;releases&amp;gt;
    &amp;lt;enabled&amp;gt;enable-it?&amp;lt;/enabled&amp;gt;
  &amp;lt;/releases&amp;gt;
&amp;lt;/repository&amp;gt;&lt;/pre&gt;
(3) How to disable default central maven repository?

&lt;br /&gt;Put following snippet into your pom.xml.

&lt;pre&gt;&amp;lt;repository&amp;gt;
  &amp;lt;id&amp;gt;central&amp;lt;/id&amp;gt;
  &amp;lt;name&amp;gt;Maven Repository Switchboard&amp;lt;/name&amp;gt;
  &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;
  &amp;lt;url&amp;gt;http://repo1.maven.org/maven2&amp;lt;/url&amp;gt;
  &amp;lt;snapshots&amp;gt;
    &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;
  &amp;lt;/snapshots&amp;gt;
  &amp;lt;releases&amp;gt;
    &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;
  &amp;lt;/releases&amp;gt;
&amp;lt;/repository&amp;gt;&lt;/pre&gt;

&lt;p&gt;(4) How can I package source code without run test?
  &lt;br /&gt;Feed parameter &lt;code&gt;-Dmaven.test.skip=true&lt;/code&gt; into the command line. 

  &lt;br /&gt;Note this property is defined by maven plugin &lt;em&gt;surefire&lt;/em&gt;.

  &lt;br /&gt;(5) Why does &amp;quot;mvn clean&amp;quot; delete my source code?

  &lt;br /&gt;In your pom.xml, if content of element &amp;lt;&lt;em&gt;directory&lt;/em&gt;&amp;gt; nested in element &amp;lt;&lt;em&gt;build&lt;/em&gt;&amp;gt; is &amp;quot;./&amp;quot;, &amp;quot;mvn clean&amp;quot; will delete all content in current directory including the &lt;em&gt;src&lt;/em&gt; directory. 

  &lt;br /&gt;There are two more elements which can be used to specify locations of compiled classes.

  &lt;br /&gt;&lt;tt&gt;outputDirectory&lt;/tt&gt;:&amp;#160; The directory where compiled &lt;em&gt;&lt;strong&gt;application classes&lt;/strong&gt;&lt;/em&gt; are placed.

  &lt;br /&gt;&lt;tt&gt;testOutputDirectory&lt;/tt&gt;:&amp;#160; The directory where compiled &lt;strong&gt;&lt;em&gt;test classes&lt;/em&gt;&lt;/strong&gt; are placed.

  &lt;br /&gt;(6) How to add resources into built package?

  &lt;br /&gt;&lt;a title="http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR" href="http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR"&gt;http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR&lt;/a&gt;.

  &lt;br /&gt;&lt;a title="http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files" href="http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files"&gt;http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files&lt;/a&gt;

  &lt;br /&gt;(7) Sometime, you want to use some libraries at compilation time and you don't want Maven to add them into your package(jar or war). How to do that?

  &lt;br /&gt;Use dependency scope &amp;quot;provided&amp;quot; instead of default &amp;quot;compile&amp;quot;. Read this post for details:

  &lt;br /&gt;&lt;a title="http://maven.apache.org/general.html#scope-provided" href="http://maven.apache.org/general.html#scope-provided"&gt;http://maven.apache.org/general.html#scope-provided&lt;/a&gt;. And this post elaborates Maven's dependency mechanism: &lt;a title="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope" href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope"&gt;http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope&lt;/a&gt;

  &lt;br /&gt;(8) How to build a &lt;em&gt;war&lt;/em&gt; instead of &lt;em&gt;jar&lt;/em&gt;?

  &lt;br /&gt;Use Maven WAR Plugin: &lt;a title="http://maven.apache.org/plugins/maven-war-plugin/usage.html" href="http://maven.apache.org/plugins/maven-war-plugin/usage.html"&gt;http://maven.apache.org/plugins/maven-war-plugin/usage.html&lt;/a&gt;.

  &lt;br /&gt;First you should set entry &lt;tt&gt;packaging&lt;/tt&gt; in pom.xml to &lt;tt&gt;war&lt;/tt&gt;.

  &lt;br /&gt;&lt;tt&gt;&amp;lt;packaging&amp;gt;war&amp;lt;/packaging&amp;gt;&lt;/tt&gt;

  &lt;br /&gt;Then you can use one of the following commands to build your war:

  &lt;br /&gt;&lt;tt&gt;mvn package
    &lt;br /&gt;mvn compile war:war

    &lt;br /&gt;mvn compile war:exploded

    &lt;br /&gt;mvn compile war:inplace&lt;/tt&gt;

  &lt;br /&gt;Also you can filter resources of your web app. See this post &lt;a title="http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html" href="http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html"&gt;http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html&lt;/a&gt;.

  &lt;br /&gt;(9) How to make war and jar at the same time?

  &lt;br /&gt;By default your source code is compiled into class files and placed into directory &lt;em&gt;WEB-INF/classes&lt;/em&gt;. Sometimes you may want to build a jar and then put it into directory WEB-INF/lib.

  &lt;br /&gt;&lt;a title="http://communitygrids.blogspot.com/2007/11/maven-making-war-and-jar-at-same-time.html" href="http://communitygrids.blogspot.com/2007/11/maven-making-war-and-jar-at-same-time.html"&gt;http://communitygrids.blogspot.com/2007/11/maven-making-war-and-jar-at-same-time.html&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html" href="http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html"&gt;http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached" href="http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached"&gt;http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached&lt;/a&gt;

  &lt;br /&gt;(10) &lt;em&gt;help&lt;/em&gt; plugin can be used get information about a project, plugin or the system.

  &lt;br /&gt;&lt;a title="http://maven.apache.org/plugins/maven-help-plugin/" href="http://maven.apache.org/plugins/maven-help-plugin/"&gt;http://maven.apache.org/plugins/maven-help-plugin/&lt;/a&gt;

  &lt;br /&gt;&lt;em&gt;mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-compiler-plugin -Dfull=true&lt;/em&gt;

  &lt;br /&gt;&lt;em&gt;mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-compiler-plugin&lt;/em&gt;

  &lt;br /&gt;&lt;em&gt;mvn help:system&lt;/em&gt;

  &lt;br /&gt;&lt;em&gt;mvn help:all-profiles&lt;/em&gt;

  &lt;br /&gt;&lt;em&gt;mvn help:active-profiles&lt;/em&gt;

  &lt;br /&gt;

  &lt;br /&gt;

  &lt;br /&gt;Properties reference:

  &lt;br /&gt;&lt;a title="http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide" href="http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide"&gt;http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide&lt;/a&gt;

  &lt;br /&gt;

  &lt;br /&gt;During my using of Maven2, I encountered several bugs:

  &lt;br /&gt;(1) &lt;em&gt;targetPath&lt;/em&gt; support on the &lt;em&gt;webResources&lt;/em&gt; war plugin parameter:

  &lt;br /&gt;&lt;a title="http://jira.codehaus.org/browse/MWAR-54" href="http://jira.codehaus.org/browse/MWAR-54"&gt;http://jira.codehaus.org/browse/MWAR-54&lt;/a&gt;

  &lt;br /&gt;(2) maven-war-plugin webResources -- relative path:

  &lt;br /&gt;&lt;a title="http://www.mail-archive.com/users@maven.apache.org/msg77274.html" href="http://www.mail-archive.com/users@maven.apache.org/msg77274.html"&gt;http://www.mail-archive.com/users@maven.apache.org/msg77274.html&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://jira.codehaus.org/browse/MNG-2382" href="http://jira.codehaus.org/browse/MNG-2382"&gt;http://jira.codehaus.org/browse/MNG-2382&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://jira.codehaus.org/browse/MWAR-79" href="http://jira.codehaus.org/browse/MWAR-79"&gt;http://jira.codehaus.org/browse/MWAR-79&lt;/a&gt;

  &lt;br /&gt;&lt;a title="http://jira.codehaus.org/browse/MWAR-77" href="http://jira.codehaus.org/browse/MWAR-77"&gt;http://jira.codehaus.org/browse/MWAR-77&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-5702627705480641024?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/5702627705480641024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=5702627705480641024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5702627705480641024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/5702627705480641024'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2008/12/how-to-use-maven2.html' title='How to use Maven2'/><author><name>Gerald Guo</name><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-36974671.post-6411154564306697048</id><published>2008-12-26T02:43:00.000-05:00</published><updated>2009-01-18T01:23:54.242-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Install and Configure Ubuntu 8.10</title><content type='html'>&lt;p&gt;Recently, I got a used desktop which would be used as linux server. I installed Ubuntu 8.10. The installation was easy. I downloaded the Ubuntu .iso file and burned it to a CD. Then just installed Ubuntu using the CD. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Vim upgrade&lt;/font&gt;&lt;/strong&gt;     &lt;br /&gt;By default, Ubuntu just installed &lt;em&gt;vim-tiny&lt;/em&gt; whose functionalities may not satisfy end user's requirements. For example, opening a directory using &lt;em&gt;vim-tiny&lt;/em&gt; would fail rather than list all files in the directory in &lt;em&gt;vim&lt;/em&gt;. So I installed vim-full which includes all vim features using this command:     &lt;br /&gt;&lt;em&gt;sudo apt-get install vim-full&lt;/em&gt;     &lt;br /&gt;Then usually &lt;em&gt;vim&lt;/em&gt; is configured to meet user's specicial requirements. In my case, the configuration file &lt;em&gt;$HOME/.vimrc&lt;/em&gt; looks like:&lt;/p&gt;  &lt;pre style="color: #3333aa"&gt;set tabstop=4
set shiftwidth=4
set wrapmargin=8
set smartindent	&amp;quot;smart indentation
set expandtab  	&amp;quot;expand tabs to spaces
set ruler 		&amp;quot;display ruler on bottom right corner
set nu			&amp;quot;display line number
set incsearch	&amp;quot;turn on incremental search
set hlsearch		&amp;quot;highlight search result

:colorscheme ron 
:filetype indent on		&amp;quot;enable special indentation rules according to file type.

&amp;quot;highlight the 81-th character in each line
au BufEnter * &amp;quot;:/\%81c&amp;quot;
&amp;quot;in default configuration, textwidth option is set
&amp;quot;so I want to override the default value.
au BufRead * set tw=0

&amp;quot;when you open a file, cursor is moved to previous position when you edited the file last time.
au BufReadPost * if line(&amp;quot;'\&amp;quot;&amp;quot;) &amp;gt; 0|if line(&amp;quot;'\&amp;quot;&amp;quot;) &amp;lt;= line(&amp;quot;$&amp;quot;)|exe(&amp;quot;norm '\&amp;quot;&amp;quot;)|else|exe &amp;quot;norm $&amp;quot;|endif|endif

:syntax on		&amp;quot;turn on syntax detection and highlight
&amp;quot;stop cursor blinking. Only available when compiled with GUI enabled,
&amp;quot;and for MS-DOS and Win32 consol
set guicursor=a:blinkon0&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;All available options of &lt;em&gt;vim&lt;/em&gt; can be read here: &lt;a title="http://www.vim.org/htmldoc/index.html" href="http://www.vim.org/htmldoc/index.html"&gt;http://www.vim.org/htmldoc/index.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Browser&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;Firefox is installed by default which is the default web browser. Several addons were installed manually.&lt;/p&gt;

&lt;table cellspacing="0" cellpadding="2" width="747" border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="181"&gt;Tab Mix Plus&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Tab browsing with added boost.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="183"&gt;All-in-One gestures&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Support mouse gestures.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" colspan="2"&gt;&amp;#160;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="184"&gt;Firebug&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Web development Evolved&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="185"&gt;RestTest&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;
        &lt;p&gt;Allow users to send HTTP requests with customized heads and data.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="185"&gt;Poster&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;
        &lt;p&gt;A developer tool for interacting with web services and other web resources that lets you make HTTP requests, set the entity body, and content type.
          &lt;br /&gt;Similar to RestTest. But Poster works on FF3 while RestTest does not.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="186"&gt;HttpFox&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;An HTTP analyzer&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;Web Developer&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Adds a menu and a toolbar with various web developer tools&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" colspan="2"&gt;&amp;#160;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;FireShot&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Take a screenshot and edit it&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;Google Notebook&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Firefox addon for google notebook application&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;QuickRestart&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Add a &amp;quot;Restart Firefox&amp;quot; item to the &amp;quot;File&amp;quot; menu.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;MenuEditor&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Customize application menus&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="187"&gt;FlashGot&lt;/td&gt;

      &lt;td valign="top" width="564"&gt;Enables single and massive downloads using external download managers. This addon itself is not a download program.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Terminal configuration&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;I like &amp;quot;&lt;em&gt;green on black&lt;/em&gt;&amp;quot; color theme. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Keyboard shortcuts&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;Click &lt;em&gt;System &lt;/em&gt;-&amp;gt; &lt;em&gt;Keyboard Shortcuts&lt;/em&gt; to display the shortcut setting dialog. Shortcuts I use very often include: 

  &lt;br /&gt;Super + s&amp;#160;&amp;#160;&amp;#160;&amp;#160; #start a terminal 

  &lt;br /&gt;Super + m&amp;#160;&amp;#160;&amp;#160; #toggle maximization state 

  &lt;br /&gt;Super + n&amp;#160;&amp;#160;&amp;#160;&amp;#160; #minimize window 

  &lt;br /&gt;Ctrl+Alt+L&amp;#160;&amp;#160;&amp;#160; #lock screen 

  &lt;br /&gt;Alt + F2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #Show run application dialog 

  &lt;br /&gt;Alt + Tab&amp;#160;&amp;#160;&amp;#160;&amp;#160; #switch between different windows 

  &lt;br /&gt;Ctrl + Alt + Left/Right/Up/Down&amp;#160;&amp;#160;&amp;#160; #switch to different workspaces&lt;/p&gt;
Following serveral shortcuts are available only after you install compiz and enable corresponding components. 

&lt;br /&gt;Super + E&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #Expo key 

&lt;br /&gt;Super + Tab&amp;#160; #another window switcher 

&lt;br /&gt;Super + leftclick&amp;#160;&amp;#160;&amp;#160; #move the window 

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Wireless network configuration&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;Wired network connection is established successfully. However, after I moved my desktop, it is not close to the router and I don't want to connect them using a cable. 

  &lt;br /&gt;I have a D-Link System AirPlus G DWL-G122 Wireless USB Adapter. After I plugged it in, I used command &lt;em&gt;lsusb&lt;/em&gt; to see whether the device was detected.&amp;#160; It was detected but it did not work. Obviously, a driver is needed to make it work. I read this post: &lt;a href="https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper"&gt;https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper&lt;/a&gt;. It states &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;D-Link DWL-G122 USB Wireless device&lt;/strong&gt;: As of December 2008, &lt;strong&gt;Ubuntu 8.10&lt;/strong&gt; provides full 'out of the box' support for this device, using the &lt;strong&gt;&lt;tt&gt;rt73usb&lt;/tt&gt;&lt;/strong&gt; driver. In this case, there is no need to use ndiswrapper at all and there is no need to make any changes to the default &lt;strong&gt;&lt;tt&gt;/etc/modprobe.d/blacklist&lt;/tt&gt;&lt;/strong&gt; file.&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But on my machine, the wireless adapter still did not work even after the module &lt;em&gt;rt73usb&lt;/em&gt; was loaded. I guess the reason is that the device mentioned in the manual and my device are different although they seem the same. 

  &lt;br /&gt;Then I followed the instructions on post &lt;a href="https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper"&gt;https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper&lt;/a&gt; and it worked well. 

  &lt;br /&gt;Network manager is a convenient tool to configure your network. 

  &lt;br /&gt;&lt;a href="http://projects.gnome.org/NetworkManager/"&gt;http://projects.gnome.org/NetworkManager/&lt;/a&gt; 

  &lt;br /&gt;&lt;a href="https://help.ubuntu.com/community/NetworkManager"&gt;https://help.ubuntu.com/community/NetworkManager&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Network Management&lt;/strong&gt;&lt;/font&gt; 

  &lt;br /&gt;Some packages and their useful commands to manage network devices&lt;/p&gt;

&lt;p&gt;Supported commands by package &amp;quot;&lt;strong&gt;&lt;em&gt;net-tools&lt;/em&gt;&lt;/strong&gt;&amp;quot;: 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;ifconfig&lt;/strong&gt;: &lt;/em&gt;configure the kernel-resident network interfaces. &lt;/p&gt;

&lt;p&gt;Supported commands by package &amp;quot;&lt;strong&gt;wireless-tools&lt;/strong&gt;&amp;quot;: 

  &lt;br /&gt;&lt;strong&gt;&lt;em&gt;iwconfig&lt;/em&gt;&lt;/strong&gt;: it is dedicated to the wireless interfaces. It can be used to set the parameters of NIC which are specific to wireless connection. 

  &lt;br /&gt;&lt;strong&gt;&lt;em&gt;iwlist&lt;/em&gt;&lt;/strong&gt;: display additional information from a wireless NIC. &amp;quot;&lt;strong&gt;&lt;em&gt;iwlist scan&lt;/em&gt;&lt;/strong&gt;&amp;quot;&lt;strong&gt;&lt;em&gt; &lt;/em&gt;&lt;/strong&gt;returns a list of available wireless networks.&lt;/p&gt;

&lt;p&gt;Supported commands by package &amp;quot;&lt;em&gt;&lt;strong&gt;network-manager&lt;/strong&gt;&lt;/em&gt;&amp;quot;: 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;NetworkManager&lt;/strong&gt;&lt;/em&gt;: network management daemon. 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;nm-tool&lt;/strong&gt;&lt;/em&gt;: utility to report state of network manager in text mode. 

  &lt;br /&gt;&lt;strong&gt;nm-system-settings&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Supported commands by package &amp;quot;&lt;em&gt;&lt;strong&gt;network-manager-gnome&lt;/strong&gt;&lt;/em&gt;&amp;quot;: 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;nm-applet&lt;/strong&gt;&lt;/em&gt;: a graphical networkmanager applet. It displays an icon in notification area(usually at top right corner) for managing network devices and connections. Usually, it is started up automatically when the system boots up. 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;nm-connection-editor&lt;/strong&gt;&lt;/em&gt;: display a graphcial connection configuration tool.&lt;/p&gt;

&lt;p&gt;Supported commands by package &amp;quot;&lt;strong&gt;&lt;em&gt;gnome-nettool&lt;/em&gt;&lt;/strong&gt;&amp;quot;: 

  &lt;br /&gt;&lt;em&gt;&lt;strong&gt;gnome-nettool&lt;/strong&gt;&lt;/em&gt; : GNOME network tools. This tool can be used to display detailed network information.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;gnome-network-preference&lt;/strong&gt;&lt;/em&gt; : Set network proxy preferences&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Compiz window manager&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;A good reference: &lt;a title="https://help.ubuntu.com/community/CompositeManager/CompizFusion" href="https://help.ubuntu.com/community/CompositeManager/CompizFusion"&gt;https://help.ubuntu.com/community/CompositeManager/CompizFusion&lt;/a&gt; 

  &lt;br /&gt;Compiz provides some very cool features I like. 

  &lt;br /&gt;Use command &lt;strong&gt;&lt;em&gt;ccsm&lt;/em&gt;&lt;/strong&gt; to display CompizConfig Settings manager. 

  &lt;br /&gt;&lt;strong&gt;More shortcuts:&lt;/strong&gt; 

  &lt;br /&gt;Super + E&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #Expo key. supported by &amp;quot;Expo&amp;quot; component. 

  &lt;br /&gt;Super + Tab&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #another window switcher. supported by &amp;quot;Shift Switcher&amp;quot; component and &amp;quot;Ring Switcher&amp;quot; component. 

  &lt;br /&gt;Alt + left-button&amp;#160;&amp;#160;&amp;#160; #move the window. supported by &amp;quot;Move Window&amp;quot; component. 

  &lt;br /&gt;Alt + mid-button&amp;#160;&amp;#160; #resize the window. supported by &amp;quot;Resize Window&amp;quot; component.&lt;/p&gt;

&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Input Method&lt;/strong&gt;&lt;/font&gt; 

  &lt;br /&gt;To input Chinese, I added Chinese language support. Executing command &amp;quot;&lt;em&gt;gnome-language-selector&lt;/em&gt;&amp;quot; would display &amp;quot;language support&amp;quot; dialog and you can select any language in the list you want to use. Releated packages are installed automatically. 

  &lt;br /&gt;SCIM (smart comman input method) is installed by default. Try command &amp;quot;&lt;em&gt;scim-setup&lt;/em&gt;&amp;quot; to configure scim. Use command &amp;quot;&lt;code&gt;im-switch -z en_US -s scim&lt;/code&gt;&amp;quot; to switch input method to scim. Then restart X. scim would be started automatically. 

  &lt;br /&gt;Also you can manually start scim using command &amp;quot;&lt;em&gt;scim -d&lt;/em&gt;&amp;quot;. 

  &lt;br /&gt;To make the lookup table follow the cursor, in scim setup dialog uncheck 

  &lt;br /&gt;&lt;em&gt;FrontEnd -&amp;gt; Global Setup -&amp;gt; Embed Preedit String into client window &lt;/em&gt;

  &lt;br /&gt;and 

  &lt;br /&gt;&lt;em&gt;Panel -&amp;gt; GTK -&amp;gt; Embedded lookup table&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Misc. Useful packages&lt;/font&gt;&lt;/strong&gt; I installed: 

  &lt;br /&gt;(*) sudo apt-get install gnome-device-manager 

  &lt;br /&gt;As its name implies, it is a device manager with GUI. Then it can be accessed by clicking &lt;em&gt;Applications-&amp;gt;System Tools -&amp;gt; Device Manager&lt;/em&gt;. 

  &lt;br /&gt;(*) Totem is installed by default which is a video player. 

  &lt;br /&gt;(*) sudo apt-get install vlc&amp;#160; #vlc player 

  &lt;br /&gt;Also, I tried to find a video player in Ubuntu repositories which can play &lt;em&gt;.rm&lt;/em&gt; and &lt;em&gt;.rmvb&lt;/em&gt; files. None of vlc, Kmplayer and mplayer can do that job. It seems that the main problem is license which means including real codec is illegal. Finally I downloaded linux version of realplayer from official real web site and installed it successfully. 

  &lt;br /&gt;(*) sudo apt-get install sun-java6-jdk&amp;#160; #jdk 6 

  &lt;br /&gt;Then use &lt;em&gt;update-alternatives --config java&lt;/em&gt; to set default &lt;em&gt;java&lt;/em&gt; executable. 

  &lt;br /&gt;(*) Package &amp;quot;&lt;em&gt;Transmission&lt;/em&gt;&amp;quot; is installed by default which is a BitTorrent client program. 

  &lt;br /&gt;(*) sudo apt-get install deluge-torrent (a bittorrent client) 

  &lt;br /&gt;(*) sudo apt-get install d4x (a download manager) 

  &lt;br /&gt;(*) sudo apt-get install gwget (another download manager)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;More tips&lt;/font&gt;&lt;/strong&gt; 

  &lt;br /&gt;How to take screenshots: &lt;a title="http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux" href="http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux"&gt;http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux&lt;/a&gt; 

  &lt;br /&gt;&lt;strong&gt;How to view &lt;em&gt;btchina&lt;/em&gt; in Linux?&lt;/strong&gt; 

  &lt;br /&gt;&lt;a title="http://mozilla.sociz.com/viewthread.php?tid=2367" href="http://mozilla.sociz.com/viewthread.php?tid=2367"&gt;http://mozilla.sociz.com/viewthread.php?tid=2367&lt;/a&gt; 

  &lt;br /&gt;First install &lt;em&gt;greasemonkey&lt;/em&gt; addon and then install the script at &lt;a title="http://userscripts.org/scripts/show/33286" href="http://userscripts.org/scripts/show/33286"&gt;http://userscripts.org/scripts/show/33286&lt;/a&gt; (click the button &amp;quot;Install&amp;quot; at top right corner). After successful installation, you can set the options of the script by clicking &lt;em&gt;Tools&lt;/em&gt;-&amp;gt;&lt;em&gt;GreaseMonkey&lt;/em&gt;-&amp;gt;&lt;em&gt;User Script Commands&lt;/em&gt; -&amp;gt; &lt;em&gt;option-here&lt;/em&gt;. 

  &lt;br /&gt;If you use FireFox on Windows, addon &lt;em&gt;IETab&lt;/em&gt; can be used. 

  &lt;br /&gt;&lt;strong&gt;Flashget on Linux?&lt;/strong&gt; 

  &lt;br /&gt;Candidates: &lt;em&gt;gwget&lt;/em&gt; and WebDownloader for X (&lt;em&gt;d4x&lt;/em&gt;) (can be installed from Ubuntu repositories). &lt;a href="http://dfast.sourceforge.net/" target="_blank"&gt;wxDownload Fast&lt;/a&gt; and &lt;a href="http://francis.dupont.free.fr/truedownloader/" target="_blank"&gt;trueDownloader&lt;/a&gt;(maybe must be installed from source). 

  &lt;br /&gt;Pick the ones you like from this list &lt;a title="http://en.wikipedia.org/wiki/List_of_download_managers" href="http://en.wikipedia.org/wiki/List_of_download_managers"&gt;http://en.wikipedia.org/wiki/List_of_download_managers&lt;/a&gt;. 

  &lt;br /&gt;&lt;strong&gt;How to configure multiple versions of a program?&lt;/strong&gt; 

  &lt;br /&gt;use utility &lt;em&gt;update-alternatives. &lt;/em&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-6411154564306697048?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/6411154564306697048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=6411154564306697048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6411154564306697048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/6411154564306697048'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2008/12/install-and-configure-ubuntu-810.html' title='Install and Configure Ubuntu 8.10'/><author><name>Gerald Guo</name><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-36974671.post-804617407393730158</id><published>2008-12-20T21:10:00.000-05:00</published><updated>2008-12-22T17:05:44.479-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><title type='text'>Latex resources</title><content type='html'>&lt;p&gt;[How to insert figures to Latex document]&lt;br&gt;&lt;a title="ftp://ftp.tex.ac.uk/tex-archive/info/epslatex.pdf" href="ftp://ftp.tex.ac.uk/tex-archive/info/epslatex.pdf"&gt;ftp://ftp.tex.ac.uk/tex-archive/info/epslatex.pdf&lt;/a&gt;&lt;br&gt;&lt;a title="http://www.miwie.org/tex-refs/html/index.html" href="http://www.miwie.org/tex-refs/html/index.html"&gt;http://www.miwie.org/tex-refs/html/index.html&lt;/a&gt;&lt;br&gt;FAQ: &lt;a title="http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/103.html" href="http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/103.html"&gt;http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/103.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;[Screen presentation]&lt;br&gt;&lt;a title="http://www.math.uakron.edu/~dpstory/pdf_present.html" href="http://www.math.uakron.edu/~dpstory/pdf_present.html"&gt;http://www.math.uakron.edu/~dpstory/pdf_present.html&lt;/a&gt;&lt;br&gt;&lt;a title="http://www.miwie.org/presentations/html/index.html" href="http://www.miwie.org/presentations/html/index.html"&gt;http://www.miwie.org/presentations/html/index.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;References&lt;br&gt;&lt;a title="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/index.html" href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/index.html"&gt;http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/index.html&lt;/a&gt;&lt;br&gt;&lt;a title="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/" href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/"&gt;http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/36974671-804617407393730158?l=tech.zhenhua.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech.zhenhua.info/feeds/804617407393730158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=36974671&amp;postID=804617407393730158' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/804617407393730158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36974671/posts/default/804617407393730158'/><link rel='alternate' type='text/html' href='http://tech.zhenhua.info/2008/12/latex-resources.html' title='Latex resources'/><author><name>Gerald Guo</name><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-36974671.post-731048218854977891</id><published>2008-12-20T21:01:00.000-05:00</published><updated>2008-12-20T21:02:28.105-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category sche
