tag:blogger.com,1999:blog-60250896152853805142024-03-12T22:49:07.977-07:00Tech TalkiesWhere I talk about my "personal itch" in Programming and ComputersGurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.comBlogger83125tag:blogger.com,1999:blog-6025089615285380514.post-33963697523382223202015-02-06T09:37:00.000-08:002015-10-20T12:42:18.040-07:00C Pointers in a Simple English<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Everyday Analogy </h2>
<div style="text-align: left;">
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
What is a pointer?</h3>
A pointer is a 'piece of paper' which stores the 'phone no' of a 'target' object .<br />
Using the pointer we can access the target.<br />
Since
we can easily change the target, we can create programs which don't
need to know what variable/object they're operating on. They just
operate on the variable indirectly through the pointer and don't care
what the target is <br />
<h3 style="text-align: left;">
</h3>
Variables are like trees, they're rooted to one place<br />
Pointers are like cheetahs, they're agile and dangerous.<br />
<br />
TODO : Replace the kludgy diagram below with a scanned proper hand-drawn version.<br />
<br />
Imagine a table with rows and columns, let's say this represents a "logical RAM".<br />
Each cell can store data. So each cell can act as a variable.<br />
Some of these variables could store locations of other cells instead of just number values.<br />
<br />
So the cells are numbered left-to-right and top-to-bottom from 1-12 in the figure below: <br />
<br />
<span id="goog_251371614"></span><span id="goog_251371615"></span></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYSuKS-_jv00nKnHgWX9qpe719h8k_OHmDiLTWVR131VXjj7Mf9rOLt-OVMxPKg-b8nozMvy634oOyKIMKxDO4R1jPQTPOpn2DQpdn80HlY7EBCc5rOgs03w5DuotByEiDC3Lw4S7Fo8w/s1600/row-column-RAM.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYSuKS-_jv00nKnHgWX9qpe719h8k_OHmDiLTWVR131VXjj7Mf9rOLt-OVMxPKg-b8nozMvy634oOyKIMKxDO4R1jPQTPOpn2DQpdn80HlY7EBCc5rOgs03w5DuotByEiDC3Lw4S7Fo8w/s1600/row-column-RAM.JPG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
So the 3rd cell stores the value 150 in it. And the 11th cell stores the value 200 in it.<br />
So the 7th cell stores the address '3' to point to the 3rd memory cell (containing the value 150 in it).<br />
And the the 10th cell stores the address '11' to point to the 11th memory cell (containing the value 200 in it).<br />
<br />
<h3 style="text-align: left;">
Everyday Analogies:</h3>
<h3 style="text-align: left;">
A) Telephone Number Analogy :</h3>
We regularly use pointers in everyday life when we use telephone numbers.<br />
[Note : <br />
a)Telephone no.s give 2-way access whereas a pointer gives only 1-way access.<br />
b)Usually the no. of links is 1 to 3 in an access path. <br />
]<br />
<br />
<h3 style="text-align: left;">
Find any Person using your Friend Network (a la 6 degrees of separation):</h3>
Let us say Tom wants to tell his friend something important.<br />
He can either physically go and talk to him or he can phone him. <br />
<br />
Lets assume Tom phones Jerry.<br />
<i><b>Tom ---> Jerry</b></i><br />
<br />
Tom doesn't have Jerry's no. Tom calls up 1 to get Jerry's no.<br />
<i><b>Tom ---> 1 ---> Jerry </b></i><br />
<br />
Tom follows the <i>"Six Degrees of Separation Rule"</i> as he knows that someone in a path going outward will know Jerry's no.<br />
<i><b>Tom ---> 1 ---> 2 ---> .... ---> N ---> Jerry</b></i><br />
<br />
Here Tom calls Jerry by <br />
a) Firstly getting the contact no. directly or indirectly from 'a friend-of-a-friend-of-a-friend'.<br />
b) Secondly Dialling the number.<br />
<br />
<h3 style="text-align: left;">
<b>B) Links of a Chain : </b></h3>
Here the intermediate links of the chain can change the destination similar to an operator diverting your call to <br />
the concerned person in an organisation.<br />
<br />
Say
Tom wants some info (from Jerry), but N on the path knows that Mickey
is a better source of info and gives Mickey's number instead.<br />
<br />
<b> a)Original path:</b><br />
<i> <b>Tom ---> 1 ---> 2 --->...N ---> Jerry</b></i><br />
<br />
<b>b)Redirection:</b><br />
<i> <b>Tom ---> 1 ---> 2 --->...N ---> Mortimer</b></i><br />
<br />
We
can remove a single link from anywhere in the chain and re-create the
(slightly smaller) chain by reattaching the links near the break in the
chain. There is a minimal cost of inserting new links or removing
existing links in the chain. This is exactly the property which allows
efficient linked lists and other data-structures to be used without
being stuck with unwieldy arrays.<br />
It takes a lot of copying to cover up the "hole" in an array if we need to delete or insert at the front or middle.<br />
But pointers just require reassigning the links fix the "break" in the chain.<br />
<br />
<h3 style="text-align: left;">
<b>C) Train Shunting :</b></h3>
This is similar to shifting tracks for
a train, we can easily divert the train to whatever track by using the
shunting mechanism.<br />
<br />
<h3 style="text-align: left;">
D) Postal Address : </h3>
Though
not as precise and neat as the telephone number analogy you can think
of a pointer variable as an envelope with the address of a person on a paper inside. <br />
<br />
<h3 style="text-align: left;">
When do we use Pointers?</h3>
a)When we want to randomly point to and access different areas of memory (say a sequence of objects). <br />
b) Access a specific memory location. (accessing a port or a vdu buffer)<br />
c) Create an anonymous object. <br />
d) Save our position in a sequence.<br />
e) Avoid needless copying/moving of data items in a data-structure by just adjusting few pointers.<br />
<br />
A pointer can point somewhere (an object) or anywhere (an address).<br />
It can be repositioned to point elsewhere.<br />
<br />
Access the object contents by location (Like voodoo)<br />
Re-target<br />
Insulate knowledge of identity of target object. (Bearer Cheque, Lottery winner)<br />
Anonymous objects (using new or malloc )<br />
Iterating over a Sequence<br />
<br />
ptrvar = &Object1; //targeting the pointer<br />
ptrvar Object1<br />
[ 1000 ] -----> [........] location 1000<br />
<br />
ptrvar = &Object2; //retargeting the pointer<br />
[ 2000 ] -----> [........] location 2000<br />
<br />
<br />
We need pointers to keep track of our position as we access different locations. <br />
Everyday usage :<br />
The index finger 'points' to our current location in a phone-directory as we rapidly scan through the entries. <br />
Website URLs, Postbox numbers or Postal addresses.<br />
<br />
We want to call up all people with the prefix 2375XXXX we just start at 23750000 and then <br />
keep adding 1 to the no. till we reach 23759999<br />
We could call up all people with 2375XXXY where Y is an even no. and so on.<br />
We can randomly dial any no. without knowing the person at the other end (anonymous object)<br />
<br />
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
How do we use Pointers?</h3>
<i><b>a) Example code to understand Pointers :</b> <a class="qlink qtext_editor_link_text" data-link-delete="http://en.wikiversity.org/wiki/C_Source_Code/Pointers" data-link-text="C Source Code/Pointers" href="http://en.wikiversity.org/wiki/C_Source_Code/Pointers" id="qlink_dvuj0drd2i">C Source Code/Pointers</a> </i><br />
<br />
<b>b) C Code to traverse and insert a node in a linked-list:</b><br />
<i> typedef struct list { </i><br />
<i> int data;</i><br />
<i> struct list *next;</i><br />
<i> }List;</i><br />
<i><br /></i>
<i> void printlist(List *first)</i><br />
<i> {</i><br />
<i> List *tmp;</i><br />
<i> for(tmp = first; tmp != NULL ; tmp = tmp->next ) { // step through the sequence</i><br />
<i> printf("%d", tmp->data);</i><br />
<i> }</i><br />
<i> return ; </i><br />
<i> }</i><br />
<i><br /></i>
<i> int main()</i><br />
<i> {</i><br />
<i> int x=1,y=2,z=0;</i><br />
<i> int num[3] = { 1, 2, 0 };</i><br />
<i> List *head = makelist(); //returns an anonymous list of objects ->[10]->[20]->[30]->null</i><br />
<i> </i><br />
<i> add(&x,&y,&z); // z = 3</i><br />
<i> add(&num[0],&num[1],&num[2]); // num[ 1, 2, 3]</i><br />
<i> printlist(head);</i><br />
<i><br /></i>
<i> return 0;</i><br />
<i> }</i><br />
<i><br /></i>
<i> void add(int *a,int *b,int *c)</i><br />
<i> {</i><br />
<i> return *c = *a + *b;</i><br />
<i> }</i></div>
<div style="text-align: left;">
===================================================================<br />
<br />
<h3 style="text-align: left;">
Location access using Pointer or Array Notation:</h3>
<br />
<i>int iarr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; //<b>Note : arrays are 0-indexed in C</b></i><br />
<i>int * iptr = &iarr[0]; //store address of 1st location of array in iptr</i><br />
<i>*iptr = 42; //get the address from envelope using star operator, go to location and <b>assign</b> '42' number</i><br />
<br />
<i>iptr[0] = iptr[9]; // read last integer of array and assign to 1st cell of array (using array notation)</i><br />
<i>*(iptr+0) = *(iptr+9); //Same as previous code we're just using pointer notation (instead of array notation). </i><br />
<i><br /></i>
<i><br /></i>
<b>See Also : </b><br />
<ol style="text-align: left;">
<li><b>Ted Jensen C Pointer Tutorial : </b>http://pweb.netcom.com/~tjensen/ptr/pointers.htm</li>
<li><b>The 5 Minute Guide to C Pointers :</b> <a href="http://denniskubes.com/2012/08/16/the-5-minute-guide-to-c-pointers">http://denniskubes.com/2012/08/16/the-5-minute-guide-to-c-pointers</a></li>
<li><b>"Understanding Pointers in C"</b> by Yeshawant Kanetkar (BPB Publications).</li>
<li><b>"Understanding C by Learning Assembly" :</b> <a href="https://www.hackerschool.com/blog/7-understanding-c-by-learning-assemblyhttps://www.hackerschool.com/blog/7-understanding-c-by-learning-assembly" target="_blank">https://www.hackerschool.com/blog/7-understanding-c-by-learning-assemblyhttps://www.hackerschool.com/blog/7-understanding-c-by-learning-assembly</a></li>
<li><b>Learning C with GDB :</b> <a href="https://www.hackerschool.com/blog/5-learning-c-with-gdb">https://www.hackerschool.com/blog/5-learning-c-with-gdb</a></li>
<li><b>Super Tutorial on Linux Memory Management :</b> <a href="http://www.linux-tutorial.info/modules.php?name=MContent&pageid=261">http://www.linux-tutorial.info/modules.php?name=MContent&pageid=261</a></li>
<li><b>Internals of C++ and Unix :</b> http://techtalkies.blogspot.com/2007/07/good-articles-on-internals-of-c-and.html </li>
</ol>
<br />
<ol style="text-align: left;">
</ol>
</div>
</div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com1tag:blogger.com,1999:blog-6025089615285380514.post-81400151137639529582014-08-26T22:42:00.004-07:002014-08-27T20:46:37.055-07:00Installing and Testing out your own crowd-sourced App with PyBossa<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<b>Testing PyBossa with a Virtual Machine :</b> <a href="http://docs.pybossa.com/en/latest/vagrant_pybossa.html">http://docs.pybossa.com/en/latest/vagrant_pybossa.html</a><br />
<br />
Install Virtualbox and Vagrant first.<br />
<textarea cols="40" name="textarea" rows="4" style="height: 115px; width: 682px;" wrap="VIRTUAL">#clone pybossa source in your local drive
$ git clone --recursive git://github.com/PyBossa/pybossa.git
#Start VM
$ cd pybossa
$ vagrant up
</textarea>
<br />
<pre><b> </b></pre>
<pre><b>Problem :</b> The 'vagrant up' fails on WinXP while installing 'hashicorp/precise32' dependency.</pre>
<pre>Following error message is seen : </pre>
<textarea cols="40" name="textarea" rows="4" style="height: 85px; width: 668px;" wrap="VIRTUAL">"The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again.
The output from attempting to unpackage (if any)"
</textarea>
<br />
<b>Cause :</b> This is caused by missing or failure in running bsdtar.exe.<br />
For More Details see : <a href="https://github.com/mitchellh/vagrant/issues/3869">https://github.com/mitchellh/vagrant/issues/3869</a>.<br />
<b>Solution:</b> <br />
1) Install Mingw with bsdtar.exe <br />
<i>2) "However, installing MinGW for the bsdtar.exe, brought up another issue.<br />
bsdtar.exe wouldn't run because it needed 'msys-lzma-1.dll' but 'msys-lzma-5.dll' was available. <br />
Just copied and renamed to expected filename and it worked!!"</i><br />
<br />
Now precise32 installs and 'vagrant up' succeeds.<br />
<br />
<b>Next step</b> <br />
<textarea cols="40" name="textarea" rows="4" style="height: 115px; width: 668px;" wrap="VIRTUAL">#Connect to VM
$ vagrant ssh
#Start Pybossa
$ cd /vagrant
$ source vagrant_start.sh</i>
</textarea>
<br />
<pre> </pre>
<b>Problem :</b> Running the 'source vagrant_start.sh' script fails<br />
<b>Cause :</b> bash requires usage of ./scriptname to execute script in current directory.<br />
<b>Solution :</b> Just changing the docs line 'source vagrant_start.sh' to 'source ./vagrant_start.sh' fixes the problem.<br />
<br />
<b>Problem :</b> 'source ./vagrant_start.sh' still fails<br />
<b>Cause :</b> It gives errors for
trailing ^M characters in the script, DOS line-feed chars.<br />
<b>Solution :</b> Editing the file and removing trailing ^M characters solves the problem.<br />
<br />
<pre>Use your web browser to browse Pybossa welcome page with this URL 'http://localhost:5000'</pre>
</div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com1tag:blogger.com,1999:blog-6025089615285380514.post-84394103880027628122014-07-17T03:13:00.001-07:002014-07-17T03:58:13.432-07:00test discourse<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
1) Configure Discourse Server Settings as described here: <a href="http://eviltrout.com/2014/01/22/embedding-discourse.html">http://eviltrout.com/2014/01/22/embedding-discourse.html</a><br />
<br />
<b>2) The Discourse comments should appear here ===> </b><br />
<div id="discourse-comments">
</div>
</div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-43506311836791652442014-07-01T01:24:00.001-07:002014-07-01T01:24:32.301-07:00Test Google Transliterate Widget<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!-- Source code from : https://developers.google.com/transliterate/v1/getting_started#Multi -->
<center>Type in Indian languages (Press Ctrl+g to toggle between English and Hindi)</center>
<div id='translControl'>
<input type="checkbox" id="checkboxId" onclick="javascript:checkboxClickHandler()"></input>
Type in <select id="languageDropDown" onchange="javascript:languageChangeHandler()"></select>
</div>
<!--br>Title : <input type='textbox' id="transl1"/-->
<br>Body<br><textarea id="transl2" style="width:600px;height:200px"></textarea>
<br><div id="errorDiv"></div>
</div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-39249509880689714112014-06-17T07:51:00.001-07:002014-07-01T01:26:23.618-07:00Test Amara Widget<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- Note1 : Need to embed the script part of amara embedding widget into blog template -->
<!-- Note2 : There an open issue with amara needing http' url and not 'https' url while embedding -->
<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<h1>
Amara Test Video for Easy Access to Amara Subtitling and Interactive Transcript on your blog or website</h1>
<div class="amara-embed" data-height="480px" data-hide-order="true" data-initial-language="en" data-show-subtitles-default="true" data-show-transcript-default="true" data-url="http://www.youtube.com/watch?v=bNySL-ihAvo" data-width="854px">
</div>
<br />
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<h2 style="text-align: left;">
<span style="font-size: small;"><b><u>Usage:</u> </b></span></h2>
</div>
<span style="font-size: small;"><b>1) Click on "amara" button</b> on video toolbar to view the different language subtitles for the video</span><br />
<span style="font-size: small;"><b>2) Click on "Transcript" button</b> to view the interactive transcript for whole video.</span><br />
<span style="font-size: small;"> Also shows "Search Toolbar" box to highlight any word/phrase in the text.</span><br />
<span style="font-size: small;"> Skip to any point in the video timeline by simply clicking on any word in the interactive transcript.</span><br />
<span style="font-size: small;"> Can be used to extract quotable quotes very easily for sharing on social media (with time position).</span><br />
<span style="font-size: small;"><b>3) Click on "CC" button</b> to toggle subtitles.</span><br />
<span style="font-size: small;"><b>4) Click on "English" button</b> to get menu to</span><br />
<span style="font-size: small;"> a) "Improve these subtitles" i.e. add new or update existing subtitles (need to login).</span><br />
<span style="font-size: small;"> b) "Embed Code" to embed the amara widget in any other page.</span><br />
<span style="font-size: small;"> c) "Download Subtitles"</span><br />
<span style="font-size: small;"> d) Switch languages.</span></div>
<br />
<h1>
Rajiv Malhotra Test Video </h1>
<div class="amara-embed" data-height="480px" data-hide-order="true" data-initial-language="en" data-show-subtitles-default="true" data-show-transcript-default="true" data-url="http://www.youtube.com/watch?v=YO2T7alfZz4" data-width="854px">
</div>
</div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-12517184851390253242014-02-14T07:04:00.002-08:002014-02-17T09:11:53.444-08:00Super way to create running notes on any ebook using Kindle<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<u><b>Super way to create running notes on any ebook using Kindle</b></u></div>
<br />
<u><b>Advantages:</b></u><br />
a) Use any spare time anywhere to read and create my own notes on any kindle ebook.<br />
<div>
b) Well worth the price of a kindle ebook. <br />
c) Many times it's difficult to <i><b>remember detailed stuff</b></i> that you read quite some time back.</div>
<div>
d) With this method you end up spending at most 2 times effort but you can keep building on it incrementally.<br />
e) However, since it's mostly automated it reduces typing effort.<br />
f) The draft and final notes are best kept in a wiki.</div>
<div>
g) Periodically update onto blog.</div>
<div>
<br />
Note: I've written to the author of bookcision bookmarklet to add copy of user notes in addition to highlighted text. He just replied back that the feature is being added in next version of the tool. Till then it's possible to extract "Notes" by copy-pasting from kindle web-page.<br />
<br />
<u><b>Buying eBooks on Amazon.com:</b></u><br />
Note: As of 13-Feb-2013<br />
a) You will be Re-directed from India amazon..in to US site amazon.com for buying kindle ebooks.<br />
b) You need to use international credit-card to buy the same.<br />
c) You can pay in Rupees for the same.<br />
d) You may need to change the country of residence.<br />
e) Of course you can always get "sample ebooks" or "free ebooks" on your Smartphone/PC/CloudReader.<br />
f) Just click Deliver to each of the specific devices.<br />
<br />
<u><b>Howto Annotate your Kindle ebook for running Notes:</b></u><br />
a) Install Kindle-for-PC, Kindle-Android-App, Kindle-Cloud-Reader (best for quickly editing notes). <br />
b) Add bookcision bookmarklet to firefox/chrome browser : <a href="http://www.norbauer.com/bookcision/" target="_blank">http://www.norbauer.com/<wbr></wbr>bookcision</a><br />
c) Highlight the Chapter/Topic in addition to text which you want to annotate. <br />
You can also add a note-to-self to the highlighted text.<br />
d) <a href="https://kindle.amazon.com/your_highlights">Highlights get stored on your kindle account : <b>https://kindle.amazon.com/your_highlights</b></a> <br />
e) Click bookcision bookmarklet to copy highlights to clipboard. This will copy only highlighted text<br />
f) To copy notes part of your highlights page "View Source(Ctrl-U)" and manually copy contents '<b>noteContent</b>' tag to your wiki. <br />
g) Copy the notes to your Tiddlywiki and edit for formatting.<br />
<br /></div>
<div>
<u><b>Sample:</b></u></div>
<a href="http://learning-notes.tiddlyspot.com/#[[Mastering%20Redmine%20Book%20Notes]]" target="_blank">http://learning-notes.<wbr></wbr>tiddlyspot.com/#[[Mastering%<wbr></wbr>20Redmine%20Book%20Notes]]</a><br />
<br />
<u><b>Install:</b></u> <br />
a) Kindle Cloud Reader : https://read.amazon.com<br />
b) Kindle App for Android : https://play.google.com/store/apps/details?id=com.amazon.kindle<br />
c) Kindle For PC : http://download.cnet.com/Kindle-for-PC/3000-20412_4-75185974.html<br />
<br />
<u><b>See Also:</b></u> <br />
a) Howto Install Kindle for PC : http://www.howtogeek.com/howto/9192/read-kindle-books-on-your-computer-with-kindle-for-pc<br />
<br />
<br /></div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-34094326955962943932013-12-24T05:37:00.002-08:002013-12-24T05:37:22.835-08:00LXR Source Code Referencing using iframe<div dir="ltr" style="text-align: left;" trbidi="on">
Reference by File,Line No:<br />
<iframe frameborder="1" height="50%" hspace="0" marginheight="0" marginwidth="0" scrolling="yes" src="http://lxr.linux.no/linux+*/ipc/msg.c#L65" vspace="0" width="100%"><p>
<br /> </p>
</iframe><br />
Reference by Keyword:<br />
<iframe frameborder="1" height="50%" hspace="0" marginheight="0" marginwidth="0" scrolling="yes" src="http://lxr.linux.no/linux+*/+code=msg_sender" vspace="0" width="100%"><p>
<br /> </p>
</iframe><br />
<br />
<a href="http://lxr.linux.no/">LXR - Source Code Cross Referencing Tool</a>: http://lxr.linux.no<br />
<a href="http://wordpress.org/hosting">WordPress Hosting solutions</a>: http://wordpress.org/hosting<br />
<br /></div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-17882408492569054362013-12-24T05:36:00.003-08:002013-12-24T05:36:28.294-08:00STL Video Tutorial by the Microsoft STL maintainer Stephen Lavavej<div dir="ltr" style="text-align: left;" trbidi="on">
<a class="externalLink" href="http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Standard-Template-Library-STL-2-of-n" target="_blank" title="External link to http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Standard-Template-Library-STL-2-of-n">Going Deep into STL with Stephen Lavavej (Video) </a><br />
<a class="externalLink" href="http://channel9.msdn.com/shows/Going+Deep/VC-10-Stephan-T-Lavavej-and-Damien-Watkins-Inside-STL/" target="_blank" title="External link to http://channel9.msdn.com/shows/Going+Deep/VC-10-Stephan-T-Lavavej-and-Damien-Watkins-Inside-STL/"> Inside STL with Stepan Lavavej (Video) </a><br />
<a class="externalLink" href="http://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx" target="_blank" title="External link to http://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx">C++0x Features in VC10 </a><br />
<br />
Todo: Viewing and analysis to follow<br />
<i>Note: Thanks to my team-mates (SriVasala and Ravi H.) for giving the link to the video</i></div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-10387714945421190292013-12-24T05:29:00.000-08:002013-12-24T05:29:25.856-08:00Resources for Exploring the Python Standard Library<div dir="ltr" style="text-align: left;" trbidi="on">
Study the standard libraries source code for good examples of Python coding.<br />
<b><u> </u></b><br />
<br />
<b><u>Using Pythonic Idioms and Style:</u></b><br />
Definition of "Pythonic" <a href="http://www.wordiq.com/definition/Python_programming_language">here</a> <br />
<i><u>Presentations: </u></i><br />
<a href="http://www.chrisarndt.de/talks/rupy/2008/output/slides.html">How to Write Pythonic" code by Christopher Arndt</a><br />
<a href="http://python.net/%7Egoodger/projects/pycon/2007/idiomatic/presentation.html">Presentation on "Code Like a Pythonista: Idiomatic Python" by David Goodger</a><br />
<a href="http://www.omahapython.org/IdiomaticPython.html">Presentation on "Code Like a Pythonista: Idiomatic Python" (Crunchy Remix) by Jeff Hinrich </a> <br />
<br />
Reference:<br />
Bruce Eckel's community contributed book<a href="http://bitbucket.org/BruceEckel/python-3-patterns-idioms">: Python 3 - Patterns & Idioms</a><br />
<a class="http" href="http://www.python.org/doc/current/lib/lib.html">Python's Standard Library Reference manual</a><br />
<br />
<a href="http://www.lightbird.net/py-by-example/">Python by Example</a><br />
<a href="http://the.taoofmac.com/static/tiddlygrimoire20050822.html">Common programming tasks in Python</a><br />
<br />
<br />
<u><b>See Also:</b></u><br />
<a href="http://techtalkies.blogspot.com/2010/10/learning-python.html">My blog on Learning Python</a></div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-58013297130456946562012-04-12T05:17:00.002-07:002012-04-12T05:20:55.673-07:00Firefox extensions to make copy-paste a piece of cake in Firefox<div dir="ltr" style="text-align: left;" trbidi="on"><div class="viewer"><h2 style="font-weight: normal;"><b></b></h2><h4 style="text-align: left;">CoLT </h4>Allows copying of a single link with Title and URL as per given output template<br />
<a class="externalLink" href="https://addons.mozilla.org/en-US/firefox/addon/colt/" target="_blank" title="External link to https://addons.mozilla.org/en-US/firefox/addon/colt/ "> Copy Link Text extension to firefox </a><br />
<hr /><h4 style="text-align: left;">copyurlplus </h4></div><div class="viewer"><br />
Allows text selection, link selection with copy of title, url and selected text<br />
<b><a class="externalLink" href="http://dmcritchie.mvps.org/firefox/firefox.htm#copyurlplus" target="_blank" title="External link to http://dmcritchie.mvps.org/firefox/firefox.htm#copyurlplus "> copyurlplus which xpi version to install for different firefox versions </a></b><br />
<b><a class="externalLink" href="http://btcorp.dyndns.org/Tools/FireFoxExtensions/FF_3.6_extensions/" target="_blank" title="External link to http://btcorp.dyndns.org/Tools/FireFoxExtensions/FF_3.6_extensions/ "> download copyurlplus xpi version 1.3.4 for firefox 3.6 </a></b><br />
<b><a class="externalLink" href="http://dmcritchie.mvps.org/firefox/copyurlplus.htm" target="_blank" title="External link to http://dmcritchie.mvps.org/firefox/copyurlplus.htm "> notes on customizing copyurlplus by dmcritchie </a></b><br />
<a class="externalLink" href="http://johnbokma.com/mexit/2006/11/03/updating-an-extension.html" target="_blank" title="External link to http://johnbokma.com/mexit/2006/11/03/updating-an-extension.html "> Making a Firefox extension work in later versions of firefox </a><br />
<a class="externalLink" href="http://johnbokma.com/mexit/2007/01/18/copy-url-plus-extension-firefox.html" target="_blank" title="External link to http://johnbokma.com/mexit/2007/01/18/copy-url-plus-extension-firefox.html "> Making copyurlplus extension work in later versions of firefox firefox </a><br />
<hr /><h4 style="text-align: left;">copyallurls</h4></div><div class="viewer">Allows copying of all open tabs (optionally with history and sorting) with Title, URL as per given output template<br />
<a class="externalLink" href="https://addons.mozilla.org/en-US/firefox/addon/copyallurls/?src=search" target="_blank" title="External link to https://addons.mozilla.org/en-US/firefox/addon/copyallurls/?src=search "> Copy all URLs from open tabs (optionally with history) </a></div></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com1tag:blogger.com,1999:blog-6025089615285380514.post-35694128765575161282011-07-28T06:52:00.000-07:002015-02-06T12:36:57.793-08:00Good Articles on Internals of C++ and Unix<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
<u><b>A) C as a glorified assembler:</b></u></h3>
<b>"C a glorified assembler" or "C a generalized assembler"</b><br />
<br />
Actually I only really started understanding C when I understood 2 things about it.<br />
1) Anything you code in C finally translates to assembly language.<br />
2) How your compiler interacts with the O.S. loading/linking mechanism.<br />
<br />
You can easily test this.<br />
Use the 'gcc --save-temps ' feature of your gcc compiler to see the assembly language output.<br />
<br />
<i><b>C program to assembly code translation</b></i><br />
<i>>>>>>>>><br />
C program<br />
>>>>>>>></i><i>extern int printf(const char *, ...)<br />
int main()<br />
{<br />
printf( "Hello, World!\n");<br />
return 0;<br />
}</i><br />
#Retain temporary intermediate files generated during preproc, compiling, assembling etc.<br />
<i>gcc --save-temps test.c</i><br />
<br />
<i>>>>>>>>><br />
Pseudo-Assembly (see link for more accurate example)<br />
>>>>>>>><br />
.data # data section starts at say 0x100<br />
msg ds "Hello, World!\n" # define string with label as msg and content as "Hello, World!\n"<br />
<br />
.text<br />
push sp # save the current stack pointer<br />
push msg # push the function parameter onto stack<br />
call _printf # make the library call<br />
ret 0 # essentially return 0 as errorvalue to bash/cmd.exe<br />
<br />
>>>>>>>></i><br />
Since the C language is portable from one platform to another it kind-of acts like a virtual machine (without byte-code generation of-course). <br />
The same C program will compile on different machine-compiler pairs to the specific assembly language and O.S. of the platform in question.<br />
<br />
This makes for chip/hardware specific assembly(Intel x86 or Motorola or ARM ...) portability.<br />
<br />
<h3 style="text-align: left;">
Write Great Code :</h3>
What happens when you run your program?
<br />
The dynamics from Compilers to O.S. to <span class="il">Assembly</span> <span class="il">language</span> to Memory to CPU.
<br />
This book covers it all
<br />
<br />
You have 2 choices:
<br />
1) You can choose to spend years garnering small nuggets of
internals of your Program and how it runs on your machine. You'd need a
few books each on Operating System, Linker Loader, <span class="il">Assembly</span> <span class="il">Language</span>, Compiler Design, Hardware.
<br />
Next would be loads of patience to connect all this into a chimera/frankestein-of-sorts (horribly put together)
<br />
OR
<br />
2) You could read it all here - Integrated into a beautiful and coherent whole written by a master.
<br />
<br />
<a href="http://www.nostarch.com/greatcode.htm" target="_blank">Write Great Code, Volume 1: Understanding the Machine</a><br />
<a href="http://www.nostarch.com/greatcode2.htm" target="_blank">Write Great Code, Volume 2: Thinking Low-Level, Writing High-Level</a><br />
<a href="http://www.nostarch.com/assembly.htm" target="_blank">The Art of Assembly Language</a> <br />
<br />
<br />
Refer:<br />
<ol style="text-align: left;">
<li><a href="http://www.eventhelix.com/RealtimeMantra/Basics/CToAssemblyTranslation.htm"><i>C to Assembly Translation Article from EventHelix</i></a></li>
<li><i><b>Inside the C++ Object Model :</b> <a href="http://techtalkies.blogspot.in/2007/07/stub-bookreview-c-object-model-by.html" target="_blank">http://techtalkies.blogspot.in/2007/07/stub-bookreview-c-object-model-by.html</a></i></li>
<li><b>X86 Calling (and stack cleanup) conventions:</b> <a href="http://en.wikipedia.org/wiki/X86_calling_conventions">http://en.wikipedia.org/wiki/X86_calling_conventions</a><br /><b>X86 Disassembly Wikibook (download as pdf):</b> <a href="http://en.wikibooks.org/wiki/X86_Disassembly">http://en.wikibooks.org/wiki/X86_Disassembly</a></li>
</ol>
==================================================================<br />
<br />
<h3 style="text-align: left;">
<u><b>B) Interaction with O.S. loader/linker/virtual-memory:</b></u></h3>
The specific C compiler would also link the O.S. specific C runtime properly.<br />
<br />
So gcc which is a portable compiler would link in.<br />
a) mingw C runtime on Win32<br />
b) linux C runtime on Linux.<br />
<br />
The same C program would also convert to correct assembly/runtime on <br />
Watcom C++, Visual C++ compiler, AIX, HP/UX compilers etc.<br />
<br />
Note:<br />
a) <a href="http://en.wikipedia.org/wiki/C_standard_library">printf() comes from the C Standard Library</a><br />
b) <a href="http://en.wikipedia.org/wiki/Runtime_library">C runtime library contains the startup code which executes before and after main</a><br />
<br />
Refer:<br />
1) <a href="http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=eb08b3f1eee02110b3f1eee02110275d6e10RCRD">C++ runtime environments on HP-UX</a><br />
2) <a href="http://techtalkies.blogspot.com/2007/07/good-articles-on-internals-of-c-and.html">Internals of C/C++ compiler implementations</a><br />
3) <a href="http://www.nobugs.org/developer/win32/debug_crt_heap.html">How to use debug C runtime to debug your application</a><br />
4) <a href="http://www.osdever.net/tutorials/view/writing-a-kernel-in-c">How to write a minimal Kernel in C</a> (a very simple Hello world program which also describes the libc C runtime library)<br />
5) <a href="http://book.opensourceproject.org.cn/kernel/kernel3rd/opensource/0596005652/understandlk-chp-10.html">Understanding System Calls</a><br />
Note:<br />
The C standard library calls like open(), close(), putc(), getc() etc actually just forward the call to O.S. system calls in the linux kernel. The C runtime actually maps a stdlibrarycall to an interrupt vector i.e. system call index number in a lookup table. Then it uses a software interrupt to call the system call (transfers from user mode to kernel mode and back)<br />
<br />
================================================================== <br />
<br />
These are a set of articles that take a look at what happens inside C, C++, Unix internals as we compile and run our programs. The info here is invaluable to debug compile errors, runtime errors and memory issues. You can go through these in your spare time. Take a print out to read in your spare time and go through these articles.<br />
<br />
<ol style="text-align: left;">
<li><a href="https://www.blogger.com/goog_251371671">What Happens When You Compile and Link a Program</a></li>
<li><a href="https://www.blogger.com/goog_251371671">What a Compiler Turns Your C Code Into </a></li>
<li><a href="https://www.blogger.com/goog_251371671">Virtual Base Classes Implementation</a></li>
<li><a href="https://www.blogger.com/goog_251371671">How the C++ compiler mangles/decorates function names</a><a href="https://www.blogger.com/goog_251371671">Unix And C-C++ Runtime Memory Management For Programmers</a></li>
<li><b>Under The Hood Look At Operating Systems Internals with Windows and Linux :</b> <a href="http://techtalkies.blogspot.in/2010/08/operating-systems-and-linux.html">http://techtalkies.blogspot.in/2010/08/operating-systems-and-linux.html</a></li>
<li><b>mmap is not the territory (Part 1):</b> <a href="http://techtalkies.blogspot.com/2010/09/mmap-is-not-territory-or-mapfail-sigbus.html">http://techtalkies.blogspot.com/2010/09/mmap-is-not-territory-or-mapfail-sigbus.html</a></li>
<li><b>mmap is not the territory (Part 2): </b><a href="http://techtalkies.blogspot.com/2010/09/mmap-is-not-territory-part-2.html">http://techtalkies.blogspot.com/2010/09/mmap-is-not-territory-part-2.html</a><b><br /></b></li>
</ol>
<br />
==================================================================<br />
<br /></div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-60351030788932164582011-07-13T06:39:00.000-07:002011-07-13T06:39:21.793-07:00Remotely editing files with ssh, sshmenu, bcvi and vim<h2 style="font-weight: normal;"> </h2><strong style="font-weight: normal;">No need to install your favourite vim settings etc on the remote server just use bcvi to start gvim on your workstation. <br />
It uses scp internally to create an editing session from workstation to server</strong><br />
<strong><a class="externalLink" href="http://sshmenu.sourceforge.net/articles/transparent-mulithop.html" target="_blank" title="External link to http://sshmenu.sourceforge.net/articles/transparent-mulithop.html "> Transparent multi-hop ssh </a></strong><br />
<strong><a class="externalLink" href="http://sshmenu.sourceforge.net/setup/" target="_blank" title="External link to http://sshmenu.sourceforge.net/setup/ "> sshmenu setup howto </a></strong><br />
<strong><a class="externalLink" href="http://sshmenu.sourceforge.net/articles/bcvi/" target="_blank" title="External link to http://sshmenu.sourceforge.net/articles/bcvi/ "> Remotely editing files with bcvi and vim </a></strong><br />
<strong><a class="externalLink" href="http://vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vim" target="_blank" title="External link to http://vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vim "> Editing remote files in vim via scp </a></strong>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-63291386904423999152011-07-13T06:00:00.000-07:002011-07-13T06:00:15.099-07:00Browsing XSLT with Vim by adding a Custom Language to Ctags<h2> XSLT Source Code Browsing with Vim and Ctags</h2><h3> Creating a tags file</h3>1) Test out the regular-expressions for your custom language: <br />
<pre>$> egrep 'pattern' *.xsl</pre>2) Copy-paste custom language with the above regular-expressions into ~/.ctags.<br />
<pre>$> vi ~/.ctags
--langdef=EXSLT
--langmap=EXSLT:.xsl
--regex-EXSLT=/<xsl:variable[ \t]+name="\"([-a-zA-Z0-9_]+)\"/\1/v,variable/i<br">--regex-EXSLT=/<func:function[ \t]+name="\"([-a-zA-Z0-9_:]+)\"/\1/f,function/i<br">--regex-EXSLT=/<xsl:template[ \t]+match="\"([/-a-zA-Z0-9_:]+)\"/\1/t,template/i<br">$> cd srcdir
$> ctags -R *
$> vi ./tags #check for tag-entries containing the search patterns
$> vi test.xsl #Use Ctrl-] to jump from a pattern usage to its definition, Ctrl-T to jump back</xsl:template[></func:function[></xsl:variable[></pre>Note: <br />
1) Above solution for templates only uses xpath of match="xyz".<br />
The search-key for the template (displays taglist for templates with same xpath).<br />
Potentially a template is uniquely identifiable using match AND mode:<br />
<template match="xpath" mode="one"><br />
Solution: Choose from multiple results of taglist (Or) <br />
Use '*' and '#' to forwards/backward search in current or other opened files.<br />
2) ctags will work with exslt functions:<br />
<func:function name="myns:foo"><br />
3) ctags will work with xslt variables (displays taglist for variables with same name):<br />
<xsl:variable name="user"><br />
4) The ( and ) are used to create a tag-entry in tags file where \1 is the matching keyword.<br />
5) <a class="externalLink" href="http://ctags.sourceforge.net/EXTENDING.html" target="_blank" title="External link to http://ctags.sourceforge.net/EXTENDING.html "> Extending Ctags for a new language </a> requires C coding and is a different cup of tea totally.<br />
<hr /><strong><a class="externalLink" href="http://stackoverflow.com/questions/6466928/is-there-a-ctags-like-tool-for-browsing-navigating-xslt-code-in-vim" target="_blank" title="External link to http://stackoverflow.com/questions/6466928/is-there-a-ctags-like-tool-for-browsing-navigating-xslt-code-in-vim "> My question on Browsing XSLT with Ctags and Vim </a></strong><br />
<strong><a class="externalLink" href="http://stackoverflow.com/questions/2502955/how-can-i-generate-a-tags-file-for-groovy-classes-for-use-in-vim-emacs" target="_blank" title="External link to http://stackoverflow.com/questions/2502955/how-can-i-generate-a-tags-file-for-groovy-classes-for-use-in-vim-emacs "> Adding ActionScript language using Ctags and TList in vim </a></strong><br />
<strong><a class="externalLink" href="http://www.zeusedit.com/zforum/viewtopic.php?t=3367" target="_blank" title="External link to http://www.zeusedit.com/zforum/viewtopic.php?t=3367 "> Adding Clipper language to Ctags on Zeus </a></strong><br />
<strong><a class="externalLink" href="http://vim.wikia.com/wiki/Browsing_programs_with_tags" target="_blank" title="External link to http://vim.wikia.com/wiki/Browsing_programs_with_tags "> Creating and Browsing with Ctags files in Vim </a></strong><br />
<strong><a class="externalLink" href="http://vimdoc.sourceforge.net/htmldoc/usr_29.html#29.1" target="_blank" title="External link to http://vimdoc.sourceforge.net/htmldoc/usr_29.html#29.1 "> Vim documentation on Using Ctags </a></strong><br />
<strong><a class="externalLink" href="http://www.arl.wustl.edu/%7Efredk/Courses/Docs/vim/if_cscop.html#csto" target="_blank" title="External link to http://www.arl.wustl.edu/~fredk/Courses/Docs/vim/if_cscop.html#csto "> Vim documentation on Using CScope </a></strong><br />
<a class="externalLink" href="http://www.pnotepad.org/docs/howto/tag_custom_languages" target="_blank" title="External link to http://www.pnotepad.org/docs/howto/tag_custom_languages "> Adding custom languages to Ctags with langdef/langmap at pnotepad </a><br />
<a class="externalLink" href="http://pwet.fr/man/linux/commandes/posix/ctags" target="_blank" title="External link to http://pwet.fr/man/linux/commandes/posix/ctags "> ctags tag format for C and FORTRAN mini explanation </a><br />
<a class="externalLink" href="http://ctags.sourceforge.net/EXTENDING.html" target="_blank" title="External link to http://ctags.sourceforge.net/EXTENDING.html "> Howto extend Ctags using a language extension </a><br />
<hr /><h3>Other languages</h3><a class="externalLink" href="http://stackoverflow.com/questions/4477322/how-to-make-vim-ctags-works-for-modern-javascript" target="_blank" title="External link to http://stackoverflow.com/questions/4477322/how-to-make-vim-ctags-works-for-modern-javascript "> Make ctags work with modern javascript </a><br />
<a class="externalLink" href="http://weblogs.asp.net/george_v_reilly/archive/2009/03/24/exuberant-ctags-and-javascript.aspx" target="_blank" title="External link to http://weblogs.asp.net/george_v_reilly/archive/2009/03/24/exuberant-ctags-and-javascript.aspx "> modern javascript langdef and langmap for ctags </a><br />
<a class="externalLink" href="http://www.linuxdocs.org/HOWTOs/Vim-HOWTO-6.html#ss6.1" target="_blank" title="External link to http://www.linuxdocs.org/HOWTOs/Vim-HOWTO-6.html#ss6.1 "> Shell script to Generate Ctags for Embedded SQL </a><br />
<a class="externalLink" href="http://www.linuxdocs.org/HOWTOs/Vim-HOWTO-6.html#ss6.2" target="_blank" title="External link to http://www.linuxdocs.org/HOWTOs/Vim-HOWTO-6.html#ss6.2 "> Shell script to generate Ctags for Javascript, Korn and Bourne Shells </a><br />
<a class="externalLink" href="http://hackage.haskell.org/package/hasktags" target="_blank" title="External link to http://hackage.haskell.org/package/hasktags "> Haskell tags generator download </a><br />
<a class="externalLink" href="http://scie.nti.st/2006/12/22/how-to-add-css-support-to-ctags" target="_blank" title="External link to http://scie.nti.st/2006/12/22/how-to-add-css-support-to-ctags "> How to compile in CSS support to Ctags </a></xsl:variable></func:function></template>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-28983990154332290732011-07-11T07:16:00.000-07:002015-02-06T12:42:03.018-08:00Apprenticeship Patterns: Patterns and Anti-Patterns of Problem-Solving<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<b>The Intellectual Side of Problem-Solving:</b></h3>
(Borrowing heavily from AI terminology) <br />
Imagine a 3D Cube containing the start-state, the goal-state, the problem-space and the solution-paths.<br />
You're essentially scanning a problem space for a solution i.e. a combination of sub-steps which finally lead to goal.<br />
1) Explore the problem space first i.e. try out things<br />
2) Identify what worked or is promising and extend the branches into the sub-problem spaces<br />
3) Recurse over the sub-branches until you've covered enough of the problem-space.<br />
4) If the volume of the problem-space is vast it may help to BackTrack from Goal towards the problem state.<br />
<br />
This reduces the volume of problem-space to be probed for possible solution-paths. This is known an "Alph-Beta" Pruning of the (Decision??) Tree.<br />
//TODO: Add Diagram of 3D Problem Space and Decision(??) Tree.<br />
<br />
<br />
In Nature, Lightning follows a very similar method of Back-Tracking.<br />
It seeks out the easiest path between cloud and ground through an insulating volume of air.<br />
Actually there is an initial weak backtracking path from ground to cloud, followed later by a strong return path.<br />
//TODO: Add picture of Lightning fingers<br />
<br />
<h3 style="text-align: left;">
<b>The Emotional Side of Problem-Solving:</b></h3>
Basicially we must first ask "Why" is problem-solving so important?<br />
Not all problems we face are life-threatening to require immediate attention.<br />
So then what is it that makes solving them so important in the first place.<br />
<br />
Refer:<br />
1) Psychology of Computer Programming by Gerald Weinberg<br />
2) Emotional Intelligence <br />
<br />
<h3 style="text-align: left;">
<b>Experience - coming to terms with "immediate failures" vs. "future pay-offs" </b></h3>
1) Try out many things to get a better solution or a solution which appeals to your way of doing things.<br />
2) All the things you try won't/can't succeed at least immediately.<br />
Mostly many of these "dead-end branches" are just waiting for the right time to flower. You're actually building up a fund of ideas and efforts which will help you overcome some other obstacle.<br />
Example: <br />
Unix was a result of dissatisfaction with implementing Multics which itself was a replacement for some other O.S.<br />
Ken Thompson went on to implement ideas for distributed O.S in CODA, Plan9 etc. 30-40 years later these lessons learned and 'the-roads-tried-but-not-taken' have resulted in writing a 'go' language.<br />
It's used in Google which puts those same ideas refined over time into concrete working programs.<br />
<br />
3) Watching my son getting frustrated when his cycle got stuck in a corner. <br />
He'd start screaming and banging the cycle into the wall.<br />
Beating it with red-face and small fists. <br />
The tears of frustration and incomprehension as to why the universe conspired against his cycling.<br />
<br />
4) This felt so much like my own frustration with my own efforts.<br />
The perceived low return-on-investment of the "meagre" results.<br />
So many ideas half-implemented, unimplemented and ALL the wonderful things not even attempted i.e. 'the-road-not-taken'.<br />
The universe almost conspiring to thwart each hope and attempt at magically succeeding at all things.<br />
<br />
5) Frustrations comes from other people's expectations. <br />
And more so our own awareness of not "measuring-up" to their and our own expectations.<br />
Perfectionism adds heavily to an already sticky situation.<br />
A feeling that time is running out. <br />
The impending joining of ranks with washed-out oldies. <br />
A feeling of helplessness and hopelessness that things can't/won't change no matter what. <br />
Unable to leave coding and unwilling to change to management (manipulating people not machines).<br />
Fear of becoming obsolete, of not living up-to the dreams, hopes and self-expectation built up over the years.<br />
<br />
----<br />
<br />
<h3 style="text-align: left;">
<b>Patterns: The Middle Path between the Emotional and Intellectual Sides of Problem-Solving</b></h3>
<i>"Why patterns work?!!"</i> AKA <i>"All I needed to know about Patterns I learned in Kindergarten"</i><br />
<br />
Patterns force you to Think and NOT concentrate so much on the Feeling part (which is the cause of frustration)<br />
a) Read, understand, see how the Pattern fits the Problem. <br />
b) Re-evaluate the problem itself.<br />
c) Try carrying out/coding the Pattern.<br />
d) Customizing the Pattern to the situation.<br />
e) Utilize your Feeling side by reflecting on aesthetics as pattern application is a very qualitative activity.<br />
<br />
Patterns are primarily a set of ready-made formulas (cookbook-style) for successful problem-solving.<br />
<br />
<h3 style="text-align: left;">
<b>Raise Flagging Hopes:</b></h3>
These are also sufficiently magic-endowed by hearing good things from others etc. This helps you get over the inertia of hopelessness or feeling stuck at a problem. <u><i>"Who knows this just might work - I've nothing to lose."</i></u><br />
<br />
<h3 style="text-align: left;">
<b>Abstract the problem solving process.</b></h3>
De-personalise the problem takes the bite out of it.<br />
If the trial fails it's just the Pattern failing NOT you. <br />
You're fore-warned to try out different patterns for different circumstances.<br />
So you just try some other Pattern or just do something else.<br />
Since the Pattern comes from outside, you give yourself time to understand it.<br />
This is the crucial part where you become accepting of time and effort to customize the Pattern to your particular situation.<br />
<br />
<b>Conclusion: </b><br />
Patterns are very effective Devices for Distraction from Result and Focus onto Process instead.<br />
<br />
<ol>
<li><b>Failure Modes of Hacker Schoolers :</b> <a href="https://www.hackerschool.com/blog/66-four-failure-modes-of-hacker-schoolers">https://www.hackerschool.com/blog/66-four-failure-modes-of-hacker-schoolers</a></li>
</ol>
</div>
Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-27367974214413637452011-07-01T00:41:00.000-07:002011-07-01T01:31:53.730-07:00How-to Repair an Oracle Database using Putty, SQL Developer GUI and some trial-and-error<div dir="ltr" style="text-align: left;" trbidi="on">I had a problem earlier when I made some changes to the test/dev DB and didn't know how to revert back to correct state.<br />
<br />
Issue:<br />
I couldn't delete a row in a table containing incorrect data as the row's primary key was acting as a foreign key in some other table. If I deleted this row it would violate the integrity of the other table(s).<br />
<br />
Process: <br />
So I took a backup of the entire DB (just in case I needed it and I did need it!!).<br />
Dropped the constraints, deleted all the related rows (or something like that)<br />
Recreated the constraints and the DB was restored to correct state.<br />
In the process I learned quite a bit about DB's.<br />
<br />
Tried out individual commands in the GUI.<br />
Then copied multiple commands into a script.<br />
Ran the scripts, corrected any errors till I got a working script.<br />
Liberally used transaction and rollback to help in the trial-and-error process.<br />
<br />
----<br />
I don't remember the specific details but basically <br />
I used a GUI DB browser (SQL Developer) to connect to a Remote DB by port forwarding from my Unix machine.<br />
<br />
Working with command-line client is ok if you're really good at it and know all the command syntax etc.<br />
But using a GUI browser really speeds things up as it can manage things like transactions, rollback etc all at the click of a button.<br />
<br />
Database GUI SQL Developer allows you to <br />
+ Try out individual commands (with rollback) to see if you're getting the right results.<br />
+ Copy paste small commands into a bigger sql script (with start transaction at start and commit or rollback at script end)<br />
+ Browse a remote DB in GUI mode using a DB connection (using ssh tunnel), <br />
+ backup the entire database (for safety)<br />
+ maybe try out things on a local database first, before attempting the same on the actual DB.<br />
<br />
You can export the original DB. Import into a local DB. Try out the operations to check it works.<br />
It may also help to create try out your modifications on a duplicate DB on remote machine instead of touching the problematic DB directly.<br />
<br />
1) SQL Developer Setup and Tunneling (port forwarding) instructions are available here. <br />
http://www.cs.tau.ac.il/~boim/courses/databases2009/slides/moreinfo/connection-guide.htm#_Toc150420090<br />
http://www.madirish.net/?article=152<br />
2) You may need to tweak a few things on your Unix machine to get the tunnel working though. <br />
3) Finding somebody in your/other teams who's good at Databases will be a big help. <br />
Local person who can see what the problem is and give quick suggestion is always better.<br />
4) Searching on error messages would help find howto's for fixing the problem.<br />
5) Search error messages in forums like stackoverflow.com will help to quickly find the info or relevant links.<br />
<br />
HTH.<br />
----<br />
<b>Oracle SQL Developer</b> <br />
<h2></h2><a href="http://download.oracle.com/docs/cd/E12151_01/doc.150/e12152.pdf"> PDF - Oracle SQL Developer User Guide </a><br />
<a class="externalLink" href="http://en.wikipedia.org/wiki/Oracle_SQL_Developer" target="_blank" title="External link to http://en.wikipedia.org/wiki/Oracle_SQL_Developer "> Oracle SQL Developer at wikipedia </a><br />
<a class="externalLink" href="http://st-curriculum.oracle.com/tutorial/SQLDeveloper/index.htm" target="_blank" title="External link to http://st-curriculum.oracle.com/tutorial/SQLDeveloper/index.htm "> Oracle SQL Developer Tutorial </a><br />
<a class="externalLink" href="http://hodentek.blogspot.com/2008/12/oracle-sql-developer-tool-15-with-sql.html" target="_blank" title="External link to http://hodentek.blogspot.com/2008/12/oracle-sql-developer-tool-15-with-sql.html "> Connecting Oracle SQL Developer to MS SQL Server </a><br />
<a class="externalLink" href="http://hodentek.blogspot.com/2008/02/how-to-export-query-results-from-oracle.html" target="_blank" title="External link to http://hodentek.blogspot.com/2008/02/how-to-export-query-results-from-oracle.html "> How-to Export Tables/Entire DB with Oracle SQL Developer </a><br />
<hr /><b>Oracle SQL*Plus command line interface (CLI)</b><br />
<br />
<a class="externalLink" href="http://www.orafaq.com/wiki/SQL*Plus_FAQ" target="_blank" title="External link to www.orafaq.com/wiki/SQL*Plus_FAQ ">SQL*Plus CLI FAQ</a><br />
<a href="http://www.lorentzcenter.nl/awcourse/oracle/server.920/a90842/ch13.htm">SQL*Plus CLI command reference</a><br />
<a class="externalLink" href="http://www.sql-plus.com/" target="_blank" title="External link to http://www.sql-plus.com/ "> SQL*Plus Tutorial </a><br />
</div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-74117681717059674142011-06-23T10:30:00.000-07:002011-06-23T10:30:42.603-07:00Network and SysAdmin, Scripting, Debugging, O.S. Books<div dir="ltr" style="text-align: left;" trbidi="on"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]><img src="http://img2.blogblog.com/img/video_object.png" style="background-color: #b2b2b2; " class="BLOGGER-object-element tr_noresize tr_placeholder" id="ieooui" data-original-id="ieooui" /> <style>
st1\:*{behavior:url(#ieooui) }
</style> <![endif]--><!--[if gte mso 10]> <style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style> <![endif]--> <br />
<div class="MsoNormal" style="margin: 5pt 0in;"><b><span style="font-family: Arial; font-size: 10pt;">[System Administration]</span></b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/UNIX-Linux-System-Administration-Handbook/dp/0131480057/ref=sr_1_1?s=books&ie=UTF8&qid=1308365347&sr=1-1"><b>UNIX and Linux System Administration Handbook (4th Edition)</b></a> by Evi Nemeth, Garth Snyder, <a href="http://www.blogger.com/Trent-R.-Hein/e/B001IGFJ5Q/ref=sr_ntt_srch_lnk_1?qid=1308365347&sr=1-1">Trent R. Hein</a> and Ben Whaley (Jul 24, 2010) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Administration-Handbook-Evi-Nemeth/dp/0130084662/ref=cm_lmf_tit_1_rsrssi1">Linux Administration Handbook</a> by Trent R. Hein</div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Essential-System-Administration-Third-Frisch/dp/0596003439/ref=sr_1_7?s=books&ie=UTF8&qid=1308365347&sr=1-7">Essential System Administration, Third Edition</a> by Æleen Frisch (Aug 15, 2002) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-System-Administration-White-Papers/dp/B00007FYHK/ref=sr_1_35?s=books&ie=UTF8&qid=1308365715&sr=1-35">Linux System Administration White Papers: A Compilation of Technical Documents for System Administrators</a> by <a href="http://www.blogger.com/Olaf-Kirch/e/B000APEZFG/ref=sr_ntt_srch_lnk_35?qid=1308365715&sr=1-35">Olaf Kirch</a>, Eric Raymond and Lars W. Wirzenius (Sep 20, 1999) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Nutshell-Ellen-Siever/dp/0596154488/ref=sr_1_15?s=books&ie=UTF8&qid=1308365529&sr=1-15">Linux in a Nutshell</a> by <a href="http://www.amazon.com/Ellen-Siever/e/B000APQAVS/ref=sr_ntt_srch_lnk_15?qid=1308365529&sr=1-15">Ellen Siever</a>, <a href="http://www.amazon.com/Stephen-Figgins/e/B001ITTRD8/ref=sr_ntt_srch_lnk_15?qid=1308365529&sr=1-15">Stephen Figgins</a>, <a href="http://www.amazon.com/Robert-Love/e/B001ILFKVE/ref=sr_ntt_srch_lnk_15?qid=1308365529&sr=1-15">Robert Love</a> and Arnold Robbins (Sep 29, 2009)</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">======================</span></div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Network Administration]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-Network-Administrators-Guide-Bautts/dp/0596005482/ref=sr_1_14?s=books&ie=UTF8&qid=1308365529&sr=1-14">Linux Network Administrator's Guide</a> by <a href="http://www.amazon.com/Tony-Bautts/e/B0034NIC5U/ref=sr_ntt_srch_lnk_14?qid=1308365529&sr=1-14">Tony Bautts</a>, Terry Dawson and Gregor N. Purdy (Feb 10, 2005) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/LINUX-Network-Administrators-Guide-pages/dp/1441418776/ref=sr_1_3?s=books&ie=UTF8&qid=1308366080&sr=1-3"><b>LINUX Network Administrators Guide: 508 pages</b></a> by Olaf Kirch and Terry Dawson (Jan 5, 2009) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Accidental-Administrator-Step---Step-Configuration/dp/1453689923/ref=sr_1_24?s=books&ie=UTF8&qid=1308365529&sr=1-24">The Accidental Administrator: Linux Server Step-by-Step Configuration Guide</a> by <a href="http://www.amazon.com/Don-R-Crawley/e/B003YR4XPY/ref=sr_ntt_srch_lnk_24?qid=1308365529&sr=1-24">Don R Crawley</a> (Oct 27, 2010) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-TCP-IP-Network-Administration/dp/0130322202/ref=sr_1_8?s=books&ie=UTF8&qid=1308366297&sr=1-8">Linux TCP/IP Network Administration</a> by <a href="http://www.amazon.com/Scott-Mann/e/B001H6NLCU/ref=sr_ntt_srch_lnk_8?qid=1308366297&sr=1-8">Scott Mann</a> (Jul 26, 2001)<span> </span>TCP/IP stack understand, configure and troubleshoot servers</div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-Firewalls-3rd-Steve-Suehring/dp/0672327716/ref=cm_lmf_tit_11_rsrssi1">Linux Firewalls (3rd Edition)</a></b> by Robert L. Ziegler</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Networking-Cookbook-Carla-Schroder/dp/0596102488/ref=pd_sim_b_37">Linux Networking Cookbook</a> by Carla Schroder </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Internet-Routing-Architectures-2nd-Halabi/dp/157870233X/ref=pd_sim_b_49">Internet Routing Architectures (2nd Edition)</a> by Sam Halabi </div><div class="MsoNormal" style="margin: 5pt 0in;"><b>========================</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Network and System Administration]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Practice-System-Network-Administration-Second/dp/0321492668/ref=sr_1_9?s=books&ie=UTF8&qid=1308366080&sr=1-9">The Practice of System and Network Administration, Second Edition</a> by Thomas A. Limoncelli, <a href="http://www.amazon.com/Christina-J.-Hogan/e/B001IGJN8K/ref=sr_ntt_srch_lnk_9?qid=1308366080&sr=1-9">Christina J. Hogan</a> and <a href="http://www.amazon.com/Strata-R.-Chalup/e/B001IGJN9E/ref=sr_ntt_srch_lnk_9?qid=1308366080&sr=1-9">Strata R. Chalup</a> (Jul 15, 2007) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Red-Linux-Networking-System-Administration/dp/0764599496/ref=sr_1_24?s=books&ie=UTF8&qid=1308366350&sr=1-24">Red Hat Linux Networking and System Administration</a> by <a href="http://www.blogger.com/Terry-Collings/e/B001IQXJ9E/ref=sr_ntt_srch_lnk_24?qid=1308366350&sr=1-24">Terry Collings</a> and <a href="http://www.blogger.com/Kurt-Wall/e/B001IQZK00/ref=sr_ntt_srch_lnk_24?qid=1308366350&sr=1-24">Kurt Wall</a> (Oct 21, 2005)</div><div class="MsoNormal" style="margin: 5pt 0in;">=====================</div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Troubleshooting]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Troubleshooting-Bible-Christopher-Negus/dp/076456997X/ref=sr_1_1?s=books&ie=UTF8&qid=1308366457&sr=1-1">Linux Troubleshooting Bible</a> by Christopher Negus and Thomas Weeks (Jul 30, 2004) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Debugging-Performance-Tuning-Techniques/dp/0131492470/ref=sr_1_2?s=books&ie=UTF8&qid=1308366457&sr=1-2">Linux® Debugging and Performance Tuning: Tips and Techniques</a> by <a href="http://www.blogger.com/Steve-Best/e/B001ITRPEG/ref=sr_ntt_srch_lnk_2?qid=1308366457&sr=1-2">Steve Best</a> (Oct 20, 2005) </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Debugging-Embedded-Linux-Digital-ebook/dp/B000P28W3U/ref=sr_1_3?s=books&ie=UTF8&qid=1308366457&sr=1-3">Debugging Embedded Linux (Digital Short Cut)</a> by Christopher Hallinan (Aug 22, 2007)</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Nmap-Network-Scanning-Official-Discovery/dp/0979958717/ref=pd_sim_b_43">Nmap Network Scanning: The Official Nmap Project Guide to Network and Security Scanning</a> by Gordon Fyodor Lyon</div><div class="MsoNormal" style="margin: 5pt 0in;">Linux Troubleshooting for System Administrators and Power Users 2006</div><div class="MsoNormal" style="margin: 5pt 0in;">Ma<a href="http://www.amazon.com/Malware-Analysts-Cookbook-DVD-Techniques/dp/0470613033/ref=pd_sim_b_28">lware Analyst's Cookbook and DVD: Tools and...</a> by Michael Ligh </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Hacking-Art-Exploitation-Jon-Erickson/dp/1593271441/ref=pd_sim_b_60">Hacking: The Art of Exploitation, 2nd Edition</a> by Jon Erickson</div><div class="MsoNormal" style="margin: 5pt 0in;">----</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Wireshark-Network-Analysis-Official-Certified/dp/1893939995/ref=pd_sim_b_5">Wireshark Network Analysis: The Official Wiresh</a>ark Certified Network Analyst Guide by Laura Chappell </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Art-Debugging-GDB-DDD-Eclipse/dp/1593271743/ref=pd_sim_b_16">The Art of Debugging with GDB, DDD, and Eclipse</a> by Norman Matloff</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Network-Flow-Analysis-Michael-Lucas/dp/1593272030/ref=pd_sim_b_22">Network Flow Analysis</a> by Michael W. Lucas</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Build-Your-Own-Security-Lab/dp/0470179864/ref=pd_sim_b_68">Build Your Own Security Lab: A Field Guide for Network Field Testing.</a> by Michael Gregg</div><div class="MsoNormal" style="margin: 5pt 0in;">=====================</div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Performance Tuning]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/System-Performance-Tuning-OReilly-Administration/dp/059600284X/ref=sr_1_1?s=books&ie=UTF8&qid=1308365026&sr=1-1">System Performance Tuning, 2nd Edition (O'Reilly System Administration)</a> by <a href="http://www.blogger.com/Gian-Paolo-D.-Musumeci/e/B001KDZQ6Y/ref=sr_ntt_srch_lnk_1?qid=1308365026&sr=1-1">Gian-Paolo D. Musumeci</a> and Mike Loukides (Feb 2002) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Performance-Tuning-Servers-Sandra-Johnson/dp/0137136285/ref=sr_1_1?s=books&ie=UTF8&qid=1308365050&sr=1-1">Performance Tuning for Linux® Servers</a> by <a href="http://www.blogger.com/Sandra-K.-Johnson/e/B0034QCBHC/ref=sr_ntt_srch_lnk_1?qid=1308365050&sr=1-1">Sandra K. Johnson</a>, Gerrit Huizenga and Badari Pulavarty (Jun 6, 2005) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Optimizing-Linux-Performance-Hands--Guide/dp/0131486829/ref=sr_1_3?s=books&ie=UTF8&qid=1308366457&sr=1-3">Optimizing Linux® Performance: A Hands-On Guide to Linux® Performance Tools</a> by <a href="http://www.blogger.com/Phillip-G.-Ezolt/e/B001ITW17W/ref=sr_ntt_srch_lnk_3?qid=1308366457&sr=1-3">Phillip G. Ezolt</a> (Mar 24, 2005)</div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Red-Hat-Linux-Security-Optimization/dp/0764547542/ref=sr_1_9?s=books&ie=UTF8&qid=1308365050&sr=1-9"><span style="font-weight: normal;">Red Hat Linux Security and Optimization</span></a> by <a href="http://www.blogger.com/Mohammed-J.-Kabir/e/B001IYX5ZY/ref=sr_ntt_srch_lnk_9?qid=1308365050&sr=1-9">Mohammed J. Kabir</a> (Dec 1, 2001) </b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">======================</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">[RHCE]</span></b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Certified-Technician-Engineer-Administrators-Reference/dp/1615844309/ref=sr_1_18?s=books&ie=UTF8&qid=1308365529&sr=1-18">Red Hat® Certified Technician & Engineer (RHCT and RHCE) Training Guide and Administrator's Reference</a> by <a href="http://www.amazon.com/Asghar-Ghori/e/B002BLLBIG/ref=sr_ntt_srch_lnk_18?qid=1308365529&sr=1-18">Asghar Ghori</a> (Aug 10, 2009) </div><div class="MsoNormal" style="margin: 5pt 0in;">===================</div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Scripting]</b></div><div class="MsoNormal"><a href="http://www.amazon.com/Python-Unix-Linux-System-Administration/dp/0596515820/ref=sr_1_16?s=books&ie=UTF8&qid=1308365529&sr=1-16">Python for Unix and Linux System Administration</a> by <a href="http://www.amazon.com/Noah-Gift/e/B002BLY8F4/ref=sr_ntt_srch_lnk_16?qid=1308365529&sr=1-16">Noah Gift</a> and Jeremy Jones (Aug 29, 2008) <span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Learning-bash-Shell-Programming-Nutshell/dp/0596009658/ref=cm_lmf_tit_2_rsrssi1">Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly))</a></b> by Bill Rosenblatt</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Practical-Guide-Commands-Editors-Programming/dp/0131367366/ref=sr_1_2?s=books&ie=UTF8&qid=1308365821&sr=1-2"><b>Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)</b></a> by <a href="http://www.amazon.com/Mark-G.-Sobell/e/B000APJW04/ref=sr_ntt_srch_lnk_2?qid=1308365821&sr=1-2">Mark G. Sobell</a> (Nov 29, 2009) </div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-Command-Shell-Scripting-Second/dp/1118004426/ref=sr_1_5?s=books&ie=UTF8&qid=1308365821&sr=1-5">Linux Command Line and Shell Scripting Bible, Second Edition</a> by <a href="http://www.amazon.com/Richard-Blum/e/B001IODOO6/ref=sr_ntt_srch_lnk_5?qid=1308365821&sr=1-5">Richard Blum</a> and Christine Bresnahan (Apr 12, 2011) </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Automating-Linux-System-Administration-Experts/dp/1430210591/ref=sr_1_8?s=books&ie=UTF8&qid=1308365347&sr=1-8">Automating Linux and Unix System Administration (Expert's Voice in Linux)</a> by Nathan Campi and Kirk Bauer (Dec 24, 2008) </div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-Command-Shell-Scripting-Second/dp/1118004426/ref=cm_lmf_tit_3_rsrssi1">Linux Command Line and Shell Scripting Bible, Second Edition</a></b> by Richard Blum</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Regular-Expressions-Cookbook-Jan-Goyvaerts/dp/0596520689/ref=pd_sim_b_44">Regular Expressions Cookbook</a> by Jan Goyvaerts </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Perl-Best-Practices-Damian-Conway/dp/0596001738/ref=pd_sim_b_61">Perl Best Practices</a> by Damian Conway</div><div class="MsoNormal">===================</div><div class="MsoNormal"><b>[Linux Operating System]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Modern-Operating-Systems-Andrew-Tanenbaum/dp/0136006639/ref=pd_sim_b_41">Modern Operating Systems (3rd Edition)</a> by Andrew S. Tanenbaum</div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Professional-Linux-Kernel-Architecture-Programmer/dp/0470343435/ref=pd_sim_b_34">Professional Linux Kernel Architecture (Wrox...</a> by Wolfgang Mauerer </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Understanding-Linux-Kernel-Third-Daniel/dp/0596005652/ref=pd_sim_b_4">Understanding the Linux Kernel, Third Edition</a> by Daniel P. Bovet </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Understanding-Network-Internals-Christian-Benvenuti/dp/0596002556/ref=pd_sim_b_1"><b>Understanding Linux Network Internals</b></a> by Christian Benvenuti</div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-Kernel-Development-Robert-Love/dp/0672329468/ref=pd_sim_b_2">Linux Kernel Development (3rd Edition)</a> by Robert Love</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><a href="http://www.amazon.com/Linux-System-Programming-Talking-Directly/dp/0596009585/ref=pd_sim_b_10">Linux System Programming: Talking Directly to the Kernel and C Library.</a> by Robert Love </b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Linux-Device-Drivers-Jonathan-Corbet/dp/0596005903/ref=pd_sim_b_11"><b>Linux Device Drivers, 3rd Edition</b></a> by Jonathan Corbet </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Write-Great-Code-Understanding-Machine/dp/1593270038/ref=pd_sim_b_56"><b>Write Great Code: Volume 1: Understanding the Machine</b></a> by Randall Hyde</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/IA-64-Linux-Kernel-Design-Implementation/dp/0130610143/ref=pd_sim_b_65"><b>IA-64 Linux Kernel: Design and Implementation</b></a> by David Mosberger</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/x86-Instruction-Set-Architecture-Shanley/dp/0977087859/ref=pd_sim_b_19"><b>x86 Instruction Set Architecture</b></a> by Tom Shanley </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Windows%C2%AE-Internals-Including-Windows-Developer/dp/0735625301/ref=pd_sim_b_25">Windows® Internals: Including Windows Server...</a> by Mark Russinovich </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Guide-Kernel-Exploitation-Attacking-Core/dp/1597494860/ref=pd_sim_b_83">A Guide to Kernel Exploitation: Attacking the core.</a> by Enrico Perla B.Sc. C</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/UNIX-Systems-Modern-Architectures-Multiprocessing/dp/0201633388/ref=pd_sim_b_67">UNIX® Systems for Modern Architectures: Symmetric Multiprocessing and Caching for Kernel Developers.</a> by Curt Schimmel </div><div class="MsoNormal" style="margin: 5pt 0in;">----</div><div class="MsoNormal" style="margin: 5pt 0in;"><b>[Parallel and Multi threading]</b></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Synchronization-Algorithms-Concurrent-Programming-Taubenfeld/dp/0131972596/ref=pd_sim_b_57">Synchronization Algorithms and Concurrent Programming.</a> by Gadi Taubenfeld </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Art-Concurrency-Monkeys-Parallel-Applications/dp/0596521537/ref=pd_sim_b_32">The Art of Concurrency: A Thread Monkey's Guide to Parallel Applications..</a> by Clay Breshears </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Practice-Parallel-Programming-Sergey-Babkin/dp/1451536615/ref=pd_sim_b_54">The Practice of Parallel Programming</a> by Sergey A. Babkin</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Professional-Multicore-Programming-Implementation-Developers/dp/0470289627/ref=pd_sim_b_71">Professional Multicore Programming: Design and Implementation for C++ Developers (Wrox).</a> by Cameron Hughes </div><div class="MsoNormal" style="margin: 5pt 0in;"><span style="font-family: Arial; font-size: 10pt;">======================</span></div><div class="MsoNormal" style="margin: 5pt 0in;"><b><span style="font-family: Arial; font-size: 10pt;">[Enterprise]</span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Event-Driven-Architecture-Enables-Real-Time-Enterprise/dp/0321322118/ref=pd_sim_b_92">Event-Driven Architecture: How SOA Enables the Real Time Enterprise.</a> by Hugh Taylor </div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/SOA-Practice-Distributed-System-Design/dp/0596529554/ref=pd_sim_b_90"><b>SOA in Practice: The Art of Distributed System design.</b></a> by Nicolai M. Josuttis</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Design-Patterns-Prentice-Service-Oriented-Computing/dp/0136135161/ref=pd_bxgy_b_text_c"><b>SOA Design Patterns (The Prentice Hall Service-Oriented Computing Series from Thomas Erl)</b></a> by Thomas Erl Hardcover</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/SOA-Principles-Service-Design-Thomas/dp/0132344823/ref=pd_bxgy_b_text_b">SOA Principles of Service Design</a> by Thomas Erl</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_8">Enterprise Integration Patterns: Designing, Building and Deploying Messaging Solutions.</a> by Gregor Hohpe</div><div class="MsoNormal" style="margin: 5pt 0in;"><a href="http://www.amazon.com/Restful-Web-Services-Leonard-Richardson/dp/0596529260/ref=pd_sim_b_10">Restful Web Services</a> by Leonard Richardson</div><div class="MsoNormal" style="margin: 5pt 0in;">=====================<span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><br />
</div></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-64917072628911212782011-06-18T05:33:00.000-07:002011-06-18T05:33:56.685-07:00Valgrind Cheat-Sheet Notes<div dir="ltr" style="text-align: left;" trbidi="on"><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">Running Notes on Valgrind Memcheck quick-start </span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">Original document @ http://valgrind.org/docs/manual/quick-start.html</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">=======================================================</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">1) Compile your program with following options to gcc:</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> -g //Debug mode</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> -O0 //No optimization</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">valgrind --leak-check=yes myprog arg1 arg2</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--leak-check=yes </span></b><span style="font-family: Arial; font-size: 10pt;">//default valgrind tool</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Turns on Memcheck profiling</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">2.6. Core Command-line Options</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> --tool=<toolname> [default: memcheck]</toolname></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Run the Valgrind tool called toolname, e.g. Memcheck, Cachegrind, etc.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">-q, --quiet</span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Run silently, and only print error messages. Useful if you are running regression tests or have some other automated test machinery.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">-v, --verbose</span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Be more verbose. NOTE: <i><u>Repeating the option increases the verbosity level.</u></i></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Dump extra information on various aspects of your program, such as: </span></div><div class="MsoNormal"><i><span style="font-family: Arial; font-size: 10pt;"> the shared objects loaded, </span></i></div><div class="MsoNormal"><i><span style="font-family: Arial; font-size: 10pt;"> the suppressions used, </span></i></div><div class="MsoNormal"><i><span style="font-family: Arial; font-size: 10pt;"> the progress of the instrumentation and execution engines and</span></i></div><div class="MsoNormal"><i><span style="font-family: Arial; font-size: 10pt;"> warnings about unusual behaviour. </span></i><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">-----------------------------------------------------------------------------------------------------------------------------------------</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--trace-children=<yes|no> [default: no] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> This is necessary for multi-process programs.</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> trace into sub-processes initiated via the fork/exec system calls.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--child-silent-after-fork=<yes|no> [default: no] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Use to silence confusing XML output from child when --trace-children=yes is used.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--track-fds=<yes|no> [default: no] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> print out a list of open file descriptors on exit. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Along with each file descriptor is printed a stack backtrace of where the file was opened and file/socket details like name etc.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--log-file=<filename> </filename></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> send all of its messages to the specified <b>"filename.%p.%q{PerProc-EnvVariable}" </b></span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> </span></b><span style="font-family: Arial; font-size: 10pt;">where %p=CurrentProcID and %q{UniquePerProcEnvVariable} is used to identify a process by the unique value of its <b>PerProc-EnvVariable.</b></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> something like a ProcNumber maybe.</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> used along with --trace-children=yes for multiprocess applications.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">[Error Related options:]</span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">These options are used by all tools that can report errors, e.g. Memcheck, but not Cachegrind.</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--xml=<yes|no> [default: no] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> important parts of the output (e.g. tool error messages) will be in XML format rather than plain text</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> the XML output will be sent to a different output channel than the plain text output </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> i.e. you also must use one of --xml-fd, --xml-file or --xml-socket to specify where the XML is to be sent. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Note: the destination of the plain text output is controlled by <b>--log-fd</b>, <b>--log-file and --log-socket</b></span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> --xml-file=<filename></filename></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Specifies that Valgrind should send its XML output to the specified file. It must be used in conjunction with --xml=yes.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--demangle=<yes|no> [default: yes] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Supression files contain C++ function names in their mangled form so turn off mangling for supressions.</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Turn on supressions for human readability.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--num-callers=<number> [default: 12]</number></span></b></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> </span></b><span style="font-family: Arial; font-size: 10pt;">Use this if the stack trace is not big enough, to get more call-stack depth</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> <number> specifies the maximum number of entries shown in stack traces that identify program locations.</number></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> errors are commoned up using only the top four function locations (the place in the current function, and that of its three immediate callers).</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--error-limit=<yes|no> [default: yes] </yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> When enabled, Valgrind stops reporting errors after 10,000,000 in total, or 1,000 different ones, have been seen.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--track-origins=yes</span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Helps analyse the root cause of uses of uninitialised values. Otherwise you get generic messages like "Conditional jump or move depends on uninitialised value(s)"</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--error-exitcode=<number> [default: 0]</number></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Specifies an alternative exit code to return if Valgrind reported any errors in the run <i><u>(??as in #define TestSuiteFailed 100 in cppunit testcase??)</u></i></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> ... useful for using Valgrind as part of an automated test suite, since it makes it easy to detect test cases </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> for which Valgrind has reported errors, just by inspecting return codes.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> --suppressions=<filename> [default: $PREFIX/lib/valgrind/default.supp]</filename></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Specifies an extra file from which to read descriptions of errors to suppress. You may use up to 100 extra suppression files.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> --gen-suppressions=<yes|no|all> [default: no]</yes|no|all></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> When set to yes, Valgrind will pause after every error shown and print the line:</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> ---- Print suppression ? --- [Return/N/n/Y/y/C/c] ----</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Valgrind will print out a suppression for this error. You can then cut and paste it into a suppression file if you don't want to hear about the error in the future.</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> This option is particularly useful with C++ programs, as it prints out the suppressions with mangled names, as required.</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> You may want to common up similar ones, by adding wildcards to function names, and by using frame-level wildcards. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> The wildcarding facilities are powerful yet flexible, and with a bit of careful editing, you may be able to </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> suppress a whole family of related errors with only a few suppressions. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> ... the -v option which prints out all used suppression records.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> --db-attach=<yes|no> [default: no]</yes|no></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> When enabled, Valgrind will pause after every error shown and print the line:</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ----</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--db-command=<command> [default: gdb -nw %f %p]</command></span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Specify the debugger to use with the --db-attach command. The default debugger is GDB.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--read-var-info=<yes|no> [default: no]</yes|no></span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Memcheck gives more detailed description of illegal address in its output including variable declaration line/file and thread info.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">--run-libc-freeres=<yes|no> [default: yes] </yes|no></span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Force libc.so to free its private malloc's. These are normally NOT freed but fool valgrind into logging false positives. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Note: forcing call to libc-freeres() at the program exit MAY give problems with older buggy glibc versions.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">================================================================================================================</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">[Setting Default Options]</span></b></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">Note that Valgrind also reads options from three places:</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> 1. The file ~/.valgrindrc</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> 2. The environment variable $VALGRIND_OPTS</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> 3. The file ./.valgrindrc</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">These are processed in the given order, before the command-line options. Options processed later override those processed earlier; for example, options in ./.valgrindrc will take precedence over those in ~/.valgrindrc.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">Please note that the ./.valgrindrc file is ignored if it is marked as world writeable or not owned by the current user. This is because the ./.valgrindrc can contain options that are potentially harmful or can be used by a local attacker to execute code under your user account.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">Any tool-specific options put in $VALGRIND_OPTS or the .valgrindrc files should be prefixed with the tool name and a colon. For example, if you want Memcheck to always do leak checking, you can put the following entry in ~/.valgrindrc:</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">--memcheck:leak-check=yes</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">This will be ignored if any tool other than Memcheck is run. Without the memcheck: part, this will cause problems if you select other tools that don't understand --leak-check=yes.</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">================================================================================================================</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">[Threading Support:]</span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">+</span></b><span style="font-family: Arial; font-size: 10pt;"> "your program will use the native threading library, but Valgrind serialises execution so that only one (kernel) thread is running at a time.</span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> ...</span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> threaded apps run only on one CPU, even if you have a multiprocessor or multicore machine.</span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;"> ...</span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Valgrind doesn't schedule the threads itself. It merely ensures that only one thread runs at once, </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> using a simple locking scheme. The actual thread scheduling remains under control of the OS kernel."</span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">+</span></b><span style="font-family: Arial; font-size: 10pt;"> "if you have some kind of concurrency, critical race, locking, or similar, bugs. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> In that case you might consider using the tools Helgrind and/or DRD to track them down."</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">+ </span></b><span style="font-family: Arial; font-size: 10pt;">"On Linux, Valgrind also supports direct use of the clone system call, futex and so on. clone is supported </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> where either everything is shared (a thread) or nothing is shared (fork-like); partial sharing will fail. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Again, any use of atomic instruction sequences in shared memory between processes will not work reliably."</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">+</span></b><span style="font-family: Arial; font-size: 10pt;"> "Valgrind has a fairly complete signal implementation. It should be able to cope with any POSIX-compliant use of signals."</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">Signal Handling:</span></b><span style="font-family: Arial; font-size: 10pt;"></span></div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">+</span></b><span style="font-family: Arial; font-size: 10pt;"> "If your program dies as a result of a fatal core-dumping signal, Valgrind will generate its own core file (vgcore.NNNNN) containing your program's state."</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> "the core dumps do not include all the floating point register information. In the unlikely event that Valgrind itself crashes, </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> the operating system will create a core dump in the usual way."</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><b><span style="font-family: Arial; font-size: 10pt;">Memory Footprint</span></b></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> "Memory consumption of your program is majorly increased whilst running under Valgrind. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> This is due to the large amount of administrative information maintained behind the scenes. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Another cause is that Valgrind dynamically translates the original executable. </span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;"> Translated, instrumented code is 12-18 times larger than the original so you can easily end up with 50+ MB of translations when running (eg) a web browser."</span></div><div class="MsoNormal"><span style="font-family: Arial; font-size: 10pt;">==================================================================================================================</span><br />
<u><b>Valgrind:</b></u><br />
<ul><li>memcheck, </li>
<li>cachegrind, </li>
<li>multi-threaded</li>
</ul><br />
<a href="http://www.ibm.com/developerworks/aix/library/au-unix-strace.html">Valgrind Article on Memory Debugging and Profiling Howto<br />
Valgrind Howto</a><span style="font-family: Arial; font-size: 10pt;"> </span></div></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-39352405017268566412011-06-06T03:09:00.000-07:002011-06-06T03:09:10.802-07:00Open Source Projects and PeopleWare<div dir="ltr" style="text-align: left;" trbidi="on">Karl Fogel is one of Subversion maintainers. <br />
He shares his experience with Open Source in his online free book "Producing Open Source Software"<br />
Also Check out the video's at the bottom of the page.<br />
<a class="externalLink" href="http://producingoss.com/" target="_blank" title="External link to http://producingoss.com "> Karl Fogel's online book on Producing Open Source Software </a><br />
<a class="externalLink" href="http://video.google.com/videoplay?docid=-4216011961522818645" target="_blank" title="External link to http://video.google.com/videoplay?docid=-4216011961522818645 "> Video - How Open Source Projects Survive Poisonous People (And You Can Too) </a><br />
<a class="externalLink" href="http://www.archive.org/details/kfogel-flats-2007-keynote" target="_blank" title="External link to http://www.archive.org/details/kfogel-flats-2007-keynote "> Video - Principles of Participation for Open-Information Communities by Karl Fogel at Google Talk </a><br />
<a class="externalLink" href="http://youtube.com/watch?v=ZtYJoatnHb8" target="_blank" title="External link to http://youtube.com/watch?v=ZtYJoatnHb8 "> Podcast on distributed development by Ben and Fiz </a></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-35245372513758556562011-01-29T00:01:00.000-08:002011-01-29T00:01:13.940-08:00Useful Collection of Linux Server Tutorials to Configure Different Services<div dir="ltr" style="text-align: left;" trbidi="on"><span class="z19Dle" id="col-z134c3sxpoe4u54zl04chhyo5qmpdflwlng0k"><span class="zo">1) <a href="http://www.brennan.id.au/">Linux Home Server Howto</a>: </span></span><br />
<span class="z19Dle" id="col-z134c3sxpoe4u54zl04chhyo5qmpdflwlng0k"><span class="zo">A Superb collection of howtos which explain howto configure different services like FTP, SSH, NTP etc.on linux. Gives very useful commands and sample output to show how to get information, change settings, sample config files and relevant amount of background information to make it customizable for your specific needs.<br />
2) <a href="http://www.linuxhomenetworking.com/">Linux Home Networking Quick Tutorials</a>: </span></span><br />
<span class="z19Dle" id="col-z134c3sxpoe4u54zl04chhyo5qmpdflwlng0k"><span class="zo">Similar super collection of tutorials on different aspects of networking on linux. <br />
<br />
Both these sites complement each other well and are more usable when used parallely.</span></span></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-44788215275839385412011-01-09T05:17:00.000-08:002011-01-09T05:17:41.048-08:00Valgrind website updation on Eclipse IDE integration via LinuxTools plugin suiteRequest to update Valgrind Frontend/GUIs page sent to Valgrind-Developer list.<br />
Contains useful info for anyone interested in GUI based debugging of C/C++ programs using Valgrind etc.<br />
>>>>>>>>>>>>>>>>>>>>>><br />
<br />
<div id="wmd-preview"><pre>Hi,
This is regarding an updation to the "Valgrind Frontends/GUIs" page:
<a href="http://www.valgrind.org/downloads/guis.html" rel="nofollow" target="_top">http://www.valgrind.org/downloads/guis.html</a>
LinuxTools is a GUI plugin suite to integrate Valgrind into the Eclipse C++
CDT.
Could you add an entry for this in "Valgrind Frontends/GUIs" page?
As can be seen on forums like stackoverflow.com lots of people are interested in
using Valgrind (and such other tools) from the Eclipse IDE but don't know
how to go about doing it. Having an entry on Valgrind's pages would help out
such people.
Some useful links on usage of Valgrind with LinuxTools:
<b>[Website]</b>
This is the Eclipse Linux Tools website:
<a href="http://www.eclipse.org/linuxtools/index.php" rel="nofollow" target="_top">http://www.eclipse.org/linuxtools/index.php</a>
2) Valgrind support page:
<a href="http://www.eclipse.org/linuxtools/projectPages/valgrind/" rel="nofollow" target="_top">http://www.eclipse.org/linuxtools/projectPages/valgrind/</a>
<b>[Usage]</b>
1) Valgrind User Guide (Wiki):
<a href="http://wiki.eclipse.org/Linux_Tools_Project/Valgrind/User_Guide" rel="nofollow" target="_top">http://wiki.eclipse.org/Linux_Tools_Project/Valgrind/User_Guide</a>
2) How-to configure Valgrind plugin of Eclipse (with Video Demos):
<a href="http://www.eclipse.org/linuxtools/projectPages/valgrind/" rel="nofollow" target="_top">http://www.eclipse.org/linuxtools/projectPages/valgrind/</a>
3) How-to configure Callgrind plugin of Eclipse:
<a href="http://www.eclipse.org/linuxtools/projectPages/callgraph/" rel="nofollow" target="_top">http://www.eclipse.org/linuxtools/projectPages/callgraph/</a>
4) How-to use Valgrind with Eclipse as an External Tool:
<a href="http://kapo-cpp.blogspot.com/2007/02/detecting-memory-leak.html" rel="nofollow" target="_top">http://kapo-cpp.blogspot.com/2007/02/detecting-memory-leak.html</a>
<b>[Download]</b>
Eclipse IDE for C/C++ Linux Developers
(includes Incubating components like valgrind, gprof, systemtap etc) (120 MB):
<a href="http://techtalkies.blogspot.com/2010/09/howto-install-eclipse-cdt-for-c.html" rel="nofollow" target="_top">http://techtalkies.blogspot.com/2010/09/howto-install-eclipse-cdt-for-c.html</a>
<b>
[Installation]</b>
My blog post "Howto install Eclipse CDT for C++ programming on Linux":
<a href="http://techtalkies.blogspot.com/2010/09/howto-install-eclipse-cdt-for-c.html" rel="nofollow" target="_top">http://techtalkies.blogspot.com/2010/09/howto-install-eclipse-cdt-for-c.html</a>
- Gurudutt Mallapur.</pre><pre> </pre><pre>>>>>>>>>>>>>>>>>>>>>>></pre><pre></pre><i>P.S.: </i><br />
<i>Some history on the origin of this post: A mail I sent to the Valgrind Developer list on </i>2010-10-07.<br />
<div id="wmd-preview"><span style="font-size: small;">It seems to be unanswered to date and sits quietly in the archives @http://thread.gmane.org/gmane.comp.debugging.valgrind.devel/12202. I followed all the directions for submitting to the dev-list AFAIK. Though how it ended up in the debugging section I don't recollect.<span style="font-size: small;"> Actually I tried mailing multiple times/ways but all I got was a bounce-back message even after sending the mail from yahoo (disabling html).</span> Tried everything I could think of to get the message across ;-). Finally found the obituary of my post in the archives. </span></div><div id="wmd-preview"><span style="font-size: small;">Conclusion: Anyway I'm glad I've got my own blog to capture this knowledge for anyone who needs it.</span></div></div>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-88148140717179352032011-01-02T02:16:00.000-08:002011-01-02T02:16:36.928-08:00Qualities of a Great Programmer<a href="http://alcor.concordia.ca/%7Esmw/home/resources/taxonomy.html">Types of Programmers (Beginner to Great)</a>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com1tag:blogger.com,1999:blog-6025089615285380514.post-46982244150003674752011-01-02T02:00:00.000-08:002011-01-02T02:06:10.813-08:00Linux FileSystemsSee Also:<br />
Wikipedia page on <a href="http://en.wikipedia.org/wiki/List_of_file_systems" title="List of file systems">List of file systems</a> <br />
<a href="http://www.blogger.com/goog_1251436445">Wikipedia page on </a><a href="http://en.wikipedia.org/wiki/Comparison_of_file_systems" target="_blank">comparison of file systems</a><br />
<a href="http://www.howtogeek.com/howto/35676/how-to-choose-a-partition-scheme-for-your-linux-pc/" target="_blank">How to Choose a Partition Scheme for Your Linux PC</a>(How-to-Geek)<br />
<a href="http://www.howtogeek.com/howto/38125/htg-explains-what-is-the-linux-fstab-and-how-does-it-work/">How does the Linux fstab work</a> (How-to-Geek)<br />
<a href="http://www.howtogeek.com/howto/33552/htg-explains-which-linux-file-system-should-you-choose/">Which Linux FileSystem should you choose</a> (How-to-Geek)Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-23557324867547234392010-12-28T04:44:00.000-08:002010-12-28T04:44:19.119-08:00Howto Speed Up Your Work Using Linux Command Line ToolsSee Also:<br />
<ul><li><span style="font-size: small;"><a href="http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet" title="Working Productively in Bash's Vi Command Line Editing Mode (with Cheat Sheet)">Working Productively in Bash's Vi Command Line Editing Mode</a></span> </li>
<li><a href="http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history" title="The Definitive Guide to Bash Command Line History">The Definitive Guide to Bash Command Line History</a></li>
<li><a href="http://www.catonmat.net/blog/sed-stream-editor-cheat-sheet" title="Sed - UNIX Stream Editor - Cheat Sheet">Sed - UNIX Stream Editor - Cheat Sheet</a></li>
<li><a href="http://www.catonmat.net/blog/ed-unix-text-editor-cheat-sheet" title="Ed - Unix Text Editor - Cheat Sheet">Ed - Unix Text Editor - Cheat Sheet</a></li>
<li><a href="http://www.catonmat.net/blog/plain-text-versions-of-sed-ed-and-awk-cheat-sheets" title="Plain Text Versions of Sed, ed and AWK Cheat Sheets">Plain Text Versions of Sed, ed and AWK Cheat Sheets</a></li>
<li><a href="http://www.catonmat.net/blog/unix-utilities-netcat" title="A Unix Utility You Should Know About: Netcat">A Unix Utility You Should Know About: Netcat</a></li>
<li><a href="http://www.catonmat.net/blog/screen-terminal-emulator-cheat-sheet" title="Screen VT100/ANSI Terminal Emulator Cheat Sheet">Screen VT100/ANSI Terminal Emulator Cheat Sheet</a></li>
<li><a href="http://www.catonmat.net/blog/unix-utilities-pipe-viewer" title="A Unix Utility You Should Know About: Pipe Viewer">A Unix Utility You Should Know About: Pipe Viewer</a></li>
<li><a href="http://www.catonmat.net/blog/perls-special-variable-cheat-sheet" title="Perl Special Variable Cheat Sheet">Perl Special Variable Cheat Sheet</a></li>
<li><a href="http://www.catonmat.net/blog/unix-utilities-lsof" title="A Unix Utility You Should Know About: lsof">A Unix Utility You Should Know About: lsof</a><span style="font-size: x-small;"> </span></li>
</ul><h1><span style="font-size: small;"> </span></h1>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-88592991496983836162010-12-28T04:13:00.000-08:002010-12-28T04:13:55.938-08:00Using Multiple User Profiles in FireFoxSee Also:<br />
<br />
<br />
<ul><li><a href="http://support.mozilla.com/en-US/kb/Profiles">Main Profiles Howto of Firefox</a> </li>
<li><a href="http://support.mozilla.com/en-US/kb/Managing%20profiles">Managing profiles</a> how to create/delete new/old profiles. </li>
<li><a href="http://support.mozilla.com/en-US/kb/Backing%20up%20your%20information">Backing up your information</a> how to back-up/restore profiles and move profile info to a different folder/computer. </li>
<li><a href="http://support.mozilla.com/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile">Recovering important data from an old profile</a> describes what info is stored in the files in a profile and howto copy the files into a new profile. </li>
</ul>Gurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0tag:blogger.com,1999:blog-6025089615285380514.post-77723037719294383362010-12-28T03:43:00.000-08:002010-12-28T03:50:06.273-08:00Howto Setup FireFox4 beta 8 on Linux Fedora Core 141) Backup your current Firefox 3 profiles<br />
tar -cvzf $HOME/mozilla-firefox-profiles-backup.tar.gz $HOME/.mozilla/firefox/<br />
<br />
2) Change to root user for below actions:<br />
<br />
3) Add repositories for downloading FireFox4 for FC14:<br />
yum --nogpgcheck install http://rpm.livna.org/livna-release.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm<br />
<br />
## Remi Dependency on Fedora 14 ##<br />
# These below repos didn't work out for me got error message saying system-release >=15 required for <br />
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-rawhide.noarch.rpm<br />
#rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-rawhide.noarch.rpm<br />
<br />
## Fedora 14 ##<br />
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm<br />
<br />
Install Firefox4:<br />
yum --enablerepo=remi list firefox4<br />
yum --enablerepo=remi install firefox4<br />
<br />
Create different Profile for Firefox4:<br />
firefox --ProfileManager (Create 2 profiles "Default User" and "FF4")<br />
<br />
Start Firefox with FF4 profile using command:<br />
firefox4 -P FF4<br />
<br />
Or start Firefox 3.6.x with command:<br />
firefox -P 'Default User'<br />
<br />
Reference:<br />
http://www.if-not-true-then-false.com/2010/install-firefox-4-on-fedora/<br />
http://www.fedorafaq.org/#installsoftware<br />
<br />
Note: Found what I needed was the above steps. Got most of them from these above 2 sources. Either of them singly didn't work out for me so clubbing together the total install steps into this postGurudutt Mallapurhttp://www.blogger.com/profile/15104969388557638359noreply@blogger.com0