tag:blogger.com,1999:blog-203091832024-03-22T19:06:43.561+05:30puretechieOur technical scratch padShantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.comBlogger75125tag:blogger.com,1999:blog-20309183.post-37476562586629111172024-02-20T22:10:00.003+05:302024-02-20T22:10:29.016+05:30How to custom format in excel<p>Source: https://www.ablebits.com/office-addins-blog/custom-excel-number-format/#decimal-places</p><p>Converting a number to MILLIONS in currency without dividing the number by 1000000.</p><p></p><h1 style="text-align: left;">$* #,##0.00,,"M";;"";</h1><p></p>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-25714289261592341722024-02-11T12:51:00.002+05:302024-02-11T12:53:25.690+05:30Excel validating whether required columns (marked with *) are filled or not<p> Here is the formula</p><p>=LET(dataOriginal,A1:C100,</p><p>data,FILTER(dataOriginal,BYROW(dataOriginal,LAMBDA(row,SUM(--(row<>""))>0))),</p><p>firstRow,MAP(TAKE(data,1),LAMBDA(x,ISNUMBER(SEARCH("~*",x)))),</p><p>BYROW(MAP(DROP(data,1),LAMBDA(x,NOT(ISBLANK(x)))),LAMBDA(array, IF(SUMPRODUCT(--(array)*--(firstRow))=SUMPRODUCT(--(firstRow)),"OK","REQUIRED COL VALUE MISSING")))</p><p>)</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjACWXpM3rJDSoToWz7a4tTecZrGzYKIQvkONpdlPxXexWmBeo0e6voiexyeCSUNbBIYR6uz7vlibTq9B3K1DlHC7v1EobuZh3rh5fnOh23UjyREVVFbBvUufRQ3GczSw4yWHj1yzMNpGHcRQch_tjn-pdnbInvfQXJwgjp1ChiEMiZ5Xn6bzIv" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="570" data-original-width="1712" height="107" src="https://blogger.googleusercontent.com/img/a/AVvXsEjACWXpM3rJDSoToWz7a4tTecZrGzYKIQvkONpdlPxXexWmBeo0e6voiexyeCSUNbBIYR6uz7vlibTq9B3K1DlHC7v1EobuZh3rh5fnOh23UjyREVVFbBvUufRQ3GczSw4yWHj1yzMNpGHcRQch_tjn-pdnbInvfQXJwgjp1ChiEMiZ5Xn6bzIv" width="320" /></a></div><br /><p></p>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-21134119556621962132024-01-08T23:19:00.004+05:302024-01-08T23:19:44.361+05:30#HowTo Autofit columns in excel <p> <b>Problem:</b> Adjusting the width for every column using ALTH+H+O+I is painful </p><div><b>Solution</b>: Use <b><i>AutoFit</i></b></div><div><b>#How To Steps:</b></div><div>1. Right-click the sheet and select <b><i>View Code</i></b></div><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIh8jSKCiu301keYDzTHNwYRao2cvsBUxiWJzV-3K8wvlemrC6ca23SVN6cTX9Mb_jPA3IEr2GtqMbGtkttrLAGdFXp1sdmm7fePFwOewKf741NwYRdpNovl8Kqa1M3BbC4wkyNdhyuWblO7u-ZzQivOrPaOI86j4D9LIyR0T1agjSJcfm2xMQYQ/s368/2023-12-04_06-39-19.png" style="clear: left; display: block; float: left; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="368" data-original-width="330" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIh8jSKCiu301keYDzTHNwYRao2cvsBUxiWJzV-3K8wvlemrC6ca23SVN6cTX9Mb_jPA3IEr2GtqMbGtkttrLAGdFXp1sdmm7fePFwOewKf741NwYRdpNovl8Kqa1M3BbC4wkyNdhyuWblO7u-ZzQivOrPaOI86j4D9LIyR0T1agjSJcfm2xMQYQ/s320/2023-12-04_06-39-19.png" /></a><ol><li> </li></ol><div><b><i><br /></i></b></div><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIh8jSKCiu301keYDzTHNwYRao2cvsBUxiWJzV-3K8wvlemrC6ca23SVN6cTX9Mb_jPA3IEr2GtqMbGtkttrLAGdFXp1sdmm7fePFwOewKf741NwYRdpNovl8Kqa1M3BbC4wkyNdhyuWblO7u-ZzQivOrPaOI86j4D9LIyR0T1agjSJcfm2xMQYQ/s368/2023-12-04_06-39-19.png" style="clear: left; display: block; float: left; padding: 1em 0px; text-align: center;"><br /></a>2. Add the following Code under the <b><i>Worksheet</i></b><br /><div><i><div>Private Sub Worksheet_SelectionChange(ByVal Target As Range)</div><div><b> Cells.EntireColumn.AutoFit</b></div><div>End Sub</div><div style="font-weight: bold;"><br /></div></i></div></div></div>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-90375335368292119272024-01-05T04:27:00.003+05:302024-01-05T04:27:26.737+05:30Excel: Adding Table as a Data validation using INDIRECT function<p></p><ol style="text-align: left;"><li>Create a table and name it. Say <b><i>TableDiv </i></b>and the items should be of the column name <b><i>Division</i></b></li><li>In the data validation source, select the <b><i>INDIRECT </i></b>function and add the following validation <b><i>=indirect("TableDiv[Division]")</i></b></li></ol><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhN5flFgAp9ap5T_OxeSXyzPeZPBXjrC_s4CCRT93CdOIXtdk6mb_3gkxwFjhl1WGk93C7mD6848aEri94dEPGtuu2BLJnb50SOYg1ggg_thOCzQ8zkwv2w30Wre7FpbE0kcxKFoTOYr7F3S5SSslsm8y1iCOZ9y8o5znAEikIgshF3DEV-WP6V" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="852" data-original-width="1703" height="160" src="https://blogger.googleusercontent.com/img/a/AVvXsEhN5flFgAp9ap5T_OxeSXyzPeZPBXjrC_s4CCRT93CdOIXtdk6mb_3gkxwFjhl1WGk93C7mD6848aEri94dEPGtuu2BLJnb50SOYg1ggg_thOCzQ8zkwv2w30Wre7FpbE0kcxKFoTOYr7F3S5SSslsm8y1iCOZ9y8o5znAEikIgshF3DEV-WP6V" width="320" /></a></div><br /><p></p>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-78104336153860965092023-02-07T03:31:00.003+05:302023-02-07T03:31:53.129+05:30How to create scannable barcodes in Excel<p> A powerful tool for businesses is a barcode that can be scanned. Assume you wish to simplify the inventory process and have a list of products with their product codes. You are able to accomplish this in just two easy steps by creating scannable barcodes.</p><p>Format the special product codes first. This can be achieved by formatting the codes as text values and placing an asterisk (*) before and after each code cell number. (To save time, use the ampersand sign.)</p><p>The second and final step is to switch the font to Libre Barcode 128 after adding an asterisk before and after each product code. If you don't already have it installed, get it for nothing and restart Excel to use it.</p><p>Pro-tip: Boost the font size to make the barcodes easier to scan.</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj5AhjgcvUODg_FjR359EeYLjSUfWIVUh44RbCgJrDgyeqrSDbU-F8ghEqBGAvXrOkR0Jw9hAgivoFIjv7pWvEdk0WYT9fswd9V7q5O0hOVJvulbCsIHEK68-qtFOfIvLgjgzCrrQRRpezLERyJttJoX30EUuMAYKZg2aVnIamJpvngZfKEw/s600/HowToCreateBarcodeInExcel.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="427" data-original-width="600" height="411" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj5AhjgcvUODg_FjR359EeYLjSUfWIVUh44RbCgJrDgyeqrSDbU-F8ghEqBGAvXrOkR0Jw9hAgivoFIjv7pWvEdk0WYT9fswd9V7q5O0hOVJvulbCsIHEK68-qtFOfIvLgjgzCrrQRRpezLERyJttJoX30EUuMAYKZg2aVnIamJpvngZfKEw/w576-h411/HowToCreateBarcodeInExcel.gif" width="576" /></a></div><br /><p><br /></p>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-37763648582420524082016-09-19T00:00:00.000+05:302016-09-19T00:00:21.509+05:30Split comma separated string and pass to IN clause of SQL SELECT statement <div dir="ltr" style="text-align: left;" trbidi="on">
<div style="-webkit-text-stroke-width: 0px; color: black; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; margin: 0px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<span style="font-family: inherit;">This was a query from reporting team. Question looked too simple , but the solution was not obvious. </span></div>
<div style="-webkit-text-stroke-width: 0px; color: black; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; margin: 0px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<span><span style="font-family: inherit;"><br /></span></span></div>
<div style="text-align: left;">
</div>
<div style="-webkit-text-stroke-width: 0px; font-style: normal; font-weight: normal; letter-spacing: normal; margin: 0px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<br />
<h4 style="text-align: left;">
<u><span style="font-family: inherit;">Problem</span></u></h4>
<span style="font-family: inherit;"><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #555555; display: inline !important; float: none; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">We get a colon separated string (1:3) that we would need to pass to the IN clause of a select statement to get the required rows. </span><span style="background-color: white;"><span style="color: #555555;"><br /></span></span><span style="background-color: white;"><span style="color: #555555;">SQL>select * from test;</span></span><span style="background-color: white;"><span style="color: #555555;">ID Text</span></span><span style="background-color: white;"><span style="color: #555555;">1 A</span></span><span style="background-color: white;"><span style="color: #555555;">2 B</span></span><span style="background-color: white;"><span style="color: #555555;">3 C</span></span><span style="background-color: white;"><span style="color: #555555;">SQL>select * from test where ID in :P_INPUT #P_INPUT=1:3</span></span><span style="background-color: white;"><span style="color: #555555;">No rows selected</span></span><span style="background-color: white;"><span style="color: #555555;"><br /></span></span><span style="background-color: white;"><span style="color: #555555;">Here we expected 2 rows instead we got no rows. </span></span><span style="background-color: white;"><span style="color: #555555;"><br /></span></span></span><h4 style="text-align: left;">
<u><b><span style="background-color: white;"><span style="color: #555555;"><span style="font-family: inherit;">Solution</span></span></span></b></u></h4>
<ul>
<li><span style="color: #555555;"><span style="font-family: inherit;">Split the input string based on delimiter</span></span></li>
</ul>
<ul>
<li><span style="color: #555555;"><span style="font-family: inherit;">Get the individual strings as rows</span></span></li>
</ul>
<span style="font-family: inherit;"><span style="color: #555555;"><br /></span><span style="color: #555555;">For the above, we use a combination of </span> <span style="background-color: white; font-size: 12px;"><a href="https://docs.oracle.com/cd/B12037_01/server.101/b10759/functions116.htm">regexp_substr</a></span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #555555; display: inline !important; float: none; font-size: 12px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><a href="https://docs.oracle.com/cd/B12037_01/server.101/b10759/functions116.htm"> </a>function and <a href="https://docs.oracle.com/cd/B19306_01/server.102/b14200/queries003.htm">connect by</a> features in oracle. </span><span style="font-size: 12px;"><span style="background-color: white;"><span style="color: #555555;"><br /></span></span></span><u><b><span style="font-size: 12px;"><span style="background-color: white;"><span style="color: #555555;"><br /></span></span></span></b></u><span style="background-color: white;"><span style="color: #555555;">SQL>select * from test where ID in </span></span><span style="background-color: white;"><span style="color: #555555;">(</span></span><span style="background-color: white;"><span style="color: #555555;"> select regexp_substr(:P_INPUT,'[^:]+', 1, level) from dual</span></span><span style="background-color: white;"><span style="color: #555555;"> connect by regexp_substr(:P_INPUT, '[^:]+', 1, level) is not null;</span></span><span style="background-color: white;"><span style="color: #555555;">)</span></span><span style="background-color: white;"><span style="color: #555555;">ID Text</span></span><span style="background-color: white;"><span style="color: #555555;">1 A</span></span><span style="background-color: white;"><span style="color: #555555;">3 C</span></span><span style="font-size: 12px;"><span style="background-color: white;"><span style="color: #555555;"><br /></span></span></span></span><br />
<div>
<span style="font-family: 'Times New Roman';"><span style="font-size: 12px;"><span style="font-family: Arial, Verdana, sans-serif;"><span style="background-color: white;"><span style="color: #555555;"><br /></span></span></span></span></span></div>
</div>
</div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-85687417134072534912013-07-29T01:32:00.003+05:302023-02-07T03:32:06.513+05:30Bigdata projects in Apache<div dir="ltr" style="text-align: left;" trbidi="on">
Cloudera combines </div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-20360189334193979142013-07-16T14:32:00.000+05:302013-07-16T14:32:02.373+05:30Quick Dirty cscope starter<div dir="ltr" style="text-align: left;" trbidi="on">
<pre class="literal-block">find . -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" > cscope.files</pre>
<pre class="literal-block">cscope -q -R -b -i cscope.files</pre>
<pre class="literal-block">cscope -d</pre>
</div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-65812465688629064822013-06-24T15:21:00.000+05:302023-02-07T03:31:47.032+05:30Opengrok: Browser based search for your workspace<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
Installing OpenGrok</h2>
<h3 style="text-align: left;">
Installing tomcat</h3>
<br />
<h2 style="text-align: left;">
Scripts to monitor the changes</h2>
<br /></div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-22748674175149109332012-12-01T12:03:00.000+05:302014-02-26T17:04:29.689+05:30Installing Sun JDK 7 on Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
Given that Oracle does not have a release for Ubuntu platform, one way to seamlessly install the latest version is<br />
<div>
<br />
<div>
<div>
$ sudo add-apt-repository ppa:webupd8team/java</div>
<div>
<br /></div>
<div>
$ sudo apt-get update</div>
<div>
<br /></div>
<div>
$sudo apt-get install oracle-java7-installer<br />
<br />
Added after inputs from Kiran for Centos<br />
<br />
wget --no-cookies --no-check-certificate --header "Cookie:
gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "<a href="http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jre-7u51-linux-x64.rpm">http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jre-7u51-linux-x64.rpm</a>"</div>
</div>
</div>
</div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-18318366182728031992012-11-05T16:25:00.000+05:302023-02-07T03:32:10.252+05:30A curious case of Hbase <div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-65957055400282838472012-11-01T09:39:00.000+05:302013-05-12T11:23:00.414+05:30Screen way of terminal management<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
What is screen?</h2>
<span style="text-align: justify;"><span style="font-family: monospace;">I</span>t is a terminal multiplexer, essentially giving the ability . </span><a href="http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_3.html#SEC3">man screen</a> is the best option still.<br />
<br />
<a href="http://www.youtube.com/watch?v=U4kpYTfbm6g">Getting started video <span style="font-family: inherit;">can</span> be useful.</a><br />
<br />
<h2 style="text-align: left;">
Why screen?</h2>
<div style="text-align: justify;">
Its original reason for existence was allowing you to switch between
sub-sessions on a <a href="http://en.wikipedia.org/wiki/Video_terminal">video-display
terminal</a>, but it grew to
allow sessions that could be detached and reattached (if you went home
for the day, or say you were connecting via a glitchy network) and
eventually to allow the same session to be simultaneously accessed
from multiple places.</div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: left;">
Real power of screen</h2>
<br />
<ol style="text-align: left;">
<li>Persistence of the terminal based work. </li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Start your builds -- go home and see all the results intact. </span><span style="color: #222222; text-align: justify; white-space: pre;">Resistant</span><span style="color: #222222; text-align: justify; white-space: pre;"> to laptop or network snags.</span></li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Unlimited windows (unlike the hardcoded number of Linux virtual consoles)</span></li>
<li><span style="text-align: justify;"><span style="color: #222222;"><span style="white-space: pre;">Scroll-back buffer (not limited to video memory like Linux virtual consoles) & Logging. </span></span></span></li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Copy/paste between windows.</span></li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Notification of either activity or inactivity in a window</span></li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Split terminal (horizontally and vertically) into multiple regions</span></li>
<li><span style="color: #222222; text-align: justify; white-space: pre;">Locking other users out of terminal.</span></li>
</ol>
<br />
<br />
<br />
<h2 style="text-align: left;">
Advanced users of screen</h2>
<div>
<h3 style="background-color: white; color: #111111; line-height: 1; margin: 2em 0px 0.5em; padding: 0px; text-align: justify;">
<span style="font-family: inherit; font-size: large;">Buffering</span></h3>
<div>
Ctrl +a+ [ --------- Page or arrow keys work best</div>
<div>
Ctrl +a+ ] --------- To close the buffer read session</div>
<div>
<br /></div>
<div>
Helpful on remote machines where the logs are being tail-ed.<br />
<br />
<h3 style="text-align: left;">
Terminal Scrolling</h3>
Though the above buffering solution of (Ctrl+a+[ ) helps, screen uses alternate screen. So one way is to tell screen not to use this. Scroll-back can also be achieved on the terminal using<br />
<span style="background-color: #eeeeee; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">‘termcapinfo xterm ti@:te@’ to your .screenrc file.</span></div>
<div>
<br /></div>
<h3 style="text-align: left;">
<span style="font-family: inherit; font-size: large;">Starting and Naming sessions</span></h3>
<div>
<br /></div>
<div>
screen -S <screen name="name"> </screen></div>
<div>
<br /></div>
<h3 style="text-align: left;">
<span style="font-size: large;">Reconnecting</span> to screen session</h3>
<div>
<br /></div>
<div>
screen -x <screen div="div" name.="name."></screen><br />
<h3 style="background-color: white; color: #111111; line-height: 1; margin: 2em 0px 0.5em; padding: 0px; text-align: justify;">
<span style="font-family: inherit; font-size: large;">Split Screen</span></h3>
<div>
<span style="font-family: inherit; font-size: large;"><br /></span></div>
<div style="background-color: white; color: #111111; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
<span style="font-family: inherit;">You can split your terminal windows horizontally and vertically (for vertical split, you need to patch your screen).</span></div>
<div style="background-color: white; color: #111111; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
<span style="font-family: inherit;">To Split the screen horizontally: <strong style="margin: 0px; padding: 0px;">Ctrl+a</strong> & <strong style="margin: 0px; padding: 0px;">S</strong></span></div>
<div style="background-color: white; color: #111111; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
<span style="font-family: inherit;">To split the screen vertically: <strong style="margin: 0px; padding: 0px;">Ctrl+a</strong> & <strong style="margin: 0px; padding: 0px;">| or Ctrl+a </strong><span style="margin: 0px; padding: 0px;">&</span><strong style="margin: 0px; padding: 0px;"> V </strong><span style="margin: 0px; padding: 0px;">( the screen has to be patched for this)</span></span></div>
<div style="background-color: white; color: #111111; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
<span style="font-family: inherit;">To switch between windows: <strong style="margin: 0px; padding: 0px;">Ctrl+a</strong> & <strong style="margin: 0px; padding: 0px;">Tab</strong></span></div>
<div style="background-color: white; color: #111111; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
<span style="font-family: inherit;">To kill your current window: <strong style="margin: 0px; padding: 0px;">Ctrl+a</strong> & <strong style="margin: 0px; padding: 0px;">X</strong></span></div>
<div style="background-color: white; color: #111111; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 14px; line-height: 21.983333587646484px; margin-bottom: 10px; padding: 0px; text-align: justify;">
</div>
<h3 style="font-size: 1.5em; line-height: 1; margin: 2em 0px 0.5em; padding: 0px; text-align: left;">
<span style="font-family: inherit;">Logging</span></h3>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div style="margin-bottom: 10px; padding: 0px;">
The best thing what I like about screen is that you can have logs of anything you have done on screen, which can be used in lot of things in future. To enable logging, use “<strong style="margin: 0px; padding: 0px;">Ctrl+a</strong>” followed by “<strong style="margin: 0px; padding: 0px;">H</strong>“. This will create a file with name “<strong style="margin: 0px; padding: 0px;">screenlog.0</strong>” in your home directory, which will contain anything or everything you have done on the screen. If you want to stop logging, use the same, “<strong style="margin: 0px; padding: 0px;">Ctrl+a</strong>” & “<strong style="margin: 0px; padding: 0px;">H</strong>“.</div>
<div style="margin-bottom: 10px; padding: 0px;">
You can also enable logging while starting your screen session, which can be done by using “<strong style="margin: 0px; padding: 0px;">-L</strong>” switch:</div>
<div style="margin-bottom: 10px; padding: 0px;">
screen -L -S <session-name></session-name></div>
<div style="margin-bottom: 10px; padding: 0px;">
<br /></div>
<h3 style="text-align: left;">
<span style="font-family: inherit; font-size: large;">Copying and Pasting across terminals</span> </h3>
<div>
<div>
To enter copy mode in screen, hit Ctrl+A, then [. You can now use the arrow keys, or vim-like keybindings, to move around the screen. 0 gets you to the start of a line, and $ to the end of a line.</div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li>When you've reached the point where you want to start the copy, hit Enter.</li>
<li>Move the cursor to the end point of your selection (you'll see what you're copying highlighted), and then hit Enter again.</li>
<li>Now move the cursor to wherever you want to paste the selection (you can move to another screen within your session), and hit Ctrl+A ] to paste the selection.</li>
<li>You can also use Ctrl+A > filename to paste the selection to a filename and Ctrl+A < filename to read a file into the selection buffer so you can then paste it out again using Ctrl+A ].</li>
</ul>
</div>
<div>
<br /></div>
<div>
When in copy mode, you can also use screen's scrollback feature (i.e., you can scroll back upward past the top of the currently displayed text) and the search function.</div>
</div>
<div>
<br /></div>
<div>
<h3>
<span style="font-family: inherit; font-size: large;">Command line Ctrl+a does not work in screen?</span></h3>
<div>
It works in a different way where ctrl+a+a will get the effect.</div>
</div>
<h3 style="text-align: left;">
<span style="font-family: inherit; font-size: large;">Searching in the buffer (Like VIM )</span></h3>
<div>
When in Buffer mode (Ctrl + [) use / for backword search and ? for forward search. </div>
<div>
<br />
<h3 style="text-align: left;">
Getting ..... lines on the screen terminal</h3>
You see this when the user is connected in a multi-user mode and 2 users are on the same terminal. To overcome this, first issue screen -d <screen-name> and then connect using screen -x <screen name=""> </screen></screen-name></div>
<h3 style="text-align: left;">
<span style="font-family: inherit; font-size: large;">Increasing the scroll back limit</span></h3>
<div>
<div>
defscrollback 1000</div>
<div>
This increases the scrollback to 1,000 lines; you can edit this value as you prefer.</div>
</div>
<div>
<br /></div>
<h3 style="text-align: left;">
<span style="font-family: inherit; font-size: large;"><a name='more'></a>Cheat-Sheet for screen</span></h3>
<div>
<br /></div>
<div>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;"><b><u>Command</u></b> <b><u>Description</u></b>
</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, ? Show built in help</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, c Create a new screen</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, K Kill a screen session.</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, Ctrl+a Cycle through screens (just hold Ctrl down, type aa)</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, n Cycle through screens (Next screen)</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, Ctrl+n Another cycle through screens</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, S Split the screen (note the capital S)</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, X Close the split screen you are currently in (note capital X)</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, x lock a screen</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, tab Switch between split screens</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, d Detach from screen session</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, [ Start copy </pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, ] Paste</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, W Status</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;">Ctrl+a, H Start Logging, Repress to stop logging</pre>
<pre style="background-color: #f8f8f8; border: 1px solid rgb(204, 204, 204); font-family: Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; line-height: 15px; overflow-x: auto; overflow-y: hidden; padding: 0.5em;"></pre>
<pre>{Update}
</pre>
<pre><h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px; white-space: normal;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="getting_in" name="getting_in" style="margin: 0px; padding: 0px;">Getting in</a></h2>
<div class="level2" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<table class="inline" style="background-color: white; border-collapse: collapse; border-spacing: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 0px;"><tbody style="margin: 0px; padding: 0px;">
<tr class="row0" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">start a new screen session with session name</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -S <em style="margin: 0px; padding: 0px;"><name></name></em></code></td></tr>
<tr class="row1" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">list running sessions/screens</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -ls</code></td></tr>
<tr class="row2" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">attach to a running session</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -r</code></td></tr>
<tr class="row3" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">… to session with name</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -r <em style="margin: 0px; padding: 0px;"><name></name></em></code></td></tr>
<tr class="row4" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">the “ultimate attach”</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -dRR</code> (Attaches to a screen session. If the session is attached elsewhere, detaches that other display. If no session exists, creates one. If multiple sessions exist, uses the first one.)</td></tr>
</tbody></table>
</div>
</pre>
<pre><h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px; white-space: normal;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="escape_key" name="escape_key" style="margin: 0px; padding: 0px;">Escape key</a></h2>
<div class="level2" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<div style="margin-bottom: 0.5em; padding: 0px;">
All screen commands are prefixed by an escape key, by default <code style="font-size: 12px; margin: 0px; padding: 0px;">C-a</code> (that's Control-a, sometimes written <code style="font-size: 12px; margin: 0px; padding: 0px;">^a</code>). To send a literal <code style="font-size: 12px; margin: 0px; padding: 0px;">C-a</code> to the programs in screen, use <code style="font-size: 12px; margin: 0px; padding: 0px;">C-a a</code>.</div>
</div>
<div class="secedit" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<form action="http://aperiodic.net/screen/quick_reference" class="button btn_secedit" method="post" style="border: none; display: inline; margin: 0px; padding: 0px;">
<input class="button" style="background-color: white; background-image: url(http://aperiodic.net/screen/lib/tpl/doogiestpl/images/buttonshadow.png); background-position: 50% 100%; background-repeat: repeat no-repeat; border: 1px solid rgb(204, 204, 204); color: black; cursor: pointer; display: inline; float: right; font-size: 10px; margin: 0px; padding: 0px; vertical-align: middle;" title="Escape key" type="submit" value="Edit" /></form>
</div>
<h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px; white-space: normal;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="getting_out" name="getting_out" style="margin: 0px; padding: 0px;">Getting out</a></h2>
<div class="level2" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<table class="inline" style="background-color: white; border-collapse: collapse; border-spacing: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 0px;"><tbody style="margin: 0px; padding: 0px;">
<tr class="row0" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">detach</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:detach" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:detach">C-a d</a></code></td></tr>
<tr class="row1" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">detach and logout (quick exit)</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:pow_detach" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:pow_detach">C-a D D</a></code></td></tr>
<tr class="row2" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">exit screen</td><td class="col1 rightalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px; text-align: right;">“C-a : quit” or exit all of the programs in screen.</td></tr>
<tr class="row3" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">force-exit screen</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:quit" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:quit">C-a C-\</a></code> (<em style="margin: 0px; padding: 0px;">not</em> recommended)</td></tr>
</tbody></table>
</div>
<div class="secedit" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<form action="http://aperiodic.net/screen/quick_reference" class="button btn_secedit" method="post" style="border: none; display: inline; margin: 0px; padding: 0px;">
<input class="button" style="background-color: white; background-image: url(http://aperiodic.net/screen/lib/tpl/doogiestpl/images/buttonshadow.png); background-position: 50% 100%; background-repeat: repeat no-repeat; border: 1px solid rgb(204, 204, 204); color: black; cursor: pointer; display: inline; float: right; font-size: 10px; margin: 0px; padding: 0px; vertical-align: middle;" title="Getting out" type="submit" value="Edit" /></form>
</div>
<h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px; white-space: normal;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="help" name="help" style="margin: 0px; padding: 0px;">Help</a></h2>
<div class="level2" style="font-family: 'Lucida Grande', Verdana, Lucida, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: normal;">
<table class="inline" style="background-color: white; border-collapse: collapse; border-spacing: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 0px;"><tbody style="margin: 0px; padding: 0px;">
<tr class="row0" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">See help</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:help" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:help">C-a ?</a></code> (lists keybindings)
</td></tr>
</tbody></table>
<h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="scripting" name="scripting" style="margin: 0px; padding: 0px;">Scripting</a></h2>
<div class="level2" style="margin: 0px; padding: 0px;">
<table class="inline" style="background-color: white; border-collapse: collapse; border-spacing: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 0px;"><tbody style="margin: 0px; padding: 0px;">
<tr class="row0" style="margin: 0px; padding: 0px;"><td class="col0 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">send a command to a named session</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -S <em style="margin: 0px; padding: 0px;"><name></name></em> -X <em style="margin: 0px; padding: 0px;"><command></command></em></code></td></tr>
<tr class="row1" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">create a new window and run <em style="margin: 0px; padding: 0px;">ping example.com</em></td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;">screen -S <em style="margin: 0px; padding: 0px;"><name></name></em> -X screen <em style="margin: 0px; padding: 0px;">ping example.com</em></code></td></tr>
<tr class="row2" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">stuff characters into the input buffer
using bash to expand a newline character
(<a class="urlextern" href="http://lists.gnu.org/archive/html/screen-users/2007-06/msg00012.html" rel="nofollow" style="background-color: transparent; background-image: url(http://aperiodic.net/screen/lib/tpl/doogiestpl/images/link_icon.gif); background-position: 0px 1px; background-repeat: no-repeat no-repeat; color: purple; margin: 0px; padding: 1px 0px 1px 16px; text-decoration: none;" title="http://lists.gnu.org/archive/html/screen-users/2007-06/msg00012.html">from here</a>)</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><pre class="code bash" style="border: 1px dashed rgb(204, 204, 204); font-size: 12px; margin-bottom: 1em; overflow: auto; padding: 0.5em;"><span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">screen</span> <span class="re5" style="margin: 0px; padding: 0px;">-S</span> <span class="sy0" style="color: #66cc66; margin: 0px; padding: 0px;"><</span>name<span class="sy0" style="color: #66cc66; margin: 0px; padding: 0px;">></span> <span class="br0" style="color: #66cc66; margin: 0px; padding: 0px;">[</span>-p <span class="sy0" style="color: #66cc66; margin: 0px; padding: 0px;"><</span>page<span class="sy0" style="color: #66cc66; margin: 0px; padding: 0px;">></span><span class="br0" style="color: #66cc66; margin: 0px; padding: 0px;">]</span> <span class="re5" style="margin: 0px; padding: 0px;">-X</span> stuff $<span class="st_h" style="margin: 0px; padding: 0px;">'quit\r'</span></pre>
</td></tr>
<tr class="row3" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">a full example</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><pre class="code bash" style="border: 1px dashed rgb(204, 204, 204); font-size: 12px; margin-bottom: 1em; overflow: auto; padding: 0.5em;"><span class="co0" style="color: grey; font-style: italic; margin: 0px; padding: 0px;"># run bash within screen</span>
<span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">screen</span> <span class="re5" style="margin: 0px; padding: 0px;">-AmdS</span> bash_shell <span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">bash</span>
<span class="co0" style="color: grey; font-style: italic; margin: 0px; padding: 0px;"># run top within that bash session</span>
<span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">screen</span> <span class="re5" style="margin: 0px; padding: 0px;">-S</span> bash_shell <span class="re5" style="margin: 0px; padding: 0px;">-p</span> 0 <span class="re5" style="margin: 0px; padding: 0px;">-X</span> stuff $<span class="st_h" style="margin: 0px; padding: 0px;">'top\r'</span>
<span class="co0" style="color: grey; font-style: italic; margin: 0px; padding: 0px;"># ... some time later</span>
<span class="co0" style="color: grey; font-style: italic; margin: 0px; padding: 0px;"># stuff 'q' to tell top to quit</span>
<span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">screen</span> <span class="re5" style="margin: 0px; padding: 0px;">-S</span> bash_shell <span class="re5" style="margin: 0px; padding: 0px;">-X</span> stuff <span class="st_h" style="margin: 0px; padding: 0px;">'q'</span>
<span class="co0" style="color: grey; font-style: italic; margin: 0px; padding: 0px;"># stuff 'exit\n' to exit bash session</span>
<span class="kw2" style="font-weight: bold; margin: 0px; padding: 0px;">screen</span> <span class="re5" style="margin: 0px; padding: 0px;">-S</span> bash_shell <span class="re5" style="margin: 0px; padding: 0px;">-X</span> stuff $<span class="st_h" style="margin: 0px; padding: 0px;">'exit\r'</span></pre>
</td></tr>
</tbody></table>
</div>
<div class="secedit" style="margin: 0px; padding: 0px;">
<form action="http://aperiodic.net/screen/quick_reference" class="button btn_secedit" method="post" style="border: none; display: inline; margin: 0px; padding: 0px;">
<input class="button" style="background-color: white; background-image: url(http://aperiodic.net/screen/lib/tpl/doogiestpl/images/buttonshadow.png); background-position: 50% 100%; background-repeat: repeat no-repeat; border: 1px solid rgb(204, 204, 204); color: black; cursor: pointer; display: inline; float: right; font-size: 10px; margin: 0px; padding: 0px; vertical-align: middle;" title="Scripting" type="submit" value="Edit" /></form>
</div>
<h2 style="border-bottom-color: rgb(222, 231, 236); border-bottom-style: solid; border-bottom-width: 1px; clear: left; font-size: 19px; font-weight: normal; margin: 15px 0px 8px; padding: 0px;">
<a href="http://www.blogger.com/blogger.g?blogID=20309183" id="misc" name="misc" style="margin: 0px; padding: 0px;">Misc</a></h2>
<div class="level2" style="margin: 0px; padding: 0px;">
<table class="inline" style="background-color: white; border-collapse: collapse; border-spacing: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 0px;"><tbody style="margin: 0px; padding: 0px;">
<tr class="row0" style="margin: 0px; padding: 0px;"><td class="col0 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">redraw window</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:redisplay" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:redisplay">C-a C-l</a></code></td></tr>
<tr class="row1" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">enter copy mode</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:copy" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:copy">C-a [</a></code> or <code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:copy" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:copy">C-a <esc></esc></a></code> (also used for viewing scrollback buffer)</td></tr>
<tr class="row2" style="margin: 0px; padding: 0px;"><td class="col0 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">paste</td><td class="col1 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:paste" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:paste">C-a ]</a></code></td></tr>
<tr class="row3" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">monitor window for activity</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:monitor" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:monitor">C-a M</a></code></td></tr>
<tr class="row4" style="margin: 0px; padding: 0px;"><td class="col0 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">monitor window for silence</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:silence" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:silence">C-a _</a></code></td></tr>
<tr class="row5" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">enter digraph (for producing non-<acronym style="border-bottom-color: rgb(0, 0, 0); border-bottom-style: dotted; border-bottom-width: 1px; cursor: help; margin: 0px; padding: 0px;" title="American Standard Code for Information Interchange">ASCII</acronym> characters)</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:digraph" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:digraph">C-a C-v</a></code></td></tr>
<tr class="row6" style="margin: 0px; padding: 0px;"><td class="col0" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">lock (password protect) display</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:lockscreen" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:lockscreen">C-a x</a></code></td></tr>
<tr class="row7" style="margin: 0px; padding: 0px;"><td class="col0 leftalign" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;">enter screen command</td><td class="col1" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding: 3px;"><code style="font-size: 12px; margin: 0px; padding: 0px;"><a class="wikilink1" href="http://aperiodic.net/screen/commands:colon" style="color: rgb(0, 0, 238) !important; margin: 0px; padding: 0px; text-decoration: none;" title="commands:colon">C-a :</a></code></td></tr>
</tbody></table>
</div>
</div>
</pre>
<pre>Interesting usage of screen. </pre>
<pre>Reference: </pre>
<pre><a href="http://nodeguide.com/beginner.html">They are using it for running the server in the background. </a></pre>
<pre><a href="http://blog.amir.rachum.com/post/50076409920/using-screen-the-absolute-essentials">Good collection of links at the end</a> </pre>
<pre></pre>
<pre>
</pre>
</div>
</div>
</div>
</div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0Mountain View, CA, USA37.3860517 -122.083851137.335585200000004 -122.1628151 37.4365182 -122.0048871tag:blogger.com,1999:blog-20309183.post-85533742603565582962012-10-16T10:22:00.000+05:302012-10-16T10:24:07.126+05:30Password-less ssh login<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<br />
ssh from machine1 to machine2 should be password-less (say for some automation tasks)<br />
<br />
<b>user1@machine1></b>pwd<br />
/home/user1/.ssh/<br />
<b>user1@machine1></b> ssh-keygen -t rsa<br />
Generating public/private rsa key pair.<br />
Enter file in which to save the key (/home/user1/.ssh/id_rsa):<br />
Created directory '/home/user1/.ssh'.<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /home/user1/.ssh/id_rsa.<br />
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 user1@machine1<br />
<b>user1@machine1></b>cat ~/.ssh/id_rsa.pub | ssh user1@machine2 'cat >> ~/.ssh/authorized_keys && chmod 640 ~/.ssh/authorized_keys'<br />
user1@machine2's password:<br />
<b>user1@machine1></b>ssh user1@machine2<br />
<b>user1@machine2></b>hostname<br />
machine2<br />
<div>
<br /></div>
</div>
Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-48291552182302230712011-10-21T23:31:00.000+05:302023-02-07T03:32:16.374+05:30Mail thru javascript<div dir="ltr" style="text-align: left;" trbidi="on">
you can automate sending bulk emails. In case you dont want to send BCCs or even CCs, (some rare cases, i agree)..<br />
<br />
if your content is all text or html, (the example given is for text), and the mail-ids you need to send individual mails are one per line in a google spreadsheet (customisable to add other data),<br />
you can open the spreadsheet, go to tools->ScriptEditor<br />
and start typing your javascript! heres an example that sends each mail to one individual at a time, in clear text<br />
<br />
//This thing just adds a convenient menu/submenu in your spreadsheet window!<br />
<br />
<br />
function onOpen() {<br />
var subMenus = [];<br />
subMenus.push({name: "Email File to selected Range", functionName: "mysendmail"});<br />
SpreadsheetApp.getActiveSpreadsheet().addMenu("Email", subMenus);<br />
}<br />
<br />
function mysendmail() {<br />
var numAddrs=SpreadsheetApp.getActiveRange().getValues().length;<br />
<br />
for (var i=0; i<numaddrs;i++){< p=""></numaddrs;i++){<><br />
var toAddr=SpreadsheetApp.getActiveRange().getValues()[i].toString();<br />
//Browser.msgBox("what is in toAddr is: " + SpreadsheetApp.getActiveRange().getValues()[i].toString());<br />
<br />
// this is the line that sends the mail<br />
GmailApp.sendEmail(toAddr, "sendmail", "testing");<br />
}<br />
}<br />
<br />
if you want to attach a file, you need to use MailApp's sendEmail interface that accepts the attachment.<br />
<br />
MailApp.sendEmail(recipients, emailSubject, emailMessage, {attachments: fileName});<br />
<br />
check the documentation for other cool scripting interfaces with google apps.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-40225145877127511792011-02-28T21:01:00.003+05:302011-02-28T21:03:31.367+05:30RSS feed for gmail ...I like this feature, where gmail is now accessible over rss feed. <div><br /></div><div>try this in firefox ( is rss feed support there in chrome by now? )</div><div>https://USERNAME:PASSWORD@gmail.google.com/gmail/feed/atom</div><div><br /></div><div>Though this feature is nice , i wonder if there are any uses of this feature in-spite of PoP3 or SMTP clients</div><div><br /></div>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com1tag:blogger.com,1999:blog-20309183.post-32742765212735788392010-08-21T00:44:00.000+05:302023-02-07T03:32:18.684+05:30linux system infoif you ever want to get low level h/w info from your linux installation and your proc file system is cryptic, use 'biosdecode' and/or 'dmidecode'<br />
<br />
biosdecode is known to be inadequate. some recent versions of enterprise linux dont ship biosdecode by default. use dmidecode instead. however, it is known to be inaccurate or un-reliable. But, it gives a quick and easy peek into the system and if you need reliable data, you must anyway look into the proc fs.<br />
<br />
'dmidecode -t' prints all available sub-system level info.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-20309183.post-14973753817186324062009-12-07T11:28:00.002+05:302009-12-07T11:34:07.317+05:30New features in Java 7: Switch on StringsAt last there is this feature is in Java 7<br /><br /><pre class="sh_java sh_sourceCode"><span class="sh_usertype">String</span><span class="sh_normal"> </span>s <span class="sh_symbol">= "something something something"</span><span class="sh_symbol"></span><br /><span class="sh_keyword">switch</span><span class="sh_symbol">(</span>s<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span><br /><span class="sh_keyword">case</span> <span class="sh_string">"Jayanagar"</span><span class="sh_symbol">:</span><br /> goToOxford(<span class="sh_symbol"></span>s<span class="sh_symbol">);</span><br /> break;<br /><br /> <span class="sh_keyword">case</span> <span class="sh_string">"Rajajinagar"</span><span class="sh_symbol">:</span><br /> <span class="sh_keyword">case</span> <span class="sh_string">"Navrang"</span><span class="sh_symbol">:</span><br /> <span class="sh_function">haveDosainAjanta</span><span class="sh_symbol">(</span>s<span class="sh_symbol">);</span><br /> <span class="sh_keyword">break</span><span class="sh_symbol">;</span><br /><br /> <span class="sh_keyword">default</span><span class="sh_symbol">:</span><br /> <span class="sh_function">goToBrahminsCoffeebar(</span><span class="sh_symbol"></span>s<span class="sh_symbol">);</span><br /> <span class="sh_keyword">break</span><span class="sh_symbol">;</span><br /><span class="sh_cbracket">}</span><br />More on ... <a href="http://java.sun.com/features/jdk/7/">http://java.sun.com/features/jdk/7/</a><br /></pre>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-45271592196966811232009-09-18T13:01:00.010+05:302009-09-18T16:26:50.681+05:30Getting customized mobile updates from twitter and other RSS servicesThis post marks the 4th year of this blog.<br />Hope is to actively engage in writing this blog.<br /><br />Presented below is an orchestrate of seemingly disparate technologies to enable your favorite updates on your cellphone.<br />Note: Your cellphone need not have Wifi or GPRS options. This works on basic SMS incoming facility.<br /><br />Now some of my favorite online items which i need to keep track are:<br />1) Twitter updates from selected friends.<br />2) Posts from selected blogs which i want to keep myself updated.<br />3) Instant updates from Google alerts.<br /><br />Here is one way we can have all the elements integrated:<br /><br />1) Collect RSS feeds of all the items listed above.<br />2) Using yahoo pipes you can do the following:<br /> 2a) Using Fetch Feed , aggregate all the feeds.<br /> 2b) Use a sort by published date to get the feeds in order. <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=cab822b22b54c23a1951c83d933cce02">Click here for a preview</a><br /> 2c) This service gives out a common aggregated RSS feed for the selected set.<br /> 2d) Also one can use alternatives like RSSmix to achieve a common RSS feed.<br />3) To get the updates on the cellphone, use <a href="http://www.labnol.org/internet/google-sms-subscribe-rss-via-sms/4726/">Google SMS Channel</a> . By configuring our cellphone for the alerts in Google SMS Channel , we can get the desired updates on our cellphone.Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-21111085717184724902009-07-06T13:21:00.005+05:302009-07-14T00:45:59.889+05:30Java URL BloomerI came across an interesting problem in java<br /><br /><br /><br />public class URLBloomer {<br /> public static void main(String[] args) throws MalformedURLException, URISyntaxException {<br /> String[] urls= {<br /> "http://meshlabsinc.com",<br /> "http://meshserver.org"<br /> };<br /> Set<url> testing=new HashSet<url>();<br /> for (String url : urls) {<br /> testing.add(new URL(url));<br /> }<br /> System.out.println(testing.size());<br /> }<br />}<br /><br /><br />Output : 1<br /><br />Reason .... meshlabsinc.com and meshserver.org point to the same IP<br /><br /><br />Lesson learnt is to use URI instead of URL class.<br /><br /><br />public class URLBloomer {<br /> public static void main(String[] args) throws MalformedURLException, URISyntaxException {<br /> String[] urls= {<br /> "http://meshlabsinc.com",<br /> "http://meshserver.org"<br /> };<br /> Set<uri> testing=new HashSet<uri>();<br /> for (String url : urls) {<br /> testing.add(new URI(url));<br /> }<br /> System.out.println(testing.size());<br /> }<br /> }<br /><br />Output : 2<br /><input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div></uri></uri></url></url>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-8722790145224601432009-02-24T20:28:00.001+05:302009-02-24T20:30:58.595+05:30Getting the create table command for an already existing table in mysqlmysql>SHOW CREATE TABLE <table_name><br /><br />mysql> create table x (i integer);<br />Query OK, 0 rows affected (0.27 sec)<br /><br />mysql> show create table x;<br />+-------+--------------------------------------------------------------------------------------+<br />| Table | Create Table |<br />+-------+--------------------------------------------------------------------------------------+<br />| x | CREATE TABLE `x` (<br /> `i` int(11) default NULL<br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 |<br />+-------+--------------------------------------------------------------------------------------+<br />1 row in set (0.06 sec)<br /><br />mysql>Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-3223564365426104902008-10-13T21:19:00.004+05:302008-10-13T21:26:34.447+05:30Java code to send message to your gtalk friendsHave used a library called <a href="http://www.igniterealtime.org/projects/smack/index.jsp">Smack </a>(http://www.igniterealtime.org/projects/smack/index.jsp)<br /><br />import java.util.Collection;<br /><br />import org.jivesoftware.smack.*;<br /><br />public class GtalkClient {<br /><br /> public static void main(String[] args) throws XMPPException {<br /> ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");<br /> XMPPConnection connection = new XMPPConnection(config);<br /> connection.connect();<br /> connection.login("< username >","< password >");<br /> <br />// Below is the code to get the users<br /> <br /> <br />// Roster roster = connection.getRoster();<br />// Collection<RosterEntry> rosterEntries = roster.getEntries();<br />// <br />// System.out.println("\n\n" + rosterEntries.size() + " friend(s):");<br />// for(RosterEntry rosterEntry:rosterEntries)<br />// {<br />// System.out.println(rosterEntry.getUser());<br />// }<br /> <br />// Here is a code to send message to a friend<br /> <br /> MessageListener messageListener = null;<br /> Chat chat = connection.getChatManager().createChat("shantanu.gg@gmail.com",messageListener);<br /> chat.sendMessage("Hello this is a ping from a java program");<br /> }<br />}Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-14584054203044068992008-09-30T15:58:00.002+05:302008-09-30T16:05:27.401+05:30Sending email using GMAIL using Java Mail ApiNote: Search for changeme and replace with appropriate terms.<br /><br /><br /><br /><br /><br />import javax.mail.*;<br />import javax.mail.internet.*;<br />import java.util.*;<br /><br />public class MailSender {<br /> final String senderEmailID = "changeme @ changeme .com";<br /> final String senderPassword = "changeme";<br /> final String emailSMTPserver = "smtp.gmail.com";<br /> final String emailServerPort = "465";<br /> String receiverEmailID = null;<br /> String emailSubject = null;<br /> String emailBody = null;<br /><br /> public MailSender(String receiverEmailID, String emailSubject, String emailBody) {<br /> this.receiverEmailID=receiverEmailID;<br /> this.emailSubject=emailSubject;<br /> this.emailBody=emailBody;<br /> <br /> <br /> Properties props = new Properties();<br /> props.put("mail.smtp.user",senderEmailID);<br /> props.put("mail.smtp.host", emailSMTPserver);<br /> props.put("mail.smtp.port", emailServerPort);<br /> props.put("mail.smtp.starttls.enable", "true");<br /> props.put("mail.smtp.auth", "true");<br /> // props.put("mail.smtp.debug", "true");<br /> props.put("mail.smtp.socketFactory.port", emailServerPort);<br /> props.put("mail.smtp.socketFactory.class",<br /> "javax.net.ssl.SSLSocketFactory");<br /> props.put("mail.smtp.socketFactory.fallback", "false");<br /><br /> SecurityManager security = System.getSecurityManager();<br /><br /> try {<br /> Authenticator auth = new SMTPAuthenticator();<br /> Session session = Session.getInstance(props, auth);<br /> // session.setDebug(true);<br /><br /> MimeMessage msg = new MimeMessage(session);<br /> msg.setText(emailBody);<br /> msg.setSubject(emailSubject);<br /> msg.setFrom(new InternetAddress(senderEmailID));<br /> msg.addRecipient(Message.RecipientType.TO,<br /> new InternetAddress(receiverEmailID));<br /> Transport.send(msg);<br /> } catch (Exception mex) {<br /> mex.printStackTrace();<br /> }<br /><br /> <br /> }<br /> private class SMTPAuthenticator extends javax.mail.Authenticator {<br /> public PasswordAuthentication getPasswordAuthentication() {<br /> return new PasswordAuthentication(senderEmailID, senderPassword);<br /> }<br /> }<br /> /**<br /> * @param args<br /> */<br /> public static void main(String[] args) {<br /> // TODO Auto-generated method stub<br /> MailSender mailSender=new MailSender("changeme @ changeme .com","Test Mail from Puretechie","Here goes the body");<br /> }<br /> <br />}Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-64626671812524849842008-09-22T12:18:00.002+05:302008-09-22T12:59:16.286+05:30Common bad practice in database calculationscreate table x ( i int, j varchar(10))<br />insert into x values (1,'a')<br />insert into `x`(`i`,`j`) values ( '2',NULL)<br /><br /><br />select count(*) from x<br />2<br />Select count(j) from x<br />1<br /><br />Note the difference when the count(col_name) is used.<br /><br />count(col_name) is used under the impression that it is faster than count(*) , however quite the opposite is true.<br /><br />MYISAM table MySQL has cached number of rows in the table. Thats the reason why MYISM is able to instantly answer COUNT(*) query, but not COUNT(col_name). <br /><br />Why ? Because say if col_name column is not defined as NOT NULL there can be some NULL values in it and so MySQL have to perform table scan to find out. This is also why result is different for the second query.<br /><br />Using count(*) instead of count(col_name) falls in the best practice category.Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0tag:blogger.com,1999:blog-20309183.post-22413583864770170862008-06-21T02:26:00.004+05:302008-06-21T02:51:57.509+05:30Ways to manage RSS feedsRSS feeds aim to manage the information load.<br /><br />I for example blog at these places :<br /><br />a) http://dinchari.blogspot.com/ --- my Personal blog <br />b) http://puretechie.blogspot.com/ --- were a group of like minded tech enthusiasts post about topics of their interest. <br /><br />Ideally I would like my friends to have be updated with my thoughts on either blogs. Currently they have to refer to the individual rss feeds separately. <br /><br /><br />To ease matters, I have used Yahoo Pipes to create a combined RSS feed for the consumers as a single combined RSS feed.<br /><br /><a href="http://pipes.yahoo.com/pipes/pipe.run?_id=yH0_vQk_3RGAydbXiHrL0A&_render=rss">Click here for the new combined RSS link</a><br /><br /><br />Now this essentially is simple.<br /><br />We can develop on this use case extensively.<br /><br />Initially,<br />a) Now in the tech blog: there are many other authors. With the above URL , the consumers will also get the updates from these other authors. There needs to be filtering mechanism based on Author.<br /><br />Adding more complexity,<br />b) Suppose you like all my articles about the puzzles and are not interested in any other topics. This is where the whole thing gets tricky. Using filtering its possible, but I have to explore the capabilities of customizing to individual consumers.Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com1tag:blogger.com,1999:blog-20309183.post-21835263603087069122008-05-27T07:14:00.002+05:302008-05-27T07:17:50.668+05:30Processing RSS feeds --the Python way[shantanu@myjunkyard rss]$ cat a1.py<br />#!/usr/bin/env python<br />import feedparser<br />import sys<br />d = feedparser.parse(sys.argv[1])<br />for i in d['entries']:<br /> for j in i['links']:<br /> print i['title'] + "######" + j['href']<br /><br /><br />[shantanu@myjunkyard rss]$ cat rssFeed.list<br />http://puretechie.blogspot.com/atom.xml<br /><br />[shantanu@myjunkyard rss]$ for i in `cat rssFeed.list `; do ./a1.py $i; done<br /><br />See it Yourself :)Shantanuhttp://www.blogger.com/profile/00088855664889365698noreply@blogger.com0