<?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-4161148738347405259</id><updated>2012-02-16T02:34:14.868-08:00</updated><category term='scripting'/><category term='Python'/><category term='xml'/><category term='physics engines'/><category term='iPhone'/><category term='CMake'/><category term='html5'/><category term='shell'/><category term='unix'/><category term='linking'/><category term='perl'/><category term='Networking'/><category term='Safari'/><category term='Cocoa'/><category term='iPad'/><category term='OSX'/><category term='gaming'/><category term='svn'/><category term='dylib'/><category term='CoreAnimateion'/><title type='text'>Tech Nomad</title><subtitle type='html'>Commentary on my technology exploration...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-1665460444397998381</id><published>2010-10-22T12:55:00.000-07:00</published><updated>2010-10-22T12:55:10.331-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='physics engines'/><category scheme='http://www.blogger.com/atom/ns#' term='gaming'/><title type='text'>Physics engines for Iphone</title><content type='html'>For some reason today I began browsing for physics engine for Iphone. JIC I get an idea to develop a game kinds...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Chipmunk_physics_engine"&gt;Chipmunk&lt;/a&gt; and &lt;a href="http://cocos2d.org/index.html"&gt;cocos2d&lt;/a&gt; interested me.&lt;br /&gt;&lt;br /&gt;Did a bit of googling and cocos2d really simple. I found this great &lt;a href="http://www.youtube.com/user/SDKTutor"&gt;youtube channel&lt;/a&gt;&amp;nbsp;with some useful cocos2d tutorial. I'll play around with cocos2d for a while and then probably look in to chimpmunk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-1665460444397998381?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/1665460444397998381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/10/physics-engines-for-iphone.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/1665460444397998381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/1665460444397998381'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/10/physics-engines-for-iphone.html' title='Physics engines for Iphone'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-5728407685949913254</id><published>2010-08-15T20:58:00.000-07:00</published><updated>2010-08-15T20:58:27.195-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html5'/><title type='text'>Delve into HTML5</title><content type='html'>Following link points to good resources on HTML5&lt;br /&gt;&lt;br /&gt;&lt;a href="http://playground.html5rocks.com/"&gt;http://playground.html5rocks.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-5728407685949913254?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/5728407685949913254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/delve-into-html5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/5728407685949913254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/5728407685949913254'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/delve-into-html5.html' title='Delve into HTML5'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-1544336216640363598</id><published>2010-08-06T08:48:00.000-07:00</published><updated>2010-08-06T08:48:12.408-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Validating Shell Script Arguments...</title><content type='html'>Following are the few links that helped me to validating shell script arguments.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://aplawrence.com/Unix/getopts.html"&gt;http://aplawrence.com/Unix/getopts.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.bash-hackers.org/scripting/posparams"&gt;http://wiki.bash-hackers.org/scripting/posparams&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.faqs.org/docs/air/tsshell.html"&gt;http://www.faqs.org/docs/air/tsshell.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-1544336216640363598?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/1544336216640363598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/validating-shell-script-arguments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/1544336216640363598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/1544336216640363598'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/validating-shell-script-arguments.html' title='Validating Shell Script Arguments...'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-6297567899285319425</id><published>2010-08-03T07:02:00.000-07:00</published><updated>2010-08-03T07:02:12.434-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CMake'/><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>CMake on OSX</title><content type='html'>Here I create my first CMakeList for OSX to create a library&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;cmake_minimum_required(VERSION 2.6)&lt;br /&gt;project (cmakeTest)&lt;br /&gt;&lt;br /&gt;set(PROJECT_ROOT $ENV{PROJECT_ROOT})&lt;br /&gt;set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)&lt;br /&gt;set(CMAKE_OSX_ARCHITECTURES "i386")&lt;br /&gt;&lt;br /&gt;SET(CMAKE_AR ar)&lt;br /&gt;add_definitions( -Wall )&lt;br /&gt;&lt;br /&gt;set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./CMAKE_build)&lt;br /&gt;&lt;br /&gt;set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ./CMAKE_build/bin)&lt;br /&gt;&lt;br /&gt;set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ./CMAKE_build/bin)&lt;br /&gt;&lt;br /&gt;include_directories(${PLUGIN_ROOT}/cmakeTest/API)&lt;br /&gt;&lt;br /&gt;add_definitions(-DMACOSX)&lt;br /&gt;add_library(cmakeTest STATIC&lt;br /&gt;${PROJECT_ROOT}/cmakeTest/src/File1.cpp&lt;br /&gt;${PROJECT_ROOT}/cmakeTest/src/File2.cpp&lt;br /&gt;${PROJECT_ROOT}/cmakeTest/src/File3.cpp&lt;br /&gt;${PROJECT_ROOT}/cmakeTest/src/File4.cpp&lt;br /&gt;${PROJECT_ROOT}/cmakeTest/src/File5.cpp)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It was bit of a struggle to get to this point because the cmake documentation is very bad I felt..&lt;br /&gt;&lt;a href="http://www.cmake.org/Wiki/CMake_Cross_Compiling"&gt;http://www.cmake.org/Wiki/CMake_Cross_Compiling&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cmake.org/cmake/help/cmake2.6docs.html"&gt;http://www.cmake.org/cmake/help/cmake2.6docs.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Following couple of link came to my rescue.&lt;br /&gt;&lt;a href="http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake"&gt;http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake&lt;/a&gt;&lt;br /&gt;&lt;a href="http://stackoverflow.com/questions/794137/how-to-set-up-cmake-to-build-a-library-for-the-iphone"&gt;http://stackoverflow.com/questions/794137/how-to-set-up-cmake-to-build-a-library-for-the-iphone&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-6297567899285319425?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/6297567899285319425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/cmake-on-osx.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6297567899285319425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6297567899285319425'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/08/cmake-on-osx.html' title='CMake on OSX'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-398174256787969808</id><published>2010-07-20T06:46:00.001-07:00</published><updated>2010-07-31T06:59:54.236-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Perl : Tutorials</title><content type='html'>Following link points to a neat perl tutorial..&lt;br /&gt;&lt;div&gt;&lt;a href="http://www.comp.leeds.ac.uk/Perl/"&gt;http://www.comp.leeds.ac.uk/Perl/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Some more links of String matching/replacements using perl:&lt;br /&gt;&lt;a href="http://www.htmlite.com/perl025c.php"&gt;http://www.htmlite.com/perl025c.php&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.troubleshooters.com/codecorn/littperl/perlreg.htm"&gt;http://www.troubleshooters.com/codecorn/littperl/perlreg.htm&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-398174256787969808?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/398174256787969808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/07/perl-tutorials.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/398174256787969808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/398174256787969808'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/07/perl-tutorials.html' title='Perl : Tutorials'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-4557814034283495882</id><published>2010-07-07T03:15:00.000-07:00</published><updated>2010-07-07T03:15:01.140-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CoreAnimateion'/><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Cocoa'/><title type='text'>Animating NSViews and NSWindows</title><content type='html'>Following is a neat article on how to animate, NSWindows and NSViews using core-animation.&lt;br /&gt;&lt;br /&gt;http://www.informit.com/articles/article.aspx?p=1431312&amp;amp;seqNum=3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-4557814034283495882?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/4557814034283495882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/07/animating-nsviews-and-nswindows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4557814034283495882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4557814034283495882'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/07/animating-nsviews-and-nswindows.html' title='Animating NSViews and NSWindows'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-3846073684677633642</id><published>2010-05-17T23:50:00.000-07:00</published><updated>2010-05-17T23:50:17.310-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='Safari'/><title type='text'>No Safari Plugins on iPad</title><content type='html'>Do not bother developing Safari plugin on iPhone or iPad. Detect the user agent and re-direct to the plugin disabled page.&lt;br /&gt;&lt;br /&gt;Apple &lt;a href="http://developer.apple.com/safari/library/technotes/tn2010/tn2262/index.html"&gt;Tech Note&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-3846073684677633642?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/3846073684677633642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/05/no-safari-plugins-on-ipad.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/3846073684677633642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/3846073684677633642'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/05/no-safari-plugins-on-ipad.html' title='No Safari Plugins on iPad'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-4815579733206927916</id><published>2010-03-30T23:43:00.000-07:00</published><updated>2010-03-31T22:23:55.660-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>Berkely Packet Filters</title><content type='html'>I had to implement a feature to list down all the free IP addresses available on a given subnet. Theoretically &lt;a href="http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol"&gt;ICMP&lt;/a&gt; or&lt;a href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol"&gt;ARP&lt;/a&gt; protocols could be used to do this, I chose ARP as it exactly fits my bill. &lt;br /&gt;&lt;br /&gt;How to implement was not really clear ? I piped in data from &lt;a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/arp.8.html"&gt;arp command&lt;/a&gt; to my application, so that application development does not stop because of this. However this is not at all a good way, this forks a new process which is a bloody costly in my application context. One more thing is that arp command looks up the arp tables and does not send an arp packet to check the existence of an IP. Anyways that was make shift arrangement till I implement it the right way.&lt;br /&gt;&lt;br /&gt;The main problem was that the ARP works at the &lt;a href="http://en.wikipedia.org/wiki/Data_Link_Layer"&gt;data link layer&lt;/a&gt; and not on the &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer"&gt;transport layer&lt;/a&gt;. To implement I'll need to send link layer raw packets. Using any transport layer protocols will not serve the purpose. I banged my head for couple of days. Then I found my savior &lt;a href="http://en.wikipedia.org/wiki/Berkeley_Packet_Filter"&gt;Berkley Packet Filters (bpf)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Any Unix like Operating systems will have some bpf devices. My Mac has 4 bpf devices. Using bpf we can send raw ethernet packets, with out the need of any transport layer protocol. However to receive the response from these raw ethernet packets, a packet sniffer needs to be implemented. Mac OSX ships &lt;a href="http://sourceforge.net/projects/libpcap/"&gt;libpcap&lt;/a&gt; (lib packet capture), I used this to create a packet sniffer. &lt;br /&gt;&lt;br /&gt;Packet sniffer was capturing all kind of packets, just realized the amount of communication goes on, in the background. libcap allows applications to add filters I had to apply an filter to capture only ARP packets. &lt;br /&gt;&lt;br /&gt;ARP implementation solved 2 of my problems.&lt;br /&gt;- finding a list of free IP addresses on a given subnet&lt;br /&gt;- finding Mac-address of the gateway on that subnet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-4815579733206927916?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/4815579733206927916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/03/berkely-packet-filters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4815579733206927916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4815579733206927916'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/03/berkely-packet-filters.html' title='Berkely Packet Filters'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-9058771127644989565</id><published>2010-03-08T08:26:00.000-08:00</published><updated>2010-03-08T08:26:49.659-08:00</updated><title type='text'>libz inflate and deflate samples</title><content type='html'>Following link points to sample code to inflate (zip) and deflate (unzip) using libz library.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://brlcad.org/xref/source/src/other/libz/examples/zpipe.c"&gt;BRL-CAD/src/other/libz/examples/zpipe.c&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://www.blogadda.com/rate.php?blgid=14272" width="170" height="75" frameborder="0" scrolling="no" &gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-9058771127644989565?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://brlcad.org/xref/source/src/other/libz/examples/zpipe.c' title='libz inflate and deflate samples'/><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/9058771127644989565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/03/libz-inflate-and-deflate-samples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/9058771127644989565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/9058771127644989565'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/03/libz-inflate-and-deflate-samples.html' title='libz inflate and deflate samples'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-5225245590507209743</id><published>2010-02-18T04:04:00.001-08:00</published><updated>2010-02-18T04:04:45.082-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>tracing routing table...</title><content type='html'>found a piece of code to parse through routing tables...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mail-archive.com/freebsd-net@freebsd.org/msg09484.html"&gt;http://www.mail-archive.com/freebsd-net@freebsd.org/msg09484.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-5225245590507209743?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/5225245590507209743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/02/tracing-routing-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/5225245590507209743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/5225245590507209743'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/02/tracing-routing-table.html' title='tracing routing table...'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-4612700370718650700</id><published>2010-02-12T02:39:00.000-08:00</published><updated>2010-02-12T02:40:28.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>Network Adapter Dilemma</title><content type='html'>I was for a long time, stuck with a problem of enumerating the available network adapters on my Mac and identifying the active adapter or say finding the default adapter. &lt;br /&gt;&lt;br /&gt;I had an alternate way of doing this by piping the output of the &lt;code&gt;"netstat -r -n | grep default"&lt;/code&gt; into my application actually. However better way to do this is through code, considering the performance benchmarks the application had to meet. &lt;br /&gt;&lt;br /&gt;After a bit of struggling to find right &lt;code&gt;mib&lt;/code&gt; values for &lt;code&gt;sysctl&lt;/code&gt; using the following code I was able to enumerate the network adapters. &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;int &lt;br /&gt;findNetworkAdapters&lt;br /&gt;{&lt;br /&gt;int     mib[6];&lt;br /&gt;size_t  bufferSize = 0;&lt;br /&gt;uint8_t *buffer = NULL, *nextChunk = NULL;&lt;br /&gt;&lt;br /&gt;mib[0] = CTL_NET;&lt;br /&gt;mib[1] = AF_ROUTE;&lt;br /&gt;mib[2] = 0;&lt;br /&gt;mib[3] = AF_LINK;&lt;br /&gt;mib[4] = NET_RT_IFLIST;&lt;br /&gt;mib[5] = 0;&lt;br /&gt;&lt;br /&gt;if (sysctl(mib, 6, NULL, &amp;bufferSize, NULL, 0) != 0)&lt;br /&gt;return -1;&lt;br /&gt;&lt;br /&gt;buffer = new uint8_t[bufferSize];&lt;br /&gt;&lt;br /&gt;if (buffer != NULL)&lt;br /&gt;{&lt;br /&gt;if (sysctl(mib, 6, buffer, &amp;bufferSize, NULL, 0) == 0)&lt;br /&gt;{&lt;br /&gt;struct if_msghdr *interface = (struct if_msghdr*)buffer; &lt;br /&gt;&lt;br /&gt;for ( nextChunk = buffer; &lt;br /&gt;nextChunk != buffer + bufferSize; nextChunk = nextChunk + interface-&gt;ifm_msglen)&lt;br /&gt;{&lt;br /&gt;interface = (struct if_msghdr*)nextChunk;&lt;br /&gt;if (interface-&gt;ifm_type == RTM_IFINFO)&lt;br /&gt;{&lt;br /&gt;struct sockaddr_dl *link = (struct sockaddr_dl*)(interface + 1);&lt;br /&gt;if (link-&gt;sdl_type == IFT_ETHER)&lt;br /&gt;{&lt;br /&gt;std::string name = (link-&gt;sdl_data);&lt;br /&gt;printf("Interface   : %s\n", name.c_str());&lt;br /&gt;&lt;br /&gt;struct ether_addr hwaddr;&lt;br /&gt;memcpy ((void*)&amp;hwaddr, LLADDR(link), ETHER_ADDR_LEN);&lt;br /&gt;printf("HW address  : %x:%x:%x:%x:%x:%x\n", hwaddr.octet[0], hwaddr.octet[1], hwaddr.octet[2], hwaddr.octet[3], hwaddr.octet[4], hwaddr.octet[5]);      &lt;br /&gt;&lt;br /&gt;findIPAddress(name.c_str());&lt;br /&gt;findSubnetMask(name.c_str());&lt;br /&gt;&lt;br /&gt;printf ("\n");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;free buffer;&lt;br /&gt;}  &lt;br /&gt;return 1;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The job is now half done. I need to find active adapters,for this I need to get the IP address and Subnet mask assigned to the network adapter. Only active network adapters will have a valid IP and subnet mask assigned.&lt;br /&gt;&lt;br /&gt;Thats a uncomplicated job &lt;code&gt;ioctl&lt;/code&gt; the socket and wallah !! I got the IP and subnet mask. Based on IP and subnet mask I could easily identify the active network adapters.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;int&lt;br /&gt;findIPAddress(const char* iName)&lt;br /&gt;{&lt;br /&gt;struct ifreq req;&lt;br /&gt;struct sockaddr_in *sin;&lt;br /&gt;int fd = socket(AF_INET, SOCK_DGRAM, 0);&lt;br /&gt;&lt;br /&gt;memset((void*)&amp;req, 0, sizeof(struct ifreq));&lt;br /&gt;strcpy(req.ifr_name, iName);&lt;br /&gt;&lt;br /&gt;if (ioctl(fd, SIOCGIFADDR, (char *)&amp;req) == -1)&lt;br /&gt;{&lt;br /&gt;printf("Error : %s\n", strerror(errno));&lt;br /&gt;close(fd);&lt;br /&gt;return -1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sin = (struct sockaddr_in*)(&amp;(req.ifr_addr));&lt;br /&gt;printf("IP          : %s\n", inet_ntoa(sin-&gt;sin_addr)); &lt;br /&gt;&lt;br /&gt;close(fd);&lt;br /&gt;return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int&lt;br /&gt;findSubnetMask(const char* iName)&lt;br /&gt;{&lt;br /&gt;struct ifreq req;&lt;br /&gt;struct sockaddr_in *sin;&lt;br /&gt;int fd = socket(AF_INET, SOCK_DGRAM, 0);&lt;br /&gt;&lt;br /&gt;memset((void*)&amp;req, 0, sizeof(struct ifreq));&lt;br /&gt;strcpy(req.ifr_name, iName);&lt;br /&gt;&lt;br /&gt;if (ioctl(fd, SIOCGIFNETMASK, (char *)&amp;req) == -1)&lt;br /&gt;{&lt;br /&gt;printf("Error : %s\n", strerror(errno));&lt;br /&gt;close(fd);&lt;br /&gt;return -1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sin = (struct sockaddr_in*)(&amp;(req.ifr_addr));&lt;br /&gt;printf("Subnet Mask : %s\n", inet_ntoa(sin-&gt;sin_addr)); &lt;br /&gt;&lt;br /&gt;close(fd);&lt;br /&gt;return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-4612700370718650700?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/4612700370718650700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/02/network-adapter-dilemma.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4612700370718650700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/4612700370718650700'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/02/network-adapter-dilemma.html' title='Network Adapter Dilemma'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-357683886905800837</id><published>2010-01-13T10:23:00.001-08:00</published><updated>2010-01-13T10:27:02.064-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Head-Start in Python</title><content type='html'>Wanna learn Python ? Following link points to a great way of learning Python.&lt;br /&gt;&lt;a href="http://inventwithpython.com/chapters/"&gt;http://inventwithpython.com/chapters/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Learning Python using games... a good way I feel...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-357683886905800837?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/357683886905800837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2010/01/head-start-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/357683886905800837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/357683886905800837'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2010/01/head-start-in-python.html' title='Head-Start in Python'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-802067157617773268</id><published>2009-12-24T00:02:00.000-08:00</published><updated>2009-12-24T00:20:10.596-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><title type='text'>NSXMLParser : Nuggets</title><content type='html'>&lt;div&gt;&lt;div&gt;I was trying to parse an xml of the form between the tags: &lt;tag&gt; text xml1 &amp;amp; text xml&lt;/tag&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;NSXMLParser was for some reason was considering &lt;code&gt;&amp;amp;&lt;/code&gt; as a delimiter and was calling &lt;code&gt;- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string&lt;/code&gt; thrice, once for &lt;code&gt;text xml1&lt;/code&gt;, second time for &lt;code&gt;&amp;amp;&lt;/code&gt; and third time for &lt;code&gt;text xml2&lt;/code&gt;. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Using escape sequence&lt;code&gt;%26&lt;/code&gt;  instead of &lt;code&gt;&amp;amp;&lt;/code&gt; solved the solved the problem. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ergo use escape sequence wherever possible instead of &amp;amp;, if parsing with NSXMLParser. I do think there is such problem with &lt;a href="http://xerces.apache.org/xerces-c/"&gt;xerces&lt;/a&gt; and &lt;a href="http://www.grinninglizard.com/tinyxml/"&gt;tinyxml&lt;/a&gt;. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Below are some commonly used escape sequences:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  color: rgb(17, 17, 17); font-family:Verdana, Tahoma, 'Arial Unicode MS', sans-serif;font-size:12px;"&gt;&lt;pre  style=" display: block; overflow-x: auto; overflow-y: auto; font-size:12px;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; font-family:Verdana, Tahoma, 'Arial Unicode MS', sans-serif;"&gt;&lt;pre  style=" display: block; overflow-x: auto; overflow-y: auto; font-size:12px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);  white-space: normal;  font-family:Arial, sans-serif;font-size:13px;"&gt;&lt;dt class="dlterm" id="wp1111724__wp1111737" style="margin-top: 0.5em; margin-bottom: 0.5em; font-weight: bold; "&gt;&lt;span class="Apple-style-span"   style=" font-weight: normal;  font-family:sans-serif;font-size:small;"&gt;&lt;table align="center" cellspacing="20" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="frame" align="right" style="color: black; font-family: sans-serif; font-size: small; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: top; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;table class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); border-collapse: collapse; "&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(248, 248, 255); background-position: initial initial; background-repeat: initial initial; "&gt;Character&lt;/th&gt;&lt;th class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(248, 248, 255); background-position: initial initial; background-repeat: initial initial; "&gt;Escape Code&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;SPACE&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%20&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;&lt;&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3C&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3E&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;#&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%23&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%25&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;{&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%7B&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;}&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%7D&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;|&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%7C&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;\&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%5C&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;^&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%5E&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;~&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%7E&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td class="frame" align="left" style="color: black; font-family: sans-serif; font-size: small; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: top; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;table class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); border-collapse: collapse; "&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(248, 248, 255); background-position: initial initial; background-repeat: initial initial; "&gt;Character&lt;/th&gt;&lt;th class="data" style="color: black; font-family: sans-serif; font-size: small; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(248, 248, 255); background-position: initial initial; background-repeat: initial initial; "&gt;Escape Code&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;[&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%5B&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;]&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%5D&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;`&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%60&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;;&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3B&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;/&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%2F&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;?&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3F&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;:&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3A&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;@&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%40&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;=&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%3D&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;&amp;amp;&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%26&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;$&lt;/span&gt;&lt;/td&gt;&lt;td class="data" align="center"   style="color: black;   padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(153, 153, 153); font-family:sans-serif;font-size:small;"&gt;&lt;span style="font-size:+1;"&gt;%24&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&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/4161148738347405259-802067157617773268?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/802067157617773268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/12/nsxmlparser-nuggets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/802067157617773268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/802067157617773268'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/12/nsxmlparser-nuggets.html' title='NSXMLParser : Nuggets'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-2259521153761886352</id><published>2009-11-06T10:58:00.000-08:00</published><updated>2009-11-06T11:32:08.477-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>Shell scripting 101</title><content type='html'>I had to automate the build system today. The task was simple however my shell scripting knowledge is somewhat limited. I've done itsy-bitsy work on shell scripting but nothing extensive. Today in the process of automating the build I got to learn a few things, might be trivial but they were learning for me.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;To check if the file already exists on the filesystem&lt;br /&gt;&lt;code&gt;[ -f filename ] &amp;&amp; echo"file exists"&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;To check if the directory exists on the filesystem&lt;br /&gt;&lt;code&gt;[ -f dirname ] &amp;&amp; echo"dir exists"&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;To copy the output of the command executed in the script to a variable.&lt;br /&gt;&lt;code&gt;result=`pwd`&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;export&lt;/code&gt; command is used to set a environment variable.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Use = for comparisons not ==.&lt;br /&gt;&lt;code&gt;if [ $name = "shiv" ];&lt;br /&gt;then &lt;br /&gt;   echo "its me"&lt;br /&gt;fi&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Use option "o" with unzip command to overwrite existing files without prompting.&lt;br /&gt;&lt;code&gt;unzip -o myArchive.zip&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Use option "r" to travel recurcively with zip command&lt;br /&gt;&lt;code&gt;zip -r zipfilename sourcedir *&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Following link points to a quick shell scripting reference.&lt;br /&gt;&lt;a href="http://www.opengroup.org/onlinepubs/007908799/xcu/shellix.html"&gt;http://www.opengroup.org/onlinepubs/007908799/xcu/shellix.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-2259521153761886352?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/2259521153761886352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/shell-scripting-101.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/2259521153761886352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/2259521153761886352'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/shell-scripting-101.html' title='Shell scripting 101'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-6139338596960678615</id><published>2009-11-06T10:38:00.000-08:00</published><updated>2009-11-06T10:46:08.645-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='dylib'/><category scheme='http://www.blogger.com/atom/ns#' term='linking'/><title type='text'>Working with dylibs : Deployment Issues - Part 3</title><content type='html'>&lt;a href="http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html"&gt;Read Part 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues.html"&gt;Read Part 2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;if you are using install_name_tool extensively. I'd recommend you use the linker flag -headerpad_max_install_names. Man page of &lt;a href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/ld.1.html"&gt;ld&lt;/a&gt; describes this flag as follows.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;-headerpad_max_install_names&lt;br /&gt;                 Automatically adds space for future expansion of load commands such that all paths could expand to MAXPATHLEN.  Only useful if intend to run install_name_tool to alter the load commands later. Size is a hexadecimal number.&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html"&gt;Read Part 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues.html"&gt;Read Part 2&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-6139338596960678615?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/6139338596960678615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues_06.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6139338596960678615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6139338596960678615'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues_06.html' title='Working with dylibs : Deployment Issues - Part 3'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-9051139553847360386</id><published>2009-11-03T05:50:00.000-08:00</published><updated>2009-11-03T06:22:51.778-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Obtaining Current Date and Time</title><content type='html'>I had a simple task of adding a time stamp for a resource request. By time stamp I mean the year-date-time when the resource was requested. It was C++ code I did not want to add objective-c code in there. So the option I had was to use Core-Foundation &lt;a href="http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFDateRef/Reference/reference.html"&gt;CFDate&lt;/a&gt; or to use simple unix calls. I hate Carbon anyways, whenever I get a chance I try avoid it. Same was the case here. I used unix apis. They turned out be simple and did the job with charm.&lt;br /&gt;&lt;br /&gt;Code snippet:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;time_t currtime;&lt;br /&gt;time(&amp;currtime);&lt;br /&gt;&lt;br /&gt;struct tm *dateAndTime = locattime(&amp;currtime);&lt;br /&gt;&lt;br /&gt;int year = 1900 + timedate-&gt;tm_year;&lt;br /&gt;int month = dateAndTime-&gt;tm_mon+1;&lt;br /&gt;int date  = dateAndTime-&gt;tm_mday;&lt;br /&gt;int hour  = dateAndTime-&gt;tm_hour;&lt;br /&gt;int min   = dateAndTime-&gt;tm_min;&lt;br /&gt;int sec   = dateAndTime-&gt;tm_sec;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now I can format the time-stamp string in any damn way I want. If objective-c was an option &lt;a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/clm/NSDate/dateWithNaturalLanguageString:"&gt;NSDate&lt;/a&gt; would have done the job for me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-9051139553847360386?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/9051139553847360386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/obtaining-current-date-and-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/9051139553847360386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/9051139553847360386'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/obtaining-current-date-and-time.html' title='Obtaining Current Date and Time'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-2440759198227790685</id><published>2009-11-02T11:08:00.000-08:00</published><updated>2009-11-06T10:45:48.345-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='dylib'/><category scheme='http://www.blogger.com/atom/ns#' term='linking'/><title type='text'>Working with dylibs : Deployment Issues - Part 2</title><content type='html'>&lt;a href="http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html"&gt;Read Part 1 of the post&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues_06.html"&gt;Read Part 3 of the post&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In addition to what I had already written on dylib deployment. My friend, Vishvesh, pointed out some additional notes.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;dylib execution path can be specified in Xcode project "Installation Directory" field. Using this will not require to use complex command line tools to specify the dylib installation path [I have yet verified this]. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;otool&lt;/code&gt; when run against a static libraries (.a) lists all the object files.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Command &lt;code&gt;file&lt;/code&gt; can be used to detect the architecture type a dylib or a static lib is built for.&lt;br /&gt;&lt;br /&gt;example :&lt;br /&gt;&lt;code&gt;%file myCustom.dylib&lt;br /&gt;myCustom.dylib: Mach-O universal binary with 2 architectures&lt;br /&gt;myCustom.dylib(for architecture i386):   Mach-O dynamically linked shared library i386&lt;br /&gt;myCustom.dylib(for architecture ppc):   Mach-O dynamically linked shared library ppc&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;%file libdoCustomProcessing.a&lt;br /&gt;libdoCustomProcessing.a: Mach-O universal binary with 2 architectures&lt;br /&gt;libdoCustomProcessing.a (for architecture i386):   current ar archive&lt;br /&gt;libdoCustomProcessing.a (for architecture ppc):   current ar archive&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html"&gt;Read Part 1 of the post&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues_06.html"&gt;Read Part 3 of the post&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-2440759198227790685?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/2440759198227790685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/2440759198227790685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/2440759198227790685'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues.html' title='Working with dylibs : Deployment Issues - Part 2'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-8082226500316538371</id><published>2009-10-30T08:38:00.000-07:00</published><updated>2009-11-06T10:49:13.819-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>How To - svn:externals</title><content type='html'>Today I had to add &lt;a href="http://webkit.org/"&gt;webkit&lt;/a&gt; as an &lt;a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html"&gt;external directory&lt;/a&gt; to my trunk in &lt;a href="http://subversion.tigris.org/"&gt;SVN&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;My SVN folder structure is like this.&lt;br /&gt;&lt;code&gt;/SVN/Repos/Trunk&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/Lib1&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/Lib2&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/App&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I wanted to add an external directory to trunk folder. As shown below.&lt;br /&gt;&lt;code&gt;/SVN/Repos/Trunk&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/Lib1&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/Lib2&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/webkit&lt;br /&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp/App&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I tried various ways to set the svn:externals property all in vain. Thanks to the following link I got to know how to do it right.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;%cd /SVN/Repos/Trunk&lt;br /&gt;%svn propset svn:externals 'webkit http://svn.webkit.org/repository/webkit/trunk' .&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;This did the trick.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;%svn propget svn:externals&lt;/code&gt;&lt;br /&gt;can be used to verify if the externals are properly set.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-8082226500316538371?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/8082226500316538371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/10/how-to-svnexternals.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/8082226500316538371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/8082226500316538371'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/10/how-to-svnexternals.html' title='How To - svn:externals'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4161148738347405259.post-6190119036402591938</id><published>2009-10-28T05:59:00.001-07:00</published><updated>2009-11-06T10:47:07.537-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='dylib'/><category scheme='http://www.blogger.com/atom/ns#' term='linking'/><title type='text'>Working with dylibs : Deployment Issues</title><content type='html'>Working with dylibs can be a troublesome at times. I encountered troubles with it few days back. &lt;br /&gt;&lt;br /&gt;Application I was developing links with a custom dylib, I developed. All was working well while running through XCode. However on deployment, the application would not launch. On investigation, I realized that OSX was unable to find a dylib, Hence the application failed to launch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;I was faced with the problem of the OSX not knowing where to find the dylibs required by my application in deployment environment.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;code&gt;otool&lt;/span&gt;&lt;/code&gt; and &lt;span style="font-weight:bold;"&gt;&lt;code&gt;install_name_tool&lt;/code&gt;&lt;/span&gt; came to my rescue.&lt;br /&gt;&lt;br /&gt;As per Apple documentation&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otool.1.html"&gt;&lt;code&gt;otool&lt;/code&gt;&lt;/a&gt; - Object file displaying tool.&lt;/li&gt;&lt;li&gt;&lt;code&gt;&lt;a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html"&gt;install_name_tool&lt;/a&gt;&lt;/code&gt; - change dynamic shared library install names.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;First I wanted see to all the library install names in my application. In simple terms paths of all the libraries my application is linked with.&lt;br /&gt;&lt;br /&gt;On terminal in cd into my app package Contents/Macos.&lt;br /&gt;&lt;code&gt;% otool -L myAppUnixBinay&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The output listed all the library install names. &lt;br /&gt;&lt;br /&gt;&lt;code&gt; libmycustom.dylib (compatibility version 5.0.0, current version 5.0.0)&lt;br /&gt; /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)&lt;br /&gt; /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;My application linked against libmycustom.dylib, it failed to load it since no proper path was provided. &lt;br /&gt;&lt;br /&gt;Now I used install_name_tool to set the right path to the dylib.&lt;br /&gt;&lt;code&gt;% install_name_tool -change libmycustom.dylib @executable_path/../Frameworks/libmycustom.dylib myAppUnixBinay&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The above line tell the OSX to find the library in /Contents/Frameworks of the application package.&lt;br /&gt;&lt;br /&gt;Now when I ran the application all worked well. &lt;br /&gt;&lt;br /&gt;I automated this process by adding a runscript to XCode target that runs post build process.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues.html"&gt;Read Part 2 of the post&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tech-no-mad.blogspot.com/2009/11/working-with-dylibs-deployment-issues_06.html"&gt;Read Part 3 of the post&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4161148738347405259-6190119036402591938?l=tech-no-mad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-no-mad.blogspot.com/feeds/6190119036402591938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6190119036402591938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4161148738347405259/posts/default/6190119036402591938'/><link rel='alternate' type='text/html' href='http://tech-no-mad.blogspot.com/2009/10/working-with-dylibs-deployment-issues.html' title='Working with dylibs : Deployment Issues'/><author><name>Shivanand PB</name><uri>http://www.blogger.com/profile/02982002753401385691</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_DLer0md6nEg/SfVDNxvJeLI/AAAAAAAABUU/b2Mt5iotWV0/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry></feed>
