<?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-1610341979741183427</id><updated>2011-11-27T16:35:07.896-08:00</updated><category term='child'/><category term='GWT'/><category term='mysql'/><category term='erlang'/><category term='dlsym'/><category term='Boost.MultiIndex'/><category term='process. parent'/><category term='epoll'/><category term='ActiveMQ'/><category term='boost'/><category term='alignment'/><category term='Java'/><category term='Shared Libraries'/><category term='asio'/><category term='alive'/><category term='gethostbyaddr'/><category term='Distributed Systems'/><category term='Core Dump'/><category term='atexit'/><category term='STL'/><category term='Linux'/><category term='-fpic'/><category term='JMS'/><category term='Patterns'/><category term='Spring'/><category term='call stack'/><category term='Boost Threads'/><category term='c++'/><category term='backtrace'/><category term='ipv6'/><category term='Cloud'/><category term='MPI'/><title type='text'>Mutex  Lock</title><subtitle type='html'>This contains commentaries in general about programming / network protocols and similar stuff.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>pseudonym</name><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>42</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1610341979741183427.post-7969317790410550368</id><published>2010-02-28T21:08:00.001-08:00</published><updated>2010-02-28T21:08:40.687-08:00</updated><title type='text'>PHP - OpenID library integration</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;An excellent introduction to the openID library as a consumer from the PHP &lt;a href='http://devzone.zend.com/article/3581'&gt;here&lt;/a&gt;. &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=582b4eab-62ec-83b5-bf0d-ad0d87985ff4' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-7969317790410550368?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/7969317790410550368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=7969317790410550368' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7969317790410550368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7969317790410550368'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/02/php-openid-library-integration.html' title='PHP - OpenID library integration'/><author><name>pseudonym</name><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-1610341979741183427.post-7381114845475229338</id><published>2010-02-16T12:41:00.000-08:00</published><updated>2010-02-16T12:46:31.627-08:00</updated><title type='text'>Erlang based WebSocket client in place</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;An erlang based WebSocket client in place &lt;a href='http://github.com/davebryson/erlang_websocket/blob/master/README.textile'&gt;here&lt;/a&gt; , for clients that deal with web socket protocol as yet.  &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=3352a95d-808a-814a-8cf7-e1b06ba96d32' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-7381114845475229338?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/7381114845475229338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=7381114845475229338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7381114845475229338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7381114845475229338'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/02/erlang-based-websocket-client-in-place.html' title='Erlang based WebSocket client in place'/><author><name>pseudonym</name><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-1610341979741183427.post-5641286356688140681</id><published>2010-02-16T11:29:00.000-08:00</published><updated>2010-02-16T11:30:16.841-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='erlang'/><title type='text'>Storing Data in a Hash - Erlang</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Came across this nice example in the Erlang mailing list for storing data in an hashmap. &lt;br /&gt;&lt;br /&gt;&lt;pre class='brush: erl'&gt;-module(db_server).&lt;br /&gt;&lt;br /&gt;-export([start/0, init/1, write/2, read/1, delete/1]).&lt;br /&gt;&lt;br /&gt;start() -&amp;gt;&lt;br /&gt;register(server, spawn(db_server, init, [dict:new()])).&lt;br /&gt;&lt;br /&gt;init(Records) -&amp;gt;&lt;br /&gt;receive&lt;br /&gt;{add, Pid, Key, Value} -&amp;gt;&lt;br /&gt;RecordsNew = dict:store(Key, Value, Records),&lt;br /&gt;Pid ! {ok, Key, Value},&lt;br /&gt;init(RecordsNew);&lt;br /&gt;{show, Pid, Key} -&amp;gt;&lt;br /&gt;case dict:find(Key, Records) of&lt;br /&gt;{ok, Value} -&amp;gt; Pid ! {ok, Value};&lt;br /&gt;error -&amp;gt;  Pid ! {error, no_such_value}&lt;br /&gt;end,&lt;br /&gt;init(Records);&lt;br /&gt;{delete, Pid, Key} -&amp;gt;&lt;br /&gt;RecordsNew = dict:erase(Key, Records),&lt;br /&gt;Pid ! {ok, ok},&lt;br /&gt;init(RecordsNew)           &lt;br /&gt;end.&lt;br /&gt;&lt;br /&gt;write(Key, Value) -&amp;gt;&lt;br /&gt;server ! {add, self(), Key, Value},&lt;br /&gt;receive Res -&amp;gt;&lt;br /&gt;Res&lt;br /&gt;end.&lt;br /&gt;&lt;br /&gt;read(Key) -&amp;gt;&lt;br /&gt;server ! {show, self(), Key},&lt;br /&gt;receive Res -&amp;gt;&lt;br /&gt;Res&lt;br /&gt;end.&lt;br /&gt;&lt;br /&gt;delete(Key) -&amp;gt;&lt;br /&gt;server ! {delete, self(), Key},&lt;br /&gt;receive Res -&amp;gt;&lt;br /&gt;Res&lt;br /&gt;end.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=a843d9f2-1f8e-827b-ad72-ad79da6d3fbe' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-5641286356688140681?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/5641286356688140681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=5641286356688140681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5641286356688140681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5641286356688140681'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/02/storing-data-in-hash.html' title='Storing Data in a Hash - Erlang'/><author><name>pseudonym</name><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-1610341979741183427.post-8614254521494714176</id><published>2010-02-05T12:07:00.000-08:00</published><updated>2010-02-08T11:35:46.592-08:00</updated><title type='text'>Deleting tags from remote in git</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Happened to go through a build process , and while flipping around with versions - it created some tags on the remote repository that I wanted to get rid of entirely. &lt;br /&gt;&lt;br /&gt;For example - lets assume the tag name is artifactA-0.1.0 . &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ git tag -d artifactA-0.1.0 &lt;/pre&gt;&lt;br /&gt;This deletes the tag locally ( in your local clone ) &lt;br /&gt;To push the change to remote and to delete the tag remotely as well - we can give - &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ git push origin :artifactA-0.1.0&lt;br /&gt;&lt;/pre&gt;where , I assume origin is the name of the remote branch from which I cloned initially. &lt;br /&gt;&lt;br /&gt;This should delete the tag remotely as well. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=79b73768-9ee2-8667-afb5-4cadd94adbeb' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8614254521494714176?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8614254521494714176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8614254521494714176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8614254521494714176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8614254521494714176'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/02/deleting-tags-from-remote-in-git.html' title='Deleting tags from remote in git'/><author><name>pseudonym</name><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-1610341979741183427.post-3628981135116207688</id><published>2010-02-04T16:11:00.000-08:00</published><updated>2010-02-08T11:36:14.814-08:00</updated><title type='text'>GPG agent</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;When preparing some artifacts to be published to a maven repository - needed some help with gpg publishing. &lt;br /&gt;&lt;br /&gt;More often that not - when the gpg key verification was happening - it was reporting about a missing file -    ~/.gnupg/S.gpg-agent . &lt;br /&gt;&lt;br /&gt;'touch'ing would not help because that is not a file , but a socket for the agent to listen on. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ gpg-agent --use-standard-socket --daemon 2&amp;gt;/dev/null&lt;br /&gt;&lt;/pre&gt;This makes the agent listen on the socket. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=12f9e150-ee44-8541-a530-1915eef90fb3' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-3628981135116207688?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/3628981135116207688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=3628981135116207688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3628981135116207688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3628981135116207688'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/02/gpg-agent.html' title='GPG agent'/><author><name>pseudonym</name><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-1610341979741183427.post-1727294545681653159</id><published>2010-01-29T17:18:00.000-08:00</published><updated>2010-01-29T17:22:16.058-08:00</updated><title type='text'>Google Collections SVN repository</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Google Collections 1.0 was released recently towards the end of December 2009. While very useful from an API and performance perspective, the API had quite an amount of surprises / deprecations / removals in its later stages ( 0.7 / 0.8 etc.) . &lt;br /&gt;&lt;br /&gt;With 1.0 the API seems to have been stabilized and as an added benefit for those integrating with mvn - it is also available here as the mvn repository - &lt;a href=' http://google-maven-repository.googlecode.com/svn/repository/com/google/collections/google-collections/1.0/'&gt; http://google-maven-repository.googlecode.com/svn/repository/com/google/collections/google-collections/1.0/&lt;/a&gt; . &lt;br /&gt;&lt;br /&gt;com.google.collections / google-collections / 1.0 should do the trick in ivy.xml / pom.xml as appropriate. &lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=2911d448-8cf2-8657-af3f-42596ea77ef6' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-1727294545681653159?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/1727294545681653159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=1727294545681653159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1727294545681653159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1727294545681653159'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/google-collections-svn-repository.html' title='Google Collections SVN repository'/><author><name>pseudonym</name><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-1610341979741183427.post-3823847786794682379</id><published>2010-01-28T11:10:00.000-08:00</published><updated>2010-01-28T11:15:12.549-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>libevent 2.0 released</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;As per this &lt;a href='http://google-opensource.blogspot.com/2010/01/libevent-20x-like-libevent-14x-only.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed:+GoogleOpenSourceBlog+%28Google+Open+Source+Blog%29'&gt;update on the google developer blog &lt;/a&gt;, libevent 2.0 seems to be released. &lt;br/&gt;&lt;br/&gt;For those of you new to the library - libevent provides a platform agnostic event handling library so that the user does deal with the quirks of the operating systems like Linux and Solaris and chooses the best event handling adapter present in the kernel ( Eg: In Linux, from 2.6 - epoll performs much better than poll / select . The former in O(1) in handling of connections whereas the latter group is O(n) in event handling proportional to the number of active connections at that time instant ). &lt;br/&gt;&lt;br/&gt;More details are available in the &lt;a href='http://www.wangafu.net/%7Enickm/libevent-book/'&gt;book available&lt;/a&gt; here. &lt;br/&gt;&lt;br/&gt;Specifically about the update - it seems like the developers on Windows would benefit a lot from the API changes made. I will probably write a more detailed review of the same after playing around with the software / API on various platforms and distributions. &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=952727e9-f01a-89c5-b792-7db936936b12' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-3823847786794682379?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/3823847786794682379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=3823847786794682379' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3823847786794682379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3823847786794682379'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/libevent-20-released.html' title='libevent 2.0 released'/><author><name>pseudonym</name><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-1610341979741183427.post-6211021581808978373</id><published>2010-01-23T00:59:00.000-08:00</published><updated>2010-02-08T11:37:48.017-08:00</updated><title type='text'>Resetting / Overwriting /etc/resolv.conf in EC2 instance</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Creates a new EC2 instance ( CentOS ) and by default it comes with a dns resolver to the outside world. &lt;br /&gt;&lt;br /&gt;For our purposes - we had set up an internal dns server running (bind - process 'named' on a particular host).&lt;br /&gt;&lt;br /&gt;When we were launching our pool of servers - we wanted to make sure that the new instances fall under the same domain that we specify it to be. &lt;br /&gt;&lt;br /&gt;We also wanted to set the nameserver of the newly created instances pointing to the internal DNS server we have to resolve the ambiguity we have. &lt;br /&gt;&lt;br /&gt;Before making the change - the file /etc/resolv.conf was looking as follows. &lt;br /&gt;&lt;pre class="brush: bash"&gt;# cat /etc/resolv.conf&lt;br /&gt;; generated by /sbin/dhclient-script&lt;br /&gt;search some.internal.aws.domain&lt;br /&gt;nameserver 172.x.y.z &lt;/pre&gt;&lt;br /&gt;where 172.x.y.z was something set by Amazon EC2 by default. &lt;br /&gt;&lt;br /&gt;Edit &lt;span style="font-family: 'Courier New';"&gt;/etc/dhclient.conf&lt;/span&gt; ( Create one , if it does not exist )&lt;br /&gt;&lt;pre class="brush: bash"&gt;supersede  domain-name "ec2.mycompany.com" ;&lt;br /&gt;prepend domain-name-servers 10.p.q.r ;my internal company dns&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I also found it useful to create an Elastic IP and associate the dns server instance with the elastic ip, &lt;br /&gt;and then have the&lt;span style="font-family: 'Courier New';"&gt; prepend domain-name-servers&lt;/span&gt; refer to the elastic ip , instead of the internal ip. &lt;br /&gt;So - even if the internal dns server fails = we can reconstruct it from another AMI and associate with the elastic ip without affecting the rest of the system. &lt;br /&gt;&lt;br /&gt;To see the changes to /etc/dhclient , do the following &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ dhclient -r ; dhclient &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This command forcibly renews the dhcp lease that will force the new credentials from &lt;span style="font-family: 'Courier New';"&gt;/etc/dhclient.conf&lt;/span&gt; to be read. &lt;br /&gt;&lt;br /&gt;After doing this , verify &lt;span style="font-family: 'Courier New';"&gt;/etc/resolv.conf &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;search ec2.mycompany.com&lt;br /&gt;nameserver 10.p.q.r&amp;nbsp;&amp;nbsp;&amp;nbsp; ; our DNS server&lt;br /&gt;nameserver 172.x.y.z&amp;nbsp; ; the one set by amzn&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So that completes the process and we are good about it. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="zemanta-pixie"&gt;&lt;img alt="" class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=c61f1324-2740-8747-a53e-aff884ce899f" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6211021581808978373?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6211021581808978373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6211021581808978373' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6211021581808978373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6211021581808978373'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/resetting-overwriting-etcresolvconf-in.html' title='Resetting / Overwriting /etc/resolv.conf in EC2 instance'/><author><name>pseudonym</name><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-1610341979741183427.post-2997104090111721769</id><published>2010-01-17T11:24:00.001-08:00</published><updated>2010-01-17T11:24:36.848-08:00</updated><title type='text'>Zookeeper build</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Was trying to build Zookeeper from trunk ( 3.3.0 ) . &lt;br/&gt;&lt;br/&gt;Came across this error  - &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;create-cppunit-configure:&lt;br/&gt;     [exec] configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library&lt;br/&gt;     [exec] libtoolize: putting auxiliary files in `.'.&lt;br/&gt;     [exec] libtoolize: copying file `./config.guess'&lt;br/&gt;     [exec] libtoolize: copying file `./config.sub'&lt;br/&gt;     [exec] libtoolize: copying file `./install-sh'&lt;br/&gt;     [exec] libtoolize: copying file `./ltmain.sh'&lt;br/&gt;     [exec] libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and&lt;br/&gt;     [exec] libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.&lt;br/&gt;     [exec] libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.&lt;br/&gt;     [exec] configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library&lt;br/&gt;     [exec] configure.ac:33: error: possibly undefined macro: AM_PATH_CPPUNIT&lt;br/&gt;     [exec]       If this token and others are legitimate, please use m4_pattern_allow.&lt;br/&gt;     [exec]       See the Autoconf documentation.&lt;br/&gt;     [exec] autoreconf: /usr/bin/autoconf failed with exit status: 1&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;Installed - &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;$  sudo apt-get install libcppunit-dev&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;Ended up with .. &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;     [exec] .../zookeeper/src/c/configure: line 5015: syntax error near unexpected token `1.10.2'&lt;br/&gt;     [exec] .../zookeeper/src/c/configure: line 5015: `   AM_PATH_CPPUNIT(1.10.2)'&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;Hmm.. bad times. &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=9605d9e0-14f5-8645-9fbf-633be0d829fb' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-2997104090111721769?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/2997104090111721769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=2997104090111721769' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2997104090111721769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2997104090111721769'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/zookeeper-build.html' title='Zookeeper build'/><author><name>pseudonym</name><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-1610341979741183427.post-8132054792759634141</id><published>2010-01-15T00:20:00.001-08:00</published><updated>2010-02-08T11:38:25.808-08:00</updated><title type='text'>Installing Thrift Continued</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Continuing my &lt;a href='http://mutexlock.blogspot.com/2010/01/installing-thrift.html'&gt;previous post of installing Thrift&lt;/a&gt; - needed to install the following obvious ones as well. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt; sudo apt-get install flex bison &lt;/pre&gt;&lt;br /&gt;And then , run ./configure once again to make sure all the libraries are linked together. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt; ./configure&lt;br /&gt;&lt;/pre&gt;This should regenerate the makefiles once again, after installing flex and bison. &lt;br /&gt;&lt;br /&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=8bf5ec08-7943-8267-ac97-0b2c4d25c405' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8132054792759634141?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8132054792759634141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8132054792759634141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8132054792759634141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8132054792759634141'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/installing-thrift-continued.html' title='Installing Thrift Continued'/><author><name>pseudonym</name><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-1610341979741183427.post-7386363440810863905</id><published>2010-01-15T00:12:00.001-08:00</published><updated>2010-01-15T00:12:50.891-08:00</updated><title type='text'>Installing Thrift</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Checked out thrift from the trunk on my ubuntu box ( 9.10 ) . &lt;br/&gt;&lt;br/&gt;The first step on the installation was running the program &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;$ ./bootstrap.sh&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;It failed with some errors , some fairly obvious (missing autoconf ) - some not so obvious. &lt;br/&gt;The first step is to get autoconf installed. &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;$ sudo apt-get install autoconf&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;Then ran into this error.&lt;br/&gt;&lt;font face='Courier New'&gt;&lt;br/&gt;$ ./bootstrap.sh &lt;br/&gt;configure.ac:44: error: possibly undefined macro: AC_PROG_LIBTOOL&lt;br/&gt;      If this token and others are legitimate, please use m4_pattern_allow.&lt;br/&gt;      See the Autoconf documentation.&lt;br/&gt;configure.ac:26: installing `./install-sh'&lt;br/&gt;configure.ac:26: installing `./missing'&lt;br/&gt;compiler/cpp/Makefile.am: installing `./depcomp'&lt;br/&gt;configure.ac: installing `./ylwrap'&lt;br/&gt;lib/cpp/Makefile.am:24: Libtool library used but `LIBTOOL' is undefined&lt;br/&gt;lib/cpp/Makefile.am:24:   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'&lt;br/&gt;lib/cpp/Makefile.am:24:   to `configure.ac' and run `aclocal' and `autoconf' again.&lt;br/&gt;lib/cpp/Makefile.am:24:   If `AC_PROG_LIBTOOL' is in `configure.ac', make sure&lt;br/&gt;lib/cpp/Makefile.am:24:   its definition is in aclocal's search path.&lt;br/&gt;test/Makefile.am:30: Libtool library used but `LIBTOOL' is undefined&lt;br/&gt;test/Makefile.am:30:   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'&lt;br/&gt;test/Makefile.am:30:   to `configure.ac' and run `aclocal' and `autoconf' again.&lt;br/&gt;test/Makefile.am:30:   If `AC_PROG_LIBTOOL' is in `configure.ac', make sure&lt;br/&gt;test/Makefile.am:30:   its definition is in aclocal's search path.&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;The fix was to install libtool. &lt;br/&gt;&lt;font face='Courier New'&gt;$ sudo apt-get install libtool &lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;And then comes the boost libraries - &lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'&gt;$ sudo apt-get install libboost1.40-dev libboost1.40-doc&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;(Your boost library version might be different from mine but you get the idea !!). &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=96e2791c-a01e-880d-9fbe-01f60e474808' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-7386363440810863905?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/7386363440810863905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=7386363440810863905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7386363440810863905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7386363440810863905'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2010/01/installing-thrift.html' title='Installing Thrift'/><author><name>pseudonym</name><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-1610341979741183427.post-5237329741614036052</id><published>2009-11-19T14:11:00.001-08:00</published><updated>2010-02-08T11:38:51.838-08:00</updated><title type='text'>HDFS Permissions issues</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;If you are running into permissions issue in hdfs installation (Eg: When you try to write to hdfs and that does not seem to work ) - then you may want to *relax* the permissions by the following setting in all hdfs cluster nodes , in hdfs-site.xml ( starting from 0.20 ). Of course - the namednode needs to be restarted for the changes to be effective. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;property&amp;gt;&lt;br /&gt;&amp;lt;name&amp;gt;dfs.permissions&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;lt;value&amp;gt;false&amp;lt;/value&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Important - this has a gaping security hole in itself by relaxing the permissions and currently the hdfs team is actively working on enabling better permission based access rules. So - this change is best in the early stages of development to get started and should be revisited once again soon after. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=f7849664-9b9b-8a1f-a43a-2949338459e6' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-5237329741614036052?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/5237329741614036052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=5237329741614036052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5237329741614036052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5237329741614036052'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/11/hdfs-permissions-issues.html' title='HDFS Permissions issues'/><author><name>pseudonym</name><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-1610341979741183427.post-8807689431981572819</id><published>2009-07-23T12:43:00.003-07:00</published><updated>2009-07-23T12:43:55.909-07:00</updated><title type='text'>iBator eclipse plugin</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;If you are like me and you are into using iBatis eclipse plugin - check out &lt;a href='http://ibatis.apache.org/ibator.html'&gt;http://ibatis.apache.org/ibator.html&lt;/a&gt;. It comes with an eclipse plugin that is quite useful if you are working with the ibatis configuration files. &lt;br/&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/1610341979741183427-8807689431981572819?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8807689431981572819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8807689431981572819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8807689431981572819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8807689431981572819'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/07/ibator-eclipse-plugin.html' title='iBator eclipse plugin'/><author><name>pseudonym</name><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-1610341979741183427.post-6253829507911758493</id><published>2009-07-17T09:26:00.001-07:00</published><updated>2009-07-17T09:29:06.184-07:00</updated><title type='text'>Handling signals in Java</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Signals by definition are specific to the underlying implementation ( read, operating system) . &lt;br/&gt;&lt;br/&gt;Java, being a platform independent language , it is often discouraged to write platform specific stuff except for the rarest cases and when there is a clear business justification for the same.&lt;br/&gt;&lt;br/&gt;Java does have an undocumented API that talks about signals where we can override the default signal handler for a given signal.  Scenarios where this might be useful and necessary are when we try to release resources ( connections etc.). &lt;br/&gt;&lt;br/&gt;&lt;b&gt;Note:&lt;/b&gt; When we override default signal handlers, it is important to delegate the behavior to the default handler implementation (Hint: Save the old handler when overriding the same) after we finish the current implementation. &lt;br/&gt;&lt;br/&gt;&lt;pre class='brush:java'&gt;&lt;br /&gt;package experiment;&lt;br /&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.Map;&lt;br /&gt;import java.util.logging.Logger;&lt;br /&gt;&lt;br /&gt;import sun.misc.Signal;&lt;br /&gt;import sun.misc.SignalHandler;&lt;br /&gt;&lt;br /&gt;public class CustomSignalHandler implements SignalHandler&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  private static final Logger               LOGGER   = Logger.getLogger(CustomSignalHandler.class.getName());&lt;br /&gt;&lt;br /&gt;  private static Map&amp;lt;Signal, SignalHandler&amp;gt; handlers = new HashMap&amp;lt;Signal, SignalHandler&amp;gt;();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  public void handle(Signal signal)&lt;br /&gt;  {&lt;br /&gt;    LOGGER.info("received " + signal);&lt;br /&gt;&lt;br /&gt;    // Delegate to the existing handler after handling necessary clean-up.&lt;br /&gt;    handlers.get(signal).handle(signal);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Important: This API is not portable but heavily platform dependent as the signal name depends&lt;br /&gt;   * on the underying operating system. &lt;br /&gt;&lt;br /&gt;   * &lt;br /&gt;   * @param signalName&lt;br /&gt;   * @param signalHandler&lt;br /&gt;   */&lt;br /&gt;  public static void delegateHandler(final String signalName,&lt;br /&gt;                                     final SignalHandler signalHandler)&lt;br /&gt;  {&lt;br /&gt;    try { &lt;br /&gt;      Signal signal = new Signal(signalName);&lt;br /&gt;      SignalHandler oldhandler = Signal.handle(signal, signalHandler);&lt;br /&gt;    } finally { &lt;br /&gt;      handlers.put(signal, oldhandler);&lt;br /&gt;    } &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args)&lt;br /&gt;  {&lt;br /&gt;    final int LONG_TIME = 50000;&lt;br /&gt;&lt;br /&gt;    SignalHandler example = new CustomSignalHandler();&lt;br /&gt;    delegateHandler("TERM", example);&lt;br /&gt;    delegateHandler("INT", example);&lt;br /&gt;    delegateHandler("ABRT", example);&lt;br /&gt;&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;      Thread.sleep(LONG_TIME);&lt;br /&gt;    }&lt;br /&gt;    catch (InterruptedException ie)&lt;br /&gt;    {&lt;br /&gt;      ie.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br/&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/1610341979741183427-6253829507911758493?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6253829507911758493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6253829507911758493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6253829507911758493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6253829507911758493'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/07/handling-signals-in-java.html' title='Handling signals in Java'/><author><name>pseudonym</name><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-1610341979741183427.post-2042630169160184849</id><published>2009-07-17T08:35:00.001-07:00</published><updated>2009-07-17T08:35:02.283-07:00</updated><title type='text'>Advanced Linux Programming</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;There is a new free e-book on advanced linux programming available here at - &lt;a href='http://www.advancedlinuxprogramming.com/alp-folder'&gt;http://www.advancedlinuxprogramming.com/alp-folder&lt;/a&gt;  . &lt;br/&gt;&lt;br/&gt;The chapter list is as follows. &lt;br/&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Chapter 01 - Advanced Unix Programming with Linux&lt;/li&gt;&lt;li&gt;Chapter 02 - Writing Good GNU/Linux Software&lt;/li&gt;&lt;li&gt;Chapter 03 - Processes&lt;/li&gt;&lt;li&gt;Chapter 04 - Threads&lt;/li&gt;&lt;li&gt;Chapter 05 - Interprocess Communication&lt;/li&gt;&lt;li&gt;Chapter 06 - Mastering Linux&lt;/li&gt;&lt;li&gt;&lt;b&gt;Chapter 07 - The /proc File System&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Chapter 08 - Linux System Calls&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Chapter 09 - Inline Assembly Code&lt;/li&gt;&lt;li&gt;Chapter 10 - Security&lt;/li&gt;&lt;li&gt;Chapter 11 - A Sample GNU/Linux Application&lt;/li&gt;&lt;/ul&gt;Among the list of chapters - chapter 7 and chapter 8 to some extent are especially useful and well-written where there are some good hidden treasures even for a seasoned linux professional. &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;font face='Courier New'/&gt;&lt;br/&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/1610341979741183427-2042630169160184849?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/2042630169160184849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=2042630169160184849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2042630169160184849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2042630169160184849'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/07/advanced-linux-programming.html' title='Advanced Linux Programming'/><author><name>pseudonym</name><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-1610341979741183427.post-5613582622756809159</id><published>2009-07-01T11:48:00.000-07:00</published><updated>2010-02-08T11:39:27.355-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Core Dump'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Segmentation Fault - but no core dump ?</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;When I was working on a given binary - it gave me a "Segmentation Fault" but no core dump. &lt;br /&gt;&lt;br /&gt;Started with the usual suspects . &lt;br /&gt;* Checked the permission of the directory to see if the user has write permission to write the core file. It was ok. &lt;br /&gt;* Checked the /tmp directory just in case. &lt;br /&gt;&lt;br /&gt;Then I realized that I was working on bash, that sets core file size to be 0 automatically.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ ulimit -a&lt;br /&gt;core file size          (blocks, -c)   0&lt;br /&gt;data seg size           (kbytes, -d) unlimited&lt;br /&gt;scheduling priority             (-e) 20&lt;br /&gt;&lt;br /&gt;..&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Reset the same as below &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt;$ ulimit -c unlimited&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now I ran my executable again and yes , this time the core dump is available for processing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&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/1610341979741183427-5613582622756809159?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/5613582622756809159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=5613582622756809159' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5613582622756809159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5613582622756809159'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/07/segmentation-fault-but-no-core-dump.html' title='Segmentation Fault - but no core dump ?'/><author><name>pseudonym</name><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-1610341979741183427.post-5676452290630044155</id><published>2009-02-04T11:45:00.001-08:00</published><updated>2009-02-04T11:45:42.286-08:00</updated><title type='text'>Linux AIO Examples</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Tim Jones gives an &lt;a href='http://www.ibm.com/developerworks/linux/library/l-async/?ca=dgr-lnxw16UsingPOISIXAIOAPI'&gt;excellent introduction and motivation&lt;/a&gt; behind aio here.  All 2.6 kernels have aio as a standard feature now. &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/1610341979741183427-5676452290630044155?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/5676452290630044155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=5676452290630044155' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5676452290630044155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/5676452290630044155'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/02/linux-aio-examples.html' title='Linux AIO Examples'/><author><name>pseudonym</name><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-1610341979741183427.post-380058116181604831</id><published>2009-01-29T21:37:00.003-08:00</published><updated>2009-01-29T21:41:35.998-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud'/><title type='text'>Elastic Block Store</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Amazon comes up with another *potential* low-margin - high volume business by announcing &lt;a href='http://www.amazon.com/gp/browse.html?node=689343011'&gt;Elastic  Block Store&lt;/a&gt; today. &lt;br/&gt;The most interesting feature is of course the facility to provide block level storage. The S3 service is already extremely popular - thanks to getting away from the relational model (which sometimes could end up being an overkill ) and reducing the headache of IT management for a potential entrepreneur .&lt;br/&gt;&lt;br/&gt;EC2  service, no doubt - is much better to create your own instance of an image from scratch and use it. In spite of having free REST requests to the S3 service , the absence of persistence as such on the image instance was a drawback.&lt;br/&gt;&lt;br/&gt;EBS provides us with block-level storage volumes that could be attached to an EC2 instance. As opposed to the other tools that has a much stepper adoption curve ( s3 needs some sort of wrapper around REST - the popular being &lt;a href='https://jets3t.dev.java.net/'&gt;JetS3t&lt;/a&gt; ) - this is probably as simple as it could get and hence it might increase the adoption rate compared to the rest. &lt;br/&gt;&lt;br/&gt;I have not got the time to compare the pricing of EBS against the rest, but my guess is that people probably would not mind paying up for this given the level of comfort it gives to making the EC2 instances more usable.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-380058116181604831?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/380058116181604831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=380058116181604831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/380058116181604831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/380058116181604831'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/01/elastic-block-store.html' title='Elastic Block Store'/><author><name>pseudonym</name><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-1610341979741183427.post-6195294502451031597</id><published>2009-01-29T21:37:00.001-08:00</published><updated>2009-01-29T21:37:02.355-08:00</updated><title type='text'>Graphite - Visualization Tool</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;a href='http://www.orbitz.com/'&gt;Orbitz&lt;/a&gt;, the popular travel planning website,  had recently brought  some of their (previously proprietary) projects into the public domain by making them open source. &lt;br /&gt;&lt;br /&gt;&lt;a href='http://graphite.wikidot.com/'&gt;Graphite&lt;/a&gt; is a scalable, &lt;b&gt;real-time&lt;/b&gt; graph visualization tool, released under the Apache License. &lt;br /&gt;&lt;br /&gt;Some of the interesting aspects of the same  (courtesy, the &lt;a href='http://graphite.wikidot.com/faq'&gt;FAQ of the software&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; Written in Python, based on the &lt;a href='http://www.djangoproject.com/'&gt;Django&lt;/a&gt; project.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; The rendering engine is based on the &lt;a href='http://www.cairographics.org/'&gt;Cairo framework&lt;/a&gt;, the same rendering engine used for the rendering of content in the Firefox 3 browser. &lt;br /&gt;&lt;/li&gt;&lt;li&gt; The input data has to be a numeric time series. (This seems intuitive since graph visualization schemes, differences ought to be based on some quantitative measure eventually). And then, of course - any categorical metric could be mapped to preset numerical values to achieve a similar effect. &lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;Graphite, seems to achieve the scalability by storing the entries in a distributed in-memory database, similar to what LiveJournal implements using the &lt;a href='http://www.danga.com/memcached/'&gt; memcached &lt;/a&gt; service. And more recently, microsoft has started offering &lt;a href='http://www.microsoft.com/downloads/details.aspx?FamilyId=B24C3708-EEFF-4055-A867-19B5851E7CD2&amp;amp;displaylang=en'&gt;Velocity&lt;/a&gt; , a competing product in the same space (with subtle differences though- which I will cover later ).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6195294502451031597?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6195294502451031597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6195294502451031597' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6195294502451031597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6195294502451031597'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/01/graphite-visualization-tool.html' title='Graphite - Visualization Tool'/><author><name>pseudonym</name><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-1610341979741183427.post-8739495860883666452</id><published>2009-01-29T21:35:00.001-08:00</published><updated>2009-01-29T21:35:07.713-08:00</updated><title type='text'>Ct - Programming language for multi-core processor</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;With multi-core processors becoming the norm, the responsibility of exploiting the parallelism / improving the performance has increased on the software development rather than the hardware. &lt;br /&gt;&lt;br /&gt;Intel has recently come out with a prototype implementation of &lt;a href='http://www.informationweek.com/news/software/development/showArticle.jhtml?articleID=208403616'&gt;Ct, a new programming language&lt;/a&gt;, for multi-core processors.  As per the release notes, the learning curve of Ct is expected to be smoother, as the fundamental language construct seems to be based on the C/C++ programming language, in addition to the language specific features that enable the programmer to refer to parallelism. &lt;br /&gt;&lt;br /&gt;A brief introduction to the language construct is available &lt;a href='http://www.intel.com/technology/itj/2007/v11i4/7-future-proof/1-abstract.htm'&gt;here &lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;With multi-core systems - it obviously makes more sense to extract / specify data-level parallelism ( + related instructions), as opposed to &lt;a href='http://en.wikipedia.org/wiki/Instruction_level_parallelism'&gt;instruction level parallelism&lt;/a&gt; only, to get the best results.  New constructs are available in the programming language to specify the same. &lt;br /&gt; &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Mention of a new Generic Vector Type (TVEC), that exist in the  &lt;b&gt;managed&lt;/b&gt; space. It is important to note that TVECs could be a flat vector or a multi-dimensional vector. &lt;/li&gt;&lt;br /&gt;&lt;li&gt; Restricted operator overloading on TVEC objects, with the important restriction of allowing those with no &lt;a href='http://en.wikipedia.org/wiki/Side_effect_(computer_science)'&gt;side-effects&lt;/a&gt;.  &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;As a proof of concept, the examples listed in the tutorial talk about the &lt;a href='http://en.wikipedia.org/wiki/Black%E2%80%93Scholes'&gt;Black-Scholes option pricing model&lt;/a&gt; and the &lt;a href='http://en.wikipedia.org/wiki/Convolution'&gt;Convolution operator&lt;/a&gt; (widely applied in Computer Vision / Image processing applications). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I have not been able to confirm if the implementation + runtime is made available to the public yet. One of the components, The Threading building blocks, has been available as a &lt;a href='http://www.intel.com/cd/software/products/asmo-na/eng/294797.htm'&gt;open source project&lt;/a&gt; for sometime though. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This interesting release brings some interesting questions. &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; The last C++ standard (C++03) was written for a single-threaded abstract machine , and threading as yet - is not part of the current C++ standard (current, as supported by the compilers). With fragmented threading libraries across platforms and implementations, portability had always been an issue with threading libraries on C++. But more recently, with &lt;a href='http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html'&gt;Boost Threads&lt;/a&gt; providing a nice wrapper over the implementation-specific thread libraries - it is becoming less of a concern. And there is a very good chance that most of these primitives / APIs would be used in the upcoming &lt;a href='http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2320.html'&gt;C++0x standard&lt;/a&gt; as well. Given that, the standardization process of introducing thread support into the languages is a little bit late and C++ look-alikes specific to multi-core processors, pushed by the architecture vendor themselves, what would the first choice of technology developers to implement high frequency applications ? &lt;/li&gt;&lt;br /&gt;&lt;li&gt; Functions with no-side effects, &lt;a href='http://en.wikipedia.org/wiki/List_comprehension'&gt; List Comprehension&lt;/a&gt; are all first class citizens, welcome in the &lt;a href='http://en.wikipedia.org/wiki/Functional_programming'&gt;Functional Programming&lt;/a&gt; world.  More specifically, recently , I am fascinated with the &lt;a href='http://www.erlang.org/'&gt;Erlang Programming Language&lt;/a&gt; with native constructs supporting concurrency (no shared memory, thanks) and based on message passing. So - can the job of extracting better performance from multi-core processors be split between providing a robust interpreter / compiler for the functional programming languages and the functional programming language developer ? &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;We need to wait and see the way things take shape regarding the above mentioned scenarios.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8739495860883666452?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8739495860883666452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8739495860883666452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8739495860883666452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8739495860883666452'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/01/ct-programming-language-for-multi-core.html' title='Ct - Programming language for multi-core processor'/><author><name>pseudonym</name><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-1610341979741183427.post-4308620062565418576</id><published>2009-01-27T19:56:00.001-08:00</published><updated>2010-02-08T11:40:03.316-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JMS'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='ActiveMQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>JMS (ActiveMQ) using Spring</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;For a recent project - I wanted to get started with JMS implementations and finally settled on &lt;a href="http://activemq.apache.org/"&gt;ActiveMQ&lt;/a&gt; . I chose the Spring framework because of the range of integration options it gives us with the other parts of the stack.&lt;br /&gt;&lt;br /&gt;Here is the sample code fragment using the same. Pre-requisites: Download Apache ActiveMQ 5.2.0 and Spring JMS 2.5.6.A (use ivy from the&lt;a href="http://www.springsource.com/repository/app/bundle/version/detail?name=org.springframework.transaction&amp;amp;version=2.5.6.A&amp;amp;searchType=bundlesByName&amp;amp;searchQuery=spring+transaction"&gt; spring repository&lt;/a&gt; to grab the same).&lt;br /&gt;&lt;br /&gt;Launch the activemq binary , before running the program below. The binary is usually available in $ACTIVEMQ_HOME/bin/activemq. The binary launches the tcp listening endpoint using the openwire protocol. You will see a line similar to below&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain"&gt;INFO  TransportServerThreadSupport   - Listening for connections at: &amp;lt;b&amp;gt;tcp://hostname:61616&amp;lt;/b&amp;gt;&lt;br /&gt;INFO  TransportConnector             - Connector &amp;lt;b&amp;gt;openwire&amp;lt;/b&amp;gt; Started&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;package mymq;&lt;br /&gt;&lt;br /&gt;import java.io.Serializable;&lt;br /&gt;import java.text.DateFormat;&lt;br /&gt;import java.text.SimpleDateFormat;&lt;br /&gt;import java.util.Date;&lt;br /&gt;import java.util.concurrent.ExecutorService;&lt;br /&gt;import java.util.concurrent.Executors;&lt;br /&gt;&lt;br /&gt;import javax.jms.ConnectionFactory;&lt;br /&gt;import javax.jms.JMSException;&lt;br /&gt;import javax.jms.Message;&lt;br /&gt;import javax.jms.Session;&lt;br /&gt;&lt;br /&gt;import org.apache.activemq.ActiveMQConnectionFactory;&lt;br /&gt;import org.apache.activemq.command.ActiveMQObjectMessage;&lt;br /&gt;import org.springframework.jms.JmsException;&lt;br /&gt;import org.springframework.jms.core.JmsTemplate;&lt;br /&gt;import org.springframework.jms.core.MessageCreator;&lt;br /&gt;&lt;br /&gt;public class Producer {&lt;br /&gt;&lt;br /&gt;public static class FlyWeight implements Serializable {&lt;br /&gt;&lt;br /&gt;public FlyWeight(String _msg) {&lt;br /&gt;msg = _msg;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private String msg;&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public String toString() {&lt;br /&gt;return msg;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* @param args&lt;br /&gt;* @throws JmsException&lt;br /&gt;*/&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;Producer prod = new Producer();&lt;br /&gt;prod.startProducer();&lt;br /&gt;prod.startConsumer();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void startProducer() {&lt;br /&gt;service.submit(new Runnable() {&lt;br /&gt;&lt;br /&gt;public void run() {&lt;br /&gt;try {&lt;br /&gt;JmsTemplate template = new JmsTemplate(getConnectionFactory());&lt;br /&gt;template.afterPropertiesSet();&lt;br /&gt;final DateFormat fmt = new SimpleDateFormat("HH:mm:ss");&lt;br /&gt;while (true) {&lt;br /&gt;Thread.sleep(1000 * 2);&lt;br /&gt;template.send(QUEUE_NAME, new MessageCreator() {&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public Message createMessage(Session session) throws JMSException {&lt;br /&gt;ActiveMQObjectMessage msg = new ActiveMQObjectMessage();&lt;br /&gt;msg.setObject(new FlyWeight(fmt.format(new Date())));&lt;br /&gt;return msg;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;} catch (Exception ex) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void startConsumer() {&lt;br /&gt;service.submit(new Runnable() {&lt;br /&gt;public void run() {&lt;br /&gt;try {&lt;br /&gt;JmsTemplate template = new JmsTemplate(getConnectionFactory());&lt;br /&gt;template.afterPropertiesSet();&lt;br /&gt;while (true) {&lt;br /&gt;Thread.sleep(1000 * 2);&lt;br /&gt;Message msg = template.receive(QUEUE_NAME);&lt;br /&gt;if (msg instanceof ActiveMQObjectMessage) {&lt;br /&gt;ActiveMQObjectMessage text = (ActiveMQObjectMessage) msg;&lt;br /&gt;System.out.println(text.getObject());&lt;br /&gt;} else {&lt;br /&gt;System.err.println("Message type invalid " + msg.getClass());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;} catch (Exception ex) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static ConnectionFactory getConnectionFactory() {&lt;br /&gt;ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();&lt;br /&gt;// Default port.&lt;br /&gt;// Important: The script 'activemq' must be launched for this program to&lt;br /&gt;// work&lt;br /&gt;// By default - activemq binds a tcp listener (openwire protocol)&lt;br /&gt;// listening to requests at the same.&lt;br /&gt;factory.setBrokerURL("tcp://localhost:61616");&lt;br /&gt;return factory;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static final String QUEUE_NAME = "MyQueue";&lt;br /&gt;&lt;br /&gt;static ExecutorService service = Executors.newFixedThreadPool(2);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-4308620062565418576?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/4308620062565418576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=4308620062565418576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/4308620062565418576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/4308620062565418576'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2009/01/jms-activemq-using-spring_27.html' title='JMS (ActiveMQ) using Spring'/><author><name>pseudonym</name><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-1610341979741183427.post-6484860290381843908</id><published>2008-12-21T09:09:00.001-08:00</published><updated>2009-07-08T17:41:23.602-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>Creating a new user in mysql</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;If we want to create a new user in mysql , we can use the following command.&lt;br /&gt;&lt;pre class="brush:sql"&gt;&lt;br /&gt;&lt;br /&gt;mysql &amp;gt; create database newdb&lt;br /&gt;      &amp;gt; grant all privileges on newdb.* to newuser@"localhost" identified by 'newpassword';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This would create the new user identified by that username and password. This can be validated by logging in again.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:sql"&gt;&lt;br /&gt;mysql &amp;gt; mysql -u newuser -p &lt;br /&gt;Enter password:  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So - now we have created this user and password and tested the same.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6484860290381843908?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6484860290381843908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6484860290381843908' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6484860290381843908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6484860290381843908'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/creating-new-user-in-mysql.html' title='Creating a new user in mysql'/><author><name>pseudonym</name><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-1610341979741183427.post-103427015308197920</id><published>2008-12-18T15:44:00.001-08:00</published><updated>2010-02-08T11:40:56.784-08:00</updated><title type='text'>Solr - Http Caching enabled by default - how to disable the same.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;a href='http://lucene.apache.org/solr/'&gt;Solr &lt;/a&gt;is a system , that provides service access (among many other things)  to the underlying &lt;a href='http://lucene.apache.org/'&gt;Lucene&lt;/a&gt; implementation  and provides a much faster distributed search indexing / retrieval feature.&lt;br /&gt;&lt;br /&gt;Much of the configuration in the Solr application is based on solrconfig.xml in the solr.solr.home directory .  Among the important set of options - that might be useful for development is ( especially when testing responses over the browser ) could be, disabling http caching so as to not to continue to clear the browser cache before viewing the page. &lt;br /&gt;&lt;br /&gt;This is done as follows, by setting the never304 ,attribute to be true for httpCaching as follows. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;httpcaching never304="true" .... /&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This should disable httpCaching so that we do not need to refresh the browser. But for the deployment in production - make sure to deploy the same with the property false ,(as it was by default). &lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-103427015308197920?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/103427015308197920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=103427015308197920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/103427015308197920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/103427015308197920'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/solr-http-caching-enabled-by-default.html' title='Solr - Http Caching enabled by default - how to disable the same.'/><author><name>pseudonym</name><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-1610341979741183427.post-3711919879256259509</id><published>2008-12-16T11:51:00.001-08:00</published><updated>2008-12-16T11:51:31.205-08:00</updated><title type='text'>JMeter - JUnit Sampler</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;JMeter has a JUnit sampler since release  . More details are available in the following &lt;a href='http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf'&gt;PDF&lt;/a&gt;.  I will post an example once I get my first cut example working on the same. &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/1610341979741183427-3711919879256259509?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/3711919879256259509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=3711919879256259509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3711919879256259509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3711919879256259509'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/jmeter-junit-sampler.html' title='JMeter - JUnit Sampler'/><author><name>pseudonym</name><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-1610341979741183427.post-8586206830325807767</id><published>2008-12-10T20:28:00.001-08:00</published><updated>2008-12-12T08:20:53.348-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Encryption library for Java - JBCrypt</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;I was looking for a good encryption library for Java. &lt;br/&gt;&lt;br/&gt;The &lt;a href='http://www.mindrot.org/projects/jBCrypt/'&gt;JBCrypt&lt;/a&gt; library (ported from BCrypt, a C++ implementation) is a very useful one for the given purpose. &lt;br/&gt;&lt;br/&gt;An &lt;a href='http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ'&gt;introductory article in GWT incubator&lt;/a&gt; discusses the plugin in detail. &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/1610341979741183427-8586206830325807767?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8586206830325807767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8586206830325807767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8586206830325807767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8586206830325807767'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/encryption-library-for-java-jbcrypt.html' title='Encryption library for Java - JBCrypt'/><author><name>pseudonym</name><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-1610341979741183427.post-1352924934276050639</id><published>2008-12-09T13:06:00.001-08:00</published><updated>2009-07-08T17:35:19.052-07:00</updated><title type='text'>Lucene 2.4.0 - Hello World</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Lucene 2.4.0 - Hello World application to play around with indexing / searching capabilities of Lucene. The original code is attributed to Lucene tutorial mentioned &lt;a href='http://www.lucenetutorial.com/lucene-in-5-minutes.html'&gt;here&lt;/a&gt;. &lt;br/&gt;&lt;br/&gt;Some of the API in the code like Hits have been deprecated that creates costly Document objects. The revised code, after addressing compilation warnings is shown herewith. &lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre  class="brush:java"&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;import org.apache.lucene.analysis.standard.StandardAnalyzer;&lt;br /&gt;import org.apache.lucene.document.Document;&lt;br /&gt;import org.apache.lucene.document.Field;&lt;br /&gt;import org.apache.lucene.index.IndexWriter;&lt;br /&gt;import org.apache.lucene.index.IndexWriter.MaxFieldLength;&lt;br /&gt;import org.apache.lucene.queryParser.ParseException;&lt;br /&gt;import org.apache.lucene.queryParser.QueryParser;&lt;br /&gt;import org.apache.lucene.search.IndexSearcher;&lt;br /&gt;import org.apache.lucene.search.Query;&lt;br /&gt;import org.apache.lucene.search.ScoreDoc;&lt;br /&gt;import org.apache.lucene.search.TopDocs;&lt;br /&gt;import org.apache.lucene.store.Directory;&lt;br /&gt;import org.apache.lucene.store.RAMDirectory;&lt;br /&gt;&lt;br /&gt;public class HelloLucene {&lt;br /&gt;  public static void main(String[] args) throws IOException, ParseException {&lt;br /&gt;    // 1. create the index&lt;br /&gt;    Directory index = new RAMDirectory();&lt;br /&gt;    IndexWriter w = new IndexWriter(index, new StandardAnalyzer(), true, new MaxFieldLength(25000));&lt;br /&gt;  &lt;br /&gt;    addDoc(w, "Lucene in Action");&lt;br /&gt;    addDoc(w, "Lucene for Dummies");&lt;br /&gt;    addDoc(w, "Managing Gigabytes");&lt;br /&gt;    addDoc(w, "The Art of Computer Science");&lt;br /&gt;    w.close();&lt;br /&gt;&lt;br /&gt;    // 2. query&lt;br /&gt;    String querystr = args.length &gt; 0 ? args[0] : "lucene";&lt;br /&gt;    Query q = new QueryParser("title", new StandardAnalyzer()).parse(querystr);&lt;br /&gt;&lt;br /&gt;    // 3. search&lt;br /&gt;    IndexSearcher s = new IndexSearcher(index);&lt;br /&gt;    TopDocs docs = s.search(q, null, 100);&lt;br /&gt;&lt;br /&gt;    // 4. display results&lt;br /&gt;    System.out.println("Found " + docs.totalHits + " hits.");&lt;br /&gt;    ScoreDoc [] hits = docs.scoreDocs;&lt;br /&gt;    int i = 0;&lt;br /&gt;    for(ScoreDoc scoreDoc : hits) {&lt;br /&gt;      System&lt;br /&gt;.out.println((i + 1) + ". " + s.doc(scoreDoc.doc) );&lt;br /&gt;       ++i;&lt;br /&gt;    }&lt;br /&gt;    s.close();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  private static void addDoc(IndexWriter w, String value) throws IOException {&lt;br /&gt;    Document doc = new Document();&lt;br /&gt;    doc.add(new Field("title", value, Field.Store.YES, Field.Index.ANALYZED));&lt;br /&gt;    w.addDocument(doc);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&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/1610341979741183427-1352924934276050639?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/1352924934276050639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=1352924934276050639' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1352924934276050639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1352924934276050639'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/lucene-240-hello-world.html' title='Lucene 2.4.0 - Hello World'/><author><name>pseudonym</name><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-1610341979741183427.post-6087604529541293296</id><published>2008-12-04T21:53:00.001-08:00</published><updated>2010-02-08T11:41:33.372-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>GWT - 1.5.3 - Ubuntu - libstdc++.so.5: cannot open shared object file</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Started my work successfully on GWT 1.5.3 for a test project of mine. &lt;br /&gt;&lt;br /&gt;I followed the sample instructions as given in the GWT &lt;a href='http://code.google.com/webtoolkit/gettingstarted.html'&gt;website&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;After using the &lt;i&gt;projectCreator&lt;/i&gt; and &lt;i&gt;applicationCreator&lt;/i&gt; scripts - when I tried to import the project in eclipse and run it - I encountered the following error trace. &lt;br /&gt;&lt;verbatim&gt;&lt;b&gt;/opt/software/gwt-linux/mozilla-1.7.12/libxpcom.so:libstdc++.so.5: cannot open shared object file: No such file or directory&lt;br /&gt;&lt;/b&gt; at java.lang.ClassLoader$NativeLibrary.load(Native Method)&lt;br /&gt;at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)&lt;br /&gt;at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)&lt;br /&gt;at java.lang.Runtime.load0(Runtime.java:770)&lt;br /&gt;at java.lang.System.load(System.java:1005)&lt;br /&gt;at com.google.gwt.dev.shell.moz.MozillaInstall.load(MozillaInstall.java:190)&lt;br /&gt;at com.google.gwt.dev.BootStrapPlatform.go(BootStrapPlatform.java:40)&lt;br /&gt;at com.google.gwt.dev.GWTShell.main(GWTShell.java:318)&lt;br /&gt;&lt;/verbatim&gt;&lt;br /&gt;I was working on Ubuntu 8.04. &lt;br /&gt;&lt;br /&gt;I did the following &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: bash"&gt; sudo apt-get install libstdc++5&lt;br /&gt;&lt;/pre&gt;to get rid of the above mentioned error to install the missing .so files.  That fixed the issue.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6087604529541293296?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6087604529541293296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6087604529541293296' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6087604529541293296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6087604529541293296'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/12/gwt-153-ubuntu-libstdcso5-cannot-open_04.html' title='GWT - 1.5.3 - Ubuntu - libstdc++.so.5: cannot open shared object file'/><author><name>pseudonym</name><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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610341979741183427.post-3575896965896379675</id><published>2008-02-01T12:10:00.000-08:00</published><updated>2008-02-01T12:12:59.887-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='boost'/><category scheme='http://www.blogger.com/atom/ns#' term='MPI'/><title type='text'>Boost MPI implementation</title><content type='html'>Boost got a new MPI approved in its vast list of libraries - &lt;br /&gt;&lt;a href="http://www.osl.iu.edu/~dgregor/boost.mpi/doc/index.html"&gt;Boost MPI&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Boost MPI is the way to go if we are planning to use it for high frequency applications.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-3575896965896379675?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/3575896965896379675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=3575896965896379675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3575896965896379675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3575896965896379675'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/02/boost-mpi-implementation.html' title='Boost MPI implementation'/><author><name>Pseudonym</name><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-1610341979741183427.post-6337100368980696042</id><published>2008-01-29T22:41:00.000-08:00</published><updated>2009-07-02T08:34:30.922-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='alignment'/><title type='text'>Alignment</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Sometimes when we are coding on architectures with limited memory footprints , we might end up writing a memory allocator ourselves (more often than not ). Having said that - one of the important design considerations for a memory allocator is getting an address that is probably aligned with the underlying architecture. &lt;br/&gt;&lt;br/&gt;Here is the simple code fragment to do the alignment for a given size. &lt;br/&gt;Note that - the align function returns a new address &lt;b&gt;only when&lt;/b&gt; the input address is not aligned by itself. &lt;br/&gt;&lt;br/&gt;&lt;pre&gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;/* align address to be a multiple of n. */&lt;br /&gt;void* align(void* memory, int alignment)&lt;br /&gt;{&lt;br /&gt; unsigned char* ptr;&lt;br /&gt; unsigned int offset;&lt;br /&gt;&lt;br /&gt; ptr =(unsigned char*)memory;&lt;br /&gt; offset =(unsigned int)ptr % alignment;&lt;br /&gt;&lt;br /&gt; return offset ? (ptr + alignment - offset ): ptr;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt; void * a;&lt;br /&gt;&lt;br /&gt; a = malloc(sizeof(char) * 10);&lt;br /&gt;&lt;br /&gt; printf("\nAddress: 0x%p ", a ); &lt;br /&gt; printf("\nAligned Address:0x%p ",  align(a, sizeof(int) ));&lt;br /&gt; return EXIT_SUCCESS;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-articles'&gt;Related articles by Zemanta:&lt;ul class='zemanta-articles'&gt;&lt;li&gt;&lt;a href='http://teabreak.pk/simplest-way-to-bubble-sort-an-array-in-c-259/17344/'&gt;Simplest way to Bubble Sort an Array in C++&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href='http://www.mysqlperformanceblog.com/2009/06/15/how-to-pretty-print-mycnf-with-a-one-liner/'&gt; How to pretty-print my.cnf with a one-liner &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href='http://www.canonware.com/%7Ettt/2009/05/mr-malloc-gets-schooled.html'&gt; Mr. Malloc gets schooled &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href='http://www.mysqlperformanceblog.com/2009/02/12/how-much-memory-can-mysql-use-in-the-worst-case/'&gt;How much memory can MySQL use in the worst case?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;a title='Reblog this post [with Zemanta]' href='http://reblog.zemanta.com/zemified/95e534b0-a7c1-4efc-b107-4dcbbd5d881a/' class='zemanta-pixie-a'&gt;&lt;img alt='Reblog this post [with Zemanta]' src='http://img.zemanta.com/reblog_e.png?x-id=95e534b0-a7c1-4efc-b107-4dcbbd5d881a' class='zemanta-pixie-img'/&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6337100368980696042?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6337100368980696042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6337100368980696042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6337100368980696042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6337100368980696042'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/alignment.html' title='Alignment'/><author><name>Pseudonym</name><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-1610341979741183427.post-2627153822169727766</id><published>2008-01-24T21:17:00.000-08:00</published><updated>2008-01-24T21:50:29.337-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='STL'/><category scheme='http://www.blogger.com/atom/ns#' term='Boost.MultiIndex'/><category scheme='http://www.blogger.com/atom/ns#' term='boost'/><title type='text'>C++ STL list with logarithmic lookup ??</title><content type='html'>If we talk about standard C++ SQL (C++03, at least) looking for a data structure to simulate a list with logarithmic lookup, the question will appear to be contradictory to begin with. &lt;br /&gt;&lt;br /&gt;If we are looking for a data structure whose access pattern is different from that of the underlying storage mechanism - &lt;a href="http://www.boost.org/libs/multi_index/doc/tutorial/index.html"&gt;Boost MultiIndex&lt;/a&gt; is an option worth spending at.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-2627153822169727766?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/2627153822169727766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=2627153822169727766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2627153822169727766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2627153822169727766'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/c-stl-list-with-logarithmic-lookup.html' title='C++ STL list with logarithmic lookup ??'/><author><name>Pseudonym</name><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-1610341979741183427.post-439036020773203557</id><published>2008-01-23T07:48:00.000-08:00</published><updated>2009-07-08T17:38:58.254-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='STL'/><category scheme='http://www.blogger.com/atom/ns#' term='atexit'/><title type='text'>C++ - atexit implementation</title><content type='html'>More than one occasion - when a program exits - we may want to do some cleanup operations and notify other processes ( this becomes extremely important in the case of child-parent processes). &lt;br /&gt;&lt;br /&gt;C/C++ does have a function called atexit() that does that. &lt;br /&gt;&lt;br /&gt;A sample code fragment to use the same is as follows. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:c++"&gt;&lt;br /&gt;#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;void do1()&lt;br /&gt;{&lt;br /&gt; std::cout &lt;&lt; "do1 implementation\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void do2()&lt;br /&gt;{&lt;br /&gt; std::cout &lt;&lt; "do2 implementation\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt; atexit(do1);&lt;br /&gt; atexit(do2);&lt;br /&gt;&lt;br /&gt; exit(EXIT_SUCCESS);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Sample output:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:bash"&gt;&lt;br /&gt;$ g++ -Wall -Werror testexit.cpp&lt;br /&gt;[noname@localhost test]$ ./a.out&lt;br /&gt;do2 implementation&lt;br /&gt;do1 implementation&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-439036020773203557?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/439036020773203557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=439036020773203557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/439036020773203557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/439036020773203557'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/c-atexit-implementation.html' title='C++ - atexit implementation'/><author><name>Pseudonym</name><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-1610341979741183427.post-2279263386829899160</id><published>2008-01-21T17:54:00.001-08:00</published><updated>2008-01-21T17:54:46.174-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Boost Threads'/><title type='text'>Tutorial on Boost Threads</title><content type='html'>If you are looking for a tutorial on Boost Threads, start &lt;a href="http://www.ddj.com/cpp/184401518"&gt; here &lt;/a&gt; .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-2279263386829899160?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/2279263386829899160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=2279263386829899160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2279263386829899160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2279263386829899160'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/tutorial-on-boost-threads.html' title='Tutorial on Boost Threads'/><author><name>Pseudonym</name><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-1610341979741183427.post-8116977929145173275</id><published>2008-01-09T15:07:00.000-08:00</published><updated>2008-01-09T15:13:33.764-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='Distributed Systems'/><title type='text'>Books on Design Patterns for concurrent / networked objects</title><content type='html'>One of the interesting books on concurrent / networked objects is - &lt;br /&gt;&lt;a href="http://www.amazon.com/Pattern-Oriented-Software-Architecture-Concurrent-Networked/dp/0471606952"&gt;Pattern-Oriented Software Architecture Volume 2: Patterns for Concurrent and Networked Objects&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8116977929145173275?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8116977929145173275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8116977929145173275' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8116977929145173275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8116977929145173275'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/books-on-design-patterns-for-concurrent.html' title='Books on Design Patterns for concurrent / networked objects'/><author><name>Pseudonym</name><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-1610341979741183427.post-1769437211663482708</id><published>2008-01-09T12:14:00.000-08:00</published><updated>2008-01-09T12:19:33.208-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='epoll'/><category scheme='http://www.blogger.com/atom/ns#' term='boost'/><category scheme='http://www.blogger.com/atom/ns#' term='asio'/><title type='text'>Boost ASIO library  for high performance networking servers</title><content type='html'>If anybody is venturing into developing networking libraries in C++ , the ACE framework is the one that strikes your mind first. &lt;br /&gt;&lt;br /&gt;Recently came across the library called boost asio - available &lt;a href="http://asio.sourceforge.net/"&gt;here&lt;/a&gt; . &lt;br /&gt;&lt;br /&gt;Boost ASIO definitely makes things much easy and portable. If the application we are developing needs to be truly portable - the fact that asio is part of the boost framework guarantees portability by definition ( across a large number of compilers across many platforms). &lt;br /&gt;&lt;br /&gt;There is also an interesting &lt;a href="http://cplusplus-soup.blogspot.com/2006/12/boost.html"&gt;article&lt;/a&gt; on the design patterns to be used by the boost library available here. &lt;br /&gt;&lt;br /&gt;That makes interesting reading for sure.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-1769437211663482708?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/1769437211663482708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=1769437211663482708' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1769437211663482708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1769437211663482708'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2008/01/boost-asio-library-for-high-performance.html' title='Boost ASIO library  for high performance networking servers'/><author><name>Pseudonym</name><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-1610341979741183427.post-6635720514793222910</id><published>2007-12-26T17:00:00.000-08:00</published><updated>2009-07-08T17:37:34.391-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process. parent'/><category scheme='http://www.blogger.com/atom/ns#' term='alive'/><category scheme='http://www.blogger.com/atom/ns#' term='child'/><title type='text'>Checking if a process is alive or not.</title><content type='html'>In a multi-processing system - if we want to check if a given child process is alive or not (after forking it) for a longer period of time - we could send a signal 0 to the process using the kill API. &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:cpp"&gt;&lt;br /&gt;   #include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;    #include &amp;lt;signal.h&amp;gt;&lt;br /&gt;&lt;br /&gt;    int kill(pid_t pid, int sig);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Use this API to send a signal of 0. If the errno is set to ESRCH - then the process had most probably exited.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-6635720514793222910?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/6635720514793222910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=6635720514793222910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6635720514793222910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/6635720514793222910'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/checking-if-process-is-alive-or-not.html' title='Checking if a process is alive or not.'/><author><name>Pseudonym</name><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-1610341979741183427.post-8278036481068639640</id><published>2007-12-24T00:42:00.000-08:00</published><updated>2007-12-24T00:43:16.531-08:00</updated><title type='text'>Probability</title><content type='html'>Interesting article about probability &lt;a href="http://mathforum.org/library/drmath/view/56503.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8278036481068639640?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8278036481068639640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8278036481068639640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8278036481068639640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8278036481068639640'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/probability.html' title='Probability'/><author><name>Pseudonym</name><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-1610341979741183427.post-1634785592625589335</id><published>2007-12-21T14:29:00.000-08:00</published><updated>2007-12-21T14:30:42.437-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='call stack'/><category scheme='http://www.blogger.com/atom/ns#' term='backtrace'/><title type='text'>Want to trace function call stack on Linux</title><content type='html'>If you want to trace function call stack on a Linux box - then we can use backtrace family of functions on GNU/Linux. &lt;br /&gt;&lt;br /&gt;For more details regarding the API and examples - refer &lt;a href="http://www.gnu.org/software/libc/manual/html_node/Backtraces.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-1634785592625589335?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/1634785592625589335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=1634785592625589335' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1634785592625589335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/1634785592625589335'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/want-to-trace-function-call-stack-on.html' title='Want to trace function call stack on Linux'/><author><name>Pseudonym</name><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-1610341979741183427.post-7606105251047741557</id><published>2007-12-19T15:05:00.000-08:00</published><updated>2007-12-19T16:37:58.062-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='-fpic'/><title type='text'>-fpic OR -fPIC</title><content type='html'>When preparing dynamic libraries on Linux, there is always a choice about selecting -fpic / -fPIC. &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The difference lies mostly on RISC architectures. -fpic seems to take lesser number of instructions as compared to -fPIC . &lt;br /&gt;&lt;br /&gt;For more details - refer to Section 2, in the document - "How to write Shared Libraries" by Ulrich Drepper.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-7606105251047741557?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/7606105251047741557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=7606105251047741557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7606105251047741557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/7606105251047741557'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/fpic-or-fpic.html' title='-fpic OR -fPIC'/><author><name>Pseudonym</name><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-1610341979741183427.post-8703222113037577427</id><published>2007-12-19T11:30:00.000-08:00</published><updated>2007-12-19T11:31:36.095-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shared Libraries'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>How to write shared libraries</title><content type='html'>Ulrich Drepper got this nice &lt;a href="http://people.redhat.com/drepper/dsohowto.pdf"&gt;PDF document&lt;/a&gt;, explaining how to write shared libraries on Linux. A must read before anyone ventures onto writing one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-8703222113037577427?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/8703222113037577427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=8703222113037577427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8703222113037577427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/8703222113037577427'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/how-to-write-shared-libraries.html' title='How to write shared libraries'/><author><name>Pseudonym</name><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-1610341979741183427.post-4769653584633772779</id><published>2007-12-18T19:01:00.000-08:00</published><updated>2007-12-18T19:06:08.105-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shared Libraries'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='dlsym'/><title type='text'>Resolving unresolved symbol error in Linux shared libraries</title><content type='html'>Frequently we used to come across a case in which when we create shared libraries on a Linux box and try dynamic loading using 'dlsym' methods - the load fails with unresolved symbols error. &lt;br /&gt;&lt;br /&gt;InformIT hosts &lt;a href="http://www.informit.com/articles/article.aspx?p=22435&amp;rl=1"&gt;a wonderful article&lt;/a&gt;  on the different techniques on resolving these errors.&lt;br /&gt;&lt;br /&gt;Option 1:&lt;br /&gt;&lt;br /&gt;"To generate an executable that exports all of its functions and variables dynamically, specify the compiler flag -Wl,-export-dynamic when you link your executable"&lt;br /&gt;&lt;br /&gt;Option 2:&lt;br /&gt;&lt;br /&gt;"Your main executable may load other shared libraries at runtime, using dlopen. By default, they cannot see each other's dynamic symbols. You can make these libraries' symbols visible to each other by specifying the bitwise or of the value RTLD_GLOBAL in the second argument to dlopen."&lt;br /&gt;&lt;br /&gt;Specifically I like Option 1 as it makes me aware of the linking going. RTLD_GLOBAL seems too generic to me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-4769653584633772779?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/4769653584633772779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=4769653584633772779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/4769653584633772779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/4769653584633772779'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/resolving-unresolved-symbol-error-in.html' title='Resolving unresolved symbol error in Linux shared libraries'/><author><name>Pseudonym</name><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-1610341979741183427.post-3963249635674537781</id><published>2007-12-01T13:28:00.000-08:00</published><updated>2007-12-01T16:24:12.505-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gethostbyaddr'/><category scheme='http://www.blogger.com/atom/ns#' term='ipv6'/><title type='text'>Why gethostbyname is evil</title><content type='html'>Ulrich Drepper discusses why gethostbyname is evil in his &lt;A href="http://udrepper.livejournal.com/16116.html"&gt;post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Moral of the story: Use gethostbyaddr even if we are not talking about IPv6 .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-3963249635674537781?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/3963249635674537781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=3963249635674537781' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3963249635674537781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/3963249635674537781'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/why-gethostbyaddr-is-evil.html' title='Why gethostbyname is evil'/><author><name>Pseudonym</name><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-1610341979741183427.post-2249063737161450225</id><published>2007-12-01T13:16:00.000-08:00</published><updated>2007-12-01T13:17:32.501-08:00</updated><title type='text'>Robust Futex</title><content type='html'>A wonderful commentary on robust futexes by Ingo Molnar available &lt;a href="http://lxr.linux.no/source/Documentation/robust-futexes.txt"&gt;here &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610341979741183427-2249063737161450225?l=mutexlock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mutexlock.blogspot.com/feeds/2249063737161450225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610341979741183427&amp;postID=2249063737161450225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2249063737161450225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610341979741183427/posts/default/2249063737161450225'/><link rel='alternate' type='text/html' href='http://mutexlock.blogspot.com/2007/12/robust-futex.html' title='Robust Futex'/><author><name>Pseudonym</name><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></feed>
