<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5382426726630308577</id><updated>2012-02-09T14:59:05.402-08:00</updated><category term='UBIFS'/><category term='NANDSIM'/><category term='RAW FLASH'/><category term='UBI'/><title type='text'>Nothing technical about it</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>51</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-346066946523273421</id><published>2012-02-09T14:56:00.001-08:00</published><updated>2012-02-09T14:58:58.308-08:00</updated><title type='text'>Linux early boot debug</title><content type='html'>As a part of my project at NCSU (North Carolina State University), I am trying to setup the development environment for a FreeScale Board (i.MX53QSB). This includes the ability to build a custom kernel. However, when I tried to cross-compile the kernel and load it on the board, the console sadly hung at&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;Uncompressing Linux... done, booting the kernel&lt;/i&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Armed with my previous experience at the u-boot/kernel interface, I made sure that the &lt;a href="http://lxr.linux.no/linux+v3.2.5/arch/arm/tools/mach-types"&gt;architecture number&lt;/a&gt;&amp;nbsp;in uboot and kernel matched. At this stage the kernel is in its very nascent stages of booting. No drivers have been initialized, including the in-kernel UART drivers. This means no kgdb. printk and such debugging interfaces do not work at such early stages of booting. JTAG would probably work, but my exposure to JTAG is limited. Nonetheless, the kernel being as awesome as it is, there is an excellent way to debug at even such an early stage: The Kernel Low-Level debug facilities.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In brief, this particular (and many other boards too) board comes with a debug UART. UART1 is set in debug mode by uboot. Enabling CONFIG_DEBUG_LL in the kernel will link in some functions that will enable early code to setup and use this debug UART. The logs can then be viewed easily on the host machine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Following are the steps to enable low-level debug:&lt;/div&gt;&lt;div&gt;1) make ARCH=arm menuconfig&lt;/div&gt;&lt;div&gt;2) Go to "Kernel Hacking". Enable "Kernel Debugging". This will unhide lots of options, including "Kernel low-level Debugging functions". Enabling that will unhide "Early printk". Enable "Early printk" too.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After a full recompile, append "earlyprintk" to the bootargs in the uboot environment (Usually it is the ${bootargs} variable). Thats it!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, booting the kernel shows a step-by-step log of what the kernel is doing. In my case, I found out that there was an unhandled alignment trap that led to a kernel crash. The fix was to add "-mno-unaligned-access" to CFLAGS while kernel compilation. After solving a couple of issues, now I am stuck here.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;blockquote class="gmail_quote" style="border-left-color: rgb(204,204,204); border-left-style: solid; border-left-width: 1px; margin-bottom: 0px; margin-left: 0.8ex; margin-right: 0px; margin-top: 0px; padding-left: 1ex;"&gt;&lt;i&gt;Uncompressing Linux... done, booting the kernel.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Built 1 zonelists in Zone order, mobility grouping on. &amp;nbsp;Total pages: 218112&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Kernel command line: console=ttymxc0,115200 earlyprintk root=/dev/mmcblk0p1 rw rootwait&lt;/i&gt;&lt;br /&gt;&lt;i&gt;PID hash table entries: 4096 (order: 2, 16384 bytes)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Memory: 352MB 512MB = 864MB total&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Memory: 871240k/871240k available, 13496k reserved, 0K highmem&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Virtual kernel memory layout:&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; vector &amp;nbsp;: 0xffff0000 - 0xffff1000 &amp;nbsp; ( &amp;nbsp; 4 kB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; fixmap &amp;nbsp;: 0xfff00000 - 0xfffe0000 &amp;nbsp; ( 896 kB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; DMA &amp;nbsp; &amp;nbsp; : 0xf4600000 - 0xffe00000 &amp;nbsp; ( 184 MB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; vmalloc : 0xe0800000 - 0xf2000000 &amp;nbsp; ( 280 MB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; lowmem &amp;nbsp;: 0x80000000 - 0xe0000000 &amp;nbsp; (1536 MB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; pkmap &amp;nbsp; : 0x7fe00000 - 0x80000000 &amp;nbsp; ( &amp;nbsp; 2 MB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; modules : 0x7f000000 - 0x7fe00000 &amp;nbsp; ( &amp;nbsp;14 MB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .init : 0x80008000 - 0x80030000 &amp;nbsp; ( 160 kB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .text : 0x80030000 - 0x804ebc68 &amp;nbsp; (4848 kB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .data : 0x804ec000 - 0x80539ca0 &amp;nbsp; ( 312 kB)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1&lt;/i&gt;&lt;br /&gt;&lt;i&gt;NR_IRQS:848&lt;/i&gt;&lt;br /&gt;&lt;i&gt;TrustZone Interrupt Controller (TZIC) initialized&lt;/i&gt;&lt;br /&gt;&lt;i&gt;MXC GPIO hardware&lt;/i&gt;&lt;br /&gt;&lt;i&gt;imx-uart.0: ttymxc0 at MMIO 0x53fbc000 (irq = 31) is a IMX&lt;/i&gt;&lt;br /&gt;&lt;i&gt;�枞������`&amp;gt;�&amp;amp;���&amp;amp;�8�&amp;amp;���8����&amp;gt;枞����8��&amp;amp;&lt;/i&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As soon the kernel UART drivers kick in, my console starts spitting out garbage. This should be an easy fix now.&lt;/div&gt;&lt;div&gt;/me goes back to poring over the UART driver&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-346066946523273421?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/346066946523273421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=346066946523273421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/346066946523273421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/346066946523273421'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2012/02/linux-early-boot-debug.html' title='Linux early boot debug'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-8686881071765597243</id><published>2011-09-23T10:25:00.001-07:00</published><updated>2011-09-23T10:34:40.871-07:00</updated><title type='text'>Plotting a dependency graph</title><content type='html'>While working with building loads of packages, it is often necessary to visualise dependencies between them. Two years ago I suffered a lot trying to do just that and at best I came up with a python script that gives a textual list of deps. Today, I found an awesome tool to plot dependency graphs. Although useless for most of the people, it is quite a nifty trick for the few who work with thousands of packages.&lt;br /&gt;&lt;br /&gt;Two RPMs need to be installed before anything else&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;# yum install rpmorphan graphviz&lt;/blockquote&gt;&lt;br /&gt;Now, assume you need all the deps for rebuilding "rpm" (The actual RPM rpm)&lt;br /&gt;First, generate a textual dep graph using:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;# rpmdep -dot rpm.dot rpm&lt;/blockquote&gt;&lt;br /&gt;The "dot" is a file-format which will be used by the "dot" program to plot a graph. To plot the graph&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;# dot -Tsvg rpm.dot -o rpm.svg&lt;/blockquote&gt;&lt;br /&gt;The command takes rpm.dot and plots the graph in an svg format. &lt;br /&gt;&lt;br /&gt;Simple!!&lt;br /&gt;&lt;br /&gt;A sample image I generated is here:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-OcEArF9koFE/TnzDD5yT08I/AAAAAAAAFKY/asc45JMYqVY/s1600/test.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="79" src="http://4.bp.blogspot.com/-OcEArF9koFE/TnzDD5yT08I/AAAAAAAAFKY/asc45JMYqVY/s320/test.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-8686881071765597243?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/8686881071765597243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=8686881071765597243' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8686881071765597243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8686881071765597243'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2011/09/plotting-dependency-graph.html' title='Plotting a dependency graph'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-OcEArF9koFE/TnzDD5yT08I/AAAAAAAAFKY/asc45JMYqVY/s72-c/test.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-9074089831167514633</id><published>2011-08-09T20:45:00.001-07:00</published><updated>2011-08-09T20:45:18.788-07:00</updated><title type='text'>vim: How to setup awesome autocomplete</title><content type='html'>&lt;span style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote" id="goog_130481342"&gt;&lt;/span&gt;&lt;span id="goog_130481343"&gt;&lt;/span&gt;&lt;a href="/"&gt;&lt;/a&gt;Recently I moved to a company which has a huge codebase and loves long names! All vim/emacs users will sympathize with such a situation. Eclipse would autocomplete names in a jiffy. I was sorely missing good autocomplete on my favourite editor: vim.&lt;br&gt; &lt;br&gt;Typically by setting the &amp;quot;dict&amp;quot; variable appropriately, one can autocomplete english words, but what about C/C++ code? &lt;br&gt;One fine morning, I had an epiphany. Why don&amp;#39;t people use the ctags/etags database to autocomplete. The database already has lots of semantic information about the code and it would have all the project specific keywords too. Now, I am not a guy who has too many epiphanies, so I was sure someone had implemented it even before I could spell &amp;quot;vim&amp;quot;. With this in mind, I googled the specific terms &amp;quot;vim autocomplete using ctags&amp;quot;. The first &lt;a href="http://stackoverflow.com/questions/1115876/autocompletion-in-vim"&gt;stackoverflow result &lt;/a&gt;had a brilliant suggestion: omniautocomplete.&lt;br&gt; &lt;br&gt;Before I go into what omniautocomplete (a plug-in for vim) does, let me first list down my requirements from an autocomplete tool&lt;br&gt;1) Autocomplete sensibly: Use the knowledge that I am editing &amp;quot;c++&amp;quot; code and give sensible suggestions.&lt;br&gt; 2) It should *not* be enabled by default when I run vim i.e. do not blindly putt crao in my .vim. The reason is that I work on multiple projects at the same time and I don&amp;#39;t want suggestions from one project to be mixed with other.&lt;br&gt; 3) No lag in autocompleting. &lt;br&gt;4) Provide a quick way to update the autocomplete &amp;quot;database&amp;quot;.&lt;br&gt;&lt;br&gt;Some vim scripting + omnicomplete provides all that and more. What more, you might ask. Well, it provides an eclipse-like pop-up when asked to autocomplete. It can also fire when I enter a &amp;quot;.&amp;quot; or &amp;quot;-&amp;gt;&amp;quot;. It also has an option to show &amp;quot;function prototypes&amp;quot; alongwith autocomplete suggestions. This is awesome!!!&lt;br&gt; &lt;br&gt;To get you excited, here is a &lt;a href="http://www.rjsteinert.com/sites/default/files/drupal6-vim-omni-complete-plugin.png"&gt;screenshot&lt;/a&gt;. It looks exactly the same.&lt;br&gt;&lt;br&gt;Setting up omnicomplete is super-easy. Installation instructions are outlined &lt;a href="http://www.vim.org/scripts/script.php?script_id=1520"&gt;here&lt;/a&gt;. All it involves is unzipping a zip file to ~/.vim&lt;br&gt; &lt;br&gt;The next part is more interesting:&lt;br&gt;Since ctags database is used, ctags needs to be compiled with some specific options. The commandline I picked up from their documentation is this:&lt;br&gt;&lt;br&gt;$ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .&lt;br&gt; &lt;br&gt;Now, the &amp;quot;tags&amp;quot; variable in vim needs to point to the tags of your project. Setting this up each time you open vim can be irritating. Very irritating. So, I wrote the following vim function to alleviate the issue:&lt;br&gt; &lt;br&gt;&lt;blockquote&gt;function! SetProj(proj)&lt;br&gt;        if a:proj == &amp;quot;mythread&amp;quot;&lt;br&gt;                map &amp;lt;C-F12&amp;gt; :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f /home/jitesh/repos/mythread_lib/tags /home/jitesh/repos/mythread_lib&amp;lt;CR&amp;gt;&lt;br&gt;                 set tags+=/home/jitesh/repos/mythread_lib/tags&lt;br&gt;                let OmniCpp_ShowPrototypeInAbbr = 1&lt;br&gt;                let OmniCpp_MayCompleteDot = 1&lt;br&gt;        endif&lt;br&gt;endfunction&lt;br&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt; Now, when I open vim, all I have to do is:&lt;br&gt;&lt;br&gt;&lt;blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"&gt;:call SetProj(&amp;quot;mythread&amp;quot;)&lt;br&gt;&lt;/blockquote&gt; &lt;br&gt;Note - Re-generating the ctags database is also pretty easy, Just press Ctrl+F12. Notice the keymapping in the vim function above.&lt;br&gt;So, when I define a new function in my code, I just do a Ctrl+F12 and the tags are updated and ready to be auto-completed.&lt;br&gt; &lt;br&gt;Pressing ctrl+P or ctrl+N invokes the autocompletion.&lt;br&gt;&lt;br&gt;When I  start vim, none of this stuff is loaded, so there is no load-time penalty/bloat + I can work on multiple projects just by calling &amp;quot;SetProj&amp;quot; with the appropriate parameter.&lt;br&gt; &lt;br&gt;I sign-off a happy user! vim FTW&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-9074089831167514633?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/9074089831167514633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=9074089831167514633' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/9074089831167514633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/9074089831167514633'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2011/08/vim-how-to-setup-awesome-autocomplete.html' title='vim: How to setup awesome autocomplete'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-404705581419967233</id><published>2011-04-22T13:26:00.001-07:00</published><updated>2011-04-22T13:31:24.712-07:00</updated><title type='text'>Block processing and shell-scripts</title><content type='html'>Feature 1:&lt;br /&gt;Shell-scripts can easily process files/records line-by-line.&lt;br /&gt;A typical construct to do so is:&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ps aux |&lt;br /&gt;while read line do;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;echo $line&lt;br /&gt;done&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But, this kind of a thing isn't very easy to process outputs of&lt;br /&gt;commands like ifconfig. ifconfig has output in blocks instead of&lt;br /&gt;lines. Recently I had to do it and I was really surprised that I had&lt;br /&gt;no idea of how to parse blocks of data in shell-script. After some&lt;br /&gt;time, I figured it out myself. The pipe command pipes the output to a&lt;br /&gt;shell. So what if that shell contains another shell-script instead of&lt;br /&gt;a single command?&lt;br /&gt;Here's how to parse ifconfig command. The script prints out a list of&lt;br /&gt;interfaces and corresponding IP address (NIL if no IP): (Note:&lt;br /&gt;Brackets fork a new shell)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ifconfig -a |&lt;br /&gt;(&lt;br /&gt;#Read the first line&lt;br /&gt;while read line; do&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;INTERFACE_ADDR=`echo $line | awk '{print $1}'`&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Read second line in the block and store the IP address, if any&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;read line;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IP=`echo $line | grep "inet addr" | awk '{print $2}' | cut -d':' -f2`&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while true; do&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# Skip all other lines from the block&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;read line;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# End of block is a new line. Start parsing new block then&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if [ -z "$line" ]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fi&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;done&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo $INTERFACE_ADDR $IP&lt;br /&gt;done&lt;br /&gt;)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There. This is albeit a simple example. You can construct truly&lt;br /&gt;awesome block parsing constructs using the sub-shell (i.e. the&lt;br /&gt;brackets '()' )&lt;br /&gt;&lt;br /&gt;Feature 2:&lt;br /&gt;Wonder why a shell-script doesn't have a block commenting feature?&lt;br /&gt;Wonder no more.&lt;br /&gt;Here is a cool trick using here-documents to comment out a block of shell script&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;: &amp;lt;&amp;lt;'END1'&lt;/code&gt;&lt;br /&gt;&lt;code&gt;"The commented block goes here"&lt;/code&gt;&lt;br /&gt;&lt;code&gt;END1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;1) ":" means "true". /dev/null equivalent for a shell script.&lt;br /&gt;2) Make sure that the string "END1" is the same at both the places,&lt;br /&gt;else, this thing is not going to work.&lt;br /&gt;Happy scripting :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-404705581419967233?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/404705581419967233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=404705581419967233' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/404705581419967233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/404705581419967233'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2011/04/block-processing-and-shell-scripts.html' title='Block processing and shell-scripts'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5311032192264066176</id><published>2010-11-30T12:14:00.001-08:00</published><updated>2010-11-30T12:14:19.544-08:00</updated><title type='text'>Jajuk</title><content type='html'>Writing a music player for the lazy is a overwhelmingly tough job to do. The lazy people expect all kinds of automatic stuff. Play by Genre, ambience, mood, ratings. Play with untagged songs nicely instead of dumping them under one &amp;quot;Unknown&amp;quot; Label. Automatic tagging of songs whenever possible. Automatically fetch Lyrics, cover, wiki information. Ability to detect which songs the user doesn&amp;#39;t like and play them lesser and lesser. File-tree view, album-tree view, artist-tree view. Automatic purging of duplicates. Music discovery via similar artists or people-who-liked-this-also-liked-this. Internet Radio for the ones who are bored of their collection. Some ego-boosting features for music junkies like all kinds of graphs and statistics of your collection and the Genre you like the most.&lt;br&gt; &lt;br&gt;Overall, I have wayy too many expectations out of a music player. It is more like a music manager for me. Till date I hadn&amp;#39;t gotten over my first love Amarok-1.4 completely. I didn&amp;#39;t like the direction Amarok-1.9 and 2.0 took, so I dumpled Amarok long ago. iTunes and all its Linux clones are disappointing altogether too, so do NOT mention them. Finally today I came across this Java-based player called &amp;quot;Jajuk&amp;quot;. I have to say it the most I liked since Amarok-1.4. It has brilliant features, amazingly intuitive interface which somehow hides all the complexity behind the complex features it provides. There is just an endless list of features and they actually work! It is my new default music player.&lt;br&gt; &lt;br&gt;There are some catches though -&amp;gt;&lt;br&gt;1) Being Java-based it is heavy. Once I got used to it though, it is not a problem.&lt;br&gt;2) Global hotkeys are not supported. Now this is a *must* have. I have filed a feature request. Lets see whether it gets footage :-D. &lt;br&gt; &lt;br&gt;Give Jajuk a try. It is good.&lt;br&gt;Find it here: &lt;a href="http://jajuk.info/index.php/Main_Page"&gt;http://jajuk.info/index.php/Main_Page&lt;/a&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5311032192264066176?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5311032192264066176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5311032192264066176' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5311032192264066176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5311032192264066176'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/11/jajuk.html' title='Jajuk'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2784532186195275522</id><published>2010-11-22T22:23:00.001-08:00</published><updated>2010-11-22T22:23:44.629-08:00</updated><title type='text'>Traffic Shaping</title><content type='html'>So today was a rather weird day and I had a searing pain in my head. So I  decided on a special masochistic thing to learn : traffic shaping.  Since I am working on a project that needs this exclusively, I reckoned  it will be helpful too.&lt;br /&gt;&lt;br /&gt;I am sure most of you must have come across this term. In case you haven't, the wiki page &lt;a href="http://en.wikipedia.org/wiki/Traffic_shaping" target="_blank"&gt;here &lt;/a&gt;provides  a good introduction. Traffic shaping is mostly used by ISPs and people  who manage routers. It is a way to give priority to certain users or  certain types of data. The term "Giving priority" hugely underestimates  the complexity of the task. eg. Real time data streaming may value  real-time data delivery whereas others might tolerate some delay. In  general, when traffic shaping goes near QoS, it becomes a difficult  problem to solve. &lt;br /&gt;&lt;br /&gt;However, here I am going to rant about the ISP aspect of traffic  shaping (i.e. allocating bandwidth per user, per service, etc). "tc" is a  very powerful command in Linux to implement traffic shaping. I won't be  giving sample commands or such because tc is quite complex. Instead (if  anyone ever ends up using this post, which I strongly suspect is going  to be my future self) I will give out links to tutorials I used for my  setup.&lt;br /&gt;&lt;br /&gt;Some introduction to tc is in line. With tc you can create queues per device. Multiple queues. You can choose which&lt;a href="http://lartc.org/howto/lartc.qdisc.classless.html" target="_blank"&gt; queueing discipline&lt;/a&gt;  you are going to use. Queueing discipline says how the queue is  managed. You can have a standard FIFO queue or a Token-Bucket filter  (neatly manages bandwidth difference between two lines) or Stochastic  Fair Queueing (ensures fairness). Queues can be defined as hierarchy and  they can inherit each other's properties. Eg. I might define a queue  for www traffic which takes up 40% of the bandwidth and 60% of  everything else. Now, I can define another queue for ssh which is a  child of the "other" queue (it basically means that the ssh queue can  borrow bandwidth from its parent and go beyond its limit to occupy upto  60% of the bandwidth. This way you guarantee minimum service). On  routers, each queue can represent a customer or a chunk of customers.  High paying customers get more share of the bandwidth. After we are done  defining this classes of traffic, next step is to define rules for  saying which traffic belongs to which class. tc provides a wide variety  of filters for the purpose. You can look at almost any of the TCP or IP  headers, which interface the packet comes from, etc. For all purposes,  this set of filters proves to be sufficient. &lt;br /&gt;&lt;br /&gt;Now that we know how tc works, lets see what all tc can do:&lt;br /&gt;1) Provide only a defined amount of bandwidth to a particular user (write a filter based on IP address)&lt;br /&gt;2) Provide a defined amount of bandwidth to a particular service (write a filter based on port number)&lt;br /&gt;3) Enable flexibility. i.e. if there is a burst of traffic in one class  accommodate the burst instead of providing hard boundaries. (burst and  cburst parameters control that)&lt;br /&gt;4) Rates can be specified in percentage of total as well as actual absolute values like 8kbits, etc. &lt;br /&gt;&lt;br /&gt;An addition to tc can do more wonderful stuff. It is called "netem"  which stands for network emulator. netem has tunable knobs for any  parameter you can conceive which can help you simulate a WAN. Here is  what we tried today:&lt;br /&gt;1) Simulate delays. If you are simulating a WAN at home, the major issue  is that delays don't get simulated. With tc combined with netem, you  can introduce fake delays. You can even vary delays about a point. eg.  You can say probabilistically change delay at 100ms +- 10ms. You can  even change the probability distribution by which it randomises the  delay.&lt;br /&gt;2) Simulate losses. When in WAN loses are inevitable. Either due to  network congestion or corruption. netem with tc can simulate both. You  can simulate percentage losses, losses in bursts, losses following a  specific probability distribution, losses following a particular  pattern. Anything under the sun.&lt;br /&gt;3) Packet duplication, packet corruption, packet reordering.&lt;br /&gt;4) Introducing a latency is only a defined type of traffic (to test QoS)&lt;br /&gt;&lt;br /&gt;Anyone  who knows a little about networks realises how difficult each one of  this is to implement. Tuning all these knobs appropriately can give you  an awesome simulation of the internet. I am working on a project which  needs me to simulate network congestion at home. With a line-speed  router and a speed of 100mbps, it is really tough to simulate  congestion. We used tc command exclusively (with a lot of actual studies  which has derived the loss and corruption values) to successfully  simulate the internet at home. We now a get a very good TCP congestion  window graph. The things that tc can do are pretty amazing.  Unfortunately tc is a complex command and needs a lot of knowledge first  to start using it. Fret not. Here are links to some tutorials that can  get you going:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tldp.org/HOWTO/html_single/Traffic-Control-HOWTO/" target="_blank"&gt;The classic TLDP tutorial&lt;/a&gt;&lt;br /&gt;&lt;a href="http://luxik.cdi.cz/%7Edevik/qos/htb/manual/userg.htm#intro" target="_blank"&gt;HTB tutorial&lt;/a&gt; : Contains some excellent explanations and practical examples with commands. &lt;br /&gt;&lt;a href="http://www.linuxfoundation.org/collaborate/workgroups/networking/netem" target="_blank"&gt;netem Introduction&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Learning tc is a process and the end result is pretty satisfying. \m/ to the author of tc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2784532186195275522?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2784532186195275522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2784532186195275522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2784532186195275522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2784532186195275522'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/11/traffic-shaping.html' title='Traffic Shaping'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7119413055467735741</id><published>2010-10-26T18:31:00.001-07:00</published><updated>2010-10-26T18:31:47.537-07:00</updated><title type='text'>gdb-heap</title><content type='html'>The newer gdb (gdb 7 and above) is supporting memory debugging.&lt;br&gt;Quoting from &lt;a href="http://fedoraproject.org/wiki/Features/MemoryDebuggingTools"&gt;http://fedoraproject.org/wiki/Features/MemoryDebuggingTools&lt;/a&gt;&lt;p&gt;&amp;quot;The new &amp;quot;gdb-heap&amp;quot; package adds a new &amp;quot;heap&amp;quot; command to /usr/bin/gdb.&lt;p&gt;The command allows you to get a breakdown of how that process is using&lt;br&gt;dynamic memory.&lt;p&gt;It allows for unplanned memory usage debugging: if a process&lt;br&gt;unexpectedly starts using large amounts of memory you can attach to it&lt;br&gt;with gdb, and use the heap command to figure out where the memory is&lt;br&gt;going. You should also be able to use it on core dumps.&lt;p&gt;We believe this approach is entirely new, and is unique to Fedora 14. &amp;quot;&lt;p&gt;&lt;br&gt;Sounds promising!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7119413055467735741?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7119413055467735741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7119413055467735741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7119413055467735741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7119413055467735741'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/10/gdb-heap.html' title='gdb-heap'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-1039776519616541715</id><published>2010-10-02T01:31:00.000-07:00</published><updated>2010-10-02T01:31:48.598-07:00</updated><title type='text'>Writing cache efficient programs</title><content type='html'>Just recently I discovered how much effect cache misses can have on the running time of your program! Its truly amazing how much savings you can make, yet I had ignored it for more than 4 years now.&lt;br /&gt;&lt;br /&gt;Consider the matrix multiplication program again&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (i = 0; i &amp;lt; MAX_NUM; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (j = 0; j &amp;lt; MAX_NUM; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (k = 0; k &amp;lt; MAX_NUM; k++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y[i][j] += A[i][k] * B[k][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note that when you have a cache miss (depending on your cache properties), you'll fetch in 32 bytes of consecutive data from main memory. Now see the B[][] array in the program. We are accessing it column-wise. Now, once we access B[0][0], we fetch in B[0][0] tp B[0][7]. But, we only end-up using B[0][0]. Only 12.5% cache usage. REALLY bad!&lt;br /&gt;&lt;br /&gt;When MAX_NUM = 1000, this code takes ~6.778ms to run.&lt;br /&gt;&lt;br /&gt;Now, how can we optimise this for good cache usage. One method is to transpose B[][] matrix and use the transpose in the multiplication. (Transpose = Interchange rows and columns). This way, we'll access B[][] by its rows and improve cache usage. &lt;br /&gt;&lt;br /&gt;New code will look something like this (For the moment, ignore the time taken to transpose the matrix. We'll come to it later):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (i = 0; i &amp;lt; MAX_NUM; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (j = 0; j &amp;lt; MAX_NUM; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (k = 0; k &amp;lt; MAX_NUM; k++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y[i][j] += A[i][k] * B[j][k];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Notice how we access B[][] row-wise now. Our cache-efficient version takes 5.629ms for a 1000 dimension array. &lt;br /&gt;So how much did we save? We saved 16.9% of execution time!! Isn't that cool?&lt;br /&gt;17% savings is too much to ignore!!&lt;br /&gt;&lt;br /&gt;Coming back to transpose of the matrix. There are multiple solutions to this problem:&lt;br /&gt;1) Store it as the transpose right from the start. Thus, you don't have to do that operation before a multiplication. Neat solution.&lt;br /&gt;2) There are cache-efficient ways to transpose a matrix which take less than 0.15ms for a 1000-element array. You still end-up with ~12% savings! I'll try to write a post on that someday too.&lt;br /&gt;&lt;br /&gt;Ofcourse this is a very crude solution to use cache efficiently and can be optimised further to get even lower execution times. There is one called "Blocking factor" which I am still learning. I never thought so much about cache hits/misses when writing a program. For 17% savings, I certainly should!&lt;br /&gt;&lt;br /&gt;Combined with my earlier post on &lt;a href="http://nothingtechnicalaboutit.blogspot.com/2010/09/writing-parallel-programs-with-c-and.html"&gt;parallelizing a program&lt;/a&gt;, you could effectively have double the cache size (assuming dual core) and hence more the savings!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-1039776519616541715?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/1039776519616541715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=1039776519616541715' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1039776519616541715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1039776519616541715'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/10/writing-cache-efficient-programs.html' title='Writing cache efficient programs'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-4915325159891877591</id><published>2010-09-25T14:19:00.001-07:00</published><updated>2010-09-25T14:19:07.864-07:00</updated><title type='text'>Geek Saturday (Rants)</title><content type='html'>Fixed three irritating problems on my Fedora-13 laptop.&lt;br&gt;&lt;br&gt;1) When fading, mouse/keyboard input doesn&amp;#39;t stop fading and you have to go enter the password to unlock the screen.&lt;br&gt;&lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=612620"&gt;https://bugzilla.redhat.com/show_bug.cgi?id=612620&lt;/a&gt;&lt;br&gt; The latest xorg-x11-server update fixed the problem. Simple enough!&lt;br&gt;&lt;br&gt;2) Inserting headphones in the audio jack doesn&amp;#39;t mute the speakers. &lt;br&gt;&lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=623632"&gt;https://bugzilla.redhat.com/show_bug.cgi?id=623632&lt;/a&gt;&lt;br&gt; After some grepping in /var/log/messages and google, found out that my kernel couldn&amp;#39;t detect the model of my audio card. Simple fix was to add &lt;br&gt;&amp;lt;code&amp;gt;&lt;br&gt;options snd_hda_intel model=quanta&lt;br&gt;&amp;lt;/code&amp;gt;&lt;br&gt; to /etc/modprobe.conf/dist-alsa.conf to force snd_hda_intel module to use the given model.&lt;br&gt;&lt;br&gt;3) Flash videos don&amp;#39;t work in fullscreen.&lt;br&gt;&lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=608957"&gt;https://bugzilla.redhat.com/show_bug.cgi?id=608957&lt;/a&gt;&lt;br&gt; Simple fix was this:&lt;br&gt;&amp;lt;code&amp;gt;&lt;br&gt;mkdir -p /etc/adobe &lt;br&gt;echo &amp;quot;OverrideGPUValidation=1&amp;quot; &amp;gt; /etc/adobe/mms.cfg&lt;br&gt;&amp;lt;/code&amp;gt;&lt;br&gt;&lt;br&gt;There is just one irritating problem now. When I shutdown Fedora with windows open on various desktops, Fedora should remember the desktop number the window was open on. However, when I start back, all windows come back to desktop 1. hmm Couldn&amp;#39;t figure out a solution to that yet :-(. But it was low priority anyway. All the major problems are now resolved :-). Peace!&lt;br&gt; &lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-4915325159891877591?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/4915325159891877591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=4915325159891877591' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4915325159891877591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4915325159891877591'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/geek-saturday-rants.html' title='Geek Saturday (Rants)'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7376469054284638067</id><published>2010-09-24T17:52:00.001-07:00</published><updated>2010-09-24T17:52:55.494-07:00</updated><title type='text'>On paranoia</title><content type='html'>This graduation thing is making me a paranoid. First I semantically obfuscated my email addresses everywhere and now I just turned off cookies on my browser after reading this: &lt;a href="http://www.cookiecentral.com/"&gt;http://www.cookiecentral.com/&lt;/a&gt;. gmail and most sites which need some sort of a user identification ofcourse use cookies so you have to go selectively allow cookies for certain sites. But after reading how &lt;a href="http://doubleclick.net"&gt;doubleclick.net&lt;/a&gt; uses cookies, I really don&amp;#39;t mind the extra effort. &lt;br&gt; &lt;br&gt;After my MS, I will probably be such a security paranoid as to even block ssh connections to my machine as Linus does :-(. Ignorance is such a bliss!&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7376469054284638067?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7376469054284638067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7376469054284638067' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7376469054284638067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7376469054284638067'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/on-paranoia.html' title='On paranoia'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2244533102355027629</id><published>2010-09-15T17:18:00.000-07:00</published><updated>2010-09-15T17:18:30.750-07:00</updated><title type='text'>Writing parallel programs with C and gcc</title><content type='html'>I just found a cool gcc feature. gcc implements the &lt;a href="http://www.openmp.org/mp-documents/cspec20.pdf"&gt;OpenMP specification.&lt;/a&gt;  OpenMP specification details how to write shared memory parallel programs  in various languages. This got me interested and I took the best  parallelisable example : The matrix multiplication. Matrix  multiplication is an O(n^3) algorithm. The loop structure of a matrix  multiplication program look like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (i = 0; i &amp;lt; MAX_NUM; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (j = 0; j &amp;lt; MAX_NUM; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (k = 0; k &amp;lt; MAX_NUM; k++) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y[i][j] += A[i][k] * B[k][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The  i and j loops are parallel. This means that given a unique (i, j)  combination, the computations in the loop body do not depend on any previously computed values for multiplication i.e. each matrix element can be computed independently.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Lets get out hand dirty and make the i loop  parallel. I have chosen size of matrix  to be 1000X1000 so that we can see the speed-up clearly. &lt;br /&gt;&lt;br /&gt;Now, all we have to do is, add one #pragma line before the i loop. Here is what the parallel code will look like&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#pragma omp parallel for default(shared) private(i, j, k)&lt;br /&gt;for (i = 0; i &amp;lt; MAX_NUM; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (j = 0; j &amp;lt; MAX_NUM; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (k = 0; k &amp;lt; MAX_NUM; k++) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y[i][j] += A[i][k] * B[k][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Don't worry about the #pragma statement. These are actually quite  simple to figure out and are a 5 minute job to learn from here:  &lt;a href="http://www.openmp.org/mp-documents/cspec20.pdf"&gt;http://www.openmp.org/mp-documents/cspec20.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note that we haven't specified how many parallel tasks to fork. This is  specified via an environment variable OMP_NUM_THREADS. This allows great  flexibility in specifying how many threads to use without recompiling the  program.&lt;br /&gt;&lt;br /&gt;To enable OpenMP spec, use the "-fopenmp" switch with gcc:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ gcc -o parallel -fopenmp parallel.c&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here are some test-runs which clearly show the speed-up:&lt;br /&gt;&lt;b&gt;Only one thread (serial program)&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ export OMP_NUM_THREADS=1&lt;br /&gt;$ time ./parallel&lt;br /&gt;&lt;br /&gt;real&amp;nbsp;&amp;nbsp; &amp;nbsp;0m13.633s&lt;br /&gt;user&amp;nbsp;&amp;nbsp; &amp;nbsp;0m13.558s&lt;br /&gt;sys&amp;nbsp;&amp;nbsp; &amp;nbsp;0m0.028s &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Two threads&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ export OMP_NUM_THREADS=2&lt;br /&gt;$ time ./parallel&lt;br /&gt;&lt;br /&gt;real&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m8.144s&lt;br /&gt;user&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m13.963s&lt;br /&gt;sys&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m0.035s&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Four threads&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ export OMP_NUM_THREADS=4&lt;br /&gt;$ time ./parallel&lt;br /&gt;&lt;br /&gt;real&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m7.960s&lt;br /&gt;user&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m13.815s&lt;br /&gt;sys&amp;nbsp;&amp;nbsp;&amp;nbsp; 0m0.037s&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Notice the speed-up? &lt;br /&gt;With one thread, we have a execution time of 13.6s. With two threads it  becomes 8.144s which is almost half. And with four threads it is&amp;nbsp; 7.9s.  Now what happened in the case of 4 threads? Didn't we expect 1/4th time?  Well, mine is only a dual core PC, so the max speed-up for a CPU  intensive task is when number of parallel tasks = number of  cores/threads = 2. &lt;br /&gt;&lt;br /&gt;You can see the running parallel threads with &lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ ps -Haux | grep parallel&lt;br /&gt;jitesh&amp;nbsp;&amp;nbsp;&amp;nbsp; 7240 26.0&amp;nbsp; 0.0&amp;nbsp; 44536&amp;nbsp; 1164 pts/0&amp;nbsp;&amp;nbsp;&amp;nbsp; Rl+&amp;nbsp; 20:10&amp;nbsp;&amp;nbsp; 0:00 ./parallel&lt;br /&gt;jitesh&amp;nbsp;&amp;nbsp;&amp;nbsp; 7240 25.5&amp;nbsp; 0.0&amp;nbsp; 44536&amp;nbsp; 1164 pts/0&amp;nbsp;&amp;nbsp;&amp;nbsp; Rl+&amp;nbsp; 20:10&amp;nbsp;&amp;nbsp; 0:00 ./parallel&lt;br /&gt;jitesh&amp;nbsp;&amp;nbsp;&amp;nbsp; 7240 27.5&amp;nbsp; 0.0&amp;nbsp; 44536&amp;nbsp; 1164 pts/0&amp;nbsp;&amp;nbsp;&amp;nbsp; Rl+&amp;nbsp; 20:10&amp;nbsp;&amp;nbsp; 0:00 ./parallel&lt;br /&gt;jitesh&amp;nbsp;&amp;nbsp;&amp;nbsp; 7240 27.5&amp;nbsp; 0.0&amp;nbsp; 44536&amp;nbsp; 1164 pts/0&amp;nbsp;&amp;nbsp;&amp;nbsp; Rl+&amp;nbsp; 20:10&amp;nbsp;&amp;nbsp; 0:00 ./parallel&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The "-H" switch displays the threads. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cool, isn't it?&lt;br /&gt;Thus, a parallel program with minimum effort and LOTS of time savings.  We reduced the execution time of matrix multiplication to half with  proper parallelism. On a 16-core machine with native support for  threads, imagine how parallel programs will perform!&lt;br /&gt;&lt;br /&gt;gcc and OpenMP FTW!&lt;br /&gt;&lt;br /&gt;Note: If you are interested in learning OpenMP, see the spec links I have posted in the body of the blog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2244533102355027629?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2244533102355027629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2244533102355027629' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2244533102355027629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2244533102355027629'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/writing-parallel-programs-with-c-and.html' title='Writing parallel programs with C and gcc'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-9203195207304666172</id><published>2010-09-06T08:22:00.001-07:00</published><updated>2010-09-06T08:22:15.570-07:00</updated><title type='text'>A note on email address obfuscation</title><content type='html'>Email address obfuscation:&lt;br&gt;When you put your email address on the internet (eg.&lt;br&gt;&lt;a href="mailto:jitesh@example.com"&gt;jitesh@example.com&lt;/a&gt;), there is a chance that your address is mined for&lt;br&gt;spamming. Spam-bots crawl the internet day-and-night to mine email&lt;br&gt;addresses for spamming. Now, you can do something to prevent a spam&lt;br&gt;bot reading your email address. The key factor here is that an&lt;br&gt;automated BOT is going to scan the pages, so it is easy to fool it. Or&lt;br&gt;is it?&lt;p&gt;A very common form of obfuscation is to spell out the special&lt;br&gt;characters. eg. jitesh AT example DOT com. Note that this is infact a&lt;br&gt;very weak form of obfuscation. Because, you are simply changing the&lt;br&gt;syntax of writing your email address and hence, the bot-writer has to&lt;br&gt;just add one more grammar to his list of rules and he is done.&lt;br&gt;Ofcourse, bot-writers are not so stupid as to miss this simple change.&lt;p&gt;What you need is a semantic change which is impossible (or extremely&lt;br&gt;hard to be practical) for the bots to infer. But, humans can do it&lt;br&gt;easily. eg. I might obfuscate my address as : my-first-name AT example&lt;br&gt;DOT com&lt;br&gt;Note that: &amp;quot;my-first-name&amp;quot; here is a semantic change. Only a human can&lt;br&gt;infer that this is to be replaced by &amp;quot;jitesh&amp;quot;. This is REAL&lt;br&gt;obfuscation.&lt;p&gt;So guys, if you have a non-gmail account with a sucky spam filter,&lt;br&gt;make your obfuscation stronger and do NOT underestimate spammers :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-9203195207304666172?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/9203195207304666172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=9203195207304666172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/9203195207304666172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/9203195207304666172'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/note-on-email-address-obfuscation.html' title='A note on email address obfuscation'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7858825458930296053</id><published>2010-09-01T23:01:00.000-07:00</published><updated>2010-09-01T23:01:50.327-07:00</updated><title type='text'>Loving LaTeX</title><content type='html'>I've been learning LaTeX for a while now and it is *awesome* (For the uninitiated LaTeX is a language used for typesetting. You can print all sorts of mathematical and scientific symbols using LaTeX). &lt;a href="https://sites.google.com/site/jitesh1337/files/hw-2-prob-3.pdf"&gt;Here&lt;/a&gt; is the result of experiments. Pretty neat eh?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7858825458930296053?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7858825458930296053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7858825458930296053' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7858825458930296053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7858825458930296053'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/loving-latex.html' title='Loving LaTeX'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-6147314714824090722</id><published>2010-09-01T19:05:00.001-07:00</published><updated>2010-09-01T19:05:43.769-07:00</updated><title type='text'>\m/</title><content type='html'>&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)&lt;br /&gt;Newsgroups: comp.os.minix&lt;br /&gt;Subject: Free minix-like kernel sources for 386-AT&lt;br /&gt;Message-ID: &amp;lt;1991Oct5.054106.4647@klaava.Helsinki.FI&amp;gt;&lt;br /&gt;Date: 5 Oct 91 05:41:06 GMT&lt;br /&gt;Organization: University of Helsinki&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Do  you pine for the nice days of minix-1.1, when men were men  and wrote  their own device drivers? Are you without a nice project and  just dying  to cut your teeth on a OS you can try to modify for your  needs? Are  you finding it frustrating when everything works on minix? No  more  all-nighters to get a nifty program working? Then this post might  be  just for you &lt;img alt=":-)" class="wp-smiley" src="http://atulchitnis.net/wp-includes/images/smilies/icon_smile.gif" /&gt;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt; &lt;/code&gt;&lt;br /&gt;&lt;code&gt;As  I mentioned a month(?) ago, I'm working on a free version of  a  minix-lookalike for AT-386 computers. It has finally reached the  stage  where it's even usable (though may not be depending on what you  want),  and I am willing to put out the sources for wider distribution.&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;It  is just version 0.02 (+1 (very small) patch already), but I've   successfully run bash/gcc/gnu-make/gnu-sed/compress etc under it.&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-6147314714824090722?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/6147314714824090722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=6147314714824090722' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6147314714824090722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6147314714824090722'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/09/m.html' title='\m/'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5656520175707969905</id><published>2010-05-08T10:18:00.001-07:00</published><updated>2010-05-08T10:18:07.893-07:00</updated><title type='text'>Completing the Text Processing Arsenal</title><content type='html'>For months and months, I have been procrastinating to learn the last tool in my text processing arsenal: awk. After a particularly uneventful afternoon, I decided today was the day. Sleeves rolled-up, chips by the table, all sources of interference disposed off, I sat down and finally put the last piece of the jigsaw in place. Today I rant about my text processing arsenal. &lt;br&gt; &lt;br&gt;Here is a list of text processing commands/scripts available at your disposal in Linux and how you can combine them to serve your purpose.&lt;br&gt;&lt;br&gt;1) The very basics: &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?echo"&gt;echo&lt;/a&gt;, &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?cat"&gt;cat&lt;/a&gt;, &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?less"&gt;less&lt;/a&gt; (Useful to look through large logs or files that don&amp;#39;t fit into one screen), &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?more"&gt;more&lt;/a&gt; (less is really better), &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?head"&gt;head&lt;/a&gt; (Prints first few lines of a file. Can be a very good help in scripts), &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?tail"&gt;tail &lt;/a&gt;(with -f switch, can be useful in watching logs real-time as they are generated)&lt;br&gt; &lt;br&gt;2) Some more basics: &lt;a href="http://www.panix.com/%7Eelflord/unix/grep.html"&gt;grep&lt;/a&gt;. grep is oxygen. I use it all the time! I suggest you really go through that linked tutorial and thoroughly learn grep. It has some nice tools in its toolbox (like umm, the -v switch which inverts the regular expression, etc). I have also written &lt;a href="http://nothingtechnicalaboutit.blogspot.com/2008/10/grep-ing-your-way-to-glory.html"&gt;a tutorial on grep&lt;/a&gt; earlier. &lt;br&gt; &lt;br&gt;3) &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?sort"&gt;sort&lt;/a&gt;, &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?uniq"&gt;uniq&lt;/a&gt;: I find both of them terribly useful for handling lists and looping on the same action for a list. &lt;br&gt; eg.&lt;br&gt;&amp;lt;code&amp;gt;&lt;br&gt;# cat package_list | grep &amp;quot;^java-*&amp;quot; | sort | uniq | xargs -n 1 build_package.sh &lt;br&gt;&amp;lt;/code&amp;gt;&lt;br&gt;This command takes a list of packages, searches for all java packages, eliminated duplicates and schedules a build for each,&lt;br&gt; &lt;br&gt;4) All the above commands mainly encompass reading or searching through already available data. What about removing/selecting only parts of sentences or translating one character to another? (like small-case characters to upper case, etc). Not to worry. &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?cut"&gt;cut&lt;/a&gt;, &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?tr"&gt;tr&lt;/a&gt; to the rescue. Cut can remove parts of a line (by defining delimiters and selecting the part) and I use tr mostly to convert lower to upper case or squeeze whitespace. More on that &lt;a href="http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch03s03.html"&gt;here&lt;/a&gt;. &lt;br&gt; &lt;br&gt;5) Getting your hands really dirty. All of the above commands really enhance your ability to mine data from a file. grep-ping interesting lines using grep, selecting only part of them using cut, making it presentable using tr, etc etc. What about actual editing in shell-scripts? Something like find and replace? Well, *lightning and thunder* sed is here! sed (which stands for stream editor) has saved me a lot of time. The very motif of sed is search and replace. And if offers VERY advanced searching patterns. You can specify regular expressions, search only a part of a file, replace first or all occurrences and a lot more. A VERY awesome tutorial is &lt;a href="http://www.grymoire.com/Unix/Sed.html"&gt;here&lt;/a&gt;. After grep, sed is the most useful tool I know. &lt;br&gt; eg. Converting fs_get to xfs_get in the entire source was never easier than this:&lt;br&gt;&amp;lt;code&amp;gt;&lt;br&gt;# find . -name &amp;quot;*.[cChH]&amp;quot; | xargs sed -i &amp;#39;s/fs_get/xfs_get/g`&lt;br&gt;&amp;lt;/code&amp;gt;&lt;br&gt;Done!&lt;br&gt;&lt;br&gt;6) All this is fine. But what about the advanced data mining and report generation tasks? awk is here. awk can process tables and columns of data. I majorly use awk to easily select and reformat text. &lt;br&gt; eg. If you observe your /var/log/messages file, the 5th field is always the process name. Suppose I wanted to find out how many times ntpd synced to the latest time. I can run&lt;br&gt;&amp;lt;code&amp;gt;&lt;br&gt;# cat /var/log/messages | awk &amp;#39;$5 ~ /^ntpd/&amp;#39; | grep &amp;quot;kernel time sync&amp;quot; | wc -l&lt;br&gt; &amp;lt;/code&amp;gt;&lt;br&gt;Don&amp;#39;t be intimidated by the awk syntax, its simple really. Just invest 10 mins is reading this tutorial &lt;a href="http://www.vectorsite.net/tsawk.html"&gt;here&lt;/a&gt;. &lt;br&gt;&lt;br&gt;7) Lastly, the most insignificant command that I have never used in my life: &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?join"&gt;join&lt;/a&gt;. Does exactly what a database join does.&lt;br&gt; &lt;br&gt;So, this is my text processing arsenal. With echo, cat, grep, sed and awk I could also write a mini-database which will have the worst performance ever, but will work just fine nevertheless. Insert, Delete, Edit, Query, Join can all be implemented using just these commands. Among them, they cover almost all the text processing requirements. &lt;br&gt; &lt;br&gt;Finally, I would like to add some more commands that I rarely use or are in my wishlist or can be useful for my readers.&lt;br&gt;&lt;br&gt;8) &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?dos2unix"&gt;dos2unix&lt;/a&gt;, &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?unix2dos"&gt;unix2dos&lt;/a&gt;: DOS likes to write newline as &amp;quot;\r\n&amp;quot;. UNIX prefers &amp;quot;\n&amp;quot;. This can lead to really interesting issues in Makefiles, etc when files are written on Windows and executed on Linux. Above 2 utilities are used to convert from one format to another. &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?iconv"&gt;iconv&lt;/a&gt; is a generic converter from hundreds to hundreds of formats. &lt;br&gt; &lt;br&gt;9) &lt;a href="http://www.gnu.org/software/gettext/manual/gettext.html"&gt;gettext&lt;/a&gt;: This is in my wishlist, but I don&amp;#39;t see myself learning to use gettext anywhere in the near future. Gettext is used to localize a program to your own language or a foreign language.&lt;br&gt; &lt;br&gt;&lt;br&gt;Thats all for now folks. Comments/Feedback appreciated.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5656520175707969905?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5656520175707969905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5656520175707969905' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5656520175707969905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5656520175707969905'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/05/completing-text-processing-arsenal.html' title='Completing the Text Processing Arsenal'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-3722502180429038711</id><published>2010-02-19T23:48:00.001-08:00</published><updated>2010-02-19T23:48:44.286-08:00</updated><title type='text'>MP3 tagger</title><content type='html'>After trying a host of automatic tagger tools : EasyTag, Kid3, pytagger, id3v2, iTunes itself, etc etc, I&amp;#39;ve found the perfect auto-tagging tool. &lt;br&gt;&lt;br&gt;&lt;a href="http://musicbrainz.org/doc/How_To_Tag_Files_With_Picard"&gt;Picard&lt;/a&gt; by MusicBrainz. And the awesomeness is that it is GPL :-)&lt;br&gt; &lt;br&gt;There is MusicBrainz integration available with Amarok, iTunes, rhythmbox, banshee, etc.. but none of the tools has as awesome and simple interface as Picard! The other tools, namely, easytag, kid3, pytagger and id3v2 use the CDDB database blindly. CDDB doesn&amp;#39;t allow queries by track name. Only album name and artist. That is an inconvenience. Also, you cannot cluster multiple mp3 files together into one and query the database. Thus, each file has to be queried manually. More inconvenience. &lt;br&gt; Picard to the rescue! It has all those niceties + the awesome (open and free to download) MusicBrainz database to back it up and a very very intuitive and simple UI!&lt;br&gt;&lt;br&gt;Hail Picard!&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-3722502180429038711?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/3722502180429038711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=3722502180429038711' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3722502180429038711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3722502180429038711'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/02/mp3-tagger.html' title='MP3 tagger'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5272796797462057936</id><published>2010-01-19T21:43:00.000-08:00</published><updated>2010-01-20T00:18:15.130-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UBIFS'/><category scheme='http://www.blogger.com/atom/ns#' term='NANDSIM'/><category scheme='http://www.blogger.com/atom/ns#' term='RAW FLASH'/><category scheme='http://www.blogger.com/atom/ns#' term='UBI'/><title type='text'>UBI / UBIFS on NANDSIM simulator</title><content type='html'>NAND simulator (&lt;code&gt;NANDSIM&lt;/code&gt;) is an extremely useful debugging and development tool which simulates NAND flashes in RAM or a file.&lt;code&gt;NANDSIM&lt;/code&gt; can emulate various errors and report wear statistics, which is extremely useful when testing how flash software handles errors.&lt;br /&gt;&lt;br /&gt;Steps involved in the working of NANDSIM :&lt;br /&gt;&lt;br /&gt;1 ) We work as a super user.&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;aruna@narsil:~$ sudo su&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;[sudo] password for aruna:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2) Now we mount the NANDSIM module.That is,we create a virtual raw flash device.&lt;br /&gt;The parameters are as follows :&lt;br /&gt;first_id_byte : The first byte returned by NAND Flash 'read ID' command (manufacturer ID)&lt;br /&gt;&lt;br /&gt;second_id_byte : The second byte returned by NAND Flash 'read ID' command (chip ID).The entire table of chip ids is given in the file nand_ids.c in the source code given &lt;a href="http://www.gelato.unsw.edu.au/lxr/source/drivers/mtd/nand/nand_ids.c"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;third_id_byte and fourth_id_byte are optional parameters which are initialized to 0xff (empty) by the system if not specified by the user.They are the third and fourth ID returned by the READ ID command.&lt;br /&gt;&lt;br /&gt;By default NANDSIM uses RAM but if you do not have enough RAM, you can make it&lt;code&gt;&lt;/code&gt; emulate the flash on top of a file using the cache_file&lt;code&gt;&lt;/code&gt; nandsim module parameter.&lt;br /&gt;&lt;br /&gt;We create a 256MiB emulated NAND flash with 2KiB NAND page size :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;root@narsil:/home/aruna# cat /proc/mtd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;dev:    size   erasesize  name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;mtd0: 10000000 00020000 "NAND simulator partition 0"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3)MTD is not LDM-enabled and udev does not create device&lt;span style="font-family:monospace;"&gt; &lt;/span&gt;MTD device nodes automatically, so create /dev/mtd0&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# mknod /dev/mtd0 c 90 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4) Now we attach UBI to our MTD device. (This can also be done by the ubiattach utility)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# modprobe ubi mtd=0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5)We create a volume on our newly mounted UBI.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# ubimkvol /dev/ubi0 -N myvolume -s 200MiB&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here we have ,&lt;br /&gt;Volume ID 0, size 1626 LEBs (209793024 bytes, 200.1 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "myvolume", alignment 1&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;root@narsil:/home/aruna# cat /proc/mtd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;dev:    size   erasesize  name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;mtd0: 10000000 00020000 "NAND simulator partition 0"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;mtd1: 0c813000 0001f800 "myvolume"&lt;/span&gt;&lt;br /&gt;Here we note that the erasesize is the size of the physical eraseblock on mtd0 (raw flash) which is 128Kb but the size on mtd1 is the size of the logical eraseblock.For each PEB,space is required to store 2 headers - one to keep track of the erase counters and the other for the logical-physical mapping.This space is not included in the LEB.Hence the size of LEB is 126Kb.&lt;br /&gt;&lt;br /&gt;6)We mount ubifs on our UBI volume.And copy a file to it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# mkdir /mnt/ubifs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# mount -t ubifs ubi0:myvolume /mnt/ubifs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna# cp /home/aruna/5.l /mnt/ubifs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;7) Now we wish to create an image of our data so that we need not have to mount an empty device the next time we use our flash.&lt;br /&gt;&lt;br /&gt;This can be done in two steps : Firstly we use a tool called &lt;span style="color: rgb(0, 204, 204);"&gt;mkfs.ubifs&lt;/span&gt; which creates a ubifs image of our data.We can stop here and then for next use we again create an mtd device , mount ubi on it,create a ubi volume and then use this image to recover our data.&lt;br /&gt;&lt;br /&gt;The second step is to use the &lt;span style="color: rgb(0, 204, 204);"&gt;ubinize&lt;/span&gt; tool on the image created by the mkfs.ubifs tool.This creates ubi image (which includes data about ubi volumes ).In this case,on the next mount ,we create an mtd device and then use the image created&lt;br /&gt;by ubinize.After this we mount ubi and ubifs. (This is a better method as we do not have to mount the empty ubi every time.)&lt;br /&gt;&lt;br /&gt;Both,mkfs.ubifs and ubinize are mtd-utils.Hence we have to sort out the dependencies before using them.&lt;br /&gt;&lt;br /&gt;8) In Fedora install zlib-devel, lzo-devel, and e2fsprogs-devel packages and in Debian install zlib1g-dev, liblzo2-dev and uuid-dev packages.&lt;br /&gt;&lt;br /&gt;9) The git repository of mtd-utils is available at git://git.infradead.org/mtd-utils.git&lt;br /&gt;We use :&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;root@narsil:/home/aruna#git clone git://git.infradead.org/mtd-utils.git&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;10) The clone command creates a new directory named mtd-utils.We cd into this directory.Here we find another directory called ubi-utils.In this directory,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# make install&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is to be done before step 11 else lubi library is not available for mkfs.ubifs&lt;br /&gt;&lt;br /&gt;11)Now back in mtd-utils,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;root@narsil:/home/aruna/mtd-utils#make install&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;12)  Now that our utilities are properly installed , we create the ubifs image first.In the folder mkfs.ubifs :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna/mtd-utils/mkfs.ubifs# ./mkfs.ubifs -r /mnt/ubifs -m 2048 -e 129024 -c 2047 -o ubifs.img&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;where,&lt;br /&gt;/mnt/ubifs is data whose image is to be created&lt;code&gt;&lt;br /&gt;&lt;/code&gt;-m 2048 indicates that the minimum  input/output unit size of the flash this UBIFS image is created for is  2048 bytes (NAND page in this case)&lt;br /&gt;-e 129024 is the logical eraseblock size of the UBI volume  this image is created for&lt;br /&gt;-c 2047 specifies maximum file-system size in logical  eraseblocks; this means that it will be possible to use the resulting  file-system on volumes up to this size (less or equivalent) so in this  particular case, the resulting FS may be put on volumes up to about  251MiB (129024 multiplied by 2047)&lt;br /&gt;&lt;br /&gt;13) Copy the created file ubifs.img to the ubi-utils folder.Then create another file called ubinize.cfg&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# cat ubinize.cfg&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;[ubifs]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;mode=ubi&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;image=ubifs.img&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;vol_id=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;vol_size=200MiB&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;vol_type=dynamic&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;vol_name=myvolume&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;vol_flags=autoresize&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we create the ubi image :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;where&lt;br /&gt;-p 128KiB is the&lt;code&gt;&lt;/code&gt; physical  eraseblock size of the flash chip the UBI image is created for is  128KiB (128 * 1024 bytes)&lt;br /&gt;-s 512 indicates that the flash  supports sub-pages and sub-page size is 512 bytes&lt;br /&gt;&lt;br /&gt;Now we have the ubi.img image saved on persistent storage.&lt;br /&gt;&lt;br /&gt;14) We can unmount the file system and our virtual device.&lt;br /&gt;&lt;br /&gt;15) The next time we need to use the device ,we follow only these steps :&lt;br /&gt;&lt;br /&gt;a)Create the device&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;aruna@narsil:~$ sudo su&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;[sudo] password for aruna: &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;root@narsil:/home/aruna# modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;root@narsil:/home/aruna# mknod /dev/mtd0 c 90 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;b) Load image to it :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# dd if=ubi.img of=/dev/mtd0 bs=20481024+0 records in&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;1024+0 records out&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;2097152 bytes (2.1 MB) copied, 0.0220489 s, 95.1 MB/s&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;c)Mount UBI to it :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# modprobe ubi mtd=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# cat /proc/mtd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;dev:    size   erasesize  name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;mtd0: 10000000 00020000 "NAND simulator partition 0"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;mtd1: 0f90c000 0001f800 "myvolume"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;d)Mount UBIFS to our volume :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# mount -t ubifs ubi0:myvolume /mnt/ubifs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can check the file we pasted here before creating the image by:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;root@narsil:/home/aruna/mtd-utils/ubi-utils# ls /mnt/ubifs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;5.l&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Happy reading ! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5272796797462057936?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5272796797462057936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5272796797462057936' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5272796797462057936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5272796797462057936'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/01/ubi-ubifs-on-nandsim-simulator.html' title='UBI / UBIFS on NANDSIM simulator'/><author><name>Aruna</name><uri>http://www.blogger.com/profile/00895955219678371133</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_bll0xno1h1k/TTlNXyNI3ZI/AAAAAAAACSE/rGFp0eHfyII/s220/179450_497914624441_789279441_6101151_1423417_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-972166884200685856</id><published>2010-01-19T05:28:00.001-08:00</published><updated>2010-01-19T06:45:50.605-08:00</updated><title type='text'>git-perforce interface</title><content type='html'>The best thing I found out and learned today was the git interface for perforce repositories. There are many things about perforce that made me cringe. &lt;br /&gt;1) No support for local commits. Limited support is provided by distinct changelists, but it only works if a non-intersecting set of files are being modified in both commits. It is rarely the case. This usually means you cannot commit small logical chunks of code and sometimes have to submit hugeeeee code-changes (which is not recommended)&lt;br /&gt;2) No rollbacks or editing commits.&lt;br /&gt;3) Limited branching support (Like I don't have permission to branch on the repository. But, with git I can have infinite local branches)&lt;br /&gt;4) Send out patches that others can apply. (Perforce patches cannot be applied)&lt;br /&gt;5) Manually check-out each file I am going to edit. This is a major pain.&lt;br /&gt;&lt;br /&gt;So, I set out looking for some kind of git-perforce inter-conversion software and found that git itself provides the required scripts. My internet is screwed, so I cannot provide a full link as of now. but, you'd find the git's git repository at &lt;a href="http://git-scm.com/"&gt;git-scm.com&lt;/a&gt;. Goto contrib/fast-import. Under that where you'll find both the documentation and the script. Unfortunately, fedora decided not to package it.&lt;br /&gt;&lt;br /&gt;With that in place, I was able to use my perforce repository as a git repository. Commit local changes. Edit commits. Send out patches for each commit separately and all the cool stuff git has to offer. (Note that perforce repository can be seen as remote branch p4/master) git-p4 assigns a changelist id to each commit, thus mapping perforce commits to git commits. At last, just call "git-p4 rebase" (to accept latest changes) and then "git-p4 submit" to submit all changes to the perforce repository. &lt;br /&gt;&lt;br /&gt;Another hassle I got rid of was to manually check-out every file I want to edit in perforce. With git, its not necessary.&lt;br /&gt;&lt;br /&gt;I sign-off as a happy user!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt; &lt;br /&gt;Here is the link I was talking about. &lt;br /&gt;http://repo.or.cz/w/git.git/tree/ff6d26a0e1d8fad775010fa3b689c0c027da8bb0:/contrib/fast-import&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-972166884200685856?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/972166884200685856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=972166884200685856' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/972166884200685856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/972166884200685856'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2010/01/git-perforce-interface.html' title='git-perforce interface'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2524370981822141045</id><published>2009-12-05T23:11:00.000-08:00</published><updated>2009-12-05T23:19:40.730-08:00</updated><title type='text'>The FOSS.in experience</title><content type='html'>As some of you know (possibly because I have been raving about it so much) this year's FOSS.in was held at Bangalore from 1st to 5th of December. I attended the conference on 2nd and 3rd of December. My plan was to attend all the 5 days, but some inevitabilities at work made it impossible.&lt;br /&gt;&lt;br /&gt;The trip started on a very good note as I boarded the Kingfisher flight from Lohagaon on 2nd of December. For the entire duration of the flight, I was kept entertained by the very nice show on the smallish personal TV : Kingfisher calendar girls. The flight was half an hour late which messed up my already tight schedule. I took a shuttle to Jayanagar from the airport (which takes approximately one and a half hour), went to the hotel room and was out within 90 seconds and reached Nimhans Convention Centre just in time to catch Rahul Sundaram's talk on the Fedora buildsystem. Before lunch, I also managed to catch some bits of the talk by &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=28"&gt;James Morris on seLinux sandboxing&lt;/a&gt;. Kedar had a fun time mocking my formal attire. (In my defence, I didn't know people come casually to the conference. I thought everyone will be in tip-top formals)&lt;br /&gt;&lt;br /&gt;After a surprisingly great lunch, I went to attend Kedar's talk on Fedora-ARM (the reason I was at the conference). The attendees included many Fedora guys, some interested students and some others that I cannot place. Kedar talked on the status of Fedora-ARM, how to contribute, ARM or secondary arch specific issues and other stuff. Read &lt;a href="http://kerneltrap.org/node/48423"&gt;here&lt;/a&gt; for more info. Rahul inaugurated the dist-f13 tag with his gnote build. After that was Rahul's talk on how to create a customized Fedora remix. I was looking forward to this particular talk since the idea of making a remix for sheevaplug has been playing into my mind since a while now. It was insightful. I moved on to attend &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=26"&gt;Holger Frether's "How to make WebKit faster"&lt;/a&gt;. It wasn't what I was expecting, but Holger gave a nice demonstration of how to use a number of well-known and less-known tools to measure performance. His focus was on beagle-board. The best talk of the day was the &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=88"&gt;Keynote by Harald Welte&lt;/a&gt;. He talked about bringing open-source to less explored platforms like GSM, RFID, etc. Very Very inspiring! &lt;br /&gt;&lt;br /&gt;As the day wrapped up, we decided to head to the Forum Mall for some sight-seeing (ahem). After some window-shopping, trying out fresh baked cookies (which turned out to be horrible) and exploring the Landmark bookstore, we went to have a brilliant lunch at the Anand Adiyaar Bhavan. Later we stopped by at the Corner House for desserts. I dared to order&amp;nbsp; "Death by Chocolate" not thinking once why it was named so and ignoring Kedar's warnings. The result was &lt;a href="http://3.bp.blogspot.com/_OArE_A9ogPU/SxqRdwhPIRI/AAAAAAAABVY/PKbrihq_tlo/s320/img059.jpg"&gt;disastrous&lt;/a&gt;. I never thought chocolate would ever nauseate me so much! A tip for the readers: if you ever order that at Corner House, share one between 5 people.&lt;br /&gt;&lt;br /&gt;Attended &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=47"&gt;Lennart Pottering's "Pulseaudio Internals"&lt;/a&gt; on the second day. He focused on the do's and dont's on System programming. Very insightful! He is a very good speaker. I wanted to talk to him (like REALLY wanted to talk to him), but a couple of guys just wouldn't let him go! They crushed my dream :-(.&amp;nbsp; After another fabulous lunch, attended &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=63"&gt;Rahul's talk on PackageKit&lt;/a&gt; and &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=25"&gt;Harald Welte's workout on GSM&lt;/a&gt;. Went to the Nokia Maemo's booth and got a peek into how they are using Linux on their ARM core. Maemo is one neat piece of hardware. I would certainly recommend it to anyone looking for an open-source phone.&lt;br /&gt;&lt;br /&gt;I really wanted to attend the &lt;a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=51"&gt;Keynote by Milosch Mariac&lt;/a&gt;, since rumour had it that they are using Fedora-ARM in their product. Kedar later confirmed that the rumour was indeed true. But, sadly I had to fly back to Pune :-(. &lt;br /&gt;&lt;br /&gt;Some of the things that really impressed me were:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Lots and lots of students attending the conference. They get a nice exposure through all the workouts and talks.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Wireless connectivity on the entire campus. Really made me realise how important my laptop is! I looked up so many terms that I heard/overheard. Very educational.&lt;/li&gt;&lt;li&gt;There was nothing formal about it and people were so passionate about technology. &lt;/li&gt;&lt;li&gt;Very Very educational.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;It was my very first conference, so I wasn't as proactive as I should have been, but I was better at it on the 2nd day than the first. I look forward to FOSS.in 2010 :-). &lt;br /&gt;&lt;br /&gt;PS: Kedar called me later just to tell me that he talked to Lennart and Milosch. grrrr. Jealous!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2524370981822141045?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2524370981822141045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2524370981822141045' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2524370981822141045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2524370981822141045'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/12/fossin-experience.html' title='The FOSS.in experience'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-6808700191532877502</id><published>2009-11-01T23:28:00.001-08:00</published><updated>2009-11-01T23:28:12.010-08:00</updated><title type='text'>I want to shout this out a thousand times!</title><content type='html'>A recent discussion on a fedora mailing list:&lt;br&gt;&lt;br&gt;&lt;i&gt;&amp;gt; I&amp;#39;d suggest that anyone who sets up a system without any user accounts&lt;br&gt;&amp;gt; _and_ somehow needs a GUI to configure the system _and_ can&amp;#39;t manage&lt;br&gt;&amp;gt; to figure out the settings to change so they can login as root should&lt;br&gt; &amp;gt; probably not be pretending to be a competent administrator.&lt;br&gt;&amp;gt;&lt;br&gt;&amp;gt; Are there not enough examples from Windows of why it&amp;#39;s a terrible idea&lt;br&gt;&amp;gt; to run with full administrator privileges -- especially software like&lt;br&gt; &amp;gt; web browsers?&lt;br&gt;&amp;gt;&lt;br&gt;&amp;gt;    &lt;br&gt;Look guys, I didn&amp;#39;t ask for a Lecture on how to do things your way, I &lt;br&gt;just ask where is Konqueror in Root.&lt;br&gt;&lt;/i&gt;&lt;br&gt;How very true! Many a times, I know what risk I run by using GUI as root user, but I still want to. I have my calculations of risk. They have no right to disable running stuff as root. Make it hard. Okay. Spew out warnings. I don&amp;#39;t care. But, just let the thing work! Disabling it is just imposing your viewpoints on everyone and it is NOT alright!&lt;br&gt; &lt;br&gt;Lots of Love,&lt;br&gt;Me&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-6808700191532877502?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/6808700191532877502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=6808700191532877502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6808700191532877502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6808700191532877502'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/11/i-want-to-shout-this-out-thousand-times.html' title='I want to shout this out a thousand times!'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-4371229126249328286</id><published>2009-10-29T06:16:00.001-07:00</published><updated>2009-10-29T06:16:29.561-07:00</updated><title type='text'>Atomic operations from userspace</title><content type='html'>Lennart Pottering, the pulseaudio developer, has made some interesting observations on emulating atomic operations, using ARMv5 as a running example. Obviously, the post is about architectures who do NOT have hardware support and lack or have minimal kernel support. (However, some Andrew Hayley has noted an obscure kernel API for the purpose). A good read overall. &lt;br&gt; &lt;br&gt;I don&amp;#39;t fully understand the post yet, but I intend to dig deep into this once I get free time. &lt;br&gt;&lt;br&gt;&lt;a href="http://0pointer.de/blog/projects/atomic-rt#1194273540.23"&gt;FYI&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-4371229126249328286?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/4371229126249328286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=4371229126249328286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4371229126249328286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4371229126249328286'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/atomic-operations-from-userspace.html' title='Atomic operations from userspace'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-8509912390784812788</id><published>2009-10-27T02:37:00.001-07:00</published><updated>2009-10-27T02:39:30.183-07:00</updated><title type='text'>yum spookiness</title><content type='html'>Recently, I started getting tracebacks on a simple &amp;quot;yum update&amp;quot;&lt;br /&gt;&lt;br /&gt;# yum update -y&lt;br /&gt;Loaded plugins: fastestmirror, presto, refresh-packagekit&lt;br /&gt;Setting up Update Process&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;  File &amp;quot;/usr/bin/yum&amp;quot;, line 29, in &amp;lt;module&amp;gt;&lt;br /&gt;    yummain.user_main(sys.argv[1:], exit_code=True)&lt;br /&gt;  File &amp;quot;/usr/share/yum-cli/yummain.py&amp;quot;, line 309, in user_main&lt;br /&gt;    errcode = main(args)&lt;br /&gt;  File &amp;quot;/usr/share/yum-cli/yummain.py&amp;quot;, line 178, in main&lt;br /&gt;    result, resultmsgs = base.doCommands()&lt;br /&gt;  File &amp;quot;/usr/share/yum-cli/cli.py&amp;quot;, line 352, in doCommands&lt;br /&gt;    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)&lt;br /&gt;  File &amp;quot;/usr/share/yum-cli/yumcommands.py&amp;quot;, line 368, in doCommand&lt;br /&gt;    return base.erasePkgs(extcmds)&lt;br /&gt;  File &amp;quot;/usr/share/yum-cli/cli.py&amp;quot;, line 641, in erasePkgs&lt;br /&gt;    if not self.remove(pattern=arg):&lt;br /&gt;  File &amp;quot;/usr/lib/python2.6/site-packages/yum/__init__.py&amp;quot;, line 3023, in remove&lt;br /&gt;    (e,m,u) = self.rpmdb.matchPackageNames([kwargs[&amp;#39;pattern&amp;#39;]])&lt;br /&gt;  File &amp;quot;/usr/lib/python2.6/site-packages/yum/packageSack.py&amp;quot;, line 224, in matchPackageNames&lt;br /&gt;    exactmatch.append(self.searchPkgTuple(pkgtup)[0])&lt;br /&gt;IndexError: list index out of range&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Initially I thought it was due to corrupted yum metadata. So, I ran a &amp;quot;yum clean all&amp;quot; to no avail. But then, rpm also started acting spooky. &amp;quot;rpm -q kdelibs&amp;quot; returned nothing although I was pretty sure I had installed kdelibs (since amarok depends on it). Looked like a bombed rpm database. &lt;br /&gt;So, the simple solution was to run &amp;quot;rpm --rebuilddb&amp;quot; which reconstructs the rpm database. Everything worked like a charm after this!&lt;br /&gt;&lt;br /&gt;PS: This is more a note to myself than a post. If it helps anyone, well and good. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-8509912390784812788?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/8509912390784812788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=8509912390784812788' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8509912390784812788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8509912390784812788'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/yum-spookiness.html' title='yum spookiness'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5065615740634165838</id><published>2009-10-21T06:42:00.001-07:00</published><updated>2009-10-21T06:42:32.354-07:00</updated><title type='text'>Using the IRC</title><content type='html'>(Following are some ways I know to ensure privacy and avoid someone spoofing your identity.)&lt;br&gt;&lt;br&gt;First, I&amp;#39;ll recommend registering yourself with a nickname so that no one can steal your identity. &lt;br&gt;Use &lt;a href="http://freenode.net/faq.shtml#registering"&gt;this&lt;/a&gt; nice tutorial to register your nick on freenode. Other services will have their how-tos.&lt;br&gt; &lt;br&gt;Second you might want to disable FINGER, TIME and VERSION requests. &lt;br&gt;FINGER enables getting personal information like Email. TIME gives out your location information and VERSION gives out the OS and client names and versions you are using. Knowing the versions, an attacker might try a specific exploit. &lt;br&gt; &lt;a href="http://t0x.in/xchatctcp.html"&gt;Here&lt;/a&gt; is a nice tutorial to do it in xchat. Look at the client specific documentation if you use a different client. &lt;br&gt;&lt;br&gt;Also, you might want to hide yourself from the global who/whois list (The way to do it on freenode is:)&lt;br&gt; /umode +i &lt;br&gt;(+i = invisible mode)&lt;br&gt;&lt;br&gt;Leave a comment if you know a good addition to this list.&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5065615740634165838?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5065615740634165838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5065615740634165838' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5065615740634165838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5065615740634165838'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/using-irc.html' title='Using the IRC'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-8545378238910812566</id><published>2009-10-13T23:34:00.001-07:00</published><updated>2009-10-13T23:36:17.116-07:00</updated><title type='text'>Automake supports cscope and ctags!</title><content type='html'>Finally! &lt;br /&gt;Automake includes support for automatic generation of cscope and ctags targets. Now, theoretically, you can take any open-source project which uses &lt;a href="http://en.wikipedia.org/wiki/GNU_build_system"&gt;GNU build system&lt;/a&gt; (and manyyy of them do) and type &amp;quot;make cscopelist&amp;quot; or &amp;quot;make ctags&amp;quot; or &amp;quot;make tags&amp;quot; and it will automatically generate the tags! Not that generating tags was a very difficult process earlier, but with support in automake, we can tinker around with the tags a lot.&lt;br /&gt;&lt;br /&gt;Eg. If there is an arch/ subdirectory in your source-code and you don&amp;#39;t want your cscope tags to be polluted by the IA64 code that you don&amp;#39;t really care about, you can do it very easily by modifying the Makefile.am file in the arch directory. &lt;br /&gt;&lt;br /&gt;I.e. you can easily control how your tags are generated!&lt;br /&gt;&lt;br /&gt;This is the commit that went in,&lt;br /&gt;&lt;a href="http://git.savannah.gnu.org/cgit/automake.git/commit/?id=ffad481680a4e6a8f220c70f07b105c9f3f2dfdf"&gt;http://git.savannah.gnu.org/cgit/automake.git/commit/?id=ffad481680a4e6a8f220c70f07b105c9f3f2dfdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hail automake!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-8545378238910812566?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/8545378238910812566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=8545378238910812566' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8545378238910812566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8545378238910812566'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/automake-supports-cscope-and-ctags.html' title='Automake supports cscope and ctags!'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-8818728206432646338</id><published>2009-10-06T13:33:00.000-07:00</published><updated>2009-10-06T13:33:56.708-07:00</updated><title type='text'>Masochism ...</title><content type='html'>Objective : Whenever volumes are mounted, I see volume icons on my Desktop. I want to hide the icons because they mess with my wallpaper. &lt;br /&gt;&lt;br /&gt;Method 1 : Find a GUI option. &lt;br /&gt;Result : None present&lt;br /&gt;&lt;br /&gt;So, after half an hour of grep-ing in ~ and lsof-ing, I found out that the option I need to set is probably hidden deep down into one of the huge gconf schemas. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;So, I started to learn the gconftool-2 tool. Its one nasty command. &lt;br /&gt;&lt;code&gt;&lt;br /&gt;# gconftool-2 --dump / &amp;gt; /tmp/gconf-dump&lt;br /&gt;# wc -l /tmp/gconf-dump &lt;br /&gt;96086 /tmp/gconf-dump&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Crap! that huge!&lt;br /&gt;So, I grep-ed for various keywords for another 15 min. Thats when I got a match.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# grep volumes /tmp/gconf-dump &lt;br /&gt;&amp;lt;key&amp;gt;/schemas/apps/nautilus/desktop/volumes_visible&amp;lt;/key&amp;gt;&lt;br /&gt;(hiding other results for the purpose of sanity)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So, thats the key I have to flip. Pored over the man-page of gconftool-2 and here is the magic command:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# gconftool-2 --type bool --set /schemas/apps/nautilus/desktop/volumes_visible false&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Similarly, you can also turn-off, trash_icon_visible, network_icon_visible (hides samba mounts), home_icon_visible and computer_icon_visible. and voila! A clean desktop!&lt;br /&gt;&lt;br /&gt;You'll have to logout and login back again to see the changes. Although, I am sure there's better way. (Like to ask gconfd to reload the config). But, its 2:00am already and I need some sleep. So, I'll update this post tomorrow!&lt;br /&gt;&lt;br /&gt;Whew!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-8818728206432646338?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/8818728206432646338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=8818728206432646338' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8818728206432646338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8818728206432646338'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/masochism.html' title='Masochism ...'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5445265974752290121</id><published>2009-10-02T00:46:00.001-07:00</published><updated>2009-10-02T00:46:43.159-07:00</updated><title type='text'>RPM Hell</title><content type='html'>End-users these days are rarely exposed to &amp;quot;rpm&amp;quot;. They&amp;#39;ll probably be using yum or PackgeKit (or a GUI-based software installer). RPM, FYI, is the backend package management tool used by Fedora, SuSe, Mandriva, etc (together known as the RPM-based distributions). And it sucks bigtime!&lt;br&gt; &lt;br&gt;Although RPM has come a long way from what it was in the 1990s and early 2000s, it stands on poor foundations and is unlikely to get any better soon. Having worked on Fedora-ARM for over half a year now, I can see the glaring issues that it faces. Fedora has done a hell of a nice job of mitigating those, but when you start to dig deeper, you realise how filthy the RPM world is. &lt;br&gt; &lt;br&gt;Here is a link to a VERY old pre-yum days paper, &amp;quot;&lt;a href="http://74.125.155.132/search?q=cache:5fbVPy3E3z4J:www.germane-software.com/%7Eser/Files/Essays/RPM_Hell.html+rpm+hell&amp;amp;cd=1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=in"&gt;RPM Hell&lt;/a&gt;&amp;quot;. Its a google cache link since the site which hosted the original paper was down. &lt;a href="http://www.germane-software.com/%7Eser/Files/Essays/RPM_Hell.html"&gt;Here&lt;/a&gt; is the original paper.&lt;br&gt; Now the interesting thing is that, most of the issues mentioned in this paper STILL EXIST and are very real! &lt;br&gt;&lt;br&gt;Following issues stand out:&lt;br&gt;&lt;br&gt;1) Package management is pathetic. If I want to install a terminal-based editor, in all probability, I might end-up installing a whole load of GTK and X crap that I am never going to use. The main reason for this is because RPM packages are monolithic. Large packages like emacs typically install all GUI files needed to support it in X even when it is a headless server. So, we have a (needless) dependency, emacs -&amp;gt; gtk. Now, gtk pulls in LOTS of its own dependencies which are really not required and I end up with a bloated installation. Now, this problem can be solved by splitting emacs into 2 packages. emacs-common and emacs-gtk and I just need to install emacs-common. But, we&amp;#39;ll soon realise that there are many capabilities a software can provide and we can&amp;#39;t keep making a separate package for each. We&amp;#39;ll end up with an unwieldy distribution. So, RPM should have a way of internally defining capabilities and installing only those which are really required. &lt;br&gt; &lt;br&gt;While we were working on the fedora-ARM project and making a basic rootfs for F-11, we had to build almost half of the GNOME packages to satisfy dependencies. WTH!! Gnome shouldn&amp;#39;t even come in the picture yet! But thats what happens when you are working with monolithic packages!&lt;br&gt; &lt;br&gt;&lt;br&gt;2) There&amp;#39;s no way to install multiple versions of a software. Now this is not really a RPM problem, it is an inherent Linux issue. Rules like, all executables go to /usr/bin make it difficult to install multiple versions, since there&amp;#39;ll be file conflicts. &lt;br&gt; So, if &amp;quot;A&amp;quot; needs B-1.0.0 but, &amp;quot;C&amp;quot; needs B-2.0.0, you have to choose between A and C. Fedora has greatly alleviated this problem by making sure every package that requires &amp;quot;B&amp;quot; would require the same version of &amp;quot;B&amp;quot;. There are a lot of rebuilds, etc for the purpose. And they are partly justified (If we don&amp;#39;t force packages to move to newer versions, they never will and we&amp;#39;ll end-up with 10 versions of each package installed on our system). But sometimes, you just need a way around! and there&amp;#39;s no way you can do it. &lt;br&gt; eg. There was a time when we had a working package built aganist python 2.4 and the new distributions had python 2.6. Now there were some difficulties because of which we couldn&amp;#39;t rebuild the package aganist python 2.6. Only if there could be multiple versions installed! But sigh! We had to devise some dirty workarounds to get stuff working. &lt;br&gt;  &lt;br&gt;&lt;br&gt;There are many other issues that yum intelligently hides. Most of them are highlighted in the &amp;quot;RPM hell&amp;quot; link above. Guess its time to rethink RPM? &lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5445265974752290121?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5445265974752290121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5445265974752290121' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5445265974752290121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5445265974752290121'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/10/rpm-hell.html' title='RPM Hell'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-1501352435179083801</id><published>2009-08-05T05:55:00.001-07:00</published><updated>2009-08-05T05:55:05.746-07:00</updated><title type='text'>Adding a swap device</title><content type='html'>Lets assume you upgrade you RAM from 1 GB to 2 GB. Since, the swap device is usually statically created during install-time and you&amp;#39;ll probably be stuck with less swap space than the recommended figure. Then, you have 3 options&lt;br&gt; 1) Who needs extra swap?&lt;br&gt;2) Make a swap file (simpler, but slower)&lt;br&gt;3) Extend the swap device.&lt;br&gt;&lt;br&gt;For Approach 2, you can use the &amp;quot;dd&amp;quot; command to created a file of required size and then use it as a loop device.&lt;br&gt; &lt;br&gt;Lets see the Third approach in detail. &lt;br&gt;&lt;br&gt;Run &amp;quot;$sudo parted --list&amp;quot; to get a list of block devices attached to the system. &lt;br&gt;Use &amp;quot;parted /dev/sda resize &amp;lt;partition-number&amp;gt; &amp;lt;start&amp;gt; &amp;lt;end&amp;gt;&amp;quot;&lt;br&gt; &lt;br&gt;&amp;quot;/dev/sda&amp;quot; is the HDD on my machine. Replace appropriately from the &amp;quot;parted --list&amp;quot;&amp;#39;s output.&lt;br&gt;Take the &amp;quot;partition-number&amp;quot; from the &amp;quot;parted --list&amp;quot; command&amp;#39;s output. Use the swap device&amp;#39;s partition number. Adjust the start end as you wish (can be specified in MBs.. eg. parted /dev/sda resize 5 5000M 7000M&amp;quot;&lt;br&gt; &lt;br&gt;You don&amp;#39;t need to worry about keeping the space free or defragmenting the drives to avoid data loss. Parted (claims) to take care of it. &lt;br&gt;&lt;br&gt;If you never had a swap space (and created a partition just now) or you are using a swap file,&lt;br&gt; Make a swapfs on the partition&lt;br&gt;&lt;br&gt;&amp;quot;$mkswap &amp;lt;device&amp;gt;&amp;quot;&lt;br&gt;(eg. $mkswap /dev/sda5)&lt;br&gt;&lt;br&gt;Then, tell the system to swap on that device&lt;br&gt;&amp;quot;$swapon &amp;lt;device&amp;gt;&amp;quot;&lt;br&gt;(eg. $swapon /dev/sda5)&lt;br&gt;&lt;br&gt; Add an entry in /etc/fstab for persisting the settings&lt;br&gt;Sample entry:&lt;br&gt;&amp;quot;/dev/sda5     swap    swap    defaults    0 0&amp;quot;&lt;br&gt;&lt;br&gt;Thats it!&lt;br&gt;&lt;br&gt;Check whether everything went fine by,&lt;br&gt;&amp;quot;$cat /proc/swaps&amp;quot;&lt;br&gt; &lt;br&gt;Recommended swap-space = twice of total physical memory.&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-1501352435179083801?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/1501352435179083801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=1501352435179083801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1501352435179083801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1501352435179083801'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/08/adding-swap-device.html' title='Adding a swap device'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-351003883612057423</id><published>2009-08-03T06:35:00.001-07:00</published><updated>2009-08-03T06:35:39.269-07:00</updated><title type='text'>enable "sudo" in Fedora..</title><content type='html'>One fine day I became tired of &amp;quot;su -&amp;quot; and entering the password every other minute. (Also, had to write a script which needed to sudo). So, I decided to enable sudo access. Its pretty simple. &lt;br&gt;There&amp;#39;s a sudo&amp;#39;ers file : /etc/sudoers&lt;br&gt; &lt;br&gt;Run &amp;quot;man sudoers&amp;quot; to find out exactly what format the file has to be in. It is a bit complex, but don&amp;#39;t distress, you won&amp;#39;t need its complexity unless you are a funky sysadmin. The sudoers file usually comes with the basic infrastructure and most-frequently-used categories defined. You can define your own categories too. (refer to &amp;quot;man sudoers&amp;quot;)&lt;br&gt; &lt;br&gt;One thing to remember is that the sudoers file should be modified *only* with the &amp;quot;visudo&amp;quot; command. visudo checks the syntax while exiting and optionally, replaces the old file if the syntax is found to be invalid. &lt;br&gt; &lt;br&gt;Just append the following entry to your sudoers file&lt;br&gt;jitesh ALL=(ALL)    NOPASSWD: ALL&lt;br&gt;&lt;br&gt;where, &amp;quot;jitesh&amp;quot; is the username on my machine. &lt;br&gt;&amp;quot;NOPASSWD: ALL&amp;quot; means that sudo won&amp;#39;t ask for password. Use with care.&lt;br&gt; &lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-351003883612057423?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/351003883612057423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=351003883612057423' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/351003883612057423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/351003883612057423'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/08/enable-sudo-in-fedora.html' title='enable &quot;sudo&quot; in Fedora..'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7710127037370786384</id><published>2009-07-31T22:58:00.001-07:00</published><updated>2009-07-31T22:58:55.765-07:00</updated><title type='text'>Avada Kedavra.</title><content type='html'>Saving yourself from the Avada Kedavra of Linux : rm -rf ./&lt;br&gt;&lt;br&gt;&lt;a href="http://www.linuxjournal.com/article/10428"&gt;http://www.linuxjournal.com/article/10428&lt;/a&gt;&lt;br&gt;(Link via &lt;a href="http://linux-hacks.blogspot.com/"&gt;cheezo&lt;/a&gt;)&lt;br&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7710127037370786384?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7710127037370786384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7710127037370786384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7710127037370786384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7710127037370786384'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/07/avada-kedavra.html' title='Avada Kedavra.'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2195992973399652107</id><published>2009-07-15T10:25:00.000-07:00</published><updated>2009-07-15T12:58:35.218-07:00</updated><title type='text'>Inline Assembly in C</title><content type='html'>I found this very simple and insightful tutorial. Its very good&lt;br&gt;&lt;a href="http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html"&gt;http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html&lt;/a&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2195992973399652107?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2195992973399652107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2195992973399652107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2195992973399652107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2195992973399652107'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/07/inline-assembly-in-c.html' title='Inline Assembly in C'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5016892782222992491</id><published>2009-07-02T10:06:00.001-07:00</published><updated>2009-07-02T10:06:22.941-07:00</updated><title type='text'>Fedora: A walk down the memory lane</title><content type='html'>(For the un-initiated, Fedora is a Linux Distro which was forked off from Red Hat in the early 2000s.)&lt;br&gt;A nice read:&lt;br&gt;&lt;a href="http://www.raiden.net/articles/Fedora_A_Hat_with_a_History/"&gt;http://www.raiden.net/articles/Fedora_A_Hat_with_a_History/&lt;/a&gt;&lt;br&gt; &lt;br&gt;Talks about the evolution of Fedora, Red Hat, RPM and also some of the design decisions that has made Red Hat what it is today. &lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5016892782222992491?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5016892782222992491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5016892782222992491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5016892782222992491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5016892782222992491'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/07/fedora-walk-down-memory-lane.html' title='Fedora: A walk down the memory lane'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-4244834042786615155</id><published>2009-07-01T00:27:00.001-07:00</published><updated>2009-07-01T00:27:32.643-07:00</updated><title type='text'>Treat Warnings as Errors</title><content type='html'>If you are reading this blog and have even a iotic sense of humour, you must have heard (and liked) this joke:&lt;br&gt;&lt;br&gt;------&lt;br&gt;&lt;p&gt;A man is smoking a cigarette and blowing smoke rings into the air.  His girlfriend becomes irritated with the smoke and says, "Can't you see the warning on the cigarette pack?  Smoking is hazardous to your health!"  &lt;/p&gt;&lt;p&gt;To which the man replies, "I am a programmer.  We don't worry about warnings; we only worry about errors." &lt;br&gt;&lt;/p&gt;-------&lt;br&gt;&lt;br&gt;Ofcourse, I laughed my ass off when I first heard the joke. Awesome it was! But then, the last month totally changed my perception. (Probably because I faced the side-effects of that).&lt;br&gt; &lt;br&gt;So, ARM architecture is very specific about alignment. It hates mis-aligned access (Its the side-effect of being an arch for embedded systems). Here is an example of unaligned access:&lt;br&gt;&lt;br&gt;1 short short_arr[4];&lt;br&gt;2 long *long_ptr = short_arr;&lt;br&gt; 3 blah = *long_ptr;&lt;br&gt;&lt;br&gt;since the data type of short_arr is &amp;quot;short&amp;quot;, gcc forces only a 16-bit alignment on the array (on 32-bit systems). but then, long_ptr is probably 32-bit and that screws up alignment for line 3. Although, i386 would work perfectly fine (but require one extra memory cycle), ARM will just give garbage data (if misaligned).&lt;br&gt; &lt;br&gt;And many many many software packages are filled with such errors. Just to give you an example:&lt;br&gt;# cat /proc/cpu/alignment &lt;br&gt;User:           1265555&lt;br&gt;&lt;br&gt;(this file is present only an ARM architecture because of ARMs peculiar alignment requirements)&lt;br&gt; &lt;br&gt;See the number of alignment errors? &lt;br&gt;Packages like mhash (which calculate hash) build fine but fail run-time, this makes such errors difficult to track down. &lt;br&gt;&lt;br&gt;So, always make it a point to compile your C programs with &amp;quot;-Werror&amp;quot; option. It treat warnings as errors. It is *very* important for your programs to work on just about any platform. Please pay attention to warnings, because warnings are there FOR A REASON. gcc developers aren&amp;#39;t stupid!&lt;br&gt; (Although sometimes, you might be sure that even if gcc warns about misalignment, the access is aligned. eg, when you typecast an IP struct into a MAC struct, etc. These are the *only* times you can let go off the -Werror option)&lt;br&gt; &lt;br&gt;But, until this point sinks into the mind of every developer, there&amp;#39;s no option but to live in this mess. :(&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-4244834042786615155?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/4244834042786615155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=4244834042786615155' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4244834042786615155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4244834042786615155'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/07/treat-warnings-as-errors.html' title='Treat Warnings as Errors'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-1582466678270676609</id><published>2009-06-28T22:26:00.001-07:00</published><updated>2009-06-28T22:26:13.529-07:00</updated><title type='text'>Emacs splash-screen</title><content type='html'>So one fine day, I grew tired of the emacs splash-screen. You try to edit a file and emacs shows its splash-screen instead of the file contents and then you have to &amp;quot;Press any key to continue&amp;quot;. So one day it got on my nerves and I decided that if I don&amp;#39;t find a way to disable it, I am going to switch to vi. But, how can an editor as customisable as emacs NOT have an option to disable the splashscreen? Ofcourse it does! and it was the first result on my google search! (probably there are just too many people in this world irritated by the splashscreen, why doesn&amp;#39;t emacs just do away with it?)&lt;br&gt; &lt;br&gt;Simply add this line to your .emacs file:&lt;br&gt;&lt;pre&gt;(setq inhibit-splash-screen t)&lt;/pre&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-1582466678270676609?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/1582466678270676609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=1582466678270676609' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1582466678270676609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1582466678270676609'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/06/emacs-splash-screen.html' title='Emacs splash-screen'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2529907031176106644</id><published>2009-06-28T00:13:00.001-07:00</published><updated>2009-06-28T00:13:52.440-07:00</updated><title type='text'>yum plug-in : Presto</title><content type='html'>I have ranted about Presto in my &lt;a href="http://nothingtechnicalaboutit.blogspot.com/2009/06/upgrading-to-fedora-11-leonidas.html" target="_blank"&gt;earlier blogpost&lt;/a&gt;. Yum&amp;#39;s fedora maintainers implemented this really cool idea of maintaining difference between binary packages instead of the binary packages themselves. It would help a lot to push out updates. I was sceptical at first about the amount of savings it would result in (because obviously binary difference is something very complicated). I expected a 20-30% saving. Although people kept reporting numbers of upto 90%. &lt;br&gt;  &lt;br&gt;Today, I decided it was time to &amp;quot;yum update&amp;quot; my machine. (crashing pidgin, crashing rhythmbox, bad font rendering). So, I ran yum update. It showed me a total download size of 876MB (i.e. the total size without presto.. since, presto is new and under beta.. its integration with yum is only perfunctory). So, I dozed off. Today I check my internet usage and guess what, the total usage yesterday night was less than 100MB. Awesome! (Usually, presto shows the difference. It prints out a line saying &amp;quot;This is actual download size and this was download size with presto&amp;quot;. But, as I dozed off, the line went off the terminal limit).&lt;br&gt; Anyway, it is infact 90% savings! that is so awesome! Now I can &amp;quot;yum update&amp;quot; even during the day :D. No need to wait for the night free time. &lt;br&gt;&lt;br&gt;Goooo fedora!!!!!&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2529907031176106644?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2529907031176106644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2529907031176106644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2529907031176106644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2529907031176106644'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/06/yum-plug-in-presto.html' title='yum plug-in : Presto'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-6361951350777560015</id><published>2009-06-27T23:31:00.001-07:00</published><updated>2009-06-27T23:34:13.870-07:00</updated><title type='text'>Linux sound level too low?</title><content type='html'>After having (finally) upgraded Fedora-11, I found it pretty annoying that the sound level was wayy too low. I mean, even with speaker volume set to full, system volume set to full and application volume set to full (not to forget pulseaudio volume .. which is another layer between the app and the system), the sound levels were only just enough for me to watch a movie without missing out a dialog. WTH! I have awesome speakers and they should ideally crack my windows. But here, even full volume was just barely enough. It hurt my ego (:P).&lt;br /&gt;&lt;br /&gt;On Windows, the full volume is a real window-cracker. What is the problem with Linux then? (I could replicate the same issue on Ubuntu 9.04 too.. that should explain why I went for generic "Linux" and NOT "fedora"). Then I found this &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=498747"&gt;bug&lt;/a&gt; filed in the fedora bugzilla which made things clearer (actually, they didn't). Don't bother to read, it went swooosh over my head. The only thing that stuck was - How to solve the problem.&lt;br /&gt;&lt;br /&gt;Here it is:&lt;br /&gt;Make sure you have the package "alsa-utils" installed.&lt;br /&gt;&lt;br /&gt;For fedora:&lt;br /&gt;&lt;code&gt; $ sudo yum install alsa-utils &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For Ubuntu:&lt;br /&gt;&lt;code&gt; $ sudo apt-get install alsa-utils &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then, run&lt;br /&gt;&lt;code&gt; $ alsamixer -c 0 &lt;/code&gt;&lt;br /&gt;and increase the master volume beyond green area to the red area. (I understand that the red area implies increased noise, but I didn't really notice much of a difference with a slightly less than maximum setting. Even with max master volume, there is only a slightly noticeable noise)&lt;br /&gt;&lt;br /&gt;I don't understand why this control is hidden away in such a manner. What is the whole point? Why not export a GUI for it? Weird. Probably they'll fix it in fedora 12. There's been a lot of work in the sound area in the last 6 months. There are going to be some bugs afterall. Anyway, this healed my ego :P. Linux sound is at-par with any other sound system! It makes me happy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-6361951350777560015?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/6361951350777560015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=6361951350777560015' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6361951350777560015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/6361951350777560015'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/06/linux-sound-level-too-low.html' title='Linux sound level too low?'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7869190831702807227</id><published>2009-06-25T03:25:00.001-07:00</published><updated>2009-06-25T03:25:39.705-07:00</updated><title type='text'>Emacs: linux-c-mode and Line numbers</title><content type='html'>&lt;div class="gmail_quote"&gt;Tired of the slow ssh access to one of the servers located outside India, I finally figured it was time to start playing with emacs to reduce the number of keystrokes needed. &lt;br&gt;&lt;br&gt;First on, I wanted the linux-c-mode enabled *by default* whenever I open a file whose extension is &amp;quot;.c&amp;quot; (Yeah Yeah, I know extensions are meaningless for Linux.. but emacs is intelligent :) ). For all the other type of files, linux-c-mode should be OFF, because it will mess-up their indentation. &lt;br&gt;  Second, line numbers should be displayed on the left-hand-side panel of each file I open. Then to go a particular line I just &amp;quot;M-g g&amp;quot;. Simple.&lt;br&gt;Third, All this should be accessible to my user account as well as root user.&lt;br&gt;  &lt;br&gt;So, I edit the ~/.emacs file (create if not already present) like this (for the first goal): &lt;br&gt;(defun linux-c-mode ()&lt;br&gt;  &amp;quot;C mode with adjusted defaults for use with the Linux kernel.&amp;quot;&lt;br&gt;  (interactive)&lt;br&gt;    (c-mode)&lt;br&gt;  (c-set-style &amp;quot;K&amp;amp;R&amp;quot;)&lt;br&gt;  (setq tab-width 8)&lt;br&gt;  (setq indent-tabs-mode t)&lt;br&gt;  (setq c-basic-offset 8))&lt;br&gt;&lt;br&gt;(add-to-list &amp;#39;auto-mode-alist &amp;#39;(&amp;quot;\\.c$&amp;quot; . linux-c-mode))&lt;br&gt; &lt;br&gt; &lt;br&gt;The first chunk defines the linux-c-mode (from Documentation/CodingStyle) and the last line enables it by default ONLY for *.c files. Simple!&lt;br&gt;&lt;br&gt;For the second part, I got a script linum.el from google (Vedang says it has been integrated into emacs)&lt;br&gt;  You can find the script here: &lt;a href="http://jitesh.1337.googlepages.com/linum.el" target="_blank"&gt;http://jitesh.1337.googlepages.com/linum.el&lt;/a&gt;&lt;br&gt;Drop this script at /usr/share/emacs/site-lisp/&lt;br&gt;&lt;br&gt;There&amp;#39;s a problem with this script. It doesn&amp;#39;t print a space after the line number. Sad! &lt;br&gt;  Here is a patch I wrote to fix it: &lt;a href="http://jitesh.1337.googlepages.com/linum.el.patch" target="_blank"&gt;http://jitesh.1337.googlepages.com/linum.el.patch&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Now I want to display line numbers for EACH file I open in emacs. So, I add the following lines in the .emacs file:&lt;br&gt;  (require &amp;#39;linum)&lt;br&gt;(global-linum-mode 1)&lt;br&gt;&lt;br&gt;(First line is needed to autoload linum.el. The second line enables it by default)&lt;br&gt;To toggle the linum mode, use &amp;quot;M-x linum-mode&amp;quot;&lt;br&gt;Simple!&lt;br&gt;&lt;br&gt;&lt;br&gt;Finally, I wanted to give access to root user too. &lt;br&gt;  A simple solution would be to make a symlink/hardlink from /root/.emacs to /home/jitesh/.emacs. &lt;br&gt;However, I wasn&amp;#39;t too concerned about the other users on the system :) .So, I simply copied to .emacs file to /usr/share/emacs/site-lisp/site-start.d/ and renamed it as myinit.pl. So, now, these things get enabled by default for *all* users. &lt;br&gt;  &lt;br&gt;Now that everything is setup (and steps documented via this blog), let me go back to coding peacefully in emacs!&lt;br&gt;&lt;br&gt; &lt;/div&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7869190831702807227?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7869190831702807227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7869190831702807227' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7869190831702807227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7869190831702807227'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/06/emacs-linux-c-mode-and-line-numbers.html' title='Emacs: linux-c-mode and Line numbers'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-3093942833556056543</id><published>2009-06-11T09:00:00.000-07:00</published><updated>2009-06-11T09:30:11.896-07:00</updated><title type='text'>Upgrading to Fedora-11 (Leonidas)</title><content type='html'>Finally I got my hands on the brand new Fedora release. Fedora-11 (Leonidas). As I had a sneek-peak into the development process this time around (work reasons), I was pretty excited to upgrade to this new version. There are a couple of nice features in Fedora-11 that makes it awesome.&lt;br /&gt;1) &lt;a href="http://fedoraproject.org/wiki/Releases/FeaturePresto"&gt;Presto&lt;/a&gt;: &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;Delta-RPMs. If you are updating your system, yum now fetches only the *change* between two versions instead of pulling in the new version entirely. Savings of 60-70% of bandwidth have been reported.&lt;br /&gt;&lt;br /&gt;2) &lt;a href="http://fedoraproject.org/wiki/Features/PackageKit"&gt;PackageKit&lt;/a&gt;: Makes installation of new packages and plug-ins very easy and user-friendly.&lt;br /&gt;&lt;br /&gt;Time for installation.&lt;br /&gt;So, I booted into F10 and set the system up for the normal upgrade method that I use. Which is:&lt;br /&gt;1) Insert the DVD.&lt;br /&gt;2) Make a yum repo which points to the DVD.&lt;br /&gt;3) Issue a "yum update"&lt;br /&gt;4) Watch a movie while your system upgrades.&lt;br /&gt;&lt;br /&gt;However, this time I decide to be a good boy and read the &lt;a href="http://fedoraproject.org/wiki/YumUpgradeFaq"&gt;fedora docs&lt;/a&gt; first to see whether it had to say anything about upgrades. Turns out it was a good decision. Apparently, there is a &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=494046"&gt;bug&lt;/a&gt; which makes such an upgrade impossible and leads to a possibly "unusable system". Whew! close shave!&lt;br /&gt;&lt;br /&gt;So, why the hell did they release F-11 when a method of upgrade was broken? Well, there were vibrant discussions in the fedora community over this bug and the final decision was: This upgrade method is not "recommended" and "supported" and hence, it isn't a F-11 blocker bug :(. Sigh!&lt;br /&gt;&lt;br /&gt;So, guess I'll have to follow the "recommended and supported" method. Boot from DVD and choose "upgrade". I'll have to stare at the screen for an hour while the system upgrades :)&lt;br /&gt;Looks like I'll wait for a respin which contains a fix.&lt;br /&gt;(/me adds himself to the CC list for the bug)&lt;br /&gt;&lt;br /&gt;Another caveat is that the &lt;a href="http://fedoraproject.org/wiki/RPM_file_format_changes_to_support_SHA-256"&gt;rpm format has been changed&lt;/a&gt; in Fedora-11 to make it more secure. This makes upgrade impossible because the installed rpm simply cannot read these new rpms. The solution is: Fedora has issued an update to F-10 "rpm" package which is aware of this new format. So, you'll have to run a "yum update" on F-10 first (older Fedora's will have to be moved to fedora-10 and then updated via "yum update"). Once, this new "rpm" package is installed, then the upgrade should go smoothly. (Note: If you don't update "rpm", yum will fail with "MD5 sum mis-match" type of errors)&lt;br /&gt;&lt;br /&gt;The delta between Fedora-10 and Fedora-11 is huge as compared to the previous deltas. There has been some heavy development. Lets see if Leonidas has the same majesty as the King ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-3093942833556056543?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/3093942833556056543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=3093942833556056543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3093942833556056543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3093942833556056543'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/06/upgrading-to-fedora-11-leonidas.html' title='Upgrading to Fedora-11 (Leonidas)'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-8079427283954526813</id><published>2009-05-21T23:53:00.000-07:00</published><updated>2009-05-22T00:07:36.741-07:00</updated><title type='text'>Debugging a segmentation fault using gdb</title><content type='html'>I am not a big proponent of gdb. If you *really* know what you are doing, gdb shouldn't be required. But, every now and then, you come across code that has used function pointers exclusively and then, hand-debugging becomes painful. gdb to the rescue.&lt;br /&gt;&lt;br /&gt;You'll need the following pre-requisites to use gdb to debug a segmentation fault:&lt;br /&gt;1) make sure you have compiled the executable WITH debugging symbols. i.e. the "-g" flag. eg&lt;br /&gt;&lt;code&gt; gcc -g -o hello hello.c&lt;/code&gt;&lt;br /&gt;Without debugging symbols, gdb won't be able to do much.&lt;br /&gt;&lt;br /&gt;2) Linux should core-dump on segmentation fault. Set:&lt;br /&gt;&lt;code&gt;ulimit -c unlimited&lt;/code&gt;&lt;br /&gt;(man ulimit for more info)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now just run that the excutable that is segfaulting. As soon as it segfaults, you should get an output something like "Segmentation fault (core dumped)". ls in your working directory and you will find a new core file has been created (probably with the name core.{pid})&lt;br /&gt;&lt;br /&gt;Now, we just have to tell gdb to analyze this core. Here's how&lt;br /&gt;&lt;code&gt; gdb {executable} {dump file}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;eg. gdb hello core.1324&lt;br /&gt;&lt;br /&gt;Check out the output spit out by gdb and make sure that all debugging symbols have been loaded.&lt;br /&gt;Now, on the gdb prompt:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;(gdb) bt&lt;/code&gt;&lt;br /&gt;(bt = backtrace .. prints stack strace)&lt;br /&gt;with this backtrace you'll now know *exactly* where the program segfaulted. The code file, line number and the call which was the culprit.&lt;br /&gt;&lt;br /&gt;You can even analyze variable values on any frame. Just change to that frame:&lt;br /&gt;&lt;code&gt;(gdb) frame {num}&lt;/code&gt;&lt;br /&gt;eg. (gdb) frame 2&lt;br /&gt;&lt;br /&gt;and use:&lt;br /&gt;&lt;code&gt;(gdb) info locals&lt;/code&gt;&lt;br /&gt;&lt;code&gt;(gdb) info args&lt;/code&gt;&lt;br /&gt;to query the values of local variables and passed arguments, respectively.&lt;br /&gt;&lt;br /&gt;With all this info, you can pin down the exact reason for the segfault pretty easily. Saves a lot of time!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-8079427283954526813?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/8079427283954526813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=8079427283954526813' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8079427283954526813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/8079427283954526813'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/05/debugging-segmentation-fault-using-gdb.html' title='Debugging a segmentation fault using gdb'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5564301275004306205</id><published>2009-01-28T06:32:00.000-08:00</published><updated>2009-01-28T10:33:05.577-08:00</updated><title type='text'>Packages: Naming scheme</title><content type='html'>Its been a while since I wrote a nice article and today I just felt that inner need to write one. Today's topic is an introduction to the naming scheme used to manage packages. But, before that it'll be useful to distinguish between some similar terms.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Package&lt;/span&gt;: This is the common name that we generally use. Eg. "Amarok" is a package name&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Build&lt;/span&gt;: A build is a particular release of a package. eg "Amarok-1.4.12-1.fc10" is a build. Note that a build specification is architecture independent.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;RPM&lt;/span&gt;: An RPM is the architecture specific binary of a build. Eg. "Amarok-1.4.12-1.fc10.i386.fc10.rpm" is an rpm.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SRPM&lt;/span&gt;: Source RPM is architecture independent and contains the sources of the build packaged as an rpm. (Now, why would that be useful, you may ask. Why not a tarball? That'd take up another post to clarify. Queuing the topic)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Naming scheme&lt;/span&gt;:&lt;br /&gt;Generally, a build is named in the following manner.&lt;br /&gt;Name-Version-Release (popularly known as the NVR of a package)&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Name&lt;/span&gt;: might be a simple name such as "Amarok". It can contain the hyphen character.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Version&lt;/span&gt;: Version is usually in x.y.z format. "z" being the least significant and "x" being the most significant. Usually, if a respun rpm contains only bug-fixes, only the "z" part is incremented. If there are some major changes or feature additions, "y" is incremented. An architectural change warrants an "x" increment.&lt;br /&gt;But, some packages (like tzdata) use a different versioning scheme. (Since, tzdata package deals with timezone stuff, they find it convenient to include the year in the version. Eg. 2007k, etc.) But, an overwhelming majority use the x.y.z scheme.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Release&lt;/span&gt;: It is generally only a decimal number. It can be viewed as the minor version number. If the change is very small, so that incrementing even "z" is unjustified, release number is incremented. It might contain small bugfixes or other minor changes.&lt;br /&gt;&lt;br /&gt;When, someone distributes a version of the rpm that deviates from upstream, (he has applied his own patches to the source) he should change the release number to reflect the same. A string is to be appended to the release number.&lt;br /&gt;eg. If someone patches amarok to add his own cool new feature. He has to change the release number from "1" (say), to "1.fa1" or something similar. Just append a string at the end. So, when you see a non-standard package, you can instantly make out from the name.&lt;br /&gt;&lt;br /&gt;RPMs also contain the architecture name along with the NVR.&lt;br /&gt;&lt;br /&gt;Now, suppose you have 2 packages "blah-1.2.3-1.fc10" and "blah-1.2.3-1.fc11". And, there's a bug-fix which only applies to the fc10 version, what do you do? Certainly, you cannot change the Version number or Release number of the fc10 rpm because it was a "fc10" specific fix and hence, not a property of the build. In such a case, the build is spun as "blah-1.2.3-1.fc10.1". But this is a fairly rare case.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well, This was a fairly basic post. But, this one merely does the job of heralding a series of posts on messing with RPMs and SRPMs. So, stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5564301275004306205?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5564301275004306205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5564301275004306205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5564301275004306205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5564301275004306205'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/01/packages-naming-scheme.html' title='Packages: Naming scheme'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-266031452521423065</id><published>2009-01-23T22:10:00.000-08:00</published><updated>2009-01-25T03:37:19.666-08:00</updated><title type='text'>Writing a resume ...</title><content type='html'>&lt;span style="font-family:times new roman;"&gt;Resume writing has always been a mystery to me. A rather pointless exercise of listing what you've done in the last 20 years. I mean come on, what does the HR care whether I have secured 40% or 99.99% in the 10th standard? Unless physics and chemistry combine to form a software engineer much like blue and yellow combine to give green. Another thing that has endlessly puzzled me in a resume is "Hobbies". When I was briefly working with the TnP cell (2 hours, before I resigned), I've seen people having such amusing hobbies and the courage to pen them down on the resume. How can "Watching TV" "playing video games" or even "playing pranks" be included in the hobbies section on a resume? Why would the HR give a damn even if you have a hobby of mooning every stranger you see!! Utterly pointless...&lt;br /&gt;&lt;br /&gt;But, then my brother gave me &lt;a href="http://steve-yegge.blogspot.com/2007/09/ten-tips-for-slightly-less-awful-resume.html"&gt;this amazing link&lt;/a&gt;. (much like the ads where you are fat and the girls are disgusted by you and they always prefer the slim ones and then your friend gives you a pill to make you super-slim within a day) It is titled "Tips for a slightly less awful resume". The author has had a good experience in resume screening. The points he has made clears many of the myths we have about resume writing and to say the least, they are ground-shaking. Whatever I thought were the best practices in resume writing are listed as a strict no-no with a very good line of reasoning. It is a must read for everyone who wants to make that resume of yours slightly less awful.&lt;br /&gt;&lt;br /&gt;The post is a bit long and I am, myself very wary of long posts. I generally skip them, if they are not entertaining enough. With this one I was hooked till the last line. The man has got an amazing sense of humour and some really sharp sarcasm. The post isn't a sermon on the do's and don'ts of resume writing but a slightly less awful waste of time on how _not_ to screw-up your resume :)&lt;br /&gt;&lt;br /&gt;Please do make it a point to read the post atleast once before you make your "awful" resume! :)&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-266031452521423065?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/266031452521423065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=266031452521423065' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/266031452521423065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/266031452521423065'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2009/01/writing-resume.html' title='Writing a resume ...'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7282061416044486292</id><published>2008-12-19T03:12:00.000-08:00</published><updated>2008-12-19T07:55:19.818-08:00</updated><title type='text'>Adding/Removing stuff from start-up</title><content type='html'>Its a wonder how frequently we need to add stuff to the start-up and yet we prefer the hard-ass manual way. You can lose hours if you forget to do one small thing (eg. one of my builds, which takes 2 hours on an average, failed merely because I forgot to start httpd.) Thats when I considered this start-up thing seriously.&lt;br /&gt;&lt;br /&gt;1) &lt;span style="font-weight: bold;"&gt;Adding/Removing services&lt;/span&gt;:&lt;br /&gt;   In very (very) loose terms, services comprise of everything under /etc/init.d directory. (Files under this directory are scripts that manage starting, stopping, restarting and status reporting of the services). The 'chkconfig' command is used to Add/remove these services from the start-up. These can be done per-runlevel too. (Just pass a suitable '--level' option)&lt;br /&gt;eg. To start httpd on startup. Just type&lt;br /&gt;&gt;&gt; chkconfig httpd on&lt;br /&gt;(To remove httpd from startup, replace 'on' with 'off')&lt;br /&gt;(Syntax ==&gt;&gt; chkconfig {service-name} on/off)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(To add a script to be managed by chkconfig, just copy the script to /etc/init.d directory and run&lt;br /&gt;&gt;&gt; chkconfig --add {name}&lt;br /&gt;This creates links in /etc/rc[0-6].d directories. Scripts in these directories are run each time the run-level is switched (provided that the service isn't already running))&lt;br /&gt;&lt;br /&gt;Type in 'chkconfig --list' to get a nice summary of the status of services at each runlevel.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2) &lt;span style="font-weight: bold;"&gt;Initializing environment variables at start-up&lt;/span&gt;:&lt;br /&gt;Just add an "export name=value" command to ~/bash_profile file. (Create the file if it isn't already there). Note that this would be a per-user initialization.&lt;br /&gt;To initialize an environment variable globally, add an entry to the /etc/profile file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3) &lt;span style="font-weight: bold;"&gt;Initializing aliases&lt;/span&gt;:&lt;br /&gt;Add a "alias name=value" to ~/bashrc file. Create the file if it isn't already present.&lt;br /&gt;/etc/bashrc file if you need global changes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4) &lt;span style="font-weight: bold;"&gt;Random stuff in start-up&lt;/span&gt;:&lt;br /&gt;What if you want to run a random command at start-up? (eg. Flushing ip-tables). In fedora you can add the commands to /etc/rc.d/rc.local file. But, the file is distro dependant. Most probably, you'll find the appropriate file in /etc/rc.d directory.&lt;br /&gt;&lt;br /&gt;Hope it helps!&lt;/name&gt;&lt;/service-name&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7282061416044486292?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7282061416044486292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7282061416044486292' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7282061416044486292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7282061416044486292'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/12/addingremoving-stuff-from-start-up.html' title='Adding/Removing stuff from start-up'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-4554810775422574517</id><published>2008-12-06T20:39:00.000-08:00</published><updated>2008-12-06T21:57:22.287-08:00</updated><title type='text'>Patching....</title><content type='html'>Before we delve into applying patches, let us have a look at a sample patch file.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;--- old_test    2008-12-07 15:43:27.000000000 +0530&lt;br /&gt;+++ new_test    2008-12-07 15:43:39.000000000 +0530&lt;br /&gt;@@ -1,5 +1,6 @@&lt;br /&gt;This&lt;br /&gt;is&lt;br /&gt;+also&lt;br /&gt;a&lt;br /&gt;test&lt;br /&gt;file&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The first line gives details about the original file and the second line about the modified file.&lt;br /&gt;Then "@@ -1,5 +1,6 @@" marks the beginning of the hunk. This line tells the patch command where, in the file-to-be-patched should it find the specified change.&lt;br /&gt;&lt;br /&gt;The line prefixed by "+" is the line that was added in the modified version. Other lines constitute the context.&lt;br /&gt;&lt;br /&gt;Now why is context important?&lt;br /&gt;Here's why. Consider this scenario. You work on this amazing new idea on a file called blah.c. At the same time, another of your friend modifies the same file to implement his crazy new idea. So, would your patch not apply to your friend's version of blah.c?&lt;br /&gt;Chances are, it will!.. because patch tries to find the same "context" in the neighbourhood of the original line numbers. If it does, patch applies successfully!... Now this is what makes patches a good idea!.. DISTRIBUTED DEVELOPMENT!&lt;br /&gt;&lt;br /&gt;So, coming back to the patch command,&lt;br /&gt;&gt;&gt; &lt;code&gt; patch -pNUM &lt; patch-file &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note that patch reads the patch file from the standard input. So, you have to redirect the standard input to the patch file.&lt;br /&gt;&lt;br /&gt;the -p option is used to specify number of components to strip.&lt;br /&gt;Here's a line from a patch file. Lets take it up as an example to understand the -p option&lt;br /&gt;&lt;code&gt;diff --git a/wlan/driver/linux/some-name.c b/wlan/driver/linux/some-name.c&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;the -p option works on the path "a/wlan/driver/linux/some-name.c".&lt;br /&gt;with -p1 : it strips one element from the LHS of the path. Thus, it will try to find "wlan" directory in the current directory.&lt;br /&gt;&lt;br /&gt;with, -p2 : patch will strip the first 2 components. i.e. "a" and "wlan" and it will try to find "driver" directory in the current directory.&lt;br /&gt;&lt;br /&gt;and so on.&lt;br /&gt;If you don't give a -p option, -p1 is used by default.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Unapplying patches&lt;/span&gt;:&lt;br /&gt;It is possible that you applied a wrong patch to your code. Or you find out after applying the patch that the damn thing is not going to work. Or there is a regression. Whatever. The point is, you want to revert the patch.&lt;br /&gt;&lt;br /&gt;Just pass a "-R" option to patch and it will try to unapply the patch. Although, do read the man page carefully before using this option.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Random notes on the patch&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;command&lt;/span&gt;:&lt;br /&gt;1) Use the strip-level option (-p) properly. If patch command doesn't find the file to be patched, chances are that you have specified an improper strip level option. (In that case, patch becomes interactive and asks you the path of the file to be patched. Most of the times, it means that you need to correct the strip-level option. so, exit with ctrl+c and give the correct strip level)&lt;br /&gt;&lt;br /&gt;2) In case, one of the hunk fails (Which is the case when, the original file is modified by someone else prior to applying the patch and there is a conflict), the hunk that failed is saved in the "filename.rej" file. You need to apply that change manually. Just open the .rej file, see which hunk failed and make the changes manually. Also, the original version of the file is saved in filename.orig, just in-case you changed your mind or you are just too lazy to do the hard-work.&lt;br /&gt;&lt;br /&gt;3) A patch is a defacto standard to give out changes like bug-fixes, minor feature additions, security patches etc. Patches are extensively used when a team is working on the same workspace (which is almost always the case). Revision control softwares like git, SVN, CVS, perforce, etc all support patches extensively in all their operations.&lt;br /&gt;Patches are something you really want to know!&lt;br /&gt;&lt;br /&gt;Hope it helped!&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-4554810775422574517?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/4554810775422574517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=4554810775422574517' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4554810775422574517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4554810775422574517'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/12/patching.html' title='Patching....'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-4090237735383703178</id><published>2008-12-03T07:43:00.000-08:00</published><updated>2008-12-03T08:16:53.993-08:00</updated><title type='text'>Diff and Patch</title><content type='html'>Patches show the difference between two versions of the same file.&lt;br /&gt;A patch shows which lines were newly added and which lines were removed. What makes a patch very useful is that a patch can be applied to the old version of the file to obtain a new version.&lt;br /&gt;i.e. (old version) X (Patch) = (new version)&lt;br /&gt;&lt;br /&gt;This fact makes it easy to manage a community software where a software is open-source and anyone can submit changes. Trust me on this, without patches we would be nowhere.&lt;br /&gt;For eg, Andrew Morton (Linux kernel maintainer) gets hundreds of patches everyday. In the absence of patches, he would have to integrate each and every change manually which would be a VERY time consuming and an inaccurate process. Patches automise this job.&lt;br /&gt;&lt;br /&gt;"Diff" is used to create patches and "patch" is used to apply it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Diff&lt;/span&gt;:&lt;br /&gt;syntax&lt;br /&gt;&gt;&gt; &lt;code&gt; diff  [options]  [original version]  [modified version] &lt;/code&gt;&lt;br /&gt;Generally, I used the diff command with "-du" options.&lt;br /&gt;eg. &lt;code&gt; diff -du old_test.c new_test.c &gt; test.patch &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note that diff produces output on the stdout and you'll have to redirect it to a file.&lt;br /&gt;Options:&lt;br /&gt;-d : Use an algorithm which will produce smaller set of differences&lt;br /&gt;-u : Use unified output format&lt;br /&gt;(-u causes newly added lines to be prefixed by "+" and removed lines prefixed by "-". Otherwise, other prefixes are used which people generally dislike :)&lt;br /&gt;&lt;br /&gt;-r : recursive.&lt;br /&gt;Now this is a beauty. You can find differences between all files under a directory. So, if you have changed multiple files, use this option to generate only ONE patch and _not_ a patch for each file separately.&lt;br /&gt;&lt;br /&gt;-N : Include new files&lt;br /&gt;With -r, it is possible that you might have added a new file in the newer version of the software which wasn't there in the old version. Diff by default ignores such files. Use this option to change this default behaviour.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Random notes on patches&lt;/span&gt;:&lt;br /&gt;1) In patch files, you will find something called hunks. Hunks are a set of changes alongwith some context. By default, 5 lines above the change and 5 lines below the change constitute the context. View a patch file in emacs/vim and you'll know what I am talking about. Context is a very important part of the patch file. I'll come back to it when I talk about applying patches.&lt;br /&gt;&lt;br /&gt;2) The beauty of patch files is that you can actually MODIFY them. Well, it won't seem to be a big deal if you havn't used patch much. But, it is a quite handy trick. You can remove entire hunks and the patch is still valid!&lt;br /&gt;So, play around with it a bit.&lt;br /&gt;&lt;br /&gt;3) Many people and inherently afraid of patches. Trust me they'll have a very hard time when they work in a group on a single project. Patches are a great way to review changes that have been made or pass them on to others. Without patches, I cannot concieve a way I'll pass on my changes to others!&lt;br /&gt;Patches are very easy to use. Just try and get comfortable with them. Ask around if you think you are stuck.&lt;br /&gt;&lt;br /&gt;Now that we know how to generate patches, it is time to move ahead and learn how to apply these patches.&lt;br /&gt;But, I think this post is long enough. So, I'll write about it in the next post.&lt;br /&gt;&lt;br /&gt;(Do leave a comment and let me know if I need to add/remove/modify anything to make the post lucid and easily understandable yet comprehensive)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-4090237735383703178?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/4090237735383703178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=4090237735383703178' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4090237735383703178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/4090237735383703178'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/12/diff-and-patch.html' title='Diff and Patch'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-1903775454663871169</id><published>2008-11-12T01:32:00.000-08:00</published><updated>2008-11-12T02:00:29.252-08:00</updated><title type='text'>How to browse source-code?</title><content type='html'>99% of your life is wasted is studying code written by someone else. And studying this code can be an awfully irritating task. (Although, studying codes written by TE/BE students can be a really pleasing experience. You can just lambaste them on every possible line! It is fun. Trust me. Simply log-on to the lab-server, access someone else's code. Don't worry about the permissions. Seems that PICT's lab assistants believe in open source. So, get someone else's code and vent your anger through comments. Don't forget to save the file :D)&lt;br /&gt;&lt;br /&gt;Anyway, getting back to the point. There are few tools available which can make the task a bit simpler.&lt;br /&gt;1) Etags&lt;br /&gt;2) Cscope&lt;br /&gt;3) Doxygen&lt;br /&gt;&lt;br /&gt;My good friend Vedang has written enough about them. Here are the links to &lt;a href="http://tech-rantings.blogspot.com/2007/09/creating-tags-using-etags-and-find.html"&gt;Etags&lt;/a&gt; and &lt;a href="http://tech-rantings.blogspot.com/2007/10/using-cscope-for-better-source-code.html"&gt;Cscope&lt;/a&gt; posts.&lt;br /&gt;&lt;br /&gt;Personally, I think Cscope is just amazing. You can find functions which call this particular function and there is a regular expression search too. Etags is quick but primitive. I generally use Etags for simple browsing and Cscope only when Etags cannot help!&lt;br /&gt;&lt;br /&gt;Tools aside, you also need to have a strategy for browsing source code. You cannot simply dig into the source code to understand how linux works. (Although, it may work if you are sufficiently genius.)&lt;br /&gt;So, first try to get a doc explaining what the piece of code does. Having an insight into the working certainly makes browsing the code a lot simpler and faster. Then, use whatever-piece-of-software you have so that you know the inputs and outputs. Start with the source code only when you think you have a good understanding of the product.&lt;br /&gt;&lt;br /&gt;Don't worry if you cannot seem to understand or remember anything the first time. Be persistent and you'll get the knack of it.&lt;br /&gt;&lt;br /&gt;Browsing the source, btw, is a very good way to understand how people think. So, if you have a crush, go get her source code! :P&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-1903775454663871169?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/1903775454663871169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=1903775454663871169' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1903775454663871169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/1903775454663871169'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/11/how-to-browse-source-code.html' title='How to browse source-code?'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-2584151705539908831</id><published>2008-10-30T06:41:00.000-07:00</published><updated>2008-10-30T07:19:33.086-07:00</updated><title type='text'>grep-ing your way to glory!</title><content type='html'>Grep is oxygen. Also, Grep is a very very powerful content search tool found on Unix-based systems.&lt;br /&gt;&lt;br /&gt;Basic Syntax:&lt;br /&gt;&gt;&gt; &lt;code&gt; grep [options] [pattern] [files to be searched] &lt;/code&gt;&lt;br /&gt;eg. &gt;&gt; &lt;code&gt; grep -r Hello . &lt;/code&gt;&lt;br /&gt;(Grep the current directory for the string "Hello". Make the search recursive i.e. search within sub-directories too)&lt;br /&gt;&lt;br /&gt;grep searches in all files. Even binary files. This can sometimes be irritating, since results from binary files are seldom useful. Pass a "-I" &lt;span style="font-weight: bold;"&gt;ignore binary files&lt;/span&gt;. (grep examines the first few of the file to determine whether the file is binary or ASCII. extensions are NOT used)&lt;br /&gt;&lt;br /&gt;Also, you may want to &lt;span style="font-weight: bold;"&gt;ignore case&lt;/span&gt;. Use "-i"&lt;br /&gt;&lt;br /&gt;By default, the format of printing the output is&lt;br /&gt;"&lt;path-to-file&gt;[path-to-file]:  [line containing the matching pattern]&lt;line&gt;"&lt;br /&gt;Sometimes it might be useful to alter this pattern.&lt;br /&gt;Use&lt;br /&gt;1) "-n" to &lt;span style="font-weight: bold;"&gt;display the line number&lt;/span&gt; in the file where a match was found&lt;br /&gt;2) "-o" to show only the matching text and NOT the entire line.&lt;br /&gt;3) "-C [num of lines]&lt;num&gt;" to show the &lt;span style="font-weight: bold;"&gt;context&lt;/span&gt; (before and after)&lt;br /&gt;4) "--color" to show the matching pattern in color.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Also, sometimes you might be interested in only the number of matching lines. use "-c".&lt;br /&gt;&lt;br /&gt;Another VERY useful option is "&lt;span style="font-weight: bold;"&gt;invert-match&lt;/span&gt;" (i.e. select non-matching lines)&lt;br /&gt;use "-v".&lt;br /&gt;eg. &gt;&gt; &lt;code&gt; grep -v -e "^#" my.c &lt;/code&gt;&lt;br /&gt;(i.e. select all lines that do NOT start with a #)&lt;br /&gt;&lt;br /&gt;grep can take only basic regular expressions. Use "-e" to pass an expression which uses the &lt;span style="font-weight: bold;"&gt;extended regex&lt;/span&gt; format.&lt;br /&gt;&lt;br /&gt;These are pretty much the frequently used options. man grep for more options.&lt;br /&gt;&lt;br /&gt;Some Grep usage scenarios:&lt;br /&gt;grep alongwith piping makes a great combo!&lt;br /&gt;you can say something like&lt;br /&gt;&gt;&gt; &lt;code&gt; find . -name "*.c" | xargs grep -in Hello &lt;/code&gt;&lt;br /&gt;to search only C files within a directory.&lt;br /&gt;Or you can say&lt;br /&gt;&gt;&gt; &lt;code&gt; find . -name "*.c" | grep hello &lt;/code&gt; | grep -v not_welcome&lt;br /&gt;to find a filename containing the string "hello" in it but NOT "not_welcome" !!&lt;br /&gt;&lt;br /&gt;NOTES:&lt;br /&gt;1) I purposely havn't talked about regular expressions. They are worthwhile to learn since they are required everywhere, not only for grep. With a good knowledge of regular expressions, grep is awesomely powerful!&lt;br /&gt;2) grep is slow. Understandable. since it is content search!&lt;br /&gt;3) Are more examples required? Let me know!&lt;br /&gt;&lt;br /&gt;PS:&lt;br /&gt;So, grep is used for search. But, what about search and replace?&lt;br /&gt;Well, use "sed" for that. sed is good! (sed has saved me loads and loads of time. It is good to know atleast basic sed)&lt;br /&gt;A nice tutorial can be found &lt;a href="http://www.grymoire.com/Unix/Sed.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;EOF&lt;/num&gt;&lt;/line&gt;&lt;/path-to-file&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-2584151705539908831?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/2584151705539908831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=2584151705539908831' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2584151705539908831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/2584151705539908831'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/grep-ing-your-way-to-glory.html' title='grep-ing your way to glory!'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-5742582176233762449</id><published>2008-10-23T10:56:00.000-07:00</published><updated>2008-10-23T12:20:58.326-07:00</updated><title type='text'>So what is so great about find?</title><content type='html'>Why do people not like find? It is a nice command to have. I gather that there is no "find" in BSD and that find is "impure" (I am not sure about both) Well, frankly, it makes no difference to me, as a user, whether a command is pure or impure. Find is a simple slick and helpful command and that is what I care about. As for BSD, get the sources and compile!&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;LOCATE&lt;/span&gt;:&lt;br /&gt;Anyway, there is an alternative to find (albeit lame). It is "locate".&lt;br /&gt;Basic syntax :&lt;br /&gt;&lt;br /&gt;&gt;&gt;&lt;code&gt; &lt;span style="font-style: italic;font-size:130%;" &gt; locate [pattern]&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;(Don't mind the square brackets. '&lt;' brackets makes google think that I am writing some xml doc. So, a quick fix)  Locate merely searches the database of names that was created by "updatedb" command. updatedb is periodically scheduled by crond. So, your database is automatically updated. You don't need to worry about that. One advantage of this approach is that the search is&lt;span style="color: rgb(0, 153, 0);"&gt; lightning fast&lt;/span&gt;. If you compare the performance of locate and find, locate would win by light years! Also, the syntax of locate is deceptively &lt;span style="color: rgb(0, 153, 0);"&gt;simple&lt;/span&gt;. Merely, "locate &lt;pattern&gt;{pattern}"&lt;br /&gt;But, as every girl you like is always taken, locate has its own drawbacks.&lt;br /&gt;&lt;br /&gt;1) locate command&lt;span style="color: rgb(204, 0, 0);"&gt; doesn't check&lt;/span&gt; whether the file actually exists on your machine. It simply consults the database and gives back the results. (Thus, after an updatedb, you delete a file, you still get it in the locate results until crond schedules another updatedb). You can pass "-e" to locate to avoid this condition. -e checks whether the file actually exists.&lt;br /&gt;&lt;br /&gt;2) If you create a new file, it won't appear in the locate results for a while. (Until crond schedules an updatedb)&lt;br /&gt;&lt;br /&gt;3) There is no way you can ask locate to &lt;span style="color: rgb(0, 0, 0);"&gt;search only within a particular directory&lt;/span&gt;. You &lt;span style="color: rgb(204, 0, 0);"&gt;have to search the entire directory tree&lt;/span&gt;, always. This, in my opinion, is the worst drawback of locate.&lt;br /&gt;&lt;br /&gt;Some other options that could be passed to locate:&lt;br /&gt;-i : ignore case&lt;br /&gt;-b : match basename only. (i.e. the final component of the whole name)&lt;br /&gt;-e : check if file exists&lt;br /&gt;-E : print only files that do not exist, but were there when database was made.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;FIND&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;Find is good.&lt;br /&gt;With find you can search a part of the direcotry tree. The basic syntax is&lt;br /&gt;&lt;br /&gt;&gt;&gt; &lt;span style="font-style: italic;font-size:130%;" &gt;&lt;code&gt;find [directory to search in] [options&lt;directory-to-search&gt;]&lt;/directory-to-search&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;eg. &gt;&gt; &lt;code&gt;find . -name "Linux"&lt;/code&gt;&lt;br /&gt;the beauty of the command is that, you can have &lt;span style="color: rgb(0, 153, 0);"&gt;many many search parameters&lt;/span&gt;. Like:&lt;br /&gt;1) -name [pattern]&lt;br /&gt;       Search name of the file&lt;br /&gt;2) -user [username]&lt;br /&gt;      Search for files owned by this particular user&lt;br /&gt;3) -perm -{octal permission bits}&lt;octal&gt;&lt;br /&gt;     Search for files with this permissions.&lt;br /&gt;4) -type [c]&lt;br /&gt;    Search for files only of type &lt;c&gt;. (eg. b for block. p for pipe etc etc)&lt;br /&gt;and many more. Check out the man page. You can combine the above options.&lt;br /&gt;eg. &gt;&gt; find . -name "Linux" -user httpd&lt;br /&gt;&lt;br /&gt;Also, with find the &lt;span style="color: rgb(0, 153, 0);"&gt;expression &lt;/span&gt;part can be "expression" "!expr" "expr or expr" "expr and expr" etc etc. Quite handy!&lt;br /&gt;&lt;br /&gt;What more? You can &lt;span style="color: rgb(0, 153, 0);"&gt;format your output&lt;/span&gt; as per you wish. check the -print option in the find man page. Havn't found the need to use this one, but such options are good for writing scripts.&lt;br /&gt;&lt;br /&gt;When you search in "/", find unecessarily searches the mounted windows paritions too? No prob, pass "-mount" and it won't !! It'll &lt;span style="color: rgb(0, 153, 0);"&gt;skip all mounts&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;With find, you can have more control over the search. But the downside is that find is terribly and horribly &lt;span style="color: rgb(204, 0, 0);"&gt;slow&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;As a&lt;span style="font-weight: bold;"&gt; third lame option&lt;/span&gt;. You can define an &lt;span style="color: rgb(0, 153, 0);"&gt;alias&lt;/span&gt;. Something like&lt;br /&gt;&lt;br /&gt;&gt;&gt;  &lt;span style="font-style: italic;font-size:130%;" &gt;&lt;code&gt;alias myfind='updatedb; locate'&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So, "myfind" becomes a new command which expands to 'updatedb; locate'. Neat, eh?&lt;br /&gt;although, the overhead of updatedb might not always be acceptable. In those cases, you can simply use locate. updatedb, btw, is NOT very slow. So, it is a better option than find, if you don't want too tight a control on your search.&lt;br /&gt;&lt;br /&gt;Enjoy searching!!&lt;br /&gt;&lt;br /&gt;(PS: Lookout for the next post on grep)&lt;/c&gt;&lt;/octal&gt;&lt;/pattern&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-5742582176233762449?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/5742582176233762449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=5742582176233762449' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5742582176233762449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/5742582176233762449'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/so-what-is-so-great-about-find.html' title='So what is so great about find?'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-3728182438870050444</id><published>2008-10-14T09:26:00.000-07:00</published><updated>2008-10-14T09:37:17.244-07:00</updated><title type='text'>Emacs v/s vi !</title><content type='html'>While looking for a comparison among the editors I stumbled across these. Great!!&lt;br /&gt;(Both emacs and vi are great and masochistic. Both of them have a steep learning curve but equally great are their uses. You can find a good comparison &lt;a href="http://en.wikipedia.org/wiki/Editor_war"&gt;here&lt;/a&gt;.)&lt;br /&gt;&lt;br /&gt;Emacs and vi have been involved in a never-ending holy war since ages. All of the verbal battles involve critisizing the people using the editor. I love such wars! :D. Yes. What with all the insulting and swearing :D. Here is a sample....&lt;br /&gt;&lt;br /&gt;LOL -----&gt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_lUaXqHQMKyk/SPTJsyL0tcI/AAAAAAAABAY/SucU2ssBVlY/s1600-h/vi-emacs2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_lUaXqHQMKyk/SPTJsyL0tcI/AAAAAAAABAY/SucU2ssBVlY/s320/vi-emacs2.jpg" alt="" id="BLOGGER_PHOTO_ID_5257048436271003074" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_lUaXqHQMKyk/SPTJ5wIIXWI/AAAAAAAABAg/cNGAb2Ws-KI/s1600-h/uf010710.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_lUaXqHQMKyk/SPTJ5wIIXWI/AAAAAAAABAg/cNGAb2Ws-KI/s320/uf010710.gif" alt="" id="BLOGGER_PHOTO_ID_5257048659056942434" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-3728182438870050444?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/3728182438870050444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=3728182438870050444' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3728182438870050444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3728182438870050444'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/emacs-vs-vi.html' title='Emacs v/s vi !'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_lUaXqHQMKyk/SPTJsyL0tcI/AAAAAAAABAY/SucU2ssBVlY/s72-c/vi-emacs2.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-3953103861037641612</id><published>2008-10-14T08:50:00.000-07:00</published><updated>2008-10-14T09:04:34.568-07:00</updated><title type='text'>How to ask questions?</title><content type='html'>n00bs often get frustrated when they start using Linux. Partly because it is very different than Windows and partly because they lack patience. Patience to figure out what is not working and why it is not working. Patience to learn. They want quick answers and so they turn to forums and mailing lists. We have seen hundreds of stupid posts/mails which go something like this - "I can't get xyz working. Help me. NOW!".&lt;br /&gt;&lt;br /&gt;One thing we all should understand is the people who made the software are not your servants. You should be thankful they opted to share their effort for free. Isn't it your responsibility to atleast try somethings out before wasting their precious time?? You get to learn a lot in the process too. Its a win-win situation!!&lt;br /&gt;&lt;br /&gt;So, before posting any question to a mailing list/forum please make sure thatyou have done your best but couldn't find the solution. (Google. Ask around. Have a look at the debugging output) Let others know what you have tried. Write it in your mail/post. Be respectful and humble.&lt;br /&gt;&lt;br /&gt;There is a nice document which documents this particular aspect. You can find it &lt;a href="http://www.catb.org/%7Eesr/faqs/smart-questions.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Happy getting-things-to-work!!! :D&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-3953103861037641612?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/3953103861037641612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=3953103861037641612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3953103861037641612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/3953103861037641612'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/how-to-ask-questions.html' title='How to ask questions?'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7091609307932356607</id><published>2008-10-13T05:22:00.000-07:00</published><updated>2008-10-13T05:28:01.375-07:00</updated><title type='text'>Nothing technical about it !!</title><content type='html'>So, we are supposed to mail our status reports each week to our manager. One of the guys (some people have a good good idea who he is !!) wrote this in his status report:&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;&lt;span style="color:#737373;"&gt;Tasks this week:&lt;/span&gt;&lt;/tt&gt;&lt;br /&gt;  &lt;tt&gt;&lt;span style="color:#737373;"&gt;* Worked on "one build to rule them all" infrastructure&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/tt&gt; And bang came the reply from the manager:&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;Three Builds for the Linux-kings in the MSI,&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;Seven for the SQA-lords in their shield-halls of stone,&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;Nine for MIPL Mortal Men doomed to code,&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;One for the Dark Lord Kedar on his Bamboo throne&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;In the Land of Linux where the RPMs lie.&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;One Build to rule them all, One Build to find them,&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;One Build to bring them all and in the flash-ness bind them&lt;/tt&gt;&lt;br /&gt;&lt;tt&gt;In the Land of Linux where the RPMs lie.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tt&gt;Need I say more?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7091609307932356607?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7091609307932356607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7091609307932356607' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7091609307932356607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7091609307932356607'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/nothing-technical-about-it.html' title='Nothing technical about it !!'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-701640169862405676</id><published>2008-10-11T08:03:00.001-07:00</published><updated>2008-10-11T08:12:48.393-07:00</updated><title type='text'>Coding Style...</title><content type='html'>No technical blog can start without commenting on the coding style. 90% of the times the code written by you would have to be understood by a third person who will enhance or maintain it. (The other 10% being college assignments.. even there the code has to be understood by MANY third people :P). So, wouldn't it be nice if your code was easily understandable and readable?&lt;br /&gt;&lt;br /&gt;You will understand the importance of coding style once you start studying code written by others. Some get so frustrated that they re-indent the entire code base (:P) which leads to worse problems!! :P. So, better write understandable code. Coding is an art and an art is nothing without presentation!&lt;br /&gt;&lt;br /&gt;A very good guide to coding style can be found in the linux kernel documentation.&lt;br /&gt;Just check out Documentation/CodingStyle in the Linux kernel sources. Remember that this coding style is recommended by people who have written/maintained millions of LOC. It has to be the best. And it is!&lt;br /&gt;&lt;br /&gt;The file also provides a configuration to be integrated with emacs so that emacs does some of the things automatically for you. Emacs is great!&lt;br /&gt;&lt;br /&gt;Welcome to the world where we like to speak quality C !! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-701640169862405676?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/701640169862405676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=701640169862405676' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/701640169862405676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/701640169862405676'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/coding-style.html' title='Coding Style...'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5382426726630308577.post-7549806176860296413</id><published>2008-10-09T08:59:00.001-07:00</published><updated>2008-10-09T09:09:56.887-07:00</updated><title type='text'>The traditional post....</title><content type='html'>As is the tradition, the first post of any blog always explains what the blog is going to be about. And as is the tradition, the blog is never about it !!&lt;br /&gt;&lt;br /&gt;We'll stick to the tradition.&lt;br /&gt;So here goes.&lt;br /&gt;The blog will contain posts that I don't think are fit for my other blogs. &lt;a href="http://aterriblewasteoflife.blogspot.com"&gt;My experiences&lt;/a&gt; and &lt;a href="http://worstjokes.blogspot.com"&gt;Humour&lt;/a&gt;. Basically everything that people don't think is fun. I won't say that I agree with them, but I can understand. Some things are better left to geniuses :P:D.&lt;br /&gt;Anyway, expect technical or atleast no non-technical posts from this blog!&lt;br /&gt;&lt;br /&gt;And have fun!&lt;br /&gt;Amen!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5382426726630308577-7549806176860296413?l=nothingtechnicalaboutit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nothingtechnicalaboutit.blogspot.com/feeds/7549806176860296413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5382426726630308577&amp;postID=7549806176860296413' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7549806176860296413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5382426726630308577/posts/default/7549806176860296413'/><link rel='alternate' type='text/html' href='http://nothingtechnicalaboutit.blogspot.com/2008/10/traditional-post.html' title='The traditional post....'/><author><name>Jitesh Shah</name><uri>http://www.blogger.com/profile/07784858389224126152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
