<?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/"
	>

<channel>
	<title>Humbug</title>
	<atom:link href="http://www.humbug.in/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.humbug.in</link>
	<description>Bah! Humbug!</description>
	<lastBuildDate>Tue, 24 Apr 2012 21:20:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Twitter Weekly Updates between 2012-04-19 and 2012-04-25</title>
		<link>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/</link>
		<comments>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 21:20:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/">Twitter Weekly Updates between 2012-04-19 and 2012-04-25</a></p><p>Twitter Digest for @free_thinker between 2012-04-19 and 2012-04-25</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/">Twitter Weekly Updates between 2012-04-19 and 2012-04-25</a></p><ul class="ws_tweet_list">
<li class="ws_tweet">2 unexploded bombs found under Ho Chi Minh City house &#8211; Approximately 800,000 tons of bombs and mines still present <a href="http://t.co/ILKjqIWX" rel="nofollow">http://t.co/ILKjqIWX</a> <a href="http://search.twitter.com/search?q=%23fb">#fb</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/192986615067586560">-&gt;</a></li>
</ul>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-19-and-2012-04-25/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates between 2012-04-12 and 2012-04-18</title>
		<link>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/</link>
		<comments>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 21:20:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/">Twitter Weekly Updates between 2012-04-12 and 2012-04-18</a></p><p>Twitter Digest for @free_thinker between 2012-04-12 and 2012-04-18</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/">Twitter Weekly Updates between 2012-04-12 and 2012-04-18</a></p><ul class="ws_tweet_list">
<li class="ws_tweet">3 Vietnamese bloggers charged over their writing | Fox News <a href="http://t.co/sFgNCYfA" rel="nofollow">http://t.co/sFgNCYfA</a> <a href="http://search.twitter.com/search?q=%23fb">#fb</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/191914891894992896">-&gt;</a></li>
</ul>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-12-and-2012-04-18/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates between 2012-04-05 and 2012-04-11</title>
		<link>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/</link>
		<comments>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 21:20:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/">Twitter Weekly Updates between 2012-04-05 and 2012-04-11</a></p><p>Twitter Digest for @free_thinker between 2012-04-05 and 2012-04-11</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/">Twitter Weekly Updates between 2012-04-05 and 2012-04-11</a></p><ul class="ws_tweet_list">
<li class="ws_tweet">Implement strong WiFi encryption the easy way with hostapd &#8211; Using WPA2-Personal with individual keys for each user <a href="http://t.co/LRuke4kJ" rel="nofollow">http://t.co/LRuke4kJ</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/189975203185561600">-&gt;</a></li>
<li class="ws_tweet">Soon, wonder vaccine that will kill 90% of cancers &#8211; Health &#8211; DNA <a href="http://t.co/AUXP0QNF" rel="nofollow">http://t.co/AUXP0QNF</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/189592256121016320">-&gt;</a></li>
<li class="ws_tweet">PHP like str_replace function in C: This post is part of a series of posts where I want to document a bunch of C f&#8230; <a href="http://t.co/agD4GNft" rel="nofollow">http://t.co/agD4GNft</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/187741815649210370">-&gt;</a></li>
<li class="ws_tweet">Kickstrap &#8211; <a href="http://search.twitter.com/search?q=%23CSS">#CSS</a> Framework: Enhancements for Bootstrap : Kickstrap uses the latest version of Twitter&#039;s <a href="http://search.twitter.com/search?q=%23bootstrap">#bootstrap</a>  <a href="http://t.co/jdvbm2H4" rel="nofollow">http://t.co/jdvbm2H4</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/187598886330826752">-&gt;</a></li>
</ul>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-04-05-and-2012-04-11/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP like str_replace function in C</title>
		<link>http://www.humbug.in/2012/php-like-str_replace-function-in-c/</link>
		<comments>http://www.humbug.in/2012/php-like-str_replace-function-in-c/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 03:21:28 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Code-Snippets]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[str_replace]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1267</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/php-like-str_replace-function-in-c/">PHP like str_replace function in C</a></p><p>This post is part of a series of posts where I want to document a bunch of C functions I use for my projects that I have written, collected and modified over the past few years. One of the functions that I use regularly is a string replacement function like the str_replace in PHP. This [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/php-like-str_replace-function-in-c/">PHP like str_replace function in C</a></p><p>This post is part of a series of posts where I want to document a bunch of C functions I use for my projects that I have written, collected and modified over the past few years. One of the functions that I use regularly is a string replacement function like the <code>str_replace</code> in PHP. This function replaces all occurences of a particular substring with a replacement pattern. The code for this was borrowed from <a href="http://coding.debuntu.org/c-implementing-str_replace-replace-all-occurrences-substring" target="_blank">here</a>. In the original code, a newly allocated string is returned after all the substrings are replaced. I have modified it so that the replacements are made in place.<span id="more-1267"></span> </p>
