<?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>MemoSoup</title>
	<atom:link href="http://www.memosoup.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memosoup.com</link>
	<description>Mix of the things I always forget</description>
	<lastBuildDate>Wed, 25 Apr 2012 09:45:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>AutoCAD: slow mouse reaction</title>
		<link>http://www.memosoup.com/20120425/autocad-slow-mouse-reaction.html</link>
		<comments>http://www.memosoup.com/20120425/autocad-slow-mouse-reaction.html#comments</comments>
		<pubDate>Wed, 25 Apr 2012 09:39:01 +0000</pubDate>
		<dc:creator>uCAD</dc:creator>
				<category><![CDATA[AutoCAD]]></category>
		<category><![CDATA[autocad]]></category>
		<category><![CDATA[mouse]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=507</guid>
		<description><![CDATA[<p>Sometimes in AutoCAD the mouse hangs for some time (up to 1 seconds) for every operation.</p> <p>Here are some methods to reduce these &#8220;sticking&#8221; moments.</p> If this is wireless mouse, check the batteries.  (In fact, this will work for every application, not for AutoCAD only!) If the Layer Palette is used &#8211; turn it OFF [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes in AutoCAD the mouse hangs for some time (up to 1 seconds) for every operation.</p>
<p>Here are some methods to reduce these &#8220;sticking&#8221; moments.</p>
<ul>
<li>If this is wireless mouse, <strong>check the batteries</strong>.  (In fact, this will work for every application, not for AutoCAD only!)</li>
<li>If the <strong>Layer Palette</strong> is used &#8211; turn it OFF (set LAYERDLGMODE to &#8220;0&#8243; to get the classic layer manager back)</li>
<li>If the &#8220;<strong>Selection Preview</strong>&#8221; is on &#8211; turn it OFF</li>
<li>If <strong>Dynamic UCS</strong> is turned on &#8211; turn it OFF</li>
<li>Set the <strong>anti-virus program</strong> to ignore AutoCAD related extensions (DWG, DWT, DCL, LSP etc)</li>
<li>Uncheck the &#8220;<strong>Check Web for Live Enablers</strong>&#8221; box  in Options-&gt;System</li>
<li>Remove unnecessay hyperlinks (or broken links)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120425/autocad-slow-mouse-reaction.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: print the name of the input file</title>
		<link>http://www.memosoup.com/20120418/perl-print-the-name-of-the-input-file.html</link>
		<comments>http://www.memosoup.com/20120418/perl-print-the-name-of-the-input-file.html#comments</comments>
		<pubDate>Wed, 18 Apr 2012 14:55:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[filename]]></category>
		<category><![CDATA[input]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=496</guid>
		<description><![CDATA[<p>The special variable $ARGV could be used to get the name of the input file. It returns the name of the file or &#8216;-&#8217; if the standard input was used.</p> <p>Here are some examples:</p> perl -nle 'END { print $ARGV }' /etc/passwd /etc/passwd echo test &#124; perl -nle 'print $ARGV' - $ &#40;echo test; echo [...]]]></description>
			<content:encoded><![CDATA[<p>The special variable $ARGV could be used to get the name of the input file.<br />
It returns the name of the file or &#8216;-&#8217; if the standard input was used.</p>
<p>Here are some examples:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-nle</span> <span style="color: #ff0000;">'END { print $ARGV }'</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span><br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span></div></div>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-nle</span> <span style="color: #ff0000;">'print $ARGV'</span><br />
-</div></div>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">test</span>; <span style="color: #7a0874; font-weight: bold;">echo</span> test2<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-nle</span> <span style="color: #ff0000;">'print $ARGV'</span><br />
-<br />
-</div></div>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-nle</span> <span style="color: #ff0000;">'print $ARGV if !$seen{$ARGV}++'</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>shells<br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span><br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>shells</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120418/perl-print-the-name-of-the-input-file.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix: show tcp packets</title>
		<link>http://www.memosoup.com/20120306/unix-show-tcp-packets.html</link>
		<comments>http://www.memosoup.com/20120306/unix-show-tcp-packets.html#comments</comments>
		<pubDate>Tue, 06 Mar 2012 10:56:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[tcpdump]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=491</guid>
		<description><![CDATA[<p>TCP packets could be catched by tcpdump:</p> tcpdump -n -i any 'tcp[tcpflags] &#38; (tcp-syn&#124;tcp-ack) == tcp-syn and port 80' ]]></description>
			<content:encoded><![CDATA[<p>TCP packets could be catched by tcpdump:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcpdump <span style="color: #660033;">-n</span> <span style="color: #660033;">-i</span> any <span style="color: #ff0000;">'tcp[tcpflags] &amp; (tcp-syn|tcp-ack) == tcp-syn and port 80'</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120306/unix-show-tcp-packets.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: converting timestamp to date</title>
		<link>http://www.memosoup.com/20120304/oracle-converting-timestamp-to-date.html</link>
		<comments>http://www.memosoup.com/20120304/oracle-converting-timestamp-to-date.html#comments</comments>
		<pubDate>Sun, 04 Mar 2012 14:40:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=489</guid>
		<description><![CDATA[<p>Here is the method to display timestamp in the convenient format:</p> SELECT TO_CHAR &#40;SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS'&#41; s_date FROM DUAL; <p>Simple conversion of the timestamp:</p> SELECT CAST&#40;SYSTIMESTAMP AS DATE&#41; x_date FROM DUAL; ]]></description>
			<content:encoded><![CDATA[<p>Here is the method to display timestamp in the convenient format:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">TO_CHAR</span> <span style="color: #66cc66;">&#40;</span>SYSTIMESTAMP<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'YYYY-MM-DD HH24:MI:SS'</span><span style="color: #66cc66;">&#41;</span> s_date<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> DUAL;</div></div>
<p>Simple conversion of the timestamp:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> CAST<span style="color: #66cc66;">&#40;</span>SYSTIMESTAMP <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AS</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">DATE</span><span style="color: #66cc66;">&#41;</span> x_date <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> DUAL;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120304/oracle-converting-timestamp-to-date.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UNIX: mounting CD</title>
		<link>http://www.memosoup.com/20120301/unix-mounting-cd.html</link>
		<comments>http://www.memosoup.com/20120301/unix-mounting-cd.html#comments</comments>
		<pubDate>Thu, 01 Mar 2012 11:58:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=484</guid>
		<description><![CDATA[<p>Here are the mount commands for different *nix systems.</p> <p>HP-UX</p> nohup /usr/sbin/pfs_mountd &#38; nohup /usr/sbin/pfsd &#38; /usr/sbin/pfs_mount -t rrip -x unix /dev/dsk/c5t2d0 /SD_CDROM <p>AIX</p> mount -r -v cdrfs /dev/cd0 /cdrom <p>Solaris Intel</p> mount -F hsfs -r /dev/dsk/c0t6d0p0 /cdrom <p>SPARC Solaris</p> mount -r -F hsfs /dev/dsk/c0t6d0s2 /cdrom <p>TRU64</p> mount -t cdfs -r -o nodefperm,noversion,rrip /dev/rz4c /cdrom [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the <strong>mount</strong> commands for different *nix systems.</p>
<p><strong>HP-UX</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>pfs_mountd <span style="color: #000000; font-weight: bold;">&amp;</span><br />
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>pfsd <span style="color: #000000; font-weight: bold;">&amp;</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>pfs_mount <span style="color: #660033;">-t</span> rrip <span style="color: #660033;">-x</span> unix <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>dsk<span style="color: #000000; font-weight: bold;">/</span>c5t2d0 <span style="color: #000000; font-weight: bold;">/</span>SD_CDROM</div></div>
<p><strong>AIX</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-r</span> <span style="color: #660033;">-v</span> cdrfs <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>cd0 <span style="color: #000000; font-weight: bold;">/</span>cdrom</div></div>
<p><strong>Solaris Intel</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount -F hsfs -r /dev/dsk/c0t6d0p0 /cdrom</div></div>
<p><strong>SPARC Solaris</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount -r -F hsfs /dev/dsk/c0t6d0s2 /cdrom</div></div>
<p><strong>TRU64</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount -t cdfs -r -o nodefperm,noversion,rrip /dev/rz4c /cdrom</div></div>
<p><strong>Linux</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount -t iso9660 /dev/cdrom /cdrom</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120301/unix-mounting-cd.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: how to get the position of the match</title>
		<link>http://www.memosoup.com/20120229/perl-how-to-get-the-position-of-the-match.html</link>
		<comments>http://www.memosoup.com/20120229/perl-how-to-get-the-position-of-the-match.html#comments</comments>
		<pubDate>Wed, 29 Feb 2012 16:30:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=474</guid>
		<description><![CDATA[<p>Let&#8217;s search for the word &#8220;brave&#8221; in the string &#8220;Hello, new brave world!&#8221;. There are several methods to get the position of the match in Perl.</p> <p>#1 &#8211; use POS function Function pos returns the position, where search was finished.</p> $txt = &#34;Hello, brave new world!&#34; ; $txt =~ m/(brave)/g; my $pos = pos&#40;$txt&#41; - [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s search for the word &#8220;brave&#8221; in the string &#8220;Hello, new brave world!&#8221;.<br />
There are several methods to get the position of the match in Perl.</p>
<p><strong>#1 &#8211; use POS function</strong><br />
Function <strong>pos</strong> returns the position, where search was finished.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Hello, brave new world!&quot;</span> <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/(brave)/g</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$pos</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/pos.html"><span style="color: #000066;">pos</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$txt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/length.html"><span style="color: #000066;">length</span></a> <span style="color: #0000ff;">$1</span><span style="color: #339933;">;</span></div></div>
<p><strong>#2 &#8211; use $PREMATCH variable</strong><br />
<strong>$PREMATCH</strong> varialbe (short name <strong>$`</strong>) contains the string, preceeding the match.<br />
This method is easy, however it could significantly affect performance of other regular expressions (see <a href="http://www.amazon.com/gp/product/0596528124/ref=as_li_qf_sp_asin_tl?ie=UTF8&#038;tag=memosoup-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596528124" title="RegExp book">RegExp book</a> for the detailed explanation). Therefor, it&#8217;s not the best solution.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">use</span> English <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Hello, brave new world!&quot;</span> <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/(brave)/g</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">###my $pos = length $`</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$pos</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/length.html"><span style="color: #000066;">length</span></a> <span style="color: #0000ff;">$PREMATCH</span><span style="color: #339933;">;</span></div></div>
<p><strong>#3 &#8211; use @LAST_MATCH_START variable</strong><br />
This method was introduced in Perl 5.6.0 and it does not make any bad impact on performance &#8211; so it&#8217;s <strong>recommended</strong> solution.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">use</span> English <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span>no_match_vars <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Hello, brave new world!&quot;</span> <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$txt</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/(brave)/g</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">### $pos = $-[0];</span><br />
<span style="color: #0000ff;">$pos</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$LAST_MATCH_START</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120229/perl-how-to-get-the-position-of-the-match.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: who is connected to the server</title>
		<link>http://www.memosoup.com/20120209/oracle-who-is-connected-to-the-server.html</link>
		<comments>http://www.memosoup.com/20120209/oracle-who-is-connected-to-the-server.html#comments</comments>
		<pubDate>Thu, 09 Feb 2012 11:56:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=465</guid>
		<description><![CDATA[<p>Here is the simple query, showing who is connected to the server.</p> col username FOR a15 col program FOR a25 trun SELECT sid, serial#, username, program, SUBSTR&#40;module,1,10&#41; module, logon_time FROM v$session ORDER BY 1,2; <p>This is almost the same query, limiting the output to the active users:</p> SELECT sid, serial#, username, program, SUBSTR&#40;module,1,10&#41; module, logon_time [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the simple query, showing who is connected to the server.</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">col username <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FOR</span> a15<br />
col program <span style="color: #993333; font-weight: bold; text-transform: uppercase;">FOR</span> a25 trun<br />
<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> sid<span style="color: #66cc66;">,</span> serial#<span style="color: #66cc66;">,</span> username<span style="color: #66cc66;">,</span> program<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SUBSTR</span><span style="color: #66cc66;">&#40;</span>module<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> module<span style="color: #66cc66;">,</span> logon_time<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> v$session <br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">ORDER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BY</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span>;</div></div>
<p>This is almost the same query, limiting the output to the active users:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> sid<span style="color: #66cc66;">,</span> serial#<span style="color: #66cc66;">,</span> username<span style="color: #66cc66;">,</span> program<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SUBSTR</span><span style="color: #66cc66;">&#40;</span>module<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> module<span style="color: #66cc66;">,</span> logon_time<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> v$session <br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> status <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'ACTIVE'</span> &nbsp;<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">ORDER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BY</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span>;</div></div>
<p>It&#8217;s important to set &#8220;MODULE&#8221; field for the running sessions. It makes the output more clear.<br />
The setting could be done with the following command:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">EXEC</span> DBMS_APPLICATION_INFO.SET_MODULE<span style="color: #66cc66;">&#40;</span> module_name<span style="color: #66cc66;">=&gt;</span><span style="color: #ff0000;">'&amp;module'</span><span style="color: #66cc66;">,</span>action_name<span style="color: #66cc66;">=&gt;</span><span style="color: #ff0000;">'&amp;action'</span> <span style="color: #66cc66;">&#41;</span>;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120209/oracle-who-is-connected-to-the-server.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: kill session</title>
		<link>http://www.memosoup.com/20120208/oracle-kill-session.html</link>
		<comments>http://www.memosoup.com/20120208/oracle-kill-session.html#comments</comments>
		<pubDate>Wed, 08 Feb 2012 12:04:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=468</guid>
		<description><![CDATA[<p>The command to kill Oracle is simple:</p> ALTER SYSTEM KILL SESSION '&#38;sid,&#38;serial'; <p>sid &#8211; session ID serial &#8211; session serial number</p> <p>&#160;</p> <p>If the version 11g and this is RAC, additional syntax is possible:</p> ALTER SYSTEM KILL SESSION '&#38;sid,&#38;serial,@&#38;inst_id'; <p>inst_id - instance id number (1, 2, 3 &#8230;)</p> <p>&#160;</p> <p>Script to find the TOAD session [...]]]></description>
			<content:encoded><![CDATA[<p>The command to kill Oracle is simple:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">ALTER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SYSTEM</span> KILL <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SESSION</span> <span style="color: #ff0000;">'&amp;sid,&amp;serial'</span>;</div></div>
<p><strong>sid</strong> &#8211; session ID<br />
<strong>serial</strong> &#8211; session serial number</p>
<p>&nbsp;</p>
<p>If the version 11g and this is RAC, additional syntax is possible:</p>
<div class="codecolorer-container oracle11 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle11 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">ALTER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SYSTEM</span> KILL <span style="color: #993333; font-weight: bold; text-transform: uppercase;">SESSION</span> <span style="color: #ff0000;">'&amp;sid,&amp;serial,@&amp;inst_id'</span>;</div></div>
<p><strong>inst_id </strong>- instance id number (1, 2, 3 &#8230;)</p>
<p>&nbsp;</p>
<p>Script to find the TOAD session older than 1 day and kill them:</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span><br />
<span style="color: #ff0000;">'ALTER SYSTEM KILL SESSION '</span><span style="color: #ff0000;">''</span> <span style="color: #66cc66;">||</span> sid <span style="color: #66cc66;">||</span> <span style="color: #ff0000;">','</span> <span style="color: #66cc66;">||</span> serial# <span style="color: #66cc66;">||</span> <span style="color: #ff0000;">''</span><span style="color: #ff0000;">' immediate;'</span> CMD<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> v$session<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span><br />
program <span style="color: #993333; font-weight: bold; text-transform: uppercase;">LIKE</span> <span style="color: #ff0000;">'%TOAD%'</span><br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span> logon_time <span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span> status !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'KILLED'</span><br />
;</div></div>
<p>&nbsp;</p>
<p>If the session is killed on the Oracle level and still stays in the list for very long time with status &#8216;KILLED&#8217;, it could be killed on the OS level.<br />
<strong>Warning!</strong> This is potentially dangerous operation! Use it only as the last resort.</p>
<div class="codecolorer-container oracle8 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="oracle8 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold; text-transform: uppercase;">SELECT</span> sess.sid<span style="color: #66cc66;">,</span> sess.serial#<span style="color: #66cc66;">,</span><br />
<span style="color: #ff0000;">'OS:'</span> <span style="color: #66cc66;">||</span> proc.spid SPID<span style="color: #66cc66;">,</span><br />
<span style="color: #ff0000;">'App:'</span> <span style="color: #66cc66;">||</span> sess.process process<span style="color: #66cc66;">,</span><br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">SUBSTR</span><span style="color: #66cc66;">&#40;</span>sess.username<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span> username <span style="color: #66cc66;">,</span><br />
sess.program<span style="color: #66cc66;">,</span><br />
logon_time <span style="color: #66cc66;">,</span><br />
sess.status<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">FROM</span> v$session sess<span style="color: #66cc66;">,</span> v$process proc<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">WHERE</span> sess.paddr <span style="color: #66cc66;">=</span> proc.addr<br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">AND</span> sess.status <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'KILLED'</span><br />
<span style="color: #993333; font-weight: bold; text-transform: uppercase;">ORDER</span> <span style="color: #993333; font-weight: bold; text-transform: uppercase;">BY</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span>;</div></div>
<p>Check if &#8220;App:&#8221; process still exist &#8211; maybe, it&#8217;s worth to stop the application first.<br />
Otherwise, kill the &#8220;OS:&#8221; process.<br />
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120208/oracle-kill-session.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mySQL: How to reset root password</title>
		<link>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html</link>
		<comments>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html#comments</comments>
		<pubDate>Sun, 05 Feb 2012 22:48:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=455</guid>
		<description><![CDATA[<p>If the password for the mysql &#8220;root&#8221; user is lost, it&#8217;s still possible reset it to some other value. The restart of the mySQL server will be necessary, of course.</p> <p>The following should be done:</p> <p>Stop the server It could be done normally:</p> /etc/init.d/mysql stop <p>or effectively:</p> ps -ef &#124; grep mysql ... mysql 25079 [...]]]></description>
			<content:encoded><![CDATA[<p>If the password for the mysql &#8220;root&#8221; user is lost, it&#8217;s still possible reset it to some other value.<br />
The restart of the mySQL server will be necessary, of course.</p>
<p>The following should be done:</p>
<p><strong>Stop the server</strong><br />
It could be done normally:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql stop</div></div>
<p>or effectively:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-ef</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> mysql<br />
...<br />
mysql <span style="color: #000000;">25079</span> <span style="color: #000000;">1</span> &nbsp; <span style="color: #000000;">0</span> &nbsp; Jan <span style="color: #000000;">31</span> ? &nbsp;<span style="color: #000000;">0</span>:00 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqld<br />
...<br />
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">25079</span></div></div>
<p><em>Please ensure that the proper process is killed!</em></p>
<p><strong>Start MySQL server without security checking</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysqld_safe <span style="color: #660033;">--skip-grant-tables</span> <span style="color: #000000; font-weight: bold;">&amp;</span></div></div>
<p><strong>Connect to mySQL without password</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql <span style="color: #660033;">-u</span> root</div></div>
<p><strong>Reset mySQL root password</strong></p>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=USE"><span style="color: #990099; font-weight: bold;">use</span></a> mysql<span style="color: #000033;">;</span><br />
<a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=UPDATE"><span style="color: #990099; font-weight: bold;">update</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/information-functions.html"><span style="color: #000099;">user</span></a> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SET"><span style="color: #990099; font-weight: bold;">set</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/encryption-functions.html"><span style="color: #000099;">password</span></a><span style="color: #CC0099;">=</span><a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/encryption-functions.html"><span style="color: #000099;">PASSWORD</span></a><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;NEW<span style="color: #008080; font-weight: bold;">_</span>PASSWORD&quot;</span><span style="color: #FF00FF;">&#41;</span> <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=WHERE"><span style="color: #990099; font-weight: bold;">where</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/information-functions.html"><span style="color: #000099;">user</span></a><span style="color: #CC0099;">=</span><span style="color: #008000;">'root'</span><span style="color: #000033;">;</span><br />
flush <a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=PRIVILEGES"><span style="color: #990099; font-weight: bold;">privileges</span></a><span style="color: #000033;">;</span></div></div>
<p>Use the real new password instead of the string &#8220;NEW_PASSWORD&#8221;.</p>
<p><strong>Restart mySQL server</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql stop<br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql start</div></div>
<p><strong>Check the connection</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120206/mysql-how-to-reset-root-password.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBA: how to read text file</title>
		<link>http://www.memosoup.com/20120205/vba-how-to-read-text-file.html</link>
		<comments>http://www.memosoup.com/20120205/vba-how-to-read-text-file.html#comments</comments>
		<pubDate>Sat, 04 Feb 2012 23:55:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[read]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=461</guid>
		<description><![CDATA[<p>This is just example, how to read text file in Visual Basic for Applications (for example, in Excel macro). </p> <p>It&#8217;s just a stub: there is no error processing here, the source file is really text file, no problems with permissions etc.</p> Sub read_from_text_file() txtFile = Application.GetOpenFilename(&#34;Text Files (*.txt), *.txt&#34;) If txtFile = False Then [...]]]></description>
			<content:encoded><![CDATA[<p>This is just example, how to read text file in Visual Basic for Applications (for example, in Excel macro). </p>
<p>It&#8217;s just a stub: there is no error processing here, the source file is really text file, no problems with permissions etc.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #E56717; font-weight: bold;">Sub</span> read_from_text_file()<br />
<br />
txtFile = Application.GetOpenFilename(<span style="color: #800000;">&quot;Text Files (*.txt), *.txt&quot;</span>)<br />
<span style="color: #8D38C9; font-weight: bold;">If</span> txtFile = <span style="color: #00C2FF; font-weight: bold;">False</span> <span style="color: #8D38C9; font-weight: bold;">Then</span><br />
&nbsp; &nbsp; MsgBox <span style="color: #800000;">&quot;No file to process&quot;</span><br />
&nbsp; &nbsp; <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span><br />
<br />
<span style="color: #151B8D; font-weight: bold;">Open</span> txtFile <span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #151B8D; font-weight: bold;">Input</span> <span style="color: #151B8D; font-weight: bold;">As</span> #1<br />
&nbsp; &nbsp; &nbsp; <span style="color: #151B8D; font-weight: bold;">Input</span> #1, myString<br />
&nbsp; &nbsp; &nbsp; MsgBox myString<br />
<span style="color: #8D38C9; font-weight: bold;">Close</span> #1<br />
&nbsp; &nbsp;<br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120205/vba-how-to-read-text-file.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

