<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dudefrommangalore&#039;s Weblog</title>
	<atom:link href="https://dudefrommangalore.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://dudefrommangalore.wordpress.com</link>
	<description>Computer Programming, Software Management and Random Thoughts...</description>
	<lastBuildDate>Thu, 16 Sep 2021 03:54:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">4944751</site><cloud domain='dudefrommangalore.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s0.wp.com/i/buttonw-com.png</url>
		<title>Dudefrommangalore&#039;s Weblog</title>
		<link>https://dudefrommangalore.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://dudefrommangalore.wordpress.com/osd.xml" title="Dudefrommangalore&#039;s Weblog" />
	<atom:link rel='hub' href='https://dudefrommangalore.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Explode map of map field in Spark Scala</title>
		<link>https://dudefrommangalore.wordpress.com/2021/09/16/explode-map-of-map-field-in-spark-scala/</link>
					<comments>https://dudefrommangalore.wordpress.com/2021/09/16/explode-map-of-map-field-in-spark-scala/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Thu, 16 Sep 2021 03:54:31 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=273</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:100%;"><div class="wp-block-syntaxhighlighter-code "><pre class="brush: scala; title: ; notranslate">
def flattenMap = udf((map: Map&#91;String, Map&#91;String, Float]]) =&gt; map.map(x =&gt; (x._1, x._2)).toArray)
val explodedDf = df.select(explode(flattenMap(col(&quot;column_name&quot;)))
explodedDf.printSchema
</pre></div></div>
</div>
</div></div>



<pre class="wp-block-code"><code>root
 |-- query: string (nullable = true)
 |-- col: struct (nullable = true)
 |    |-- _1: string (nullable = true)
 |    |-- _2: map (nullable = true)
 |    |    |-- key: string
 |    |    |-- value: double (valueContainsNull = false)
</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2021/09/16/explode-map-of-map-field-in-spark-scala/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">273</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Go&#8217;s slice inconsistent behavior</title>
		<link>https://dudefrommangalore.wordpress.com/2016/03/10/gos-slice-inconsistent-behavior/</link>
					<comments>https://dudefrommangalore.wordpress.com/2016/03/10/gos-slice-inconsistent-behavior/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Thu, 10 Mar 2016 21:10:51 +0000</pubDate>
				<category><![CDATA[golang]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=267</guid>

					<description><![CDATA[Say you have a slice (a) of size 1. a[0:] return a slice of size 1. a[1:] return a slice &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2016/03/10/gos-slice-inconsistent-behavior/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Say you have a slice (a) of size 1. a[0:] return a slice of size 1. a[1:] return a slice of size 0. a[2:] panics.</p>
<p><a href="http://play.golang.org/p/LELoC1asWN">Code is here</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2016/03/10/gos-slice-inconsistent-behavior/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">267</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Parsing embedded json string in a key</title>
		<link>https://dudefrommangalore.wordpress.com/2016/03/09/parsing-embedded-json-string-in-a-key/</link>
					<comments>https://dudefrommangalore.wordpress.com/2016/03/09/parsing-embedded-json-string-in-a-key/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Wed, 09 Mar 2016 22:41:04 +0000</pubDate>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[jq]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=256</guid>

					<description><![CDATA[jq is a great tool to parse json string on the command line. I had a case where serialized JSON is &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2016/03/09/parsing-embedded-json-string-in-a-key/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://stedolan.github.io/jq/manual/">jq</a> is a great tool to parse json string on the command line. I had a case where serialized JSON is a value of a key in the outer JSON. It is possible to parse the serialized JSON string in jq.</p>
<pre class="brush: bash; title: ; notranslate">
echo '{"key": "{\"a\": 10, \"b\": 20}"}' | jq -r .key | jq .
</pre>
<p>Output is</p>
<pre class="brush: jscript; title: ; notranslate">
{
  "a": 10,
  "b": 20
}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2016/03/09/parsing-embedded-json-string-in-a-key/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">256</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Pretty print git log</title>
		<link>https://dudefrommangalore.wordpress.com/2016/03/04/pretty-print-git-log/</link>
					<comments>https://dudefrommangalore.wordpress.com/2016/03/04/pretty-print-git-log/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Fri, 04 Mar 2016 20:26:46 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=253</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p>git log &#8211;graph &#8211;oneline &#8211;decorate &#8211;pretty=medium</p>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2016/03/04/pretty-print-git-log/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">253</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Git rebase and squash commits</title>
		<link>https://dudefrommangalore.wordpress.com/2016/03/04/git-rebase-and-squash-commits/</link>
					<comments>https://dudefrommangalore.wordpress.com/2016/03/04/git-rebase-and-squash-commits/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Fri, 04 Mar 2016 19:15:38 +0000</pubDate>
				<category><![CDATA[git]]></category>
		<category><![CDATA[workflow]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=225</guid>

					<description><![CDATA[When I am working on a feature branch that take couple of weeks to finish, I don&#8217;t want to diverge &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2016/03/04/git-rebase-and-squash-commits/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>When I am working on a feature branch that take couple of weeks to finish, I don&#8217;t want to diverge too much from the upstream. To keep my branch up to date with the upstream, I do a rebase with the upstream once every few days. Following is my workflow.</p>
<ol>
<li>Fetch upstream
<pre class="brush: plain; title: ; notranslate">
git fetch upstream
</pre>
</li>
<li>Rebase feature branch with upstream
<pre class="brush: bash; title: ; notranslate">
git rebase upstream/master
</pre>
</li>
</ol>
<p>While working on feature branch, I would have made several small commits into the feature branch. Before creating a pull request to merge the changes into upstream, it is a good practice to squash all the small commits into one commit.  Following is my workflow to squash the commits.</p>
<ol>
<li>Find the common parent between feature branch and upstream branch
<pre class="brush: bash; title: ; notranslate">
git merge-base HEAD upstream/master
</pre>
</li>
<li>Squash commits using interactive rebase with the commit hash in step 1.
<pre class="brush: bash; title: ; notranslate">
git rebase -i &lt;commit hash from step 1&gt;
</pre>
</li>
<li>When editor is opened to select which commit to keep and which to squash, change all but first commit from pick to squash (or s for shortcut). Save and quit the editor.</li>
<li>Editor is opened again for the squashed commit. Either keep it the messages as it is (not a good practice) OR delete existing commit messages, add a new meaningful commit message. Save and quit the editor.</li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2016/03/04/git-rebase-and-squash-commits/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">225</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Embedding Lua engine in C/C++</title>
		<link>https://dudefrommangalore.wordpress.com/2013/08/09/embedding-lua-engine-in-cc/</link>
					<comments>https://dudefrommangalore.wordpress.com/2013/08/09/embedding-lua-engine-in-cc/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Fri, 09 Aug 2013 20:21:20 +0000</pubDate>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=219</guid>

					<description><![CDATA[Lua is a very lightweight language to be embedded as a scripting support language for any system. Following are the &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2013/08/09/embedding-lua-engine-in-cc/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Lua is a very lightweight language to be embedded as a scripting support language for any system.</p>
<p>Following are the steps to embed Lua engine in C/C++.</p>
<p>Step 1. Include header files.</p>
<pre class="brush: cpp; title: ; notranslate">
extern &quot;C&quot; {
#include &lt;lua5.1/lua.h&gt;
#include &lt;lua5.1/lauxlib.h&gt;
#include &lt;lua5.1/lualib.h&gt;
}
</pre>
<p>Step 2. Initialize Lua engine</p>
<pre class="brush: cpp; title: ; notranslate">
lua_State *engine = lua_open();
luaopen_base(engine);
luaopen_string(engine);
luaopen_math(engine);
luaopen_table(engine);
/* above luaopen_* can be replaced with luaL_openlibs(engine) to open all standard libraries */
</pre>
<p>Step 3. Load Lua script from buffer</p>
<pre class="brush: cpp; title: ; notranslate">
char *buf;
// read script into buffer
if (luaL_loadbuffer(engine, buf, strlen(buf) != LUA_OK) {
  fprintf(stderr, &quot;loading script failed with error %s&quot;, lua_tostring(engine, -1));
  lua_pop(engine, 1);
  // do not continue
}
</pre>
<p>Step 4. Execute the loaded buffer</p>
<pre class="brush: cpp; title: ; notranslate">
if (lua_pcall(engine
                 , 0  // number of arguments on the stack
                 , 0  // number of expected result parameters
                 , 0) != LUA_OK) {
  fprintf(stderr, &quot;executing script failed with error %s&quot;, lua_tostring(engine, -1));
  lua_pop(engine, 1);
  // do not continue
}
</pre>
<p>More about <a href="http://www.lua.org/manual/5.2/manual.html#lua_pcall">lua_pcall</a></p>
<p>Step 5. Register C function to be called within Lua script</p>
<pre class="brush: plain; title: ; notranslate">
// following function can be called from Lua script with 1 parameter
int add_ten(lua_State *engine) {
   double p = lua_tonumber(engine, 1);
   p = p + 10.0;
   lua_pushnumber(engine, p);
   return 1;
}

lua_register(engine, &quot;add_ten&quot;, add_ten);

// call add_ten within engine
lua_getglobal(engine, &quot;add_ten&quot;);
lua_pushnumber(engine, 50.0);
lua_call(engine, 1, 1); // pass one parameter and get back 1 parameter
double result = lua_tonumber(engine, -1); // fetch from top of stack
printf( &quot;result = %g\n&quot;, result ); // this should print 60
</pre>
<p>Step 6. Destroy Lua engine</p>
<pre class="brush: cpp; title: ; notranslate">
lua_close(engine);
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2013/08/09/embedding-lua-engine-in-cc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">219</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up tags for vim</title>
		<link>https://dudefrommangalore.wordpress.com/2013/06/27/setting-up-tags-for-vim/</link>
					<comments>https://dudefrommangalore.wordpress.com/2013/06/27/setting-up-tags-for-vim/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Thu, 27 Jun 2013 23:53:16 +0000</pubDate>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[editors]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tips&tricks]]></category>
		<category><![CDATA[vim]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=214</guid>

					<description><![CDATA[I have multiple git repositories. Also I use Vim as my editor especially for C and C++ code. ctags a &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2013/06/27/setting-up-tags-for-vim/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>I have multiple git repositories. Also I use Vim as my editor especially for C and C++ code.</p>
<p>ctags a great tool to generate cross reference tags file. Vim support tags file to jump around between different source code files. Vim require to set tags variable to the path of tags file generated by ctags. Since I work on multiple git repositories, having a static tags file in .vimrc file is not an option for me. So I came up with .vimrc script to set the tags file.</p>
<pre class="brush: plain; title: ; notranslate">

let s:top_level_cmd = &quot;git rev-parse --show-toplevel&quot;
let s:top_level_dir = system(s:top_level_cmd)
if !v:shell_error
let s:tag_file = substitute(system(s:top_level_cmd), &quot;\n&quot;, &quot;&quot;, &quot;g&quot;). '/tags'
execute 'set tags='. s:tag_file
endif

</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2013/06/27/setting-up-tags-for-vim/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">214</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Human Vs. Machine</title>
		<link>https://dudefrommangalore.wordpress.com/2012/05/11/human-vs-machine/</link>
					<comments>https://dudefrommangalore.wordpress.com/2012/05/11/human-vs-machine/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Fri, 11 May 2012 16:30:13 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[artificial-intelligence]]></category>
		<category><![CDATA[human]]></category>
		<category><![CDATA[machine]]></category>
		<category><![CDATA[machine-learning]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=203</guid>

					<description><![CDATA[2 days back I was watching a movie called &#8220;Pasand Apni Apni&#8221; (hindi language bollywood movie) with friends. In the &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2012/05/11/human-vs-machine/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>2 days back I was watching a movie called &#8220;Pasand Apni Apni&#8221; (hindi language bollywood movie) with friends. In the middle of the match, one friend asked a question &#8220;the sequence in this movie is similar to one of the recent time movie. Which one is that?&#8221;. Everyone came up with an answer &#8220;Gajni&#8221; (yet another hindi language bollywood movie, kind of remake of hollywood movie &#8220;momento&#8221;). </p>
<p>One may ask what is so great about it? You guys have watched both movies and came up with the answer. That&#8217;s right. There is nothing great about it as long as you are a human. Nobody told us the story of the movie in words, but we derived it by looking at the sequence in the movies. All the actors/actresses in the movie became an abstract entity. We were able to mask the people in the movie, learn from the sequence &amp; the dialogues in the movie and finally come up to a conclusion about the story of the movie. This is so unique about the human ability. </p>
<p>If you have shown the same movies and several others to a machine (say Watson by IBM) and ask the same question my friend asked to Watson, would it be able to come up with the answer. I guess not (not yet). That is because Watson is programmed to search for the keywords in the question and search the vast database to come up with the answer. Keywords in the questions does not link these 2 movies in anyways. It was just the ability of the humans to analyze the question, not just by keywords, but using the context too.</p>
<p>There is no machine (not even Siri) is programmed to do such thing yet. Only the time will tell the future.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2012/05/11/human-vs-machine/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">203</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Profiling C++ code using Google Performance Tools</title>
		<link>https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/</link>
					<comments>https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/#comments</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 23:25:49 +0000</pubDate>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/?p=185</guid>

					<description><![CDATA[Google performance tool is an excellent tool for profiling C++ code. Install libunwind Install Google Performance Tools Install supporting packages &#8230;<p><a href="https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Google performance tool is an excellent tool for profiling C++ code.</p>
<ul>
<li><a href="#unwind">Install libunwind</a></li>
<li><a href="#gperf">Install Google Performance Tools</a></li>
<li><a href="#additional">Install supporting packages</a></li>
<li><a href="#code">Include profiling code in C++</a></li>
<li><a href="#run">Run Profiling</a></li>
<li><a href="#report">Generate profiling report</a></li>
</ul>
<p><a name="unwind"></a></p>
<h1>Install libuwind</h1>
<pre class="brush: bash; title: ; notranslate">
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.0.1.tar.gz
tar xvfz libunwind-1.0.1.tar.gz
cd libunwind-1.0.1
export CFLAGS=-U_FORTIFY_SOURCE
./configure
make
sudo make install
</pre>
<h1>Install Google Performance Tools</h1>
<p><a name="gperf"></a></p>
<pre class="brush: bash; title: ; notranslate">
wget http://google-perftools.googlecode.com/files/google-perftools-1.8.3.tar.gz
tar xvfz google-perftools-1.8.3.tar.gz
cd google-perftools-1.8.3
./configure
make
sudo make install
</pre>
<h1>Install supporting packages</h1>
<p><a name="additional"></a></p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install graphviz
sudo apt-get install gv
</pre>
<h1>Include profiling code in C++</h1>
<p><a name="code"></a></p>
<h2>Include supporting header file(s)</h2>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;google/profiler.h&gt;
</pre>
<h2>Start Profiler</h2>
<p>Assuming that profiler output is stored in file /tmp/output.pprof. The following code can be placed anywhere in the code. This is the point at which the profiler will start collecting data. It is possible to start profiling at multiple stages into different files. </p>
<pre class="brush: cpp; title: ; notranslate">
ProfilerStart(&quot;/tmp/output.pprof);
</pre>
<h2>Stop Profiler</h2>
<p>It is possible to start profiler at any point of time by placing the following code.</p>
<pre class="brush: cpp; title: ; notranslate">
ProfilerStop();
</pre>
<p><a name="run"></a></p>
<h1>Run Profiling</p>
<h1>
Compile the code and execute it. Once the run is finished or ProfilerStop is called, profiler output will be available in the output file.</p>
<p><a name="report"></a></p>
<h1>Generate profiling report</h1>
<p>Several types of reports can be generated from the output file.</p>
<h2>Graphical report</h2>
<p>X11 need to be enabled for the graphical report.</p>
<pre class="brush: bash; title: ; notranslate">
pprof -gv --lines /tmp/output.pprof
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">185</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
		<item>
		<title>Using expect script to automate ssh for passphraseless key</title>
		<link>https://dudefrommangalore.wordpress.com/2011/12/16/using-expect-script-to-automate-ssh-for-passphraseless-key/</link>
					<comments>https://dudefrommangalore.wordpress.com/2011/12/16/using-expect-script-to-automate-ssh-for-passphraseless-key/#respond</comments>
		
		<dc:creator><![CDATA[dudefrommangalore]]></dc:creator>
		<pubDate>Fri, 16 Dec 2011 09:15:53 +0000</pubDate>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://dudefrommangalore.wordpress.com/2011/12/16/using-expect-script-to-automate-ssh-for-passphraseless-key/</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
#!/usr/bin/expect
set timeout -1
spawn ssh my-host-name
expect &quot;yes/no&quot; { send &quot;yes\r&quot; }
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://dudefrommangalore.wordpress.com/2011/12/16/using-expect-script-to-automate-ssh-for-passphraseless-key/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">152</post-id>
		<media:content url="https://1.gravatar.com/avatar/d6ac818d54493c8a034ed92cdebc3789096e69368ad103082ac4488ed5ac4f08?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dudefrommangalore</media:title>
		</media:content>
	</item>
	</channel>
</rss>