<pre class="vim">
<span class="Comment">/*</span><span class="Comment">*</span>
<span class="Comment"> *</span>
<span class="Comment"> * str_replace.c implements a str_replace PHP like function</span>
<span class="Comment"> * Copyright (C) 2010  chantra &lt;chantra__A__debuntu__D__org&gt;</span>
<span class="Comment"> *</span>
<span class="Comment"> </span><span class="Comment">*/</span>

#include <span class="String">&quot;str_replace.h&quot;</span>

<span class="Type">void</span>
str_replace ( <span class="Type">char</span> **str, <span class="StorageClass">const</span> <span class="Type">char</span> *substr, <span class="StorageClass">const</span> <span class="Type">char</span> *replacement ){
  <span class="Type">char</span> *string =  *str;
  <span class="Type">int</span> findlen = strlen(substr), replacelen = strlen(replacement);
  <span class="Type">int</span> difflen = <span class="Number">0</span>, totaldiff = <span class="Number">0</span>;
  <span class="Type">char</span> *tok = <span class="Constant">NULL</span>;
  <span class="Type">char</span> *newstr = <span class="Constant">NULL</span>;
  <span class="Type">char</span> *oldstr = <span class="Constant">NULL</span>;
  <span class="Type">char</span> *head = <span class="Constant">NULL</span>;
  <span class="Comment">/*</span><span class="Comment"> if either substr or replacement is NULL, duplicate string a let caller handle it </span><span class="Comment">*/</span>
  <span class="Conditional">if</span>(replacelen &gt; findlen)
    difflen = replacelen - findlen;
  <span class="Conditional">if</span> ( substr == <span class="Constant">NULL</span> || replacement == <span class="Constant">NULL</span> ) <span class="Statement">return</span>;
  newstr = strdup (string);
  head = newstr;
  <span class="Repeat">while</span> ( (tok = strstr ( head, substr ))){
    oldstr = newstr;
    newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) + <span class="Number">1</span> );
    <span class="Comment">/*</span><span class="Comment">failed to alloc mem, free old string and return NULL </span><span class="Comment">*/</span>
    <span class="Conditional">if</span> ( newstr == <span class="Constant">NULL</span> ){
      free (oldstr);
      exit(<span class="Number">1</span>);
    }
    memcpy ( newstr, oldstr, tok - oldstr );
    memcpy ( newstr + (tok - oldstr), replacement, strlen ( replacement ) );
    memcpy ( newstr + (tok - oldstr) + strlen( replacement ), tok + strlen ( substr ), strlen ( oldstr ) - strlen ( substr ) - ( tok - oldstr ) );
    memset ( newstr + strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) , <span class="Number">0</span>, <span class="Number">1</span> );
    <span class="Comment">/*</span><span class="Comment"> move back head right after the last replacement </span><span class="Comment">*/</span>
    head = newstr + (tok - oldstr) + strlen( replacement );
    free (oldstr);
    totaldiff += difflen;
  }
  free(*str);
  *str = (<span class="Type">char</span> *) calloc(<span class="Operator">sizeof</span>(<span class="Type">char</span>), (strlen(newstr) + <span class="Number">1</span>));
  strcpy(*str, newstr);
  free(newstr);
  <span class="Statement">return</span>;
}

