<?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>Uncertain Binary Thoughts &#187; howto</title>
	<atom:link href="http://ankurs.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://ankurs.com</link>
	<description>01110100110101010101011101100010</description>
	<lastBuildDate>Sun, 01 Jan 2012 18:20:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Getting started with pthread</title>
		<link>http://ankurs.com/2009/09/getting-started-with-pthread/</link>
		<comments>http://ankurs.com/2009/09/getting-started-with-pthread/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:38:34 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[begining]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[pthread]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=562</guid>
		<description><![CDATA[Recently i have started coding in C a lot and what i came across from a lot of people is that doing Threading in C is very hard, is it really like that? here is a simple Pthread program that should clear that up get it here in the above program i have just created&#8230;]]></description>
			<content:encoded><![CDATA[<p>Recently i have started coding in C a lot and what i came across from a lot of people is that doing Threading in C is very hard, is it really like that? here is a simple Pthread program that should clear that up<br />
<script src="http://gist.github.com/179778.js"></script><br />
get it <a href="http://gist.github.com/179778">here</a></p>
<p>in the above program i have just created 2 threads and passed thr1 ( = 1 ) and thr2 ( = 2 ) values as parameters the function void * thread ( void * ptr ) is executes as a separate thread, we create two thread objects thread1 and thread2, and start threads using pthread_create function passing thread object, function pointer and parameters as arguments, here NULL specifies default attributes for the thread, we can change this by passing pthread_attr_t structure instead of NULL.<br />
we wait for the threads to finish using the pthread_join function<br />
One major problem that is faced by most of the people is of using a library which is not a thread safe library, so you need to be careful about the libraries you use in your program, if not sure about a particular library being thread safe, just assume it not to be thread safe</p>
<p>PS &#8211; No updates from a long time as i dont have a proper net connection &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/09/getting-started-with-pthread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your own service like tinyurl</title>
		<link>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/</link>
		<comments>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/#comments</comments>
		<pubDate>Sun, 24 May 2009 09:45:56 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[tinyurl]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=505</guid>
		<description><![CDATA[Few weeks ago i came across this article on Techcrunch which says tinyurl is worth $46Million (of course before twitter started using bit.ly as default) which made me think how hard is it to make a simple service like tinyurl and i figured out its not hard. so i used apache&#8217;s mod_rewrite to rewrite the&#8230;]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago i came across <a href="http://www.techcrunch.com/2009/03/30/if-bitly-is-worth-8-million-tinyurl-is-worth-at-least-46-million/">this</a> article on Techcrunch which says tinyurl is worth $46Million (of course before twitter started using bit.ly as default) which made me think how hard is it to make a simple service like tinyurl and i figured out its not hard. so i used apache&#8217;s mod_rewrite to rewrite the url and forward the code to a php script ( url.php ) which will then search for the url in database and take the use to the original url and for shorting, url it is inserted into a table with a auto increment primary key and the key is converted to base36 which contains [a-z] and [0-9], making the short code&#8230;</p>
<p>First create a database say &#8216;shorturl&#8217;<code><br />
CREATE TABLE IF NOT EXISTS `shorturl` (<br />
`id` int(11) NOT NULL AUTO_INCREMENT,<br />
`url` varchar(300) NOT NULL,<br />
PRIMARY KEY (`id`)<br />
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />
</code><br />
then create file .htaccess where you want your url to be and write<code><br />
RewriteEngine On<br />
RewriteCond %{REQUEST_URI} \/([0-9a-z]*)$ [NC]<br />
RewriteRule ^(.*) url.php?url=%1 [L]<br />
</code></p>
<p>and to create the url we will use a simple file say create.php<br />
<code><br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Url Shortner&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;?php<br />
ob_start();<br />
$host=""; //host<br />
$dbuser=""; // database username<br />
$dbpass=""; // database password<br />
$db=""; //database name<br />
$con = mysql_connect($host,$dbuser,$dbpass);<br />
mysql_select_db("url",$con);<br />
if (!isset($_POST['shorten']))<br />
{<br />
echo "&lt;center&gt;&lt;h3&gt;Enter the url to shorten&lt;/h3&gt;&lt;form method='POST'&gt;&lt;input type='text' name='url' /&gt;<br />
&lt;input type='submit' name='shorten' value='Shorten' /&gt;&lt;/form&gt;&lt;/center&gt;";<br />
}<br />
else<br />
{<br />
if (isset($_POST['url']))<br />
{<br />
$url=" ".mysql_real_escape_string($_POST['url']);<br />
if (strpos($url,"http://") or strpos($url,"https://") or strpos($url,"ftp://"))<br />
{<br />
$url=mysql_real_escape_string($_POST['url']);<br />
}<br />
else<br />
{<br />
$url="http://".mysql_real_escape_string($_POST['url']);<br />
}<br />
$q="select * from url where url='{$url}'";<br />
$res = mysql_query($q,$con);<br />
$row=mysql_fetch_row($res);<br />
if (!$row)<br />
{<br />
$query="insert into url set url='{$url}'";<br />
$res = mysql_query($query,$con);<br />
}<br />
$query1="select id from url where url='{$url}' limit 1";<br />
$res=mysql_query($query1,$con);<br />
$row=mysql_fetch_row($res);<br />
echo "shortened url is http://yoursite.com/".base_convert($row[0],10,36);<br />
}<br />
}<br />
ob_end_flush();<br />
?&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code><br />
then our url.php file<br />
<code><br />
&lt;?php<br />
ob_start();<br />
$host=""; //host<br />
$dbuser=""; // database username<br />
$dbpass=""; // database password<br />
$db=""; //database name<br />
$con = mysql_connect($host,$dbuser,$dbpass);<br />
mysql_select_db($db,$con);<br />
if (isset($_GET['url']))<br />
{<br />
$query="select * from url where id ='".base_convert(mysql_real_escape_string($_GET['url']),36,10)."'";<br />
$res = mysql_query($query,$con);<br />
$row=mysql_fetch_row($res);<br />
header("Location: ".$row[1]);<br />
}<br />
ob_end_flush();<br />
?&gt;</code></p>
<p>Download <a href="http://ankurs.com/wp-content/uploads/2009/05/urltar.gz">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/05/creating-your-own-service-like-tinyurl/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Synaptics Touchpad in Fedora 9</title>
		<link>http://ankurs.com/2008/05/synaptics-touchpad-in-fedora-9/</link>
		<comments>http://ankurs.com/2008/05/synaptics-touchpad-in-fedora-9/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:30:35 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Fedora 9]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[Synaptics]]></category>
		<category><![CDATA[Touchpad]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=374</guid>
		<description><![CDATA[I have been using Fedora 9 from a long time and it really kick&#8217;s ass but i was facing the problem that my Touchpad was not working with it but the i found the solution here Here is how to do it The easiest was will be to install the package http://atrpms.net/dist/f9/synaptics/ or you can&#8230;]]></description>
			<content:encoded><![CDATA[<p>I have been using Fedora 9 from a long time and it really kick&#8217;s ass but i was facing the problem that my Touchpad was not working with it but the i found the solution <a href="http://gentoo-wiki.com/HARDWARE_Synaptics_Touchpad">here</a><br />
Here is how to do it</p>
<p>The easiest was will be to install the package <a href="http://atrpms.net/dist/f9/synaptics/">http://atrpms.net/dist/f9/synaptics/</a><br />
or you can do it manually here</p>
<p>edited the /etc/X11/xorg.conf<br />
<code>gedit /etc/X11/xorg.conf</code></p>
<p>Added the following to the ServerLayout Section<br />
<code>InputDevice “TouchPad” “CorePointer”</code></p>
<p>add a new section:<br />
<code>Section “InputDevice”<br />
Driver      “synaptics”<br />
Identifier  “TouchPad”<br />
Option      “SendCoreEvents”<br />
Option      “Protocol” “auto-dev”<br />
Option      “SHMConfig” “on”<br />
Option “TapButton1″ “1″<br />
Option “TapButton2″ “2″<br />
EndSection</code></p>
<p>all done logout and login again and everything should be working fine</p>
<p>Update: found the rpm package <a href="https://bugzilla.redhat.com/show_bug.cgi?id=439386#c66">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2008/05/synaptics-touchpad-in-fedora-9/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

