<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>answersy.com Blog &#187; Linux/Unix</title>
	<atom:link href="http://answersy.com/zchen/index.php/category/it-related/linuxunix/feed/" rel="self" type="application/rss+xml" />
	<link>http://answersy.com/zchen</link>
	<description>Got questions? Got answers!</description>
	<lastBuildDate>Thu, 20 Oct 2011 04:28:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to install 64-bit sqlplus and perl DBD::Oracle package on Mac OS X?</title>
		<link>http://answersy.com/zchen/2011/10/20/how-to-install-64-bit-sqlplus-and-perl-dbdoracle-package-on-mac-os-x/</link>
		<comments>http://answersy.com/zchen/2011/10/20/how-to-install-64-bit-sqlplus-and-perl-dbdoracle-package-on-mac-os-x/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 03:18:58 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/?p=393</guid>
		<description><![CDATA[The Mac OS X version is 10.6.8. The Perl is installed at /usr/bin/perl, version (perl -version) is "v5.10.0 built for darwin-thread-multi-2level." There are two good articles on the web that discuss this issue, but none of them is perfect for me. So I tried to add my stuff here. The first is about installing sqlplus: [...]]]></description>
			<content:encoded><![CDATA[<p>The Mac OS X version is <strong>10.6.8</strong>.<br />
The Perl is installed at /usr/bin/perl, version (perl -version) is "<strong>v5.10.0 built for darwin-thread-multi-2level</strong>."</p>
<p>There are two good articles on the web that discuss this issue, but none of them is perfect for me. So I tried to add my stuff here.<br />
The first is about installing sqlplus: <a href="http://www.danilovizzarro.it/2008/07/how-to-install-sqlplus-and-the-oracle-client-v102-on-a-mac-os-x-leopard-1054/">http://www.danilovizzarro.it/2008/07/how-to-install-sqlplus-and-the-oracle-client-v102-on-a-mac-os-x-leopard-1054/</a><br />
The second is about installing DBD::Oracle: <a href="http://blacka.com/david/2008/11/12/how-to-install-dbdoracle-on-mac-os-x/">http://blacka.com/david/2008/11/12/how-to-install-dbdoracle-on-mac-os-x/</a></p>
<p><strong>To install sqlplus</strong>, you need download instantclient form <a href="http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html">oracle site</a>, the following (64-bit) packages:</p>
<li>Basic: <em>instantclient-basic-10.2.0.4.0-macosx-x64.zip</em></li>
<li>Sqlplus: <em>instantclient-sqlplus-10.2.0.4.0-macosx-x64.zip</em></li>
<p>To install DBD::Oracle, you need one more package:</p>
<li>SDK: <em>instantclient-sdk-10.2.0.4.0-macosx-x64.zip</em></li>
<p>Once you download and unzip them, all the files will go to a directory called <strong>instantclient_10_2</strong>. Move this folder to something like /opt/oracle</p>
<p><code><br />
$ sudo mv instantclient_10_2 /opt/oracle<br />
</code></p>
<p>You should set unix environment variable like the following:<br />
<code><br />
DYLD_LIBRARY_PATH="/opt/oracle/instantclient_10_2"<br />
export DYLD_LIBRARY_PATH<br />
TNS_ADMIN="/opt/oracle/tns"<br />
export TNS_ADMIN<br />
ORACLE_HOME="/opt/oracle/instantclient_10_2"<br />
export ORACLE_HOME<br />
</code></p>
<p>To connect to the an Oracle via sqlplus you can run the following command:<br />
<code><br />
# sqlplus DB_USER/DB_PASS@//DB_HOST:DB_PORT/DB_SID<br />
</code></p>
<p>To install <strong>DBD::Oracle</strong>, you will need to download perl <a href="http://search.cpan.org/dist/DBD-Oracle/">DBD package</a> from CPAN, I chose version 1.32.</p>
<p>After you download the package, unzip it to ~/Download/DBD-Oracle-1.32, make sure you have set ORACLE_HOME and DYLD_LIBRARY_PATH correctly.<br />
You need to set some soft link in $ORACLE_HOME (<span style="color: #ff0000;">This is the key step most readme files failed to mention.</span>)</p>
<p><code><br />
$ cd /opt/oracle/instantclient_10_2/<br />
$ sudo ln -s /opt/oracle/instantclient_10_2/ lib<br />
$ sudo ln -s libclntsh.dylib.10.1 libclntsh.dylib<br />
$ ls -l </code></p>
<p><code>lrwxr-xr-x   1 root  admin        31 Oct 19 16:36 lib -&gt; /opt/oracle/instantclient_10_2/<br />
lrwxr-xr-x   1 root  admin        20 Oct 19 16:32 libclntsh.dylib -&gt; libclntsh.dylib.10.1<br />
</code></p>
<p>Now you can compile the DBD::Oracle Package now:<br />
<code><br />
$ cd ~/Download/DBD-Oracle-1.32<br />
$ perl Makefile.PL<br />
$ make<br />
$ sudo make install<br />
</code></p>
<p>In perl script you connect to oracle server using the following code:<br />
<code><br />
#! /usr/bin/perl -w</p>
<p>use warnings;<br />
use strict;<br />
use Data::Dumper;<br />
use DBI;</p>
<p>my $sid = "host=host.xyz.com;sid=DBSID;port=1521"<br />
my $dbh = DBI->connect("dbi:Oracle:$sid", $user, $pass) or die "ERROR: failed to connect db: $@\n";<br />
</code></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2011%2F10%2F20%2Fhow-to-install-64-bit-sqlplus-and-perl-dbdoracle-package-on-mac-os-x%2F';
  addthis_title  = 'How+to+install+64-bit+sqlplus+and+perl+DBD%3A%3AOracle+package+on+Mac+OS+X%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2011/10/20/how-to-install-64-bit-sqlplus-and-perl-dbdoracle-package-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Handle Date with AWK?</title>
		<link>http://answersy.com/zchen/2008/01/23/how-to-handle-date-with-awk/</link>
		<comments>http://answersy.com/zchen/2008/01/23/how-to-handle-date-with-awk/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 08:12:41 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2008/01/23/how-to-handle-date-with-awk/</guid>
		<description><![CDATA[You have a file with the following format: type-1 2008/01/12 20:04:40 xxx yyy type-2 2008/01/11 10:05:20 aaa bbb type-2 2008/01/01 11:15:10 ccc ddd You want to count for each type, how many rows have time stamp > 2008/01/10 BEGIN{ ta1=0; ta2=0; } { split($2, a, " "); split(a[1], ymd, "/"); split(a[2], hms, ":"); t0 = [...]]]></description>
			<content:encoded><![CDATA[<p>You have a file with the following format:</p>
<pre>type-1    2008/01/12 20:04:40    xxx    yyy
type-2    2008/01/11 10:05:20    aaa    bbb
type-2    2008/01/01 11:15:10    ccc    ddd</pre>
<p>You want to count for each type, how many rows have time stamp > 2008/01/10</p>
<pre>BEGIN{
ta1=0;
ta2=0;
}

{
split($2, a, " ");
split(a[1], ymd, "/");
split(a[2], hms, ":");

t0 = mktime("2008 01 10 00 00 00");
t = mktime(sprintf("%s %s %s %s %s %s", ymd[1], ymd[2], ymd[3], hms[1], hms[2], hms[3]));
if( t > 0) {
if($1 == "type1") {
if(t > t0) {ta1 = ta1 +1 }
}
if($1 == "type2") {
if(t > t0) {ta2 = ta2 +1 }
}
}

END {
print "type1", ta1, "type2", ta1;
}</pre>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2008%2F01%2F23%2Fhow-to-handle-date-with-awk%2F';
  addthis_title  = 'How+to+Handle+Date+with+AWK%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2008/01/23/how-to-handle-date-with-awk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Get Total of a Column with AWK?</title>
		<link>http://answersy.com/zchen/2008/01/03/how-to-get-total-of-a-column-with-awk/</link>
		<comments>http://answersy.com/zchen/2008/01/03/how-to-get-total-of-a-column-with-awk/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 23:20:09 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2008/01/03/how-to-get-total-of-a-column-with-awk/</guid>
		<description><![CDATA[The Following code will get sum of column 1 :-) cat filename &#124; awk -F "\\t" 'BEGIN { t1=0; t2=0 } { if($1]]></description>
			<content:encoded><![CDATA[<p>The Following code will get sum of column 1 :-)</p>
<pre>cat filename | awk -F "\\t"
'BEGIN { t1=0; t2=0 } { if($1<10) t2+=$1; t1+=$1 } END { print t1, t2, t2/t1 }'</pre>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2008%2F01%2F03%2Fhow-to-get-total-of-a-column-with-awk%2F';
  addthis_title  = 'How+to+Get+Total+of+a+Column+with+AWK%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2008/01/03/how-to-get-total-of-a-column-with-awk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use LWP::UserAgent with Socks Proxy?</title>
		<link>http://answersy.com/zchen/2008/01/03/how-to-use-lwpuseragent-with-socks-proxy/</link>
		<comments>http://answersy.com/zchen/2008/01/03/how-to-use-lwpuseragent-with-socks-proxy/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 06:56:39 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[PHP/Perl]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2008/01/03/how-to-use-lwpuseragent-with-socks-proxy/</guid>
		<description><![CDATA[To use so you need LWP::Protocol::http::SocksChain. There is a number of such protocol packages, but usually, installing any one of them requires a number of other prerequisites: Here is a process I have tested, if you do have super user privilege, you can ignore where "/path/to/install" is mentioned 0. $ sudo -s 0.1 setenv PERL5LIB [...]]]></description>
			<content:encoded><![CDATA[<p>To use so you need <strong>LWP::Protocol::http::SocksChain</strong>.</p>
<p>There is a number of such protocol packages, but usually, installing any one of them requires a number of other prerequisites:</p>
<p>Here is a process I have tested, if you do have super user privilege, you can ignore where "<strong>/path/to/install</strong>" is mentioned</p>
<pre class="perl"><span style="color: #cc66cc;">0</span>. $ sudo -<a href="http://perldoc.perl.org/functions/s.html"><span style="color: #000066;">s</span></a>
<span style="color: #cc66cc;">0.1</span> setenv PERL5LIB /path/to/install/lib/site_perl
&nbsp;
<span style="color: #cc66cc;">1</span>. INSTALL OPENSSL
<span style="color: #cc66cc;">1.1</span> http://www.openssl.org/source/,
download http://www.openssl.org/source/openssl<span style="color: #cc66cc;">-0.9</span>.8g.tar.gz
<span style="color: #cc66cc;">1.2</span> Unzip openssl<span style="color: #cc66cc;">-0.9</span>.8g.tar.gz
<span style="color: #cc66cc;">1.3</span> Read INSTALL
<span style="color: #cc66cc;">1.4</span> $ ./config
<span style="color: #cc66cc;">1.5</span> $ make
<span style="color: #cc66cc;">1.6</span> $ make test
<span style="color: #cc66cc;">1.6</span> $ make install
&nbsp;
<span style="color: #cc66cc;">2</span>. INSTALL Net::<span style="color: #006600;">SSLeay</span>
<span style="color: #cc66cc;">2.1</span> Download it from http://search.cpan.org/~flora/Net-SSLeay<span style="color: #cc66cc;">-1.32</span>/,
download http://search.cpan.org/CPAN/authors/id/F/FL/FLORA/Net-SSLeay<span style="color: #cc66cc;">-1.32</span>.tar.gz
<span style="color: #cc66cc;">2.2</span> Unzip Net-SSLeay<span style="color: #cc66cc;">-1.32</span>.tar.gz
<span style="color: #cc66cc;">2.3</span> $ perl Makefile.PL PREFIX=/path/to/install
<span style="color: #cc66cc;">2.4</span> $ make install <span style="color: #808080; font-style: italic;"># the Makefile requires -lz, on certain system, you can remove it</span>
<span style="color: #cc66cc;">2.5</span> $ cd examples
<span style="color: #cc66cc;">2.6</span> $ get_page.pl www.cryptsoft.com <span style="color: #cc66cc;">443</span> /
&nbsp;
<span style="color: #cc66cc;">3</span>. INSTALL IO::<span style="color: #006600;">Socket</span>::<span style="color: #006600;">SSL</span>
<span style="color: #cc66cc;">3.1</span> Download it from http://search.cpan.org/dist/IO-Socket-SSL/,
download http://search.cpan.org/CPAN/authors/id/S/SU/SULLR/IO-Socket-SSL<span style="color: #cc66cc;">-1.12</span>.tar.gz
<span style="color: #cc66cc;">3.2</span> Unzip IO-Socket-SSL<span style="color: #cc66cc;">-1.12</span>.tar.gz
<span style="color: #cc66cc;">3.3</span> $ perl Makefile.PL PREFIX=/path/to/install
<span style="color: #cc66cc;">3.4</span> $ make
<span style="color: #cc66cc;">3.5</span> $ make test
<span style="color: #cc66cc;">3.6</span> $ make install
&nbsp;
<span style="color: #cc66cc;">4</span>. INSTALL Net::<span style="color: #006600;">SC</span>
<span style="color: #cc66cc;">4.1</span> Download it from http://search.cpan.org/~gosha/Net-SC<span style="color: #cc66cc;">-1.20</span>/,
download http://search.cpan.org/CPAN/authors/id/G/GO/GOSHA/Net-SC<span style="color: #cc66cc;">-1.20</span>.tar.gz
<span style="color: #cc66cc;">4.2</span> Unzip Net-SC<span style="color: #cc66cc;">-1.20</span>.tar.gz
<span style="color: #cc66cc;">4.3</span> $ perl Makefile.PL PREFIX=/path/to/install
<span style="color: #cc66cc;">4.4</span> $ make
<span style="color: #cc66cc;">4.5</span> $ make test
<span style="color: #cc66cc;">4.6</span> $ make install
&nbsp;
<span style="color: #cc66cc;">5</span>. INSTALL
<span style="color: #cc66cc;">5.1</span> Download it from http://search.cpan.org/~gosha/LWP-Protocol-http-SocksChain<span style="color: #cc66cc;">-1.4</span>/,
download http://search.cpan.org/CPAN/authors/id/G/GO/GOSHA/LWP-Protocol-http-SocksChain<span style="color: #cc66cc;">-1.4</span>.tar.gz
<span style="color: #cc66cc;">5.2</span> Unzip LWP-Protocol-http-SocksChain<span style="color: #cc66cc;">-1.4</span>.tar.gz
<span style="color: #cc66cc;">5.3</span> $ perl Makefile.PL PREFIX=/path/to/install
<span style="color: #cc66cc;">5.4</span> $ make
<span style="color: #cc66cc;">5.5</span> $ make test
<span style="color: #cc66cc;">5.6</span> $ make install</pre>
<p>Now you can use LWPGet</p>
<pre class="perl"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl -w</span>
<a href="http://perldoc.perl.org/functions/require.html"><span style="color: #000066;">require</span></a> <span style="color: #cc66cc;">5.8</span><span style="color: #cc66cc;">.0</span>;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> lib <span style="color: #ff0000;">&quot;/path/to/install/lib/site_perl/5.8.7&quot;</span>;
<span style="color: #000000; font-weight: bold;">use</span> LWP::<span style="color: #006600;">Simple</span>; <span style="color: #000000; font-weight: bold;">use</span> LWP::<span style="color: #006600;">UserAgent</span>;
<span style="color: #000000; font-weight: bold;">use</span> LWP::<span style="color: #006600;">Protocol</span>::<span style="color: #006600;">http</span>::<span style="color: #006600;">SocksChain</span>;
LWP::<span style="color: #006600;">Protocol</span>::<span style="color: #006600;">implementor</span><span style="color: #66cc66;">&#40;</span> http =&gt; <span style="color: #ff0000;">'LWP::Protocol::http::SocksChain'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">@LWP</span>::<span style="color: #006600;">Protocol</span>::<span style="color: #006600;">http</span>::<span style="color: #006600;">SocksChain</span>::<span style="color: #006600;">EXTRA_SOCK_OPTS</span> = <span style="color: #66cc66;">&#40;</span>
Chain_Len    =&gt; <span style="color: #cc66cc;">1</span>,
Debug        =&gt; <span style="color: #cc66cc;">0</span>,
Random_Chain =&gt; <span style="color: #cc66cc;">1</span>,
Chain_File_Data =&gt; <span style="color: #66cc66;">&#91;</span>
<span style="color: #ff0000;">'ip_of_socks_proxy:port:::5'</span>,
<span style="color: #66cc66;">&#93;</span>,
Auto_Save    =&gt; <span style="color: #cc66cc;">0</span>,
Restore_Type =&gt; <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ua</span> = <span style="color: #000000; font-weight: bold;">new</span> LWP::<span style="color: #006600;">UserAgent</span> <span style="color: #0000ff;">$ua</span>-&gt;<span style="color: #006600;">agent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$Url</span> = <span style="color: #0000ff;">$ARGV</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$response</span> = <span style="color: #0000ff;">$ua</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$Url</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$response</span>-&gt;<span style="color: #006600;">is_success</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$page</span> = <span style="color: #0000ff;">$response</span>-&gt;<span style="color: #006600;">content</span>;
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #0000ff;">$page</span>, <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #000000; font-weight: bold;">STDERR</span> <span style="color: #ff0000;">&quot;Fail to get $Url<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2008%2F01%2F03%2Fhow-to-use-lwpuseragent-with-socks-proxy%2F';
  addthis_title  = 'How+to+Use+LWP%3A%3AUserAgent+with+Socks+Proxy%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2008/01/03/how-to-use-lwpuseragent-with-socks-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install MySql 5.0+ on a Linux Box?</title>
		<link>http://answersy.com/zchen/2007/09/28/how-to-install-mysql-50-on-a-linux-box/</link>
		<comments>http://answersy.com/zchen/2007/09/28/how-to-install-mysql-50-on-a-linux-box/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 04:47:19 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2007/09/28/how-to-install-mysql-50-on-a-linux-box/</guid>
		<description><![CDATA[Step 1: Download the package You can find the official download Link at http://dev.mysql.com/downloads/ For MySql 5.0: http://dev.mysql.com/downloads/mysql/5.0.html#downloads Step 2: Install the Binary shell> /usr/sbin/groupadd mysql shell> /usr/sbin/useradd -g mysql mysql shell> cd /usr/local shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz &#124; tar xvf - shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql shell> cd mysql shell> scripts/mysql_install_db --user=mysql shell> chown [...]]]></description>
			<content:encoded><![CDATA[<p style="font-weight: bold">Step 1: Download the package</p>
<ul>
<li>You can find the<strong> official download Link at</strong> <a target="_top" href="http://dev.mysql.com/downloads/">http://dev.mysql.com/downloads/</a></li>
<li>For <strong>MySql 5.0:</strong> <a target="_top" href="http://dev.mysql.com/downloads/mysql/5.0.html#downloads">http://dev.mysql.com/downloads/mysql/5.0.html#downloads</a></li>
</ul>
<p><span style="font-weight: bold">Step 2: Install the Binary</span><strong><span style="font-weight: normal" /></strong><br />
shell> <font style="color: brown">/usr/sbin/groupadd mysql</font><br />
shell> <font style="color: brown">/usr/sbin/useradd -g mysql mysql</font><br />
shell> <font style="color: brown">cd /usr/local</font><br />
shell> <font style="color: brown">gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -</font><br />
shell> <font style="color: brown">ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql</font><br />
shell> <font style="color: brown">cd mysql</font><br />
shell> <font style="color: brown">scripts/mysql_install_db --user=mysql</font><br />
shell> <font style="color: brown">chown -R root .</font><br />
shell> <font style="color: brown">chown -R mysql data</font><br />
shell> <font style="color: brown">chgrp -R mysql .</font><br />
shell> <font style="color: brown">bin/mysqld_safe --user=mysql & </font> # start mysql daemon</p>
<p><strong> Step 3: Post-installation</strong><br />
shell> <font style="color: brown">su mysql</font><br />
shell> <font style="color: brown">mysql/scripts/mysql_install_db</font></p>
<p>shell> <font style="color: brown">mysql -u root -p</font><br />
mysql> <font style="color: brown">use mysql</font><br />
mysql> <font style="color: brown">GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;</font><br />
mysql> <font style="color: brown">set PASSWORD FOR 'user'@'localhost'  = PASSWORD('password');</font><br />
mysql> <font style="color: brown">FLUSH PRIVILEGES;</font><br />
mysql> <font style="color: brown">select * from mysql.user;</font></p>
<p>mysql> <font style="color: brown">create database db_name;</font><br />
mysql> <font style="color: brown">SHOW DATABASES;</font><br />
mysql> <font style="color: brown">use db_name;</font><br />
mysql> <font style="color: brown">SHOWTABLES;</font></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2007%2F09%2F28%2Fhow-to-install-mysql-50-on-a-linux-box%2F';
  addthis_title  = 'How+to+Install+MySql+5.0%2B+on+a+Linux+Box%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2007/09/28/how-to-install-mysql-50-on-a-linux-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Linux Screen Command?</title>
		<link>http://answersy.com/zchen/2007/09/25/how-to-use-linux-screen-command/</link>
		<comments>http://answersy.com/zchen/2007/09/25/how-to-use-linux-screen-command/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 17:34:14 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2007/09/25/how-to-use-linux-screen-command/</guid>
		<description><![CDATA[The screen command lets you start new terminals, detach them and bring them back later. So you do not need to worry about how to bring a process to background any more. Here, I will give a very brief introduction on it, which is good enough for one to see the beauty of it. If [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>screen</strong> command lets you start new terminals, detach them and bring them back later. So you do not need to worry about how to bring a process to background any more. Here, I will give a very brief introduction on it, which is good enough for one to see the beauty of it. If you want to learn more, do a search "screen man" on any search engine.</p>
<p>To <strong>start screen</strong>: enter <font style="color: brown"><strong>screen</strong> -RD</font> at Unix prompt.<br />
To <strong>exit screen</strong>: you need to close all the terminals attach to it. Hit <strong>ctrl-d</strong> or enter <strong>exit</strong> for each terminal, screen will exit when the last terminal exits.</p>
<p>To <strong>detach screen</strong> (sent it to background): simply close the terminals window if you are using any ssh/telnet clients, or to do it explicitly by hitting <strong>ctrl-a</strong> then <strong>d</strong>.</p>
<p>To <strong>re-attach screen</strong> and bring you previous Unix session to foreground: enter <font style="color: brown"><strong>screen</strong> -RD</font> at Unix prompt. If you only have one screen running on the host, it will be brought to foreground right away. Otherwise, see below.<br />
You can start multiple screens on one host, detach them to send them to background. When you enter <font style="color: brown"><strong>screen</strong> -RD</font> next time, screen will list all the detached ones, and you can choose to re-attach any one of them by <font style="color: brown"><strong>screen</strong> -RD <em>screen_name</em></font></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2007%2F09%2F25%2Fhow-to-use-linux-screen-command%2F';
  addthis_title  = 'How+to+Use+Linux+Screen+Command%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2007/09/25/how-to-use-linux-screen-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looking for some File Handling Hints on Linux or Unix?</title>
		<link>http://answersy.com/zchen/2007/09/22/looking-for-some-file-handing-hints-on-linux-or-unix/</link>
		<comments>http://answersy.com/zchen/2007/09/22/looking-for-some-file-handing-hints-on-linux-or-unix/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 00:03:11 +0000</pubDate>
		<dc:creator>zchen</dc:creator>
				<category><![CDATA[IT Related]]></category>
		<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://answersy.com/zchen/2007/09/22/looking-for-some-file-handing-hints-on-linux-or-unix/</guid>
		<description><![CDATA[To find size under a dir du -sk * To find # of files in a dir find . -type f &#124; wc find . &#124; cut -f 2 -d &#124; uniq -c &#124; sort n find . &#124; cut -f 2-3 -d &#124; uniq -c &#124; sort n To find and do sth to [...]]]></description>
			<content:encoded><![CDATA[<table>
<tr>
<td colspan="3">To find size under a dir</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>du</strong> -sk *</font></td>
</tr>
<tr>
<td colspan="3">To find # of files in a dir</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>find</strong> . -type f | wc</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>find</strong> . | <strong>cut</strong> -f 2 -d | <strong>uniq</strong> -c | <strong>sort</strong> n</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>find</strong> . | <strong>cut</strong> -f 2-3 -d | <strong>uniq</strong> -c | <strong>sort</strong> n</font></td>
</tr>
<tr>
<td colspan="3">To <strong>find</strong> and do sth to the results</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>find</strong> dir_name -name filename* | <strong>xargs cat</strong> | <strong>sort</strong> | <strong>uniq</strong> > filename_new</font></td>
</tr>
<tr>
<td colspan="3">To find all <strong>symbolic links</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown">ls -lR | grep '\->'</font></td>
</tr>
<tr>
<td colspan="3">o use <strong>tar</strong>, <strong>gzip</strong>, <strong>unzip</strong>, <strong>bzip2</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>tar</strong> cvf - . | <strong>gzip</strong> > filename.tar.gz</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>gzip</strong> -dc filename.tar.gz | <strong>tar</strong> xvf -</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>bzip2</strong> -d filename.bz2</font></td>
</tr>
<tr>
<td colspan="3">To <strong>sort</strong> file</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>sort</strong> +0 -nr input_file > output_file</font> -- sort with first column(+0), using number order(-n), reversed order(-r)</td>
</tr>
<tr>
<td colspan="3">To remove <strong>duplicated</strong> lines</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>uniq</strong> input_file > output_file</font></td>
</tr>
<tr>
<td colspan="3">To get first/last k lines of a file</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>head</strong> -n 10 input_file > output_file</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>tail</strong> -n 10 input_file > output_file</font></td>
</tr>
<tr>
<td colspan="3">To get certain lines in a file</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown"><strong>sed</strong> -n -e 20,30p filename</font> -- only print lines 20~30</td>
</tr>
<tr>
<td colspan="3">To replace all blanks after 1,2,3 with just 1,2,3</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2"><font style="color: brown">cat filename | <strong>sed</strong> -e 's/\([1-3]\)\([ ]*\)/\1/'</font></td>
</tr>
<tr>
<td colspan="3"><strong>awk</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">Line level handling</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown"><strong>awk</strong> ' {split ($0, a, "\t"); printf("%s\t%s\n", a[2], a[3])} ' input_file > output_file</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown"><strong>awk</strong> '{if ( ($2=="xxxxxxx") && ($1>150)) print $0}' input_file > output_file</font> -- given condition</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To <strong>right justify</strong> 1st column</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">cat filename | <strong>awk</strong> '{printf "%10d %s\n",$1,$2}'</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To <strong>sum numbers</strong> in a column</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">cat filename | <strong>awk</strong> 'BEGIN { tot=0 } { tot+=$1 } END { print tot }'</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">Generate batch processing scripts</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td>Move <font style="color: brown">ls -1 * | <strong>awk</strong> '{ print "mv " $1 " " $1}' | sed -e 's/EXT_A\(.*\)EXT_A/EXT_A\1EXT_B/'</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td>Copy <font style="color: brown">ls -1 * | <strong>awk</strong> '{ printf "scp host:/path/%s %s\n", $1, " ."}'</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To <strong>compare two sorted files</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">diff old_file new_file | grep ">" | awk '{print $2}' > diff.added</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">diff old_file new_file | grep "<" | awk '{print $2}' > diff.deleted</font></td>
</tr>
<tr>
<td colspan="3"><strong>vi</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To change to <strong>UPPER</strong> and <strong>lower</strong> cases</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">:%s/.*/\U&/</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">:$s/.*/\L&/</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To <strong>delete ^M</strong></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">:1,$ s/Ctl-VCtl-M//g</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td colspan="2">To <strong>view HEX value</strong> and recover</td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">:%!xxd</font></td>
</tr>
<tr>
<td style="width: 15px"></td>
<td style="width: 15px"></td>
<td><font style="color: brown">:%!xxd -r</font></td>
</tr>
</table>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fanswersy.com%2Fzchen%2F2007%2F09%2F22%2Flooking-for-some-file-handing-hints-on-linux-or-unix%2F';
  addthis_title  = 'Looking+for+some+File+Handling+Hints+on+Linux+or+Unix%3F';
  addthis_pub    = 'zchen050815';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://answersy.com/zchen/2007/09/22/looking-for-some-file-handing-hints-on-linux-or-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.587 seconds -->