<span class="Type">int</span> main(<span class="Type">void</span>) {
  <span class="Type">char</span> *string;
  string = (<span class="Type">char</span> *) malloc(<span class="Number">50</span>*<span class="Operator">sizeof</span>(<span class="Type">char</span>));
  sprintf(string, <span class="String">&quot;I'm a bad bad boy&quot;</span>);
  printf(<span class="String">&quot;Original String - </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">'bad' will be replaced with 'good'</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, string);
  str_replace(&amp;string, <span class="String">&quot;bad&quot;</span>, <span class="String">&quot;good&quot;</span>);
  printf(<span class="String">&quot;Modified String - </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, string);
  free(string);
  <span class="Statement">return</span> <span class="Number">0</span>;
}
</pre>
<pre class="vim">
<span class="PreCondit">#ifndef _STR_REPLACE_H</span>
<span class="Macro">#define _STR_REPLACE_H</span>

#include <span class="String">&lt;stdio.h&gt;</span>
#include <span class="String">&lt;string.h&gt;</span>
#include <span class="String">&lt;stdlib.h&gt;</span>
#include <span class="String">&lt;stdarg.h&gt;</span>

<span class="Type">void</span> str_replace ( <span class="Type">char</span> **string, <span class="StorageClass">const</span> <span class="Type">char</span> *substr, <span class="StorageClass">const</span> <span class="Type">char</span> *replacement );

<span class="PreCondit">#endif</span> <span class="Comment">/*</span><span class="Comment"> _STR_REPLACE_H </span><span class="Comment">*/</span>
</pre>
<p>Copy the above code into <code>str_replace.c</code> and <code>str_replace.h</code> and compile it and execute it.</p>
<pre>
@~ $  make str_replace
@~ $  ./str_replace
Original String - I'm a bad bad boy
'bad' will be replaced with 'good'
Modified String - I'm a good good boy
</pre>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/php-like-str_replace-function-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kickstrap &#8211; CSS Framework: Enhancements for Bootstrap</title>
		<link>http://www.humbug.in/2012/kickstrap-css-framework-enhancements-for-bootstrap/</link>
		<comments>http://www.humbug.in/2012/kickstrap-css-framework-enhancements-for-bootstrap/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 17:52:50 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css-framework]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1265</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/kickstrap-css-framework-enhancements-for-bootstrap/">Kickstrap &#8211; CSS Framework: Enhancements for Bootstrap</a></p><p>Kickstrap uses the latest version of Twitter&#8217;s bootstrap (http://twitter.github.com/bootstrap) and adds a layer of extras to create slick web applications with themes, modern html/css standards, an icon font, and progressive enhancement through javascript. Kickstrap: Enhancements for Bootstrap</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/kickstrap-css-framework-enhancements-for-bootstrap/">Kickstrap &#8211; CSS Framework: Enhancements for Bootstrap</a></p><p>Kickstrap uses the latest version of Twitter&#8217;s bootstrap (http://twitter.github.com/bootstrap) and adds a layer of extras to create slick web applications with themes, modern html/css standards, an icon font, and progressive enhancement through javascript.</p>
<p><a target="_blank" href='http://ajkochanowicz.github.com/Kickstrap/index.html'>Kickstrap: Enhancements for Bootstrap</a></p>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/kickstrap-css-framework-enhancements-for-bootstrap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates between 2012-03-29 and 2012-04-04</title>
		<link>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/</link>
		<comments>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 21:20:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/">Twitter Weekly Updates between 2012-03-29 and 2012-04-04</a></p><p>Twitter Digest for @free_thinker between 2012-03-29 and 2012-04-04</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/">Twitter Weekly Updates between 2012-03-29 and 2012-04-04</a></p><ul class="ws_tweet_list">
<li class="ws_tweet">The 1% <a href="http://search.twitter.com/search?q=%23Linux">#Linux</a> myth | Manila Standard Today <a href="http://t.co/fI83fPg6" rel="nofollow">http://t.co/fI83fPg6</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/187207276539555843">-&gt;</a></li>
<li class="ws_tweet">an in-kernel x86 disassember, we can look forward to more meaningful <a href="http://search.twitter.com/search?q=%23kernel">#kernel</a> panics now  <a href="http://t.co/h4gV2qrB" rel="nofollow">http://t.co/h4gV2qrB</a> <a href="http://search.twitter.com/search?q=%23fb">#fb</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/187197221740089344">-&gt;</a></li>
<li class="ws_tweet">10 Million hits a day with WordPress using a $15 server <a href="http://t.co/3yR2BOdG" rel="nofollow">http://t.co/3yR2BOdG</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/186159441752760320">-&gt;</a></li>
<li class="ws_tweet">Assign Google <a href="http://search.twitter.com/search?q=%23Adsense">#Adsense</a> Code to a <a href="http://search.twitter.com/search?q=%23PHP">#PHP</a> Variable: Assigning Google Adsense code to a PHP variable doesn&#039;t work the way.. <a href="http://t.co/8i2b0Et5" rel="nofollow">http://t.co/8i2b0Et5</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/185217787231342592">-&gt;</a></li>
</ul>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-29-and-2012-04-04/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Modify argv to hide sensitive information like passwords etc</title>
		<link>http://www.humbug.in/2012/modify-argv-to-hide-sensitive-information-like-passwords-etc/</link>
		<comments>http://www.humbug.in/2012/modify-argv-to-hide-sensitive-information-like-passwords-etc/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 06:58:27 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Code-Snippets]]></category>
		<category><![CDATA[argv]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1235</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/modify-argv-to-hide-sensitive-information-like-passwords-etc/">Modify argv to hide sensitive information like passwords etc</a></p><p>A lot of programs require you to pass sensitive information like passwords etc as arguments to the program. However if you pass passwords as arguments, it will be visible through the /proc filesystem or the ps ax output while the program is in execution. To avoid the possibility of anybody prying on sensitive information, programmers [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/modify-argv-to-hide-sensitive-information-like-passwords-etc/">Modify argv to hide sensitive information like passwords etc</a></p><p>A lot of programs require you to pass sensitive information like passwords etc as arguments to the program. However if you pass passwords as arguments, it will be visible through the <code>/proc</code> filesystem or the <code>ps ax</code> output while the program is in execution. To avoid the possibility of anybody prying on sensitive information, programmers should modify the memory location where the input parameters are stored (<code>argv</code> array), so that it is not visible to any other users, who might have the access levels to see what processes you&#8217;re running. Jotted below is some sample code which modifies its input parameters to hide it from the proc file system.<span id="more-1235"></span></p>
<pre class="vim">
<span class="Macro">#define      _GNU_SOURCE</span>
#include <span class="String">&lt;stdio.h&gt;</span>
#include <span class="String">&lt;time.h&gt;</span>
#include <span class="String">&lt;stdlib.h&gt;</span>
#include <span class="String">&lt;string.h&gt;</span>

<span class="Type">void</span> main(<span class="Type">int</span> argc, <span class="Type">char</span> **argv) {
  <span class="Type">char</span> cmd[<span class="Number">300</span>];

  <span class="Conditional">if</span> (argc == <span class="Number">2</span>) {
    <span class="Type">int</span> argvlen, i;
    printf(<span class="String">&quot;Unmodified argv[1] =&gt; </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">1</span>]);
    argvlen = strlen(argv[<span class="Number">1</span>]);
    <span class="Repeat">for</span>(i=<span class="Number">0</span>; i &lt; argvlen; i++)
      argv[<span class="Number">1</span>][i] = <span class="Character">'x'</span>;
    printf(<span class="String">&quot;Modified argv[1] =&gt; </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">1</span>]);
    sprintf(cmd,<span class="String">&quot;cat /proc/</span><span class="SpecialChar">%d</span><span class="String">/cmdline&quot;</span>, getpid());
    printf(<span class="String">&quot;/proc entry for the process at </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, cmd);
    system(cmd);
    printf(<span class="String">&quot;</span><span class="SpecialChar">\n</span><span class="String">ps ax entry for </span><span class="SpecialChar">%s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">0</span>]);
    sprintf(cmd,<span class="String">&quot;ps </span><span class="SpecialChar">%d</span><span class="String">&quot;</span>, getpid());
    system(cmd);
  } <span class="Conditional">else</span>
    printf(<span class="String">&quot;Usage: </span><span class="SpecialChar">%s</span><span class="String"> some-string</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">0</span>]);
}
</pre>
<p>Sample output of the program.</p>
<pre>
@c $  ./modify_argv test
Unmodified argv[1] => test
Modified argv[1] => xxxx
/proc entry for the process at cat /proc/22493/cmdline
./modify_argvxxxx
ps ax entry for ./modify_argv
  PID TTY      STAT   TIME COMMAND
22493 pts/0    S+     0:00 ./modify_argv xxxx
</pre>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/modify-argv-to-hide-sensitive-information-like-passwords-etc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sample C program to ping hosts using fping</title>
		<link>http://www.humbug.in/2012/sample-c-program-to-ping-hosts-using-fping/</link>
		<comments>http://www.humbug.in/2012/sample-c-program-to-ping-hosts-using-fping/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 06:07:19 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Code-Snippets]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[ping]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1229</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/sample-c-program-to-ping-hosts-using-fping/">Sample C program to ping hosts using fping</a></p><p>Here&#8217;s some sample C code which one can integrate into their projects to ping hosts. It uses fping instead of ping to do the actual pinging. Unlike ping, fping is meant to be used in scripts, so its output is designed to be easy to parse. #define _GNU_SOURCE #include &#60;stdio.h&#62; #include &#60;arpa/inet.h&#62; #include &#60;string.h&#62; #include [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/sample-c-program-to-ping-hosts-using-fping/">Sample C program to ping hosts using fping</a></p><p>Here&#8217;s some sample C code which one can integrate into their projects to ping hosts. It uses fping instead of ping to do the actual pinging. Unlike  ping,  fping is meant to be used in scripts, so its output is designed to be easy to parse. <span id="more-1229"></span></p>
<pre class="vim">
<span class="Macro">#define      _GNU_SOURCE</span>
#include <span class="String">&lt;stdio.h&gt;</span>
#include <span class="String">&lt;arpa/inet.h&gt;</span>
#include <span class="String">&lt;string.h&gt;</span>
#include <span class="String">&lt;stdlib.h&gt;</span>

<span class="Type">int</span>
ping(<span class="Type">char</span> *ipaddr) {
  <span class="Type">char</span> *command = <span class="Constant">NULL</span>;
  <span class="Type">FILE</span> *fp;
  <span class="Type">int</span> stat = <span class="Number">0</span>;
  asprintf (&amp;command, <span class="String">&quot;</span><span class="SpecialChar">%s</span><span class="String"> </span><span class="SpecialChar">%s</span><span class="String"> -q 2&gt;&amp;1&quot;</span>, <span class="String">&quot;fping&quot;</span>, ipaddr);
  fp = popen(command, <span class="String">&quot;r&quot;</span>);
  <span class="Conditional">if</span> (fp == <span class="Constant">NULL</span>) {
    fprintf(<span class="Constant">stderr</span>, <span class="String">&quot;Failed to execute fping command</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>);
    free(command);
    <span class="Statement">return</span> -<span class="Number">1</span>;
  }
  stat = pclose(fp);
  free(command);
  <span class="Statement">return</span> WEXITSTATUS(stat);
}

<span class="Comment">/*</span><span class="Comment">  Check if an ip address is valid </span><span class="Comment">*/</span>
<span class="Type">int</span> isValidIpAddress(<span class="Type">char</span> *ipaddr)
{
    <span class="Structure">struct</span> sockaddr_in sa;
    <span class="Type">int</span> result = inet_pton(AF_INET, ipaddr, &amp;(sa.sin_addr));
    <span class="Statement">return</span> result != <span class="Number">0</span>;
}

<span class="Type">int</span> main(<span class="Type">int</span> argc, <span class="Type">char</span> **argv) {
  <span class="Type">int</span> status = <span class="Number">0</span>;
  <span class="Conditional">if</span>(argc != <span class="Number">2</span>) {
    printf(<span class="String">&quot;Example Usage: </span><span class="SpecialChar">%s</span><span class="String"> 192.168.1.1</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">0</span>]);
    <span class="Statement">return</span> <span class="Number">1</span>;
  } <span class="Conditional">else</span> <span class="Conditional">if</span>(!isValidIpAddress(argv[<span class="Number">1</span>])) {
    printf(<span class="String">&quot;</span><span class="SpecialChar">%s</span><span class="String"> is an invalid IP Address</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">1</span>]);
    <span class="Statement">return</span> <span class="Number">1</span>;
  }
  status = ping(argv[<span class="Number">1</span>]);
  <span class="Conditional">if</span> (status) {
    printf(<span class="String">&quot;Could ping </span><span class="SpecialChar">%s</span><span class="String"> successfully, status </span><span class="SpecialChar">%d</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, argv[<span class="Number">1</span>], status);
  } <span class="Conditional">else</span> {
    printf(<span class="String">&quot;Machine not reachable, status </span><span class="SpecialChar">%d</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, status);
  }
  <span class="Statement">return</span> status;
}
</pre>
<p>To install fping on ubuntu:</p>
<pre>sudo apt-get install fping</pre>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/sample-c-program-to-ping-hosts-using-fping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install kmscon on Ubuntu Linux</title>
		<link>http://www.humbug.in/2012/install-kmscon-on-ubuntu-linux/</link>
		<comments>http://www.humbug.in/2012/install-kmscon-on-ubuntu-linux/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 07:45:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Tips-N-Tricks]]></category>
		<category><![CDATA[kmscon]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1224</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/install-kmscon-on-ubuntu-linux/">Install kmscon on Ubuntu Linux</a></p><p>Kmscon is a simple terminal emulator based on linux kernel mode setting (KMS). It is an attempt to replace the in-kernel VT implementation with a userspace console. It is similar to the in-kernel terminal-emulator and is based on DRM. Listed below is the procedure to install kmscon in ubuntu. sudo apt-get install libgles2-mesa-dev libgbm-dev libegl1-mesa-dev [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/install-kmscon-on-ubuntu-linux/">Install kmscon on Ubuntu Linux</a></p><p>Kmscon is a simple terminal emulator based on linux kernel mode setting (KMS). It is an attempt to replace the in-kernel VT implementation with a userspace console. It is similar to the in-kernel terminal-emulator and is based on DRM. Listed below is the procedure to install kmscon in ubuntu.</p>
<pre class="vim">
sudo apt-get <span class="Statement">install</span> libgles2-mesa-dev libgbm-dev libegl1-mesa-dev libdrm-dev libglib2.0-dev libfreetype6-dev
git clone <a href="https://github.com/dvdhrm/kmscon.git">https://github.com/dvdhrm/kmscon.git</a>
./autogen.sh
make
sudo ./kmscon <span class="Special">--switchvt</span>
</pre>
<p>The last command will start kmscon on <code>/dev/tty8</code>.</p>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/install-kmscon-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Assign Google Adsense Code to a PHP Variable</title>
		<link>http://www.humbug.in/2012/assign-google-adsense-code-to-a-php-variable/</link>
		<comments>http://www.humbug.in/2012/assign-google-adsense-code-to-a-php-variable/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 04:11:34 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Tips-N-Tricks]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1218</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/assign-google-adsense-code-to-a-php-variable/">Assign Google Adsense Code to a PHP Variable</a></p><p>Assigning Google Adsense code to a PHP variable doesn&#8217;t work the way you would expect it to. I thought just deleting the newline characters and extra spaces from the adsense code and then assigning the resulting text to a variable should work. However it does not, and I&#8217;m not sure why. However what does work [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/assign-google-adsense-code-to-a-php-variable/">Assign Google Adsense Code to a PHP Variable</a></p><p>Assigning Google Adsense code to a PHP variable doesn&#8217;t work the way you would expect it to. I thought just deleting the newline characters and extra spaces from the adsense code and then assigning the resulting text to a variable should work. However it does not, and I&#8217;m not sure why. However what does work is shown below.</p>
<pre class="vim">
<span class="Delimiter">&lt;?php</span>
<span class="Operator">$</span><span class="Identifier">googleadsensecode</span> <span class="Operator">=</span> '
<span class="String">&lt;script type=&quot;text/javascript&quot;&gt;</span>
<span class="String">google_ad_client = &quot;pub-123456789&quot;;</span>
<span class="String">google_ad_slot = &quot;123456&quot;;</span>
<span class="String">google_ad_width = 300;</span>
<span class="String">google_ad_height = 250;</span>
<span class="String">//--&gt;</span>
<span class="String">&lt;/script&gt;</span>
<span class="String">&lt;script type=&quot;text/javascript&quot;</span>
<span class="String">src=&quot;<a href="http://pagead2.googlesyndication.com/pagead/show_ads.js">http://pagead2.googlesyndication.com/pagead/show_ads.js</a>&quot;&gt;</span>
<span class="String">&lt;/script&gt;</span>';
<span class="Define">echo</span> <span class="Operator">$</span><span class="Identifier">googleadsensecode</span>;
<span class="Delimiter">?&gt;</span>
</pre>
<p>The following example does not work.</p>
<pre class="vim">
<span class="Delimiter">&lt;?php</span>
<span class="Operator">$</span><span class="Identifier">googleadsensecode</span> <span class="Operator">=</span> '<span class="String">&lt;script type=&quot;text/javascript&quot;&gt; &lt;!-- google_ad_client = &quot;ca-pub-123456789&quot;; google_ad_slot = &quot;123456&quot;; google_ad_width = 300; google_ad_height = 250; //--&gt; &lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;<a href="http://pagead2.googlesyndication.com/pagead/show_ads.js">http://pagead2.googlesyndication.com/pagead/show_ads.js</a>&quot;&gt; &lt;/script&gt;</span>';
<span class="Define">echo</span> <span class="Operator">$</span><span class="Identifier">googleadsensecode</span>
<span class="Delimiter">?&gt;</span>
</pre>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/assign-google-adsense-code-to-a-php-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates between 2012-03-22 and 2012-03-28</title>
		<link>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/</link>
		<comments>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 21:20:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/">Twitter Weekly Updates between 2012-03-22 and 2012-03-28</a></p><p>Twitter Digest for @free_thinker between 2012-03-22 and 2012-03-28</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/">Twitter Weekly Updates between 2012-03-22 and 2012-03-28</a></p><ul class="ws_tweet_list">
<li class="ws_tweet">Makefile &#8211; Check if a file exists using wildcard function: The following snippet of code can be used to check for &#8230; <a href="http://t.co/VSdW1QYj" rel="nofollow">http://t.co/VSdW1QYj</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/185000045303697409">-&gt;</a></li>
<li class="ws_tweet">Yocto Project &#8211; Open Source Embedded Linux build system, package metadata and SDK generator.: The Yocto Project™&#8230; <a href="http://t.co/PwvVvbdv" rel="nofollow">http://t.co/PwvVvbdv</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/184974190208761856">-&gt;</a></li>
<li class="ws_tweet">Configure Ubuntu to use Bash as default shell instead of Dash: Ubuntu uses Dash (Debian Almquist shell) as the def&#8230; <a href="http://t.co/JLXVzGS1" rel="nofollow">http://t.co/JLXVzGS1</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/184972869086871552">-&gt;</a></li>
<li class="ws_tweet">Going Beyond the Guidebooks &#8211; City Diary &#8211; TuoiTreNews <a href="http://t.co/fW4hHSVX" rel="nofollow">http://t.co/fW4hHSVX</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/184965354747998208">-&gt;</a></li>
<li class="ws_tweet">Now is the worst time ever to buy an Android phone <a href="http://t.co/pGjIXz4E" rel="nofollow">http://t.co/pGjIXz4E</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/183853579352801280">-&gt;</a></li>
<li class="ws_tweet">SCons: A software construction tool &#8211; Alternative to Make/Automake/Autoconf: SCons is an Open Source software cons&#8230; <a href="http://t.co/u4T2F7kb" rel="nofollow">http://t.co/u4T2F7kb</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/183567821500989440">-&gt;</a></li>
<li class="ws_tweet">Usernoise modal feedback/contact form &#8211; <a href="http://search.twitter.com/search?q=%23wordpress">#wordpress</a> plugin &#8211; <a href="http://t.co/nkFmgvxb" rel="nofollow">http://t.co/nkFmgvxb</a> <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/183439362518814720">-&gt;</a></li>
<li class="ws_tweet">RT <a href="http://twitter.com/tomosaigon">@tomosaigon</a>: If you ever need to debug crazy bugs in Chrome, chrome://net-internals/ is AWESOME. Also: chrome://view-http-cache/ <a class="ws_tweet_time" href="http://twitter.com/free_thinker/statuses/182842073395904514">-&gt;</a></li>
</ul>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/twitter-weekly-updates-between-2012-03-22-and-2012-03-28/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foresight.js &#8211; Handle High Resolution Images</title>
		<link>http://www.humbug.in/2012/foresight-js-handle-high-resolution-images/</link>
		<comments>http://www.humbug.in/2012/foresight-js-handle-high-resolution-images/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 16:54:00 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[high-resolution-images]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1215</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/foresight-js-handle-high-resolution-images/">foresight.js &#8211; Handle High Resolution Images</a></p><p>Foresight.js gives webpages the ability to tell if the user&#8217;s device is capable of viewing high-resolution images (such as the 3rd generation iPad) before the image is requested from the server. Additionally, it judges if the user&#8217;s device currently has a fast enough network connection for high-resolution images. Depending on device display and network connectivity, [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/foresight-js-handle-high-resolution-images/">foresight.js &#8211; Handle High Resolution Images</a></p><p>Foresight.js gives webpages the ability to tell if the user&#8217;s device is capable of viewing high-resolution images (such as the 3rd generation iPad) before the image is requested from the server. Additionally, it judges if the user&#8217;s device currently has a fast enough network connection for high-resolution images. Depending on device display and network connectivity, foresight.js will request the appropriate image for the webpage</p>
<ul>
<li>Request hi-res images according to device pixel ratio</li>
<li>Estimates network connection speed prior to requesting an image</li>
<li>Does not use device detection through user-agents</li>
<li>Does not make multiple requests for the same image</li>
<li>Javascript library and framework independent (ie: jQuery not required)</li>
<li>Cross-browser and cross-platform</li>
<li>Image dimensions set by percents will scale to the parent element&#8217;s available width and device pixel ratio</li>
<li>Fully customizable through global configuration options and individual <em>img</em> attributes</li>
<li>Default images will load without javascript enabled</li>
<li>Minifies down to roughly 5K</li>
</ul>
<p><a target="_blank" href='https://github.com/adamdbradley/foresight.js'>foresight.js</a></p>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/foresight-js-handle-high-resolution-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sudo execute multiple commands with superuser/root permission</title>
		<link>http://www.humbug.in/2012/sudo-execute-multiple-commands-with-superuserroot-permission/</link>
		<comments>http://www.humbug.in/2012/sudo-execute-multiple-commands-with-superuserroot-permission/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 14:16:51 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Tips-N-Tricks]]></category>
		<category><![CDATA[sudo]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1192</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/sudo-execute-multiple-commands-with-superuserroot-permission/">sudo execute multiple commands with superuser/root permission</a></p><p>The longer way of executing multiple command with root permissions is to put all the commands into a script and then executing the script using sudo. However if you want to avoid doing that for something quick, the following command construct could be used. sudo sh -c "whoami; whoami"</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/sudo-execute-multiple-commands-with-superuserroot-permission/">sudo execute multiple commands with superuser/root permission</a></p><p>The longer way of executing multiple command with root permissions is to put all the commands into a script and then executing the script using sudo. However if you want to avoid doing that for something quick, the following command construct could be used.</p>
<pre>
sudo sh -c "whoami; whoami"
</pre>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/sudo-execute-multiple-commands-with-superuserroot-permission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Makefile &#8211; Check if a file exists using wildcard function</title>
		<link>http://www.humbug.in/2012/makefile-check-if-a-file-exists-using-wildcard-function/</link>
		<comments>http://www.humbug.in/2012/makefile-check-if-a-file-exists-using-wildcard-function/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 13:46:37 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Tips-N-Tricks]]></category>
		<category><![CDATA[check-file-exists]]></category>
		<category><![CDATA[Make]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1209</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/makefile-check-if-a-file-exists-using-wildcard-function/">Makefile &#8211; Check if a file exists using wildcard function</a></p><p>The following snippet of code can be used to check for the existence of a file from within a Makefile. ifneq (&#34;$(wildcard $(PATH_TO_FILE))&#34;,&#34;&#34;) FILE_EXISTS = 1 else FILE_EXISTS = 0 endif Quoting from make documentation. $(wildcard pattern) The argument pattern is a file name pattern, typically containing wildcard characters (as in shell file name patterns). [...]</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/makefile-check-if-a-file-exists-using-wildcard-function/">Makefile &#8211; Check if a file exists using wildcard function</a></p><p>The following snippet of code can be used to check for the existence of a file from within a Makefile.</p>
<pre class="vim">
<span class="PreCondit">ifneq</span> (<span class="String">&quot;</span><span class="Identifier">$(</span><span class="Statement">wildcard</span><span class="Identifier"> $(PATH_TO_FILE))</span><span class="String">&quot;</span>,<span class="String">&quot;&quot;</span>)
<span class="Identifier">FILE_EXISTS </span>= 1
<span class="PreCondit">else</span>
<span class="Identifier">FILE_EXISTS </span>= 0
<span class="PreCondit">endif</span>
</pre>
<p>Quoting from make documentation.</p>
<div class="note">
<div class="icon"><code>$(wildcard </code><var>pattern</var><code>)</code><br />
The argument <code>pattern</code> is a file name pattern, typically containing<br />
wildcard characters (as in shell file name patterns).  The result of<br />
<code>wildcard</code> is a space-separated list of the names of existing files<br />
that match the pattern.</div>
</div>
<p>In this present case, we are not using any wildcards, but the absolute path to the file.</p>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/makefile-check-if-a-file-exists-using-wildcard-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript libraries for dealing with touch events, multitouch, normalizing across the Webkit/IE touch models</title>
		<link>http://www.humbug.in/2012/javascript-libraries-for-dealing-with-touch-events-multitouch-normalizing-across-the-webkitie-touch-models/</link>
		<comments>http://www.humbug.in/2012/javascript-libraries-for-dealing-with-touch-events-multitouch-normalizing-across-the-webkitie-touch-models/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 12:30:34 +0000</pubDate>
		<dc:creator>Pratik Sinha</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.humbug.in/?p=1206</guid>
		<description><![CDATA[<p><p><a href="http://www.humbug.in/2012/javascript-libraries-for-dealing-with-touch-events-multitouch-normalizing-across-the-webkitie-touch-models/">Javascript libraries for dealing with touch events, multitouch, normalizing across the Webkit/IE touch models</a></p><p>Javascript libraries for dealing with touch events, multitouch, normalizing across the Webkit/IE touch models https://github.com/bebraw/jswiki/wiki/Touch</p></p><p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.humbug.in/2012/javascript-libraries-for-dealing-with-touch-events-multitouch-normalizing-across-the-webkitie-touch-models/">Javascript libraries for dealing with touch events, multitouch, normalizing across the Webkit/IE touch models</a></p><p>Javascript libraries for dealing with touch events, multitouch, normalizing across the Webkit/IE touch models</p>
<p><a target="_blank" href='https://github.com/bebraw/jswiki/wiki/Touch'>https://github.com/bebraw/jswiki/wiki/Touch</a></p>
<p><a href="http://www.humbug.in">Humbug - Bah! Humbug!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.humbug.in/2012/javascript-libraries-for-dealing-with-touch-events-multitouch-normalizing-across-the-webkitie-touch-models/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 37/83 queries in 0.202 seconds using disk: basic
Object Caching 2541/2646 objects using disk: basic

Served from: www.humbug.in @ 2012-05-19 04:31:19 -->
