<?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>KalyanChakravarthy.net</title>
	
	<link>http://kalyanchakravarthy.net</link>
	<description>kalyanchakravarthy.net - Kalyan's Weblog, Rantings, Projects, Designs....and more blah</description>
	<lastBuildDate>Fri, 18 Jun 2010 10:29:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Kalyanchakravarthynet" /><feedburner:info uri="kalyanchakravarthynet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Jython script to compile jython scripts to java class files</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/RAxxOUVixXo/</link>
		<comments>http://kalyanchakravarthy.net/?p=429#comments</comments>
		<pubDate>Fri, 18 Jun 2010 10:27:38 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Jython]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=429</guid>
		<description><![CDATA[<p>Jython, the python implementation in Java, is one of the most amazing things i have come across in quite some time, the environment is a seamless fusion of both the languages.</p>
<p>Playing around with it since yesterday, from what i have&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Jython, the python implementation in Java, is one of the most amazing things i have come across in quite some time, the environment is a seamless fusion of both the languages.</p>
<p>Playing around with it since yesterday, from what i have noticed, the jythonc compiler is missing in 2.5.x version of jython. But on doing a quick search i found a java based jython compiler scripts ( <a href="http://www.dancheah.com/2010/02/compiling-jython-scripts-in-java-class-files.html">here</a> and <a href="http://hasandiwan.info/2010/03/replacing-jythonc-in-jython-25.html">here</a> ). Also there don&#8217;t seem to be any jython compiler scripts in jython, perhaps i maybe looking at wrong place. So i wrote up a quick script which tries to do that.</p>
<pre><code>"""
Author:Kalyan (18-Jun-10)
Usage: $jython jcompile.py
"""

from java.io import *
import _py_compile
import imp as pyimp
import org.python.core.imp as jimp
import os.path
import sys

#Show info
def jcompile_usage():
	print "Usage $:jython jcompile.py"
	print "file.py gets compiled to file$py.class"

#Compile .py to .class
def jcompile_compile( fname ):
	#java file object
	jfile = File( fname )
	#Get module name
	mname = _py_compile.getModuleName( jfile )
	#Compile and get bytes
	bytes = jimp.compileSource( mname, jfile )
	#Dump bytecode into a file
	jimp.cacheCompiledSource( os.path.abspath( fname ), os.path.abspath( "./" + mname + "$py.class" ), bytes )

if( len(sys.argv) != 2 ):
	jcompile_usage();	#insufficient arguments
	sys.exit(0)			#exit

if( os.path.exists( sys.argv[1] ) ):
	print "compiling %s" % sys.argv[1]
	jcompile_compile( sys.argv[1] )
else:
	print "Given file doesn't exist"
	jcompile_usage();

</code></pre>
<p>The code is a loose translation of the java code. The only catch is, there are two &#8220;imp&#8221; important internals libraries,  org.python.modules.imp and org.python.core.imp, former the python implementation and the later one being the java python implementation.</p>
<p>Usage : to compile</p>
<pre><code>kalyanc$ jython jcompilec.py foo.py
compiling foo.py
</code></pre>
<p>at this point foo$py.class is created</p>
<p>Usage : To execute</p>
<pre><code>kalyanc$ java -classpath .:/Library/Jython/2.5.1/jython.jar foo\$py
foo bar
</code></pre>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=429</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=429</feedburner:origLink></item>
		<item>
		<title>21 years of life</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/KDV8MJgKo4Y/</link>
		<comments>http://kalyanchakravarthy.net/?p=420#comments</comments>
		<pubDate>Sat, 03 Apr 2010 09:07:33 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[Ramblings and Rantings]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=420</guid>
		<description><![CDATA[<p>21 years, 21 trips around the sun, 7665 sunrises, 183960 hours of life, 11037600 breath taking minutes, 662256000 seconds, 46357920000 heart beats ( also accounting for the arbitrary unexpected losses for known reasons ), it amazes me how fast time flies.</p>
<p>Thinking in retrospect,&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>21 years, 21 trips around the sun, 7665 sunrises, 183960 hours of life, 11037600 breath taking minutes, 662256000 seconds, 46357920000 heart beats ( also accounting for the arbitrary unexpected losses for known reasons ), it amazes me how fast time flies.</p>
<p>Thinking in retrospect, all i can feel is so much has changed, evolved, come and gone in the most drastic, dramatic, unexpected,  unexplainable, unfathomable ways. No matter what the outcome has been life has left me spellbound at the beauty in which things have happened whether for good, bad, sad or worse.</p>
<p>Sometimes the feeling of &#8220;i wish it happened that way&#8221; multiplied with every damn thing, tries to creeps into the head, puncture the peace, but the very moment to make peace i am reminded that the very reason i am the way i am and i am what i am is only because of whatever that has happened. If anything would have happened in any other way other than the way it has happened, the very essence of what i really am right now would be lost. Though i still would be what i would have been, it certainly would be different from what i am at this instant of time.</p>
<p>21 for me, kinda is aptly the half of <a href="http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29">42</a> ! The reason for everything being what it is being starts with us being what we are. And this last year has significantly contributed towards the understanding of myself in a better way. Sometimes feel things could have happened differently i could have done few things differently which would have changed my life for better, i don&#8217;t find myself complaining because the very reason i am myself is because they have happened.</p>
<p>For all those things i should thank all, who aren&#8217;t, who still are friends, who will always be, who understood my way of expression, who tried to, who didn&#8217;t. And you all know who you are.</p>
<p>PS: if you are still wondering whats the philosophical speech is all about, i turned 21 <img src='http://kalyanchakravarthy.net/tech/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers. Kalyan</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=420</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=420</feedburner:origLink></item>
		<item>
		<title>Java synchronization over multiple shared objects</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/oGugYfiVmKA/</link>
		<comments>http://kalyanchakravarthy.net/?p=413#comments</comments>
		<pubDate>Sat, 27 Mar 2010 10:06:29 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[deadlocks]]></category>
		<category><![CDATA[synchronization]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=413</guid>
		<description><![CDATA[<p>When developing a multi-threaded application in Java or any threaded environment as a matter of fact,  the first and the foremost issues that one would need to consider is synchronization of shared resources.</p>
<p>To synchronize a shared object or resource in java, its&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>When developing a multi-threaded application in Java or any threaded environment as a matter of fact,  the first and the foremost issues that one would need to consider is synchronization of shared resources.</p>
<p>To synchronize a shared object or resource in java, its as straight forward as using the &#8220;synchronized&#8221; keyword while declaring a function or as a code block</p>
<pre><code>public class Foo() {
	//Way 1
	public synchronized void bar() {}
	//Way 2
	void baz() {
		synchronized(boo) {
			//some sync foo
		}
	}
} </code></pre>
<p>Whether to synchronize the code block by wrapping them under a synchronized function, or a synchronized code block over the shared resource, is upto the programmer. For a single object, the synchronized code block works just fine, but when there are more than one object to be shared by multiple threads simultaneously, one of the very important thing that usually skips the mind leading to deadlocks in the execution are &#8211; keep the statements in the same order throughout the application thread.</p>
<p>Consider (the bad way)</p>
<pre><code>
final Object foo;
final Object bar;
Runnable tObj = new Runnable {
	public void run() {
		while(true) {
			//sync #1
			synchronized(foo) {
				synchronized(bar) {
				//sync foo
				}
			}

			//More code foo
			//Some more code

			//sync #2
			synchronized(bar) {
				synchronized(foo) {
				//sync foo
				}
			}
		}
	}
}
Thread t1 = new Thread(tObj);
Thread t2 = new Thread(tObj);</code></pre>
<p>Note the different synchronization block order in step #1 and #2. As the execution starts, the first thread t1 obtains locks on foo in the first block, and then on bar if its free as well. Until the synchronized block execution is complete, the second thread is kept waiting for resources.</p>
<p>If each thread cycle is guaranteed equal execution time, it doesn&#8217;t pose a problem as the execution across different threads won&#8217;t fall out of phase. Most often than not it is not the case and each thread cycle is gets different amount of cpu time each time, and if the thread depends upon external resources such as db, files, sockets, etc, the order of execution is unpredictable.</p>
<p>As the execution starts to fall out of phase, Thread t1 currently executing at Stage #1, obtains the lock on foo, and requests for lock on bar. But the other thread t2 which is already out of phase might be executing at Stage #2, and obtained a lock on bar. The first thread t1 waits for t2 to release bar, the second thread waits for thread t1 to release foo, so that each can complete their execution. This leads for each thread wait for resources obtained by each other leading to a deadlock.</p>
<p>In an actual application scenario, the deadlocks don&#8217;t appear immediately until such an instant where the threads are executing out of phase, depending upon the application, it might take minutes or even hours.</p>
<p>I have come across such a situation while writing a java based multi threaded web crawler, which maintained two shared objects a Queue and a HashSet. Queue contained a list of all URL&#8217;s to be parsed, and HashSet contained the completed set of URL&#8217;s. Initially when tested with 1 thread, it just worked fine, for the obvious reason being there are no other competing threads. But when the number of threads were increased to two, it took about 10 minutes for the deadlock to happen and the program halted. Increasing the number of threads even further increased the deadlock state was reached a bit faster, the reason being the probability of increase in concurrent requests for locks.</p>
<p>One of the better ways of staying safe is to wrap the sync logic inside a synchronized method itself, but again one has to make sure that if there are many different functions, the order of objects should remain the same.</p>
<p>Similarly deadlocks can occur even when nested synchronization is done inside a loop, i.e a nested synchronized block inside a loop which is inside another synchronized block.</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=413</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=413</feedburner:origLink></item>
		<item>
		<title>Raphael snake</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/TykwGr-c9OE/</link>
		<comments>http://kalyanchakravarthy.net/?p=407#comments</comments>
		<pubDate>Fri, 26 Mar 2010 09:39:17 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[fun project]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[raphaeljs]]></category>
		<category><![CDATA[snake game]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=407</guid>
		<description><![CDATA[<p>RaphaelJS is an interesting SVG based javascript graphics library for the web browser, provides an intuitive and easy to use way to draw elements, animate them, add event handlers, etc. It even lets us plug in event handlers from other&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>RaphaelJS is an interesting SVG based javascript graphics library for the web browser, provides an intuitive and easy to use way to draw elements, animate them, add event handlers, etc. It even lets us plug in event handlers from other libraries such as YUI, jQuery. Inspite of apparent advantages in Canvas tag, one thing about SVG which can make a designer cry in happiness is, it works on IE. Period.</p>
<p>As i started to explore raphael for a module on espnf1, it tempted me to write a snake game as always i did when i was learning other libs such as pygame, sdl, etc.</p>
<p>Using just Raphael.js for the vector graphics to display the snake and jQuery for handling the keystrokes and other little things, It was entirely written in JavaScript, as a lunch time project, and timed myself at 2 hours. It can be accessed here -</p>
<p><a href="http://kalyanchakravarthy.net/projects/fun/rsnake/snake.html"> http://kalyanchakravarthy.net/projects/fun/rsnake/snake.html</a></p>
<p>Feel free to view the source and do whatever you fancy.<br />
PS : Use &lt;space&gt; to start, pause, resume the game. And if u feel like, post ur scores as comments</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=407</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=407</feedburner:origLink></item>
		<item>
		<title>flipkurl – php/curl api library to access flipkart.com</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/-yg5OAtQRz4/</link>
		<comments>http://kalyanchakravarthy.net/?p=404#comments</comments>
		<pubDate>Mon, 08 Mar 2010 08:12:15 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[flipkart]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[weekend project]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=404</guid>
		<description><![CDATA[<p>Flipkurl is a php-curl based api library to access the contents of <a href="http://flipkart.com">flipkart.com</a> site, login into it, search book listings, add books to cart, move books from to wishlist, read contents of cart, etc.</p>
<p>Usually shopping carts don&#8217;t persist the user&#8217;s selection&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Flipkurl is a php-curl based api library to access the contents of <a href="http://flipkart.com">flipkart.com</a> site, login into it, search book listings, add books to cart, move books from to wishlist, read contents of cart, etc.</p>
<p>Usually shopping carts don&#8217;t persist the user&#8217;s selection across logins, but this one does. So whatever books you add via the library will stay in your account, so you can checkout/pay later from there.</p>
<p>Some possible uses of the API include Custom User Interfaces, Mobile UI&#8217;s, Mashups with other API&#8217;s, Automate stuff, etc.</p>
<p>The library is released under GPL. You can find the code, more details regarding the library and examples here &#8211; <a href="http://code.google.com/p/flipkurl">http://code.google.com/p/flipkurl</a></p>
<p>It was done as a fun weekend project.</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=404</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=404</feedburner:origLink></item>
		<item>
		<title>Curl &amp; handling cookie sessions</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/gx_ZNTKSwXg/</link>
		<comments>http://kalyanchakravarthy.net/?p=400#comments</comments>
		<pubDate>Mon, 01 Mar 2010 15:10:16 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[weekend project]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=400</guid>
		<description><![CDATA[<p>Curl is a very interesting utility library which lets one connect and interact with any remote url via any of the supported standard protocol. Though curl is essentially a command line tool, various bindings are available for access via programming&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Curl is a very interesting utility library which lets one connect and interact with any remote url via any of the supported standard protocol. Though curl is essentially a command line tool, various bindings are available for access via programming languages, popularly <a href="http://php.net/curl">php</a></p>
<p>From a php perspective, curl can be used to remotely access any URL, login, authenticate, and perform other actions. Directly using curl to retrieve content is a no brainer like fetching rss feeds, etc.</p>
<pre><code>&lt;?php
$ch = curl_init( "http://www.foo.com/test.php");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
$content = curl_exec( $ch );
?&gt;
</code></pre>
<p>Going beyond that a common scenario can be a contacts grabber, in which the user specifies the auth details, the script logins into email servers, fetch the contacts in a usable format. More interesting applications can be interacting with payment gateways, shopping carts, etc.</p>
<p>This weekend has been spent with curl after long time, extracting data and fooling around with it, it just too much fun !</p>
<p>There are lots of examples and documentation regarding handling of cookies with php curl. But there are couple of catches which always turned into dead ends for me in the past couple of years, and i never really bothered to find way around as i didn&#8217;t needed them in the past. The curl documentation suggests you set the cookie handlers for curl this way, and usually as with any other php function relative paths should work, like this&#8230;</p>
<pre><code>&lt;?php
curl_setopt( $ch, CURLOPT_COOKIEFILE, "file.txt" );
curl_setopt( $ch, CURLOPT_COOKIEJAR, "file.txt" );
?&gt;</code></pre>
<p>But weirdly for some reason relative path doesn&#8217;t work !  Since my weekend fooling with curl needed it, on playing around with it a little and discovered that giving absolute path works, it just works. So using the realpath() makes it all easy.</p>
<pre><code>&lt;?php
//$fileName = "/home/kalyan/curlfoo/file.txt";
//or just use the real path function
$fileName = realpath( "file.txt" );
curl_setopt( $ch, CURLOPT_COOKIEFILE, $fileName );
curl_setopt( $ch, CURLOPT_COOKIEJAR, $fileName );
?&gt;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=400</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=400</feedburner:origLink></item>
		<item>
		<title>Broken sight</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/ti_gAwuTdpY/</link>
		<comments>http://kalyanchakravarthy.net/?p=391#comments</comments>
		<pubDate>Sat, 20 Feb 2010 11:21:41 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[black and white]]></category>
		<category><![CDATA[broken]]></category>
		<category><![CDATA[broken sight]]></category>
		<category><![CDATA[eyeglasses]]></category>
		<category><![CDATA[poem]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=391</guid>
		<description><![CDATA[<div class="wp-caption aligncenter flickrp" style="width: 510px;">
<p><a href="http://www.flickr.com/photos/kalyan02/4372716888/"><img title="Broken Sight ..." src="http://farm5.static.flickr.com/4039/4372716888_7741615352.jpg" alt="Broken Sight ..." width="500" height="332" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4372716888/">Broken Sight &#8230;</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>I am sitting here,<br />
with mind somewhere<br />
wondering what in life,<br />
am i looking at ?</p>
<p>though my other senses are<br />
functional and intact<br />
but with broken sight,<br />
what am i looking at ?</p>
<h3>Exif information</h3>
<table>
<tbody>
<tr>
<td>Camera:</td>
<td>DSLR-A200</td>
</tr>
<tr>
<td>Exposure:</td>
<td>1/4</td>
</tr>
<tr>
<td>Aperture:</td>
<td>f/5.6</td>
</tr>
<tr>
<td>Focal Length:</td>
<td>70 mm</td>
</tr>
<tr>
<td>Exposure Bias:</td>
<td>0 EV</td>
</tr>
<tr>
<td>ISO Speed:</td>
<td>400</td>
</tr>
<tr>
<td>Flash:</td>
<td>Off, Did not fire</td>
</tr>
</tbody>
</table>
&#8230;]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter flickrp" style="width: 510px;">
<p><a href="http://www.flickr.com/photos/kalyan02/4372716888/"><img title="Broken Sight ..." src="http://farm5.static.flickr.com/4039/4372716888_7741615352.jpg" alt="Broken Sight ..." width="500" height="332" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4372716888/">Broken Sight &#8230;</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>I am sitting here,<br />
with mind somewhere<br />
wondering what in life,<br />
am i looking at ?</p>
<p>though my other senses are<br />
functional and intact<br />
but with broken sight,<br />
what am i looking at ?</p>
<h3>Exif information</h3>
<table>
<tbody>
<tr>
<td>Camera:</td>
<td>DSLR-A200</td>
</tr>
<tr>
<td>Exposure:</td>
<td>1/4</td>
</tr>
<tr>
<td>Aperture:</td>
<td>f/5.6</td>
</tr>
<tr>
<td>Focal Length:</td>
<td>70 mm</td>
</tr>
<tr>
<td>Exposure Bias:</td>
<td>0 EV</td>
</tr>
<tr>
<td>ISO Speed:</td>
<td>400</td>
</tr>
<tr>
<td>Flash:</td>
<td>Off, Did not fire</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=391</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=391</feedburner:origLink></item>
		<item>
		<title>Utter Chaos !</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/9XsSQKRA5d4/</link>
		<comments>http://kalyanchakravarthy.net/?p=387#comments</comments>
		<pubDate>Sun, 14 Feb 2010 19:10:28 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[black and white]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[chaos]]></category>
		<category><![CDATA[desk]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[notebook]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=387</guid>
		<description><![CDATA[<div class="wp-caption aligncenter flickrp"><a href="http://www.flickr.com/photos/kalyan02/4356356273/"><img title="Utter Chaos" src="http://farm3.static.flickr.com/2780/4356356273_8aaff81d21.jpg" alt="Utter Chaos" width="500" height="335" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4356356273/">Utter Chaos</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>My desk &#8230; </p>
<p>Shot in black n white ! Edited in Gimp !</p>
]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter flickrp"><a href="http://www.flickr.com/photos/kalyan02/4356356273/"><img title="Utter Chaos" src="http://farm3.static.flickr.com/2780/4356356273_8aaff81d21.jpg" alt="Utter Chaos" width="500" height="335" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4356356273/">Utter Chaos</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>My desk &#8230; </p>
<p>Shot in black n white ! Edited in Gimp !</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=387</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=387</feedburner:origLink></item>
		<item>
		<title>Fallen Beauty !</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/XnQf79cKGAA/</link>
		<comments>http://kalyanchakravarthy.net/?p=366#comments</comments>
		<pubDate>Wed, 10 Feb 2010 13:10:43 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[flower]]></category>
		<category><![CDATA[orange]]></category>
		<category><![CDATA[photograhy]]></category>
		<category><![CDATA[road]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=366</guid>
		<description><![CDATA[<div class="wp-caption aligncenter flickrp">
<p><a href="http://www.flickr.com/photos/kalyan02/4346136038/"><img title="Fallen beauty" src="http://farm3.static.flickr.com/2744/4346136038_22fa168625.jpg" alt="Fallen beauty" width="500" height="335" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4346136038/">Fallen beauty</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>The Fallen beauty someday shall wake up,<br />
For she has the seeds to her offspring&#8217;s,<br />
to multiply and make it up,<br />
But alas, she shall die on the road,<br />
before they get planted up.</p>
&#8230;]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter flickrp">
<p><a href="http://www.flickr.com/photos/kalyan02/4346136038/"><img title="Fallen beauty" src="http://farm3.static.flickr.com/2744/4346136038_22fa168625.jpg" alt="Fallen beauty" width="500" height="335" /></a></p>
<p class="wp-caption-text"><a href="http://www.flickr.com/photos/kalyan02/4346136038/">Fallen beauty</a> by <a href="http://www.flickr.com/photos/kalyan02/">kalyan02</a></p>
</div>
<p>The Fallen beauty someday shall wake up,<br />
For she has the seeds to her offspring&#8217;s,<br />
to multiply and make it up,<br />
But alas, she shall die on the road,<br />
before they get planted up.</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=366</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=366</feedburner:origLink></item>
		<item>
		<title>True = False, there you go !</title>
		<link>http://feedproxy.google.com/~r/Kalyanchakravarthynet/~3/8WRPtoUYaQA/</link>
		<comments>http://kalyanchakravarthy.net/?p=352#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:01:51 +0000</pubDate>
		<dc:creator>Kalyan Chakravarthy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://kalyanchakravarthy.net/?p=352</guid>
		<description><![CDATA[<p>If you haven&#8217;t seen this before, the first thing that probably would occur is either the programmer has missed a == or has just gone mad, but apparently in python its valid. Python booleans True, False can actually be assigned&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t seen this before, the first thing that probably would occur is either the programmer has missed a == or has just gone mad, but apparently in python its valid. Python booleans True, False can actually be assigned values, and they can also be inter assigned.</p>
<pre><code class="python">&gt;&gt;&gt; False
False
&gt;&gt;&gt; True
True
&gt;&gt;&gt; False = True
&gt;&gt;&gt; False
True
&gt;&gt;&gt; False == True
True </code></pre>
<p>The reason for this being True &amp; False are not real ( can&#8217;t use the word True, can&#8217; i ? ) keywords but mere object instances of type Boolean. Since variables in python are untyped, its technically possible to assign any python object. Makes sense.</p>
<pre><code class="python">&gt;&gt;&gt; False = 10
&gt;&gt;&gt; False
10
&gt;&gt;&gt; type(False)
&lt;type 'int'&gt;
&gt;&gt;&gt; True = "what is this?"
&gt;&gt;&gt; True
'what is this?' </code></pre>
<p>&#8216;None&#8217; type since it being a real keyword(since 2.3), throws SyntaxError.</p>
<p>The good thing taken care to avoid confusion is logical statements will always return a new instances with a boolean value of 0 or 1 represented as False &amp; True.</p>
<pre><code class="python">&gt;&gt;&gt; False = True
&gt;&gt;&gt; False
True
&gt;&gt;&gt; True = 10
&gt;&gt;&gt; True
10
&gt;&gt;&gt; True = (1==1)
&gt;&gt;&gt; True
True
&gt;&gt;&gt; False = not True
&gt;&gt;&gt; False
False </code></pre>
<p>Apparently some say this is a feature of python, but i can only imagine the havoc single such statement can cause.</p>
<p>While the explanation for True,False is plausible, python weirdly lets you switch data types of data types, which just doesn&#8217;t make any sense.</p>
<pre><code class="python">&gt;&gt;&gt; int
&lt;type 'int'&gt;
&gt;&gt;&gt; str
&lt;type 'str'&gt;    #makes sense
&gt;&gt;&gt; int = str   #but wth?
&gt;&gt;&gt; int
&lt;type 'str'&gt; </code></pre>
<p>It makes me wonder why would anyone ever in the insanest of their minds let you do that in an otherwise beautiful, sensible, sane &amp; poetic language. Okay, poetic maybe an overstatement, but it does look beautiful, doesn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://kalyanchakravarthy.net/?feed=rss2&amp;p=352</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kalyanchakravarthy.net/?p=352</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 1.322 seconds --><!-- Cached page served by WP-Cache -->
