<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Harsh Tech Talk</title>
	
	<link>http://www.harshtechtalk.com</link>
	<description>This blog is all about technology covering programming, Python, C++, algorithms, data structures, coding tips and tricks and many more.</description>
	<lastBuildDate>Tue, 26 Mar 2013 08:01:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/harshtechtalk" /><feedburner:info uri="harshtechtalk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>harshtechtalk</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>How to Predict the Number of Likes on your Facebook Post? – An Analysis</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/KoYydZaMpSw/how-to-predict-the-number-of-likes-on-your-facebook-post-an-analysis.html</link>
		<comments>http://www.harshtechtalk.com/how-to-predict-the-number-of-likes-on-your-facebook-post-an-analysis.html#comments</comments>
		<pubDate>Tue, 26 Mar 2013 08:01:17 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=435346</guid>
		<description><![CDATA[Have you ever wondered why you got so many likes on your one Facebook post whereas almost none on another? Lets dive deep into this and explore how this liking process works. Now this is not going to be an easy task. Moreover, the prediction accuracy might vary a lot. Lets start by dividing the [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered why you got so many likes on your one Facebook post whereas almost none on another? Lets dive deep into this and explore how this liking process works. Now this is not going to be an easy task. Moreover, the prediction accuracy might vary a lot.</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/03/facebook_like_button_big.jpg"><img title="facebook_like_button_big" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="148" alt="facebook_like_button_big" src="http://www.harshtechtalk.com/wp-content/uploads/2013/03/facebook_like_button_big_thumb.jpg" width="332" border="0" /></a> </p>
<p>Lets start by dividing the posts that a person makes into two wide categories -</p>
<p>1) <strong>Personal posts</strong> – Like uploading an album or updating status which says something about oneself like “Having fun time at Goa, boozing and beaches!”</p>
<p>2) <strong>Non Personal posts</strong> – These include some generic updates like “Sachin’s career in an infographic”.</p>
<p>Now we need to divide people in friends list and set a “Like expectation” with each group. Its more like probability of getting a like from that group of people. Here is how I divide people in friends list -</p>
<p>a) <strong>People with whom you are in regular touch</strong> – These are people like your family, friends with whom you go out every weekend, people with whom you chat regularly, girlfriend/boyfriend etc. “Like expectation” in this case would be high. Lets keep it at 0.8 for personal posts as well as non personal posts.</p>
<p>b) <strong>People with whom you talk less frequently</strong> – These are people like your office colleagues, few relatives, some “not so good” friends, etc. “Like expectation” in this case should be around 0.3 for personal posts and 0.4 for non personal posts.</p>
<p>c) <strong>People to whom you rarely talk</strong> – These include few batch mates from graduate school, few school mates, distant relatives, etc. “Like expectation” in this case would be very low. Lets keep it at 0.1 for personal posts and 0.3 for non personal posts.</p>
<p>One important point to note here would be the variation in “Like expectation” from a) to b) to c). It doesn’t vary much in case of non personal posts, as expected, because if you share “Sachin’s career in an infographic”, then everyone sharing that interest would be equally interested in that post irrespective of your relation with that person. On the other hand, “Like expectation” varies a lot (goes down steeply) as one moves from a) to b) to c). This is more obvious as your relation with person is getting weaker and he would be less interested in your personal posts as you go from a) to b) to c).</p>
<p>These “Like expectation” values have been taken approximately, but actually they should be based on a survey. So, for a person with 250 Facebook friends and if 20, 30 and 200 are the number of people in categories a), b) and c) respectively, then he should be getting -</p>
<p>20*0.8 + 30*0.3 + 200*0.1 = 16 + 9 + 20 = 45 likes approximately if he posts a personal stuff, and</p>
<p>20*0.8 + 30*0.4 + 200*0.3 = 16 + 12 + 60 = 88 like approximately if he posts a non personal stuff.</p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="How to Predict the Number of Likes on your Facebook Post? &ndash; An Analysis" url="http://www.harshtechtalk.com/how-to-predict-the-number-of-likes-on-your-facebook-post-an-analysis.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/KoYydZaMpSw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/how-to-predict-the-number-of-likes-on-your-facebook-post-an-analysis.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/how-to-predict-the-number-of-likes-on-your-facebook-post-an-analysis.html</feedburner:origLink></item>
		<item>
		<title>Moving on from Google Reader to The Old Reader</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/tZY8OOw500U/moving-on-from-google-reader-to-the-old-reader.html</link>
		<comments>http://www.harshtechtalk.com/moving-on-from-google-reader-to-the-old-reader.html#comments</comments>
		<pubDate>Wed, 20 Mar 2013 09:46:57 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=427303</guid>
		<description><![CDATA[With Google Reader getting discontinued from 1st of July, every user is now looking for best possible alternative. With best possible option, people are also looking for the ease of switching. The Old Reader stands good on both the points. I made that transition today using the following simple steps, which I would like to [...]]]></description>
			<content:encoded><![CDATA[<p>With Google Reader getting discontinued from 1st of July, every user is now looking for best possible alternative. With best possible option, people are also looking for the ease of switching. <a href="http://theoldreader.com/" target="_blank">The Old Reader</a> stands good on both the points. I made that transition today using the following simple steps, which I would like to share -</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/03/TheOldReader.png"><img title="The Old Reader" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="121" alt="The Old Reader" src="http://www.harshtechtalk.com/wp-content/uploads/2013/03/TheOldReader_thumb.png" width="432" border="0" /></a> </p>
<p>1) Go to Google Reader –&gt; Reader Settings.</p>
<p>2) Click on Import/Export. Then click on “Download your data through Takeout”</p>
<p>3) This will take you to the Takeout page. Here if you have more than one services, choose Reader and click on “Create Archive”.</p>
<p>4) In the Downloads tab, you will see the Takeout download getting generated. Download and save the file.</p>
<p>5) In the downloaded file, look for subscriptions.xml. This is the file you would need to import your data to The Old Reader.</p>
<p>6) Now go to The Old Reader and login. Click on Import.</p>
<p>7) Now browse for the subscriptions.xml from point 5 and click on Import.</p>
<p>You are done. Most probably you will see a long queue of imports before you. That is expected as many people are switching to this service.</p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="Moving on from Google Reader to The Old Reader" url="http://www.harshtechtalk.com/moving-on-from-google-reader-to-the-old-reader.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/tZY8OOw500U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/moving-on-from-google-reader-to-the-old-reader.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/moving-on-from-google-reader-to-the-old-reader.html</feedburner:origLink></item>
		<item>
		<title>Comic: Quora Addiction</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/lilbEzH032s/comic-quora-addiction.html</link>
		<comments>http://www.harshtechtalk.com/comic-quora-addiction.html#comments</comments>
		<pubDate>Sun, 17 Feb 2013 22:58:04 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[comic]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[humor]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=393054</guid>
		<description><![CDATA[You know you are addicted to Quora when you dare to take steps like…..]]></description>
			<content:encoded><![CDATA[<p>You know you are addicted to Quora when you dare to take steps like….. <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/02/quora_addiction.png"><img title="quora_addiction" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="341" alt="quora_addiction" src="http://www.harshtechtalk.com/wp-content/uploads/2013/02/quora_addiction_thumb.png" width="643" border="0" /></a></p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="Comic: Quora Addiction" url="http://www.harshtechtalk.com/comic-quora-addiction.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/lilbEzH032s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/comic-quora-addiction.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/comic-quora-addiction.html</feedburner:origLink></item>
		<item>
		<title>Octave Beginner’s Commands – Part 1</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/Aw12Cq_jnUw/octave-beginners-commands-part-1.html</link>
		<comments>http://www.harshtechtalk.com/octave-beginners-commands-part-1.html#comments</comments>
		<pubDate>Sun, 17 Feb 2013 14:08:08 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[octave]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=392931</guid>
		<description><![CDATA[For those who are starting with Machine Learning or Data Analysis, Octave is a nice language for numerical computation. Creating graphs/plots, dealing with matrices and assembling and dealing with data in various other forms is a lot convenient in Octave. I’ve recently started to use it, as I’m going through the Machine Learning course on [...]]]></description>
			<content:encoded><![CDATA[<p>For those who are starting with Machine Learning or Data Analysis, <a href="http://www.gnu.org/software/octave/" target="_blank">Octave</a> is a nice language for numerical computation. Creating graphs/plots, dealing with matrices and assembling and dealing with data in various other forms is a lot convenient in Octave. I’ve recently started to use it, as I’m going through the <a href="https://class.coursera.org/ml-2012-002/class/index" target="_blank">Machine Learning course on Coursera</a> by Professor Andrew Ng. </p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/02/Octave.png"><img title="Octave" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="200" alt="Octave" src="http://www.harshtechtalk.com/wp-content/uploads/2013/02/Octave_thumb.png" width="200" border="0" /></a> </p>
<p>As I move on with the course and complete assignments I’m thinking of putting together all the commands with easy explanations here in my blog. As I can see that although there have been few videos on using Octave but for an absolute beginner, there is still something lacking and most people won’t get the hold of Octave properly. I would be creating this series in parts and in each part I would collect and explain few commands every time. So here are the commands for this part -</p>
<p>1) <strong>Matrix Transpose</strong> -</p>
<p>If M is the given matrix, then matrix transpose can be obtained by M’ -</p>
<blockquote><p>octave:19&gt; M = [1 2 3; 4 5 6; 7 8 9];      <br />octave:20&gt; M&#8217;       <br />ans = </p>
<p>&#160;&#160; 1&#160;&#160; 4&#160;&#160; 7      <br />&#160;&#160; 2&#160;&#160; 5&#160;&#160; 8       <br />&#160;&#160; 3&#160;&#160; 6&#160;&#160; 9</p>
</blockquote>
<p>2) <strong>Obtain a particular row from the matrix</strong> -</p>
<p>Suppose you have a matrix M and you want to get the second row of the matrix, you should use M(2,:)</p>
<p>This means that you want to take all(represented by : ) the elements present in the second row which effectively means whole of second row -</p>
<blockquote><p>octave:21&gt; M = [1 2 3; 4 5 6; 7 8 9];      <br />octave:22&gt; M(2,:)       <br />ans = </p>
<p>&#160;&#160; 4&#160;&#160; 5&#160;&#160; 6</p>
</blockquote>
<p>3) <strong>Obtain a particular column from the matrix</strong> -</p>
<p>Suppose you have a matrix M and you want to get the first column of the matrix, you should use M(:,1) </p>
<p>This means that you want to take all(represented by : ) the elements present in the first column which effectively means whole of first column -</p>
<blockquote><p>octave:23&gt; M = [1 2 3; 4 5 6; 7 8 9];      <br />octave:24&gt; M(:, 1)       <br />ans = </p>
<p>&#160;&#160; 1      <br />&#160;&#160; 4       <br />&#160;&#160; 7</p>
</blockquote>
<p>4) <strong>Obtain a particular element from the matrix</strong> -</p>
<p>From 2) and 3) its pretty clear that to get an element i,j from a matrix M, you need to invoke M(i, j) -</p>
<blockquote><p>octave:25&gt; M = [1 2 3; 4 5 6; 7 8 9];      <br />octave:26&gt; M(2,1)       <br />ans =&#160; 4</p>
</blockquote>
<p>5) <strong>Creating simple for loop</strong> -</p>
<p>0:4 shows the loop goes from 0 to 4 with interval of 1</p>
<blockquote><p>octave:29&gt; for i = 0:4      <br />&gt; 2^i       <br />&gt; end       <br />ans =&#160; 1       <br />ans =&#160; 2       <br />ans =&#160; 4       <br />ans =&#160; 8       <br />ans =&#160; 16</p>
</blockquote>
<p>6) <strong>Creating plots with some simple options</strong> -</p>
<p>Following creates a simple line plot of values of y against x -</p>
<blockquote><p>octave:32&gt; x = [1 2 3 4 5 6 7 8 9 0];      <br />octave:33&gt; y = [3 6 9 2 7 5 1 0 4 4];       <br />octave:34&gt; plot(x,y)</p>
</blockquote>
<p>Some simple options that can be added are -</p>
<p>The following command would create plot marks as blue o’s-</p>
<blockquote><p>octave:41&gt; plot(x, y, &#8216;bo&#8217;)</p>
</blockquote>
<p>If you want to increase the plot marks, you can do so by using ‘MarkerSize’ -</p>
<blockquote><p>octave:47&gt; plot(x, y, &#8216;bo&#8217;, &#8216;MarkerSize&#8217;, 15)</p>
</blockquote>
<p>You can set the labels for X and Y axis using xlabel and ylabel respectively -</p>
<blockquote><p>xlabel(‘Label for X’);</p>
<p>ylabel(‘Label for Y’);</p>
</blockquote>
<p>That’s all for this part. Happy Octaving <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="Octave Beginner&rsquo;s Commands &ndash; Part 1" url="http://www.harshtechtalk.com/octave-beginners-commands-part-1.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/Aw12Cq_jnUw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/octave-beginners-commands-part-1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/octave-beginners-commands-part-1.html</feedburner:origLink></item>
		<item>
		<title>Comic: Windows Update</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/SA7_tIWIdvs/comic-windows-update.html</link>
		<comments>http://www.harshtechtalk.com/comic-windows-update.html#comments</comments>
		<pubDate>Sat, 02 Feb 2013 07:55:23 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[comic]]></category>
		<category><![CDATA[humor]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=382594</guid>
		<description />
			<content:encoded><![CDATA[</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/02/XVL11_RHPN1.png"><img title="XVL11_RHPN1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="292" alt="XVL11_RHPN1" src="http://www.harshtechtalk.com/wp-content/uploads/2013/02/XVL11_RHPN1_thumb.png" width="644" border="0" /></a></p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="Comic: Windows Update" url="http://www.harshtechtalk.com/comic-windows-update.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/SA7_tIWIdvs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/comic-windows-update.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/comic-windows-update.html</feedburner:origLink></item>
		<item>
		<title>How to Create Facebook Login Authentication System in Django in Simple Steps</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/cXaMqcHIWf8/how-to-create-facebook-login-authentication-system-in-django-in-simple-steps.html</link>
		<comments>http://www.harshtechtalk.com/how-to-create-facebook-login-authentication-system-in-django-in-simple-steps.html#comments</comments>
		<pubDate>Tue, 01 Jan 2013 22:03:29 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=315396</guid>
		<description><![CDATA[Hi guys, today I’ve implemented Facebook Login Authentication system in Django using django-social-auth. I would like to share the experience with you in simplest possible way. So the steps I would mention here are for Windows users but would work as almost the same for Linux and Mac users. Objective – To implement a Facebook [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys, today I’ve implemented Facebook Login Authentication system in Django using <a href="https://github.com/omab/django-social-auth" target="_blank">django-social-auth</a>. I would like to share the experience with you in simplest possible way. So the steps I would mention here are for Windows users but would work as almost the same for Linux and Mac users.</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2013/01/djangologopositive_thumb.png"><img title="djangologopositive_thumb" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="84" alt="djangologopositive_thumb" src="http://www.harshtechtalk.com/wp-content/uploads/2013/01/djangologopositive_thumb_thumb.png" width="240" border="0" /></a> </p>
<p><strong><u>Objective</u></strong> – To implement a Facebook login system for authentication. If you are still unsure what I’m talking about and want to see the demo, just go to <a title="http://social.matiasaguirre.net/" href="http://social.matiasaguirre.net/">http://social.matiasaguirre.net/</a> and click Facebook.</p>
<p><strong><u>Package</u></strong> – Download the package from <a title="https://github.com/omab/django-social-auth" href="https://github.com/omab/django-social-auth">https://github.com/omab/django-social-auth</a> or direct zip url &#8211; <a title="https://github.com/omab/django-social-auth/archive/master.zip" href="https://github.com/omab/django-social-auth/archive/master.zip">https://github.com/omab/django-social-auth/archive/master.zip</a></p>
<p>Unzip the package, go to package directory and run the following command to install it -</p>
<blockquote><p>python setup.py install</p>
</blockquote>
<p>or, if you have pip installed, then you don’t need to download the package separately, simply use -</p>
<blockquote><p>pip install django-social-auth</p>
</blockquote>
<p>Now you need to associate a Facebook app with this authentication system to make it work. Go to <a title="https://developers.facebook.com/apps" href="https://developers.facebook.com/apps">https://developers.facebook.com/apps</a> and create an app. We need not do anything fancy here. We just need two values from this app – “App ID/API Key” and “App Secret”.</p>
<p>Now lets go to the core Django web application part -</p>
<p>1) Go to settings.py add the following in the INSTALLED_APPS -</p>
<blockquote><p>‘social_auth’</p>
</blockquote>
<p>2) Now we need to add few more settings for this authentication system. In the same file add the following -</p>
<blockquote><p>AUTHENTICATION_BACKENDS = (     <br />&#160;&#160;&#160; &#8216;social_auth.backends.facebook.FacebookBackend&#8217;,      <br />&#160;&#160;&#160; &#8216;django.contrib.auth.backends.ModelBackend&#8217;,      <br />) </p>
<p>TEMPLATE_CONTEXT_PROCESSORS = (     <br />&#160;&#160;&#160; &#8216;django.contrib.auth.context_processors.auth&#8217;,      <br />&#160;&#160;&#160; &#8216;social_auth.context_processors.social_auth_by_type_backends&#8217;,      <br />) </p>
<p>SOCIAL_AUTH_ENABLED_BACKENDS = (&#8216;facebook&#8217;,)     <br />SOCIAL_AUTH_DEFAULT_USERNAME = &#8216;new_social_auth_user&#8217; </p>
<p>FACEBOOK_APP_ID = &lt;Put value of App ID/API Key from the Facebook app&gt;     <br />FACEBOOK_API_SECRET = &#8216;&lt;Put value of App Secret from the Facebook app&gt;</p>
<p>LOGIN_URL = &#8216;/login/&#8217;     <br />LOGIN_REDIRECT_URL = &#8216;/polls/&#8217;      <br />LOGIN_ERROR_URL = &#8216;/login-error/&#8217;</p>
<p>&#160;</p>
</blockquote>
<p>Make sure to set proper values of “LOGIN_URL”(login page where the Facebook authentication page would come) and “LOGIN_REDIRECT_URL”(page to redirect to after authentication). They might be different in your case.</p>
<p>3) Now to reflect the changes we did to setting.py to the database, run -</p>
<blockquote><p>python manage.py syncdb</p>
</blockquote>
<p>4) Now add the following to urls.py -</p>
<blockquote><p>from django.views.generic.simple import redirect_to</p>
</blockquote>
<p>and in “urlpatterns” in urls. py add -</p>
<blockquote><p>url(r&#8221;, include(&#8216;social_auth.urls&#8217;)),</p>
<p>url(r&#8217;^login/$&#8217;, redirect_to, {&#8216;url&#8217;: &#8216;/login/facebook&#8217;}),</p>
</blockquote>
<p>There is one last thing I want to point out here is that “LOGIN_REDIRECT_URL” should be set equal to the value of “Canvas URL” in the Facebook app. To look and change the value of “Canvas URL” in the Facebook app, go to the app and click on “Edit App”. In “Settings” –&gt; “Basic”, you will see “Canvas URL”. Change it to match the value of “LOGIN_REDIRECT_URL” else you will get the following error -</p>
<blockquote><p>API Error Code: 191     <br />API Error Description: The specified URL is not owned by the application      <br />Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.</p>
</blockquote>
<p>Now run your server and goto /login/ and you will see a nice Facebook authentication page for your web app <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="How to Create Facebook Login Authentication System in Django in Simple Steps" url="http://www.harshtechtalk.com/how-to-create-facebook-login-authentication-system-in-django-in-simple-steps.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/cXaMqcHIWf8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/how-to-create-facebook-login-authentication-system-in-django-in-simple-steps.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/how-to-create-facebook-login-authentication-system-in-django-in-simple-steps.html</feedburner:origLink></item>
		<item>
		<title>How to Surf New York Times Articles for Free Forever</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/9X6sQdmlvP8/how-to-surf-new-york-times-articles-for-free-forever.html</link>
		<comments>http://www.harshtechtalk.com/how-to-surf-new-york-times-articles-for-free-forever.html#comments</comments>
		<pubDate>Sat, 16 Jun 2012 17:21:20 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=154484</guid>
		<description><![CDATA[I know that many of you are fan of NYT(New York Times) articles, especially the Opinion section which lists articles from really great people, but you also might have faced the restriction of reading at most 10 articles a month i.e. NYT allows you to read at max 10 articles a month and if you [...]]]></description>
			<content:encoded><![CDATA[<p>I know that many of you are fan of NYT(New York Times) articles, especially the <a href="http://www.nytimes.com/pages/opinion/index.html" target="_blank">Opinion</a> section which lists articles from really great people, but you also might have faced the restriction of reading at most 10 articles a month i.e. NYT allows you to read at max 10 articles a month and if you want to read more articles you need to subscribe and pay money. So, if you are done with reading 10 articles a month and move onto the 11th one, you will get this pop-up -</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2012/06/image.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="322" alt="image" src="http://www.harshtechtalk.com/wp-content/uploads/2012/06/image_thumb.png" width="630" border="0" /></a> </p>
<p>Although there are many methods available online to get rid of this annoying pop-up asking for subscription, but the one I would prefer and also the simplest one is to just change the url and you are good to go. If you’ll look at the url you will see the structure like -</p>
<p><strong>http://www.nytimes.com/2012/06/16/opinion/nocera-the-safest-bank.html?ref=opinion&amp;gwh=6CB253207125D837FD4FF2FD82FA605E</strong></p>
<p>You just need to remove the part after <strong>&amp;</strong>(including <strong>&amp;</strong>). For this example it would be -</p>
<p><strong>http://www.nytimes.com/2012/06/16/opinion/nocera-the-safest-bank.html?ref=opinion</strong></p>
<p>and you are done! With this url you wont get the subscription pop-up. Every time you see the pop-up you can see the <strong>&amp; </strong>in the url, so don’t bother that there would be any other case. Happy reading!</p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="How to Surf New York Times Articles for Free Forever" url="http://www.harshtechtalk.com/how-to-surf-new-york-times-articles-for-free-forever.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/9X6sQdmlvP8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/how-to-surf-new-york-times-articles-for-free-forever.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/how-to-surf-new-york-times-articles-for-free-forever.html</feedburner:origLink></item>
		<item>
		<title>8 Tricks Every Python User Should Know</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/Wk1wa0Ig78w/8-tricks-every-python-user-should-know.html</link>
		<comments>http://www.harshtechtalk.com/8-tricks-every-python-user-should-know.html#comments</comments>
		<pubDate>Tue, 22 May 2012 15:58:04 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/?p=146003</guid>
		<description><![CDATA[Here I present some of the Python tips and tricks to get your work done in concise and quick way. I know that many experienced users will find it trivial, but for an beginner or average Python user, these can be way too helpful. So dive in - 1) Writing concise code using list comprehension [...]]]></description>
			<content:encoded><![CDATA[<p>Here I present some of the Python tips and tricks to get your work done in concise and quick way. I know that many experienced users will find it trivial, but for an beginner or average Python user, these can be way too helpful. So dive in -</p>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2012/05/coding_tricks.png"><img title="coding_tricks" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="113" alt="coding_tricks" src="http://www.harshtechtalk.com/wp-content/uploads/2012/05/coding_tricks_thumb.png" width="240" border="0" /></a> </p>
<p>1) <strong>Writing concise code using list comprehension</strong> – This should be a basic and easy to do thing for every Python user. This is also one of the Python’s thing which lets you make your code pretty concise. Example &#8211; </p>
<pre class="csharpcode">&gt;&gt;&gt; [x*x <span class="kwrd">for</span> x <span class="kwrd">in</span> range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]</pre>
<p>2) <strong>Transposing matrices using zip function</strong> – If you want to achieve quick transpose of a matrix represented in form of lists, you can achieve it in single line using zip function. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; matrix = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
&gt;&gt;&gt; zip(*matrix)
[(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)]</pre>
<p>3) <strong>Passing arguments using splat operator(*)</strong> – If a function takes 5 arguments and you have those 5 arguments in a list or dictionary, then you need not pass each element separately. Instead what you can do is, pass the whole list or dictionary to function with splat operator(*) and it will expand itself there. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; def func(a, b, c):
    print a, b, c

&gt;&gt;&gt; lst = [11, 12, 13]
&gt;&gt;&gt; func(*lst)
11 12 13</pre>
<p>4) <strong>Swapping two variables using tuples</strong> – Two(or more) variables can be swapped using tuples in a single line of code. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; a = 10
&gt;&gt;&gt; b = 5
&gt;&gt;&gt; a, b = b, a
&gt;&gt;&gt; a
5
&gt;&gt;&gt; b
10</pre>
<p>5)&#160; <strong>Checking if a string is part of another string</strong> – If you want to check if a string is part of another string and doesn’t need to know any other info like its position in the string and all, then instead of looking for the substring using the <strong>find </strong>function, you can simply use <strong>in</strong>. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; a = <span class="str">&quot;my name is harsh&quot;</span>
&gt;&gt;&gt; b = <span class="str">&quot;name&quot;</span>
&gt;&gt;&gt; <span class="kwrd">if</span> b <span class="kwrd">in</span> a:
    print <span class="str">&quot;yes&quot;</span>

yes
&gt;&gt;&gt; </pre>
<p>6) <strong>Using lambda functions inside list comprehensions</strong> – This is needed when you want to apply a function to all the elements of the list and hence generate a new list from those results. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; x = [1, 2, 3]
&gt;&gt;&gt; y = [4, 5, 6]
&gt;&gt;&gt; map(lambda i,j: i*j, x, y)
[4, 10, 18]</pre>
<p>7) <strong>Reducing the list</strong> – This is needed when you want to run a function on all the elements on the list and want one consolidated result, like sum of all elements. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; n = [1, 2, 3, 4, 5]
&gt;&gt;&gt; s = reduce(lambda x,y: x+y, n)
&gt;&gt;&gt; s
15</pre>
<p> <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> <strong>Sum all the digits of a number in one line</strong> – This can be achieved using sum and map functions and string typecasting. Example -</p>
<pre class="csharpcode">&gt;&gt;&gt; n = 39589
&gt;&gt;&gt; sum(map(<span class="kwrd">int</span>, str(n)))
34</pre>
<p>I’ll keep adding more to this post, once I find more tricks or if you know of any trick not listed here, you can say via a comment. So please subscribe or bookmark! <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="8 Tricks Every Python User Should Know" url="http://www.harshtechtalk.com/8-tricks-every-python-user-should-know.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/Wk1wa0Ig78w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/8-tricks-every-python-user-should-know.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/8-tricks-every-python-user-should-know.html</feedburner:origLink></item>
		<item>
		<title>How to Remove ssh Connection Error Saying “Trying private key” in Windows</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/-IBSEVqV1vw/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html</link>
		<comments>http://www.harshtechtalk.com/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html#comments</comments>
		<pubDate>Thu, 01 Dec 2011 15:16:34 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html</guid>
		<description><![CDATA[I was trying to setup ssh connection to GitHub when I faced this error on Windows saying - bash-3.1$ ssh -Tv git@github.com OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /c/Documents and Settings/hjha/.ssh/config debug1: Applying options for github.com debug1: Executing proxy command: exec C:/Git/bin/connect.exe -H xxxxxxxxxxxxxxxxxx debug1: permanently_drop_suid: 500 debug1: identity file C:\\Documents\\ [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to setup ssh connection to GitHub when I faced this error on Windows saying -</p>
<blockquote><p>bash-3.1$ ssh -Tv git@github.com     <br />OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007      <br />debug1: Reading configuration data /c/Documents and Settings/hjha/.ssh/config      <br />debug1: Applying options for github.com      <br />debug1: Executing proxy command: exec C:/Git/bin/connect.exe -H xxxxxxxxxxxxxxxxxx      <br />debug1: permanently_drop_suid: 500      <br />debug1: identity file C:\\Documents\\ and\\ Settings\\hjha\\\\.ssh\\id_rsa type      <br />-1      <br />debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debia      <br />n-5github2      <br />debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*      <br />debug1: Enabling compatibility mode for protocol 2.0      <br />debug1: Local version string SSH-2.0-OpenSSH_4.6      <br />debug1: SSH2_MSG_KEXINIT sent      <br />debug1: SSH2_MSG_KEXINIT received      <br />debug1: kex: server-&gt;client aes128-cbc hmac-md5 none      <br />debug1: kex: client-&gt;server aes128-cbc hmac-md5 none</p>
<p>debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent     <br />debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP      <br />debug1: SSH2_MSG_KEX_DH_GEX_INIT sent      <br />debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY      <br />debug1: Host &#8216;github.com&#8217; is known and matches the RSA host key.      <br />debug1: Found key in /c/Documents and Settings/hjha/.ssh/known_hosts:1      <br />debug1: ssh_rsa_verify: signature correct      <br />debug1: SSH2_MSG_NEWKEYS sent      <br />debug1: expecting SSH2_MSG_NEWKEYS      <br />debug1: SSH2_MSG_NEWKEYS received      <br />debug1: SSH2_MSG_SERVICE_REQUEST sent      <br />debug1: SSH2_MSG_SERVICE_ACCEPT received      <br />debug1: Authentications that can continue: publickey      <br />debug1: Next authentication method: publickey      <br />debug1: Trying private key: C:\\Documents\\ and\\ Settings\\hjha\\\\.ssh\\id_rsa </p>
<p>debug1: No more authentication methods to try.     <br />Permission denied (publickey).      <br />bash-3.1$ ssh git@github.com      <br />Permission denied (publickey).</p>
</blockquote>
<p><a href="http://www.harshtechtalk.com/wp-content/uploads/2011/12/sshlogo.jpg"><img title="ssh-logo" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="119" alt="ssh-logo" src="http://www.harshtechtalk.com/wp-content/uploads/2011/12/sshlogo_thumb.jpg" width="133" border="0" /></a> </p>
<p>It shows up as “Permission Denied (publickey)”, to which you will find many solutions on net. But all have same underlying reason which is &#8211; ssh cannot find the location of keys because of which it shows -</p>
<blockquote><p>debug1: Trying private key: C:\\Documents\\ and\\ Settings\\hjha\\\\.ssh\\id_rsa</p>
</blockquote>
<p>Here “Trying private keys” means that ssh is trying to look for the key at the given location but could not find it. More details can be seen <a href="http://help.github.com/ssh-issues/" target="_blank">here</a> under the heading “Finding out what keys ssh is using”. Now the possible reasons as you will find would be like “keys are not named properly” or “ssh doesn’t know the path to the keys” which seem to be valid reason and you can use ssh-add to add path if in your case ssh can’t find the path to keys.</p>
<p>But, in my case situation was totally different, ssh keys were placed at right locations but ssh was looking for keys at wrong location(or a location which literally doesn’t even exist). To make it right I just opened my <em>config</em> file which would be placed at <em>~/.ssh </em>and looks something like -</p>
<blockquote><p>ProxyCommand C:/Git/bin/connect.exe -H xxxxxxxxxxxxxxxxxxx </p>
<p>Host github.com     <br />User git      <br />Port 22      <br />Hostname github.com      <br />IdentityFile &quot;C:\Documents\ and\ Settings\hjha\\.ssh\id_rsa&quot;      <br />TCPKeepAlive yes      <br />IdentitiesOnly yes </p>
<p>Host ssh.github.com     <br />User git      <br />Port 443      <br />Hostname ssh.github.com      <br />IdentityFile &quot;C:\Documents\ and\ Settings\hjha\\.ssh\id_rsa&quot;      <br />TCPKeepAlive yes      <br />IdentitiesOnly yes</p>
</blockquote>
<p>I saw that there were redundant backslashes placed in the IdentityFile locations. So, I edited my config file to -</p>
<blockquote><p>ProxyCommand C:/Git/bin/connect.exe -H xxxxxxxxxxxxxxxxxxxxxxx </p>
<p>Host github.com     <br />User git      <br />Port 22      <br />Hostname github.com      <br />IdentityFile &quot;C:\Documents and Settings\hjha\.ssh\id_rsa&quot;      <br />TCPKeepAlive yes      <br />IdentitiesOnly yes </p>
<p>Host ssh.github.com     <br />User git      <br />Port 443      <br />Hostname ssh.github.com      <br />IdentityFile &quot;C:\Documents and Settings\hjha\.ssh\id_rsa&quot;      <br />TCPKeepAlive yes      <br />IdentitiesOnly yes</p>
</blockquote>
<p>It simply means that if you are using double quotes to give any location then you need to give the path as it is without escaping spaces and special characters with backward slash. I tried sshing again with <em>ssh -vT git@github.com </em>and whoa! It worked! <img src='http://www.harshtechtalk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="How to Remove ssh Connection Error Saying &ldquo;Trying private key&rdquo; in Windows" url="http://www.harshtechtalk.com/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/-IBSEVqV1vw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/how-to-remove-ssh-connection-error-saying-trying-private-key-in-windows.html</feedburner:origLink></item>
		<item>
		<title>Swap Two Variables in Python in a Single Line</title>
		<link>http://feedproxy.google.com/~r/harshtechtalk/~3/8EyHQq83W_4/swap-two-variables-in-python-in-a-single-line.html</link>
		<comments>http://www.harshtechtalk.com/swap-two-variables-in-python-in-a-single-line.html#comments</comments>
		<pubDate>Sun, 16 Oct 2011 12:23:46 +0000</pubDate>
		<dc:creator>theharshest</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.harshtechtalk.com/swap-two-variables-in-python-in-a-single-line.html</guid>
		<description><![CDATA[This thing can be easily achieved in Python which in other languages usually require 3-4 lines. This is possible due to Python’s tuple data structure. So to interchange values of two variables ‘x’ and ‘y’ simply use - x, y = y, x “x, y” defines a new tuple which takes the values of old [...]]]></description>
			<content:encoded><![CDATA[<p>This thing can be easily achieved in Python which in other languages usually require 3-4 lines. This is possible due to Python’s <strong>tuple data structure</strong>. So to interchange values of two variables ‘x’ and ‘y’ simply use -</p>
<blockquote><p> x, y = y, x</p>
</blockquote>
<p>“x, y” defines a new tuple which takes the values of old variables which are presented in the form of another tuple as “y, x”.</p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_58108" title="Swap Two Variables in Python in a Single Line" url="http://www.harshtechtalk.com/swap-two-variables-in-python-in-a-single-line.html"></script><img src="http://feeds.feedburner.com/~r/harshtechtalk/~4/8EyHQq83W_4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.harshtechtalk.com/swap-two-variables-in-python-in-a-single-line.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.harshtechtalk.com/swap-two-variables-in-python-in-a-single-line.html</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 5.509 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-14 02:41:35 -->
