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

<channel>
	<title>sp2hari@weblog...</title>
	<atom:link href="http://sp2hari.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sp2hari.com</link>
	<description>I see, learn and rediscover... everyday!</description>
	<pubDate>Wed, 06 Aug 2008 05:28:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>As strategic as pig&#8230;</title>
		<link>http://sp2hari.com/2008/08/05/as-strategic-as-pig/</link>
		<comments>http://sp2hari.com/2008/08/05/as-strategic-as-pig/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 05:28:39 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=145</guid>
		<description><![CDATA[Looks like my blogs are only about animals now :P 
I&#8217;m &#8220;working&#8221; as a software engineer. I joined two months back, which implies I don&#8217;t work at all and just enjoy killing time at office. I meet many new people everyday (in and outside office) and the way they talk is quite funny. One day [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like my blogs are only about animals now :P </p>
<p>I&#8217;m &#8220;working&#8221; as a software engineer. I joined two months back, which implies I don&#8217;t work at all and just enjoy killing time at office. I meet many new people everyday (in and outside office) and the way they talk is quite funny. One day I happen to hear a girl say to a guy, </p>
<p>&#8220;You are as strategic as a pig.&#8221;</p>
<p>The first thing I thought when I heard this was &#8220;Why pig?&#8221;. What makes a pig strategic? I&#8217;ve heard &#8216;as cunning as a fox&#8217; but yeah, there is that crow and the vadaa story to prove that the fox is cunning. Is there any story to prove that a pig can be strategic? I was suprised to imagine a pig thinking of something and coming up with some sort of strategy. I can imagine a pig to be too lazy even to think, forget about coming up with a strategy. I tried googling for this clause but no useful results. Still I have no clue what makes a pig strategic. </p>
<p>Is that statement sarcastic? That looks more probable, though since I was there when she told this, I don&#8217;t think she was sarcastic. She actually meant it. Though I don&#8217;t know whether it is right to call an employee a pig. That is totally different argument.</p>
<p>Though one thing is for sure. I can never forget this clause. Have thought about this for more than 2 days with no final conclusion. :P</p>
<p>If anyone has been using this clause for any damn reason, do educate me more on this.<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li>No Related Post</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/08/05/as-strategic-as-pig/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Kaakarat</title>
		<link>http://sp2hari.com/2008/08/02/kaakarat/</link>
		<comments>http://sp2hari.com/2008/08/02/kaakarat/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 03:59:32 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[story]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=144</guid>
		<description><![CDATA[This story is created by a few vetti engineering students (who are supposed to a project)  and a vetti software engineer(who is supposed to work). :-) The main story is contributed by only one, but many own the copyright for this story now. OK, lets stop the intro here and begin the story.
Long ago, [...]]]></description>
			<content:encoded><![CDATA[<p><em>This story is created by a few vetti engineering students (who are supposed to a project)  and a vetti software engineer(who is supposed to work). :-) The main story is contributed by only one, but many own the copyright for this story now. OK, lets stop the intro here and begin the story.</em></p>
<p>Long ago, long long ago, there was a kaaka. It was a black one living on a black tree. So no one was able to see that kaaka. The kaakaa used to always sing as </p>
<p>&#8220;ka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakakka kakaka&#8221;.</p>
<p>One fine day, it met a kaaki[ female kaaka in our story :) ]. So started the kaaka love story. But the villain kaaka knows about this and comes with a pistol.  There were bullet sounds everywhere. &#8220;DISH DISH DISH&#8221;. This time also kaaka sings &#8220;kaaakakak&#8221;. But there was a sad tome in that voice which only the other kaaka can realize. &#8220;kakakaka&#8221;. </p>
<p>One kaaka dies. Guess who???<br />
<br/></p>
<p><code>Suspense. :P :P :P</code></p>
<p><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br />
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br />
The villian kaaka die of heart attack after hearing the bullet sound. But everyone feels sorry got the villan now, coz it didn&#8217;t even eat a vaada before dying. It&#8217;s last wish was unfulfilled. So that villian kaaka becomes a ghost (rememver this is not om shanthi om remake, coz villain won&#8217;t meet kaaki this time). It&#8217;s fed up of this mere kaaka world. It likes a rat this time :). The rat too likes kaaka. Kaaka likes rat :) [love at first site!]. </p>
<p>Now comes the song :-)<br />
kkaaaka vin paarvai ratin paakam<br />
kkaaaka vin paarvai ratin paakam<br />
ratin pakkam, ratin pakkam&#8230;</p>
<p>Now only people realise one great thing about the villain kaaka. It was MGR&#8217;s pet! MGR kaaka. So new evolutiong called kaakarat came into being.</p>
<p>THE END.<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2007/04/14/two-stories/" title="Two stories :)">Two stories :) (0)</a></li>
<li><a href="http://sp2hari.com/2008/07/19/lotr/" title="LOTR">LOTR (5)</a></li>
<li><a href="http://sp2hari.com/2008/07/15/mistakes/" title="Mistakes&#8230; :)">Mistakes&#8230; :) (1)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/winter-project/" title="Winter Project">Winter Project (5)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/mystery/" title="Mystery&#8230;">Mystery&#8230; (0)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/08/02/kaakarat/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LOTR</title>
		<link>http://sp2hari.com/2008/07/19/lotr/</link>
		<comments>http://sp2hari.com/2008/07/19/lotr/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 11:06:45 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Books]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=143</guid>
		<description><![CDATA[Hobbits 	- cheerful, short 	- 	BILBO, FRODO, SAM, PIPPIN, MERRY, SMEAGOL (GOLLUM)
Men	- serious	- ARAGORN, FARAMIR, BOROMIR, EOMER,
Elves	- wise, immortal, silent, magic (three rings)	- LEGOLAS
Dwarfs	 - short, sturdy, good with metals, stones	- 	GIMLI
Wizards	 - wise, serious, magic - SAURON, SARUMAN, GANDALF, ELROND
Orcs 	- ugly, fierce, wicked
Ents	- Tree shephards
SAURON&#8217;S COUNTRY - MORDOR
NINE NAZGULS
ELENDIL (ISILDUR&#8217;S SIRE) -  [...]]]></description>
			<content:encoded><![CDATA[<p>Hobbits 	- cheerful, short 	- 	BILBO, FRODO, SAM, PIPPIN, MERRY, SMEAGOL (GOLLUM)<br />
Men	- serious	- ARAGORN, FARAMIR, BOROMIR, EOMER,<br />
Elves	- wise, immortal, silent, magic (three rings)	- LEGOLAS<br />
Dwarfs	 - short, sturdy, good with metals, stones	- 	GIMLI<br />
Wizards	 - wise, serious, magic - SAURON, SARUMAN, GANDALF, ELROND<br />
Orcs 	- ugly, fierce, wicked<br />
Ents	- Tree shephards</p>
<p>SAURON&#8217;S COUNTRY - MORDOR<br />
NINE NAZGULS<br />
ELENDIL (ISILDUR&#8217;S SIRE) -  &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. - RANGERS - GONDOR<br />
SHIRE - HOBBIT&#8217;S VILLAGE </p>
<p>FRODO, SAM, PIPPIN, MERRY, ARAGORN, BOROMIR, LEGOLAS, GIMLI, GANDALF<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/08/02/kaakarat/" title="Kaakarat">Kaakarat (4)</a></li>
<li><a href="http://sp2hari.com/2008/07/15/mistakes/" title="Mistakes&#8230; :)">Mistakes&#8230; :) (1)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/winter-project/" title="Winter Project">Winter Project (5)</a></li>
<li><a href="http://sp2hari.com/2007/11/27/photolog-2/" title="Photolog 2&#8230;">Photolog 2&#8230; (1)</a></li>
<li><a href="http://sp2hari.com/2007/11/08/photolog/" title="Photolog&#8230;">Photolog&#8230; (5)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/07/19/lotr/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mistakes&#8230; :)</title>
		<link>http://sp2hari.com/2008/07/15/mistakes/</link>
		<comments>http://sp2hari.com/2008/07/15/mistakes/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 06:25:28 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[arbit]]></category>

		<category><![CDATA[chaat]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=142</guid>
		<description><![CDATA[When asked to read for any exam, I end up doing everything other than reading. It can be cleaning my room, washing clothes, bathing, chatting, coding, reading novels and so on. This time, when I had to give my SCJP test, I ended up watching How I Met Your Mom. ;)
Btw liked the scene I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>When asked to read for any exam, I end up doing everything other than reading. It can be cleaning my room, washing clothes, bathing, chatting, coding, reading novels and so on. This time, when I had to give my SCJP test, I ended up watching How I Met Your Mom. ;)</p>
<p>Btw liked the scene I&#8217;ve pasted below. Maybe, doing other things when you have to read is not a mistake after all. :-)</p>
<p><em>Scene 1: </em></p>
<p><em>Lily: </em>Yes, it&#8217;s a mistake. I know it&#8217;s a mistake. But there are certain things in life, where you know it&#8217;s a mistake but you don&#8217;t really know it&#8217;s a mistake because the only way to really know it&#8217;s a mistake is to make the mistake and look back and say, yup that was a mistake. So really, the bigger mistake would be to not make the mistake. Because then you go your whole life not really know if something is a mistake or not. And damn it, I&#8217;ve made no mistakes. I&#8217;ve done all of this, my life, my relationship, my career mistake free. Does any of this makes sense to you?<br />
<em>Ted: </em>I don&#8217;t know. You&#8217;ve said mistake a lot. </p>
<p><em>Scene 2: </em></p>
<p><em>Marshal: </em>It&#8217;s a mistake<br />
<em>Ted : </em>Maybe, but it&#8217;s a mistake I have to make.<br />
<em>Marshal: </em>Wrong, it&#8217;s a  mistake you don&#8217;t have to make&#8230;.<br />
<em>Ted: </em>Here is the thing about mistakes. Sometimes, even when you know something is a mistake, you&#8217;ve got to make it anyway. Even really really dumb mistakes.<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/01/07/winter-project/" title="Winter Project">Winter Project (5)</a></li>
<li><a href="http://sp2hari.com/2007/10/15/blue/" title="Blue&#8230; ;-) ;-)">Blue&#8230; ;-) ;-) (8)</a></li>
<li><a href="http://sp2hari.com/2008/08/02/kaakarat/" title="Kaakarat">Kaakarat (4)</a></li>
<li><a href="http://sp2hari.com/2008/07/19/lotr/" title="LOTR">LOTR (5)</a></li>
<li><a href="http://sp2hari.com/2008/02/09/css/" title="CSS">CSS (2)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/07/15/mistakes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Forgot the match again?</title>
		<link>http://sp2hari.com/2008/07/10/forgot-the-match-again/</link>
		<comments>http://sp2hari.com/2008/07/10/forgot-the-match-again/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 14:15:22 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[opc]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[topcoder]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=139</guid>
		<description><![CDATA[Do you play Topcoder? If yes, then there might be something for you in this post. If you don&#8217;t know what topcoder is, check http://topcoder.com/tc and then come back here.
If you play topcoder, then keeping track of when the next match is a big headache. There are many many people who login to the arena [...]]]></description>
			<content:encoded><![CDATA[<p>Do you play Topcoder? If yes, then there might be something for you in this post. If you don&#8217;t know what topcoder is, check <a href="http://topcoder.com/tc">http://topcoder.com/tc</a> and then come back here.</p>
<p>If you play topcoder, then keeping track of when the next match is a big headache. There are many many people who login to the arena one day before the contest and ask why there is not many playing today.  Come on, it is not funny to get up at 5.30 in the morning to know that the match is not today and it is tomorrow. The rest think the match is one day later, who curse themselves, bang their head for missing a match. If you want to forget forgetting :P about topcoder matches, follow the simple steps given below. </p>
<p>All you need is a Google Account. </p>
<ul>
<li>Login to google calendars at <a href="http://calendar.google.com/">http://calendar.google.com/</a></li>
<li>Search for &#8220;Topcoder&#8221; in public calendars. ( By clicking &#8220;Search Public Calendars&#8221; button). I got some 50 results when I wrote this. This may increase or decrease later. Choose anything from the list (anything from the first 5 will be good enough).</li>
<li>Click on the &#8220;Add to Calendar&#8221; button.</li>
<li>Go back to your calendar page. You can see the Topcoder calendar in the &#8220;Other calendars&#8221;.</li>
<li>You need to activate mobile setup by activating your phone number. This takes less than a minute. Give your country and phone number. Google will send you a verification code in 1 or 2 minutes. Type that validation code there and voila, you are done with the mobile setup. :-)</li>
<li>Now click on the &#8220;Calendars&#8221; tab in the settings page. </li>
<li>Click the &#8220;Notification&#8221; of your new Topcoder calendar.</li>
<li>Click the &#8220;Add a reminder&#8221; to add new remainders. </li>
<li>You can have upto 5 remainders for this calendar.</li>
</ul>
<p>See my notifications page here.<br />
<a href='http://sp2hari.com/wp-content/uploads/2008/07/topcoder.jpg'><img src="http://sp2hari.com/wp-content/uploads/2008/07/topcoder.jpg" alt="Google Calendar Notification" title="Google Calendar Notification" width="500" height="165" class="alignnone size-full wp-image-141" /></a><br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/01/15/google-maps/" title="Google Maps ">Google Maps  (4)</a></li>
<li><a href="http://sp2hari.com/2007/05/23/coding-style/" title="Coding Style &#8230;">Coding Style &#8230; (1)</a></li>
<li><a href="http://sp2hari.com/2007/05/03/seg-fault/" title="Seg Fault">Seg Fault (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/07/10/forgot-the-match-again/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Photolog 4&#8230;</title>
		<link>http://sp2hari.com/2008/07/07/photolog-4/</link>
		<comments>http://sp2hari.com/2008/07/07/photolog-4/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 09:20:26 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=137</guid>
		<description><![CDATA[Have been searching this picture for a long long time. Wasted so much time to search in all servers in my college. Finally found this in my picasa account. Anyway, better late than never. :-)

Manas, the Cook :D
Related Posts

No Related Post

]]></description>
			<content:encoded><![CDATA[<p>Have been searching this picture for a long long time. Wasted so much time to search in all servers in my college. Finally found this in my picasa account. Anyway, better late than never. :-)</p>
<p>
<center><a href='http://sp2hari.com/wp-content/uploads/2008/07/2007_0514birthday0045.jpg'><img src="http://sp2hari.com/wp-content/uploads/2008/07/2007_0514birthday0045-225x300.jpg" alt="" title="Manas, the Cook " width="225" height="300" class="aligncenter size-medium wp-image-138" /></a><br/>Manas, the Cook :D</center><br />
<h3>Related Posts</h3>
<ul class="related_post">
<li>No Related Post</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/07/07/photolog-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bye bye NITT</title>
		<link>http://sp2hari.com/2008/05/14/bye-bye-nitt/</link>
		<comments>http://sp2hari.com/2008/05/14/bye-bye-nitt/#comments</comments>
		<pubDate>Wed, 14 May 2008 13:15:57 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[college]]></category>

		<category><![CDATA[passout]]></category>

		<category><![CDATA[senti]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=132</guid>
		<description><![CDATA[My last post from LRSL (Last Row of Sun Lab, Octagon) I guess. 
Exactly one year back Manas told me, &#8220;You won&#8217;t miss the place, but you&#8217;ll miss the people.&#8221;
Hmmm now I realize what exactly it means. 
Hmmm, list of people whom I&#8217;ll miss next year 
Ankit
Anshu
Arun
Balli
Donatello
Doniv
Evo
Gcdart
Hajela
Ht
Iyer
KKS
Lavanya
Leela
Maruti
Mrrajesh
Nutty
Preeti
Sachi
Sachin
Sahil
Satya
Saurabh
Suren
Swami
Taggy
Verma
Walrus
Yazhini
If your name is not in the list, sorry. [...]]]></description>
			<content:encoded><![CDATA[<p>My last post from LRSL (Last Row of Sun Lab, Octagon) I guess. </p>
<p>Exactly one year back Manas told me, &#8220;You won&#8217;t miss the place, but you&#8217;ll miss the people.&#8221;<br />
Hmmm now I realize what exactly it means. </p>
<p>Hmmm, list of people whom I&#8217;ll miss next year </p>
<p>Ankit<br />
Anshu<br />
Arun<br />
Balli<br />
Donatello<br />
Doniv<br />
Evo<br />
Gcdart<br />
Hajela<br />
Ht<br />
Iyer<br />
KKS<br />
Lavanya<br />
Leela<br />
Maruti<br />
Mrrajesh<br />
Nutty<br />
Preeti<br />
Sachi<br />
Sachin<br />
Sahil<br />
Satya<br />
Saurabh<br />
Suren<br />
Swami<br />
Taggy<br />
Verma<br />
Walrus<br />
Yazhini</p>
<p>If your name is not in the list, sorry. It just means your name didn&#8217;t occur to me in the last 2 mins I typed this in Sun Lab.</p>
<p>And yeah, one thing. I&#8217;m not senti. :) For one thing. I&#8217;m pretty sure I&#8217;ll keep in touch with these people. Come on, I won&#8217;t lose my friends for nothing :) </p>
<p>Bye Bye NIT Trichy :) :) :)</p>
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/04/26/photolog-3/" title="Photolog 3&#8230;">Photolog 3&#8230; (2)</a></li>
<li><a href="http://sp2hari.com/2007/09/09/potato-guy/" title="Potato Guy &#8230;">Potato Guy &#8230; (5)</a></li>
<li><a href="http://sp2hari.com/2007/04/28/kelaaaaaaaa/" title="Kelaaaaaaaa">Kelaaaaaaaa (0)</a></li>
<li><a href="http://sp2hari.com/2007/04/20/gift-time/" title="Gift time :) :)">Gift time :) :) (0)</a></li>
<li><a href="http://sp2hari.com/2007/04/13/my-seniors/" title="My Seniors :) :)">My Seniors :) :) (3)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/05/14/bye-bye-nitt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Photolog 3&#8230;</title>
		<link>http://sp2hari.com/2008/04/26/photolog-3/</link>
		<comments>http://sp2hari.com/2008/04/26/photolog-3/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 22:04:34 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[college]]></category>

		<category><![CDATA[spider]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=130</guid>
		<description><![CDATA[WordPress gave me so much trouble when I tried to upload this pic. Still uploading pic in Wp 2.5 is a headache :&#8217;(. 

Related Posts

Bye bye NITT (4)
Setting up a SMS server using Gnokii (3)
Potato Guy &#8230; (5)
Kelaaaaaaaa (0)
My Seniors :) :) (3)

]]></description>
			<content:encoded><![CDATA[<p>WordPress gave me so much trouble when I tried to upload this pic. Still uploading pic in Wp 2.5 is a headache :&#8217;(. </p>
<p><a href='http://sp2hari.com/wp-content/uploads/2008/04/spider_card.jpeg'><img src="http://sp2hari.com/wp-content/uploads/2008/04/spider_card.jpeg" alt="" title="Spider Cardhttp://sp2hari.com/wp-content/uploads/2008/04/spider_card.jpeg" width="601" height="828" class="aligncenter size-medium wp-image-123" /></a><br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/05/14/bye-bye-nitt/" title="Bye bye NITT">Bye bye NITT (4)</a></li>
<li><a href="http://sp2hari.com/2008/04/18/setting-up-a-sms-server-using-gnokii/" title="Setting up a SMS server using Gnokii">Setting up a SMS server using Gnokii (3)</a></li>
<li><a href="http://sp2hari.com/2007/09/09/potato-guy/" title="Potato Guy &#8230;">Potato Guy &#8230; (5)</a></li>
<li><a href="http://sp2hari.com/2007/04/28/kelaaaaaaaa/" title="Kelaaaaaaaa">Kelaaaaaaaa (0)</a></li>
<li><a href="http://sp2hari.com/2007/04/13/my-seniors/" title="My Seniors :) :)">My Seniors :) :) (3)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/04/26/photolog-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Setting up a SMS server using Gnokii</title>
		<link>http://sp2hari.com/2008/04/18/setting-up-a-sms-server-using-gnokii/</link>
		<comments>http://sp2hari.com/2008/04/18/setting-up-a-sms-server-using-gnokii/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 10:50:18 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[gnokii]]></category>

		<category><![CDATA[sms]]></category>

		<category><![CDATA[spider]]></category>

		<guid isPermaLink="false">http://sp2hari.com/?p=128</guid>
		<description><![CDATA[I&#8217;ve used gnokii to set up a SMS server in our college as a part of Spider Project. Though I didn&#8217;t actually believe that a computer and a mobile phone can be connected when Manas suggested the idea, I coded much for this SMS server later. :P
So here is the short manual about how to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used gnokii to set up a SMS server in our college as a part of Spider Project. Though I didn&#8217;t actually believe that a computer and a mobile phone can be connected when <a href="http://manasg.com">Manas</a> suggested the idea, I coded much for this SMS server later. :P<br />
So here is the short manual about how to configure gnokii in a system. Let us assume that we have a basic Fedora or Ubuntu installed machine, a Nokia 7250i mobile and an USB data cable.</p>
<p><strong>Gnokii Installation :</strong><br />
This can be done in two ways like any other open source software.<br />
<strong>Installing from binary</strong>.<br />
Installing from binary is very easy if you have yum (Fedora) or apt (Ubuntu) configured for your system. All you need to do is to execute the following command as root or as sudo </p>
<p>In Ubuntu the command is<br />
<code>hari@spider:~$ sudo apt-get install gnokii gnokii-smsd gnokii-smsd-mysql</code><br />
In fedora the command is<br />
<code>root@spider:~# yum install gnokii gnokii-smsd gnokii-smsd-mysql</code><br />
The above packages have lots of dependencies like  libgnokii3, liblockfile1, timeout, dialog, mysql-common,  libmysqlclient15off. So it is better to install gnokii using yum (Fedora) or apt (Ubuntu) instead of rpm (Fedora )or dpkg (Ubuntu).</p>
<p><strong>Installing from Source: </strong><br />
This will be useful if you don&#8217;t have a yum or apt configured. Download the source package from <a href="http://www.gnokii.org/download/gnokii/">http://www.gnokii.org/download/gnokii/</a>. Then execute the following. I have used gnokii-0.6.9 for example. It might differ in your case.<code>[root@spider ~]# tar -zxvf gnokii-0.6.9.tar.gz<br />
[root@spider ~]# cd gnokii-0.6.9/<br />
[root@spider gnokii-0.6.9]# ./configure<br />
[root@spider gnokii-0.6.9]# make<br />
[root@spider gnokii-0.6.9]# make install<br />
</code><br />
<strong>Gnokii Configuration :</strong><br />
Once gnokii is installed, we need to change the configuration file (gnokiirc) and check whether the computer can identify the mobile phone. The configuration file can be located at two places. One in your home folder and the another in /etc.<br />
If there is no file in your home folder, then gnokii uses the configuration file present in /etc. </p>
<p>The mobile phone i use is Nokia, model 7250i, type NHL-4JX.<br />
For the example below, let us assume that you have permissions to edit the configuration file in /etc. Else copy the file from /etc and do the changes mentioned below. </p>
<p>1. Open gnokiirc file in any editor as root or sudo.<br />
2. Since I&#8217;m using an USB cable to connect the mobile to computer, set the value of port as &#8220;/dev/ttyUSB0&#8243; (quotes for clarity).<br />
This value may rarely change from computer to computer. You can from the output of the command &#8220;dmesg | tail&#8221; after you connect the USB cable to the computer. I get an output like this <code>[  325.740151] pl2303 2-1:1.0: pl2303 converter detected<br />
[  325.740847] usb 2-1: pl2303 converter now attached to ttyUSB0<br />
[  325.741245] usbcore: registered new interface driver pl2303<br />
[  325.741253] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver</code><br />
So in line 2, I know that that it is ttyUSB0.<br />
3. Set the model as AT<br />
4. Set the value of connection as serial</p>
<p>Then execute the command &#8220;gnokii &#8211;identify&#8221;. The above command shoud produce an output like<br />
<code>hari@spider:~$ gnokii --identify<br />
GNOKII Version 0.6.18<br />
IMEI         : 352955008063785<br />
Manufacturer : Nokia<br />
Model        : Nokia 7250i<br />
Product name : Nokia 7250i<br />
Revision     : V 4.63</code></p>
<p>If the command takes more than 5 or 10 seconds, than it just means that the computer hasn&#8217;t identified your mob yet. Remove the data cable from mob and USB cable from computer. Connect them once again and try. This time it may work. This has happened so many times in my machine. Still not able to come up with a nice reason why this happens :)</p>
<p>Once the computer has identifed your mobile phone, you can do lots and lots after that. :)<br />
man gnokii will give you a huge list of commands which you can use to control your mob. Some of them which will be useful for SMS interface is <code>gnokii --getsms SM 1 end  </code><br />
Above command reads all the messages stored in SIM memory <code>gnokii --getsms ME 1 end</code><br />
Above command reads all the messages stored in phone memory.<br />
See man gnokii to see more options for getsms.</p>
<p>To send SMS using gnokii, try this command <code>echo "Spider SMS Server" | gnokii --sendsms 9940557688</code></p>
<p><strong>Working with smsd </strong><br />
Once gnokii is configured, we can use smsd to send messages. This is more like a wrapper for gnokii. After you install gnokii-smsd, a database called SMS is created in your database.</p>
<p>To start the smsd server, you run the command<br />
<code>smsd -u <mysqlusername> -p <mysqlpassword> -c <mysqlhost> -m mysql</code><br />
<code>smsd -h or smsd --help</code> will be quite useful if you can&#8217;t remember the above options.</p>
<p align=justify>Once smsd is running, any SMS which comes to the mobile is taken by the computer, stored in the inbox table and then deleted. Similarly any entry added in outbox is sent to the destination. An very useful field in these two tables is &#8220;processed&#8221;. Any message which is added to the inbox has a default &#8220;processed&#8221; value of &#8220;0&#8243;. So once we are done with this message, we should change the value to 1. Any message which is inserted in the outbox has a default &#8220;processed&#8221; value of 0 and &#8220;error&#8221; value -1. If the message is sent successfully, the value of processed and error is changed to 1 and 0 respectively. If there is any error in sending the message, the value of processed and error is changed to 1 and some positive integer. Also note that changing the value of processed in outbox to 0 will result in resending the message again. </p>
<p>So any script which checks the inbox table every 5 seconds for messages with processed = 0 and does the required action when there is any new message will complete the SMS server model.<br />
<a href="http://sp2hari.com/scripts/smsd/reply-thankyou.html">This PHP script</a> sends a &#8220;Thank you&#8221; message to anyone who sends any message to the SMS server.<br />
<a href="http://sp2hari.com/scripts/smsd/massmessage-fromfile.html">This PHP script</a> sends mass message to all the numbers in a text file<br />
<a href="http://sp2hari.com/scripts/smsd/massmessage-frommysql.html">This PHP script</a> sends mass message to all the numbers in a mysql table<br />
<a href="http://sp2hari.com/scripts/smsd/leo-poll.html">This is the PHP script</a> I used for LEO poll.<br />
You can download all the above scripts as a single zip file <a href="http://sp2hari.com/scripts/smsd/smsd.zip">here</a>.<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/04/26/photolog-3/" title="Photolog 3&#8230;">Photolog 3&#8230; (2)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/04/18/setting-up-a-sms-server-using-gnokii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Image Search</title>
		<link>http://sp2hari.com/2008/03/22/google-image-search/</link>
		<comments>http://sp2hari.com/2008/03/22/google-image-search/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 07:12:52 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/03/22/google-image-search/</guid>
		<description><![CDATA[I don&#8217;t remember who exactly gave me this script. Must be either Verma or Manas, but this one is so cool.
The code looks pretty easy and clear,  though I didn&#8217;t try to understand it completely.
So this is what you have to do. 
Open Google image search and search for some image. If you are [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t remember who exactly gave me this script. Must be either Verma or Manas, but this one is so cool.<br />
The code looks pretty easy and clear,  though I didn&#8217;t try to understand it completely.<br />
So this is what you have to do. </p>
<p>Open Google image search and search for some image. If you are lazy to do that, click<br />
<a href="http://images.google.com/images?hl=en&#038;q=sp2hari&#038;btnG=Search+Images&#038;gbv=2">http://images.google.com/images?hl=en&#038;q=sp2hari&#038;btnG=Search+Images&#038;gbv=2</a></p>
<p>Then copy this javascript code and paste it in the URL bar<br />
<code>javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images; DIL=DI.length; function A(){for(i=0; i&lt;DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0)</code></p>
<p>Cool right? ;-)<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2007/06/11/topping-google-search/" title="Topping google search">Topping google search (0)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/03/22/google-image-search/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Choice&#8230;</title>
		<link>http://sp2hari.com/2008/03/17/choice/</link>
		<comments>http://sp2hari.com/2008/03/17/choice/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 15:22:53 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/03/17/choice/</guid>
		<description><![CDATA[Choice, my dear friend&#8230; You make them and then they take over!
Got this as a SMS message from one of my friends in our conversation.
Don&#8217;t know whether I like it or not, but so true. :-&#124;
Related Posts

No Related Post

]]></description>
			<content:encoded><![CDATA[<p><em>Choice, my dear friend&#8230; You make them and then they take over!</em></p>
<p>Got this as a SMS message from one of my friends in our conversation.<br />
Don&#8217;t know whether I like it or not, but so true. :-|</p>
<h3>Related Posts</h3>
<ul class="related_post">
<li>No Related Post</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/03/17/choice/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS</title>
		<link>http://sp2hari.com/2008/02/09/css/</link>
		<comments>http://sp2hari.com/2008/02/09/css/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 15:29:44 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[arbit]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/02/09/css/</guid>
		<description><![CDATA[Why should you have a nice design in your web page? Why should you have a good CSS?
I got this answer in the spider class. A nice way of telling concepts to the students.
&#8220;You know Rajinikanth right? Have you seen him without his makeup? He is old, bald, dark and certainly not an &#8220;hero&#8221; you [...]]]></description>
			<content:encoded><![CDATA[<p><center><a href='http://sp2hari.com/wp-content/uploads/2008/02/shivaji29.jpg' title='Rajini'><img src='http://sp2hari.com/wp-content/uploads/2008/02/shivaji29.jpg' alt='Rajini' /></a></center></p>
<p>Why should you have a nice design in your web page? Why should you have a good CSS?<br />
I got this answer in the spider class. A nice way of telling concepts to the students.<br />
&#8220;You know Rajinikanth right? Have you seen him without his makeup? He is old, bald, dark and certainly not an &#8220;hero&#8221; you would like to see without his makeup. But how does he look after all the makeup. A great hero and the amazing success of the movie &#8220;Shivaji&#8221; proves this. So you see, the makeup matters much. The looks make people to look at any person twice and that is true for web pages also. Have nice CSS and make people look at your web page twice.&#8221; </p>
<p>Nice thinking :-).<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/07/15/mistakes/" title="Mistakes&#8230; :)">Mistakes&#8230; :) (1)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/winter-project/" title="Winter Project">Winter Project (5)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/windows/" title="Windows">Windows (0)</a></li>
<li><a href="http://sp2hari.com/2008/01/07/mystery/" title="Mystery&#8230;">Mystery&#8230; (0)</a></li>
<li><a href="http://sp2hari.com/2007/12/10/hmmm/" title="Hmmm&#8230;">Hmmm&#8230; (3)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/02/09/css/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finally&#8230;.</title>
		<link>http://sp2hari.com/2008/01/27/finally/</link>
		<comments>http://sp2hari.com/2008/01/27/finally/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 00:43:16 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/01/27/finally/</guid>
		<description><![CDATA[This is one of the question you find being asked when browse for around 10-15 minutes.
&#8220;Your message has not been sent.
Discard your message?&#8221; from Gmail.
&#8220;Are you sure you want to navigate from this page?
Your message has not been sent.
Press OK to continue, Cancel to stay on the current Page&#8221; from Gmail
&#8220;Are you sure you want [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of the question you find being asked when browse for around 10-15 minutes.<br />
&#8220;Your message has not been sent.<br />
Discard your message?&#8221; from Gmail.</p>
<p>&#8220;Are you sure you want to navigate from this page?<br />
Your message has not been sent.<br />
Press OK to continue, Cancel to stay on the current Page&#8221; from Gmail</p>
<p>&#8220;Are you sure you want to navigate from this page?<br />
If you leave, your Meebo IM sessions will not be preserved!<br />
Press OK to continue or Cancel to stay on the current page&#8221; from meebo</p>
<p>&#8220;Are you sure you want to navigate from this page?<br />
You have unsaved changes.<br />
Press OK to continue,or Cancel to stay on the current page&#8221; from blogger</p>
<p>Well, what&#8217;s common among all 4 of these are that they ask for a confirmation to do some action. This is done generally to prevent losing by data when you click at some link by mistake. </p>
<p>For a web developer, this is one of the simplest thing to code. Javascript provides an inbuilt confirm function. Note that this function always has OK and Cancel button. So we should frame our question to suit these two buttons.</p>
<p>I had a bigger headache when i tried to have this feature in my small map application.<br />
Finally after more than 2 weeks, got how to do this thing without storing it in cookie and doing all other complicated things. I know this is not a great news, but this is really important news for just two souls who don&#8217;t mind partying for a week just to celebrate this. :) </p>
<p>Anyway, here is the link to the file that helped me in finding out the order of events and choosing which one might work.<br />
<a href="http://sp2hari.com/gmap/events.html">http://sp2hari.com/gmap/events.html</a></p>
<p>After a few clicking and clearing markers, this is the order i decided to do. </p>
<p>infoWindowBeforeClosed is called before an infoWindow is closed. In this function all the form details are stored into Javascript variables.<br />
infoWindowClosed is called after an infoWindow is closed. Here I ask whether the user wants to continue discarding his details or stay with current infowindow<br />
whatever he chooses, the infowindow will be closed. But I&#8217;ll create a new infoWindow at the same point with all those details he already provided with. Hmmmm, i do wish we had callbacks like we have in GTK ;-)</p>
<p>Two things to note here.<br />
1. After reading so much about events, now creating a marker with an infowindow at the initial position is so easy. Don&#8217;t know why I was so scared about this sometime back ;)<br />
2. Don&#8217;t know why I started thinking about cookies when I can store anything and everything I want to store in javascript variables :-(. Sometimes I do think like an idiot :P<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/01/27/google-maps-icons/" title="Google Maps - Icons">Google Maps - Icons (0)</a></li>
<li><a href="http://sp2hari.com/2007/05/23/coding-style/" title="Coding Style &#8230;">Coding Style &#8230; (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/01/27/finally/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Maps - Icons</title>
		<link>http://sp2hari.com/2008/01/27/google-maps-icons/</link>
		<comments>http://sp2hari.com/2008/01/27/google-maps-icons/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 16:54:30 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/01/27/google-maps-icons/</guid>
		<description><![CDATA[This post is for playing with icons in Google Maps. In the previous post, the last example explained how to add markers when we click on the map. We will try to add custom markers and change the properties of different markers before and after creating them. 
In the first example, we&#8217;ll create a custom [...]]]></description>
			<content:encoded><![CDATA[<p>This post is for playing with icons in Google Maps. In the previous post, the last example explained how to add markers when we click on the map. We will try to add custom markers and change the properties of different markers before and after creating them. </p>
<p>In the first example, we&#8217;ll create a custom marker instead of the default &#8220;G_DEFAULT_ICON&#8221;.<br />
First we need  marker and shadow images to create custom markers. If you are not interested in creating your own custom markers, then check out<br />
<a href="http://www.visual-case.it/cgi-bin/vc/GMapsIcons.pl">http://www.visual-case.it/cgi-bin/vc/GMapsIcons.pl</a><br />
for different markers. I downloaded these markers and stored them in a folder called &#8220;icons&#8221;. Now let us see the addMarker method which adds a custom marker at the place where you click in the map.<br />
<code>function addMarker(overlay, latlng) {<br />
		var icon = new GIcon();<br />
		icon.image = "icons/blue-pushpin.png";<br />
		icon.shadow = "icons/pushpin_shadow.png";<br />
		icon.iconSize = new GSize(32, 32);<br />
		icon.shadowSize = new GSize(59, 32);<br />
		icon.iconAnchor = new GPoint(10, 30);<br />
		icon.infoWindowAnchor = new GPoint(10, 30);<br />
    	marker[markerCount] = new GMarker(latlng, icon);<br />
        map.addOverlay(marker[markerCount]);<br />
        markerCount = markerCount+1;<br />
	    document.getElementById("message").innerHTML = "Marker added at latitude "+latlng.lat() + " longitude "+latlng.lng() ;<br />
    }</code><br />
If you aren&#8217;t sure about the methods used in the above code, check out the Google Maps API. The above code creates a new Icon and passes it when creating a new Marker<br />
To see how the above code code works, check<br />
<a href="http://sp2hari.com/gmap/icon1.html">http://sp2hari.com/gmap/icon1.html</a></p>
<p>Now let us make this more complicated. ;). How about the user deciding which type of marker should be added before he adds them?<br />
The code is quite long but certainly not complicated. Before we start with the code, check out how it works :).<br />
<a href="http://sp2hari.com/gmap/icon2.html">http://sp2hari.com/gmap/icon2.html</a><br />
Two global arrays maintain the different custom markers and their corresponding shadows.<br />
<code>    var icons = new Array("blue-pushpin.png", "yellow-pushpin.png", "red-pushpin.png", "purple-pushpin.png", "green-pushpin.png", "lightblue-pushpin.png", "pink-pushpin.png", "blue.png", "yellow.png", "red.png", "purple.png", "green.png", "lightblue.png", "pink.png", "blue-dot.png", "yellow-dot.png", "red-dot.png", "purple-dot.png", "green-dot.png", "lightblue-dot.png", "pink-dot.png");<br />
    var shadows = new Array("pushpin_shadow.png", "pushpin_shadow.png", "pushpin_shadow.png", "pushpin_shadow.png", "pushpin_shadow.png",  "pushpin_shadow.png",  "pushpin_shadow.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png", "msmarker.png");<br />
 </code><br />
Just to make things easier, I&#8217;ve written a separate createIcon function, which takes the index and creates an icon accordingly. The snippet of this function is same as that of the previous file, with very few modifications. :)<br />
<code>	function createIcon(index) {<br />
		var ticon = new GIcon();<br />
		ticon.image = "icons/"+icons[index];<br />
		ticon.shadow = "icons/"+shadows[index];<br />
		ticon.iconSize = new GSize(32, 32);<br />
		ticon.shadowSize = new GSize(59, 32);<br />
		ticon.iconAnchor = new GPoint(10, 30);<br />
		ticon.infoWindowAnchor = new GPoint(10, 30);<br />
		return ticon;<br />
	}   </code></p>
<p>Now &#8220;icon&#8221; is a global variable and keeps track of what type of icon should be created. The function changeIcon does two jobs. First it updates the preview of the icon to be displayed and changes the value of the icon. addMarker usees this  icon variable before creating an icon. So any marker created will have the icon corresponding to the selected one.  :)<br />
<code>    function changeIcon(index) {<br />
    	document.preview.src = "icons/"+icons[index];<br />
    	icon = createIcon(index);<br />
    }</code></p>
<p>Cool right ;). Now how about changing the icon of a marker which is already created. There are two ways of doing this. First one is simple, but won&#8217;t work if the shadows differ. Second one is a little complicated, but works for all kinds of markers.<br />
Before we start, check out the this link to see how the markers are changed after they are created.<br />
<a href="http://sp2hari.com/gmap/icon3.html">http://sp2hari.com/gmap/icon3.html</a><br />
In this example, the only addition to the code is<br />
<code>    function changeAllMarkers(index) {<br />
    	for (var i=0; i <markerCount; i++) {<br />
    		marker[i].setImage("icons/"+icons[index]);<br />
    	}<br />
    }</code></p>
<p>The setImage function changes the image of a marker, but doesn&#8217;t allow us to change the shadow. It&#8217;s mentioned in the API as follows</p>
<blockquote><p>Requests the image specified by the url to be set as the foreground image for this marker. Note that neither the print image nor the shadow image are adjusted. Therefore this method is primarily intended to implement highlighting or dimming effects, rather than drastic changes in marker&#8217;s appearances. (Since 2.75)</p></blockquote>
<p>Therefore, the above example is quite easy and useful if there is not much difference in the images we are going to display as markers. </p>
<p>If there is a big difference in the images we are going to display, then the only way is to delete the overlay and create a new marker at the same point.<br />
This example shows how that works.<br />
<a href="http://sp2hari.com/gmap/icon4.html">http://sp2hari.com/gmap/icon4.html</a><br />
In this example, after you create a marker, change the image and click on the marker again. You can see that the image of  the marker changes according to the one selected. :)<br />
The main idea is that when the map is clicked, if it is clicked on a marker, overlay is passed. Else latlng is passed. Thus using this we code the addMarker as follows :)<br />
<code>    function addMarker(overlay, latlng) {<br />
    	if (overlay == null) {<br />
	    	marker[markerCount] = new GMarker(latlng, icon);<br />
	        map.addOverlay(marker[markerCount]);<br />
	        markerCount = markerCount+1;<br />
		    document.getElementById("message").innerHTML = "Marker added at latitude "+latlng.lat() + " longitude "+latlng.lng() ;<br />
	    }<br />
	    else {<br />
	    	point = overlay.getPoint();<br />
			map.removeOverlay(overlay)<br />
	    	icon = createIcon(document.forms[0].selecticon.selectedIndex);<br />
			addMarker(null, point);<br />
	    }<br />
    }</code><br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/01/27/finally/" title="Finally&#8230;.">Finally&#8230;. (0)</a></li>
<li><a href="http://sp2hari.com/2007/05/23/coding-style/" title="Coding Style &#8230;">Coding Style &#8230; (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/01/27/google-maps-icons/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Maps</title>
		<link>http://sp2hari.com/2008/01/15/google-maps/</link>
		<comments>http://sp2hari.com/2008/01/15/google-maps/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 22:59:56 +0000</pubDate>
		<dc:creator>sp2hari</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[pushpin]]></category>

		<guid isPermaLink="false">http://sp2hari.com/2008/01/15/google-maps/</guid>
		<description><![CDATA[I have been using Google Maps for a long time (a nice way to kill time) and now I am using the Google Map API to create my own site (not a nice way to kill time). Was able to start with my work using the  sample examples given in the Google Maps site [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using Google Maps for a long time (a nice way to kill time) and now I am using the Google Map API to create my own site (not a nice way to kill time). Was able to start with my work using the  sample examples given in the Google Maps site and by trial and error method.<br />
But came to a dead end when i had to manage many events at the same time. Say for the example, when the user clicks in the map, first an infowindow opens up with a form in it. When the user clicks elsewhere when already an infowindow is open, then an prompt asking for whether he should save the old place or not. If he says no, the show the new infowindow. Else retain the old infowindow. Save the details using an Ajax request so that the page is not reloaded again and again. Mummy&#8230;. </p>
<p>But now, after exploring so much about Google Maps, I was able to manage things now. A simple tutorial about how to handle events in Google Maps. The reason why i choose events is that this is more difficult to grasp AFAIK. :)</p>
<p>First let us start with a simple Google Map as shown in the following url<br />
<a href='http://sp2hari.com/gmap/event-simple.html'  target=_blank> http://sp2hari.com/gmap/event-simple.html</a><br />
The main code which adds the event listener is<br />
<code>        GEvent.addListener(map,"click", function(overlay,latlng) {<br />
        	alert ("Map Clicked");<br />
        });<br />
        GEvent.addListener(map,"click", displayMessage);  </code><br />
Note that for the same event &#8220;click&#8221;, I have added two event listeners. In the first listener, the code to be executed when the event occurs is inline. This is fine if the code is very small. Even then i advice you to follow the second method where the function name to be called is given as argument. Then you can mention all the actions to be done when the event occurs in that function. For example, my displayMessage will look like<br />
<code>   function displayMessage(overlay, latlng) {<br />
	    document.getElementById("message").innerHTML = "Clicked at latitude "+latlng.lat()+ " and longitude "+latlng.lng();<br />
    }</code></p>
<p>Yup. That&#8217;s all it needs to add a simple event listener for Google Maps.<br />
Now let us try something more ;)<br />
How about trying to add a marker at the place where it is clicked and a button to clear all markers?<br />
Check this url<br />
<a href='http://sp2hari.com/gmap/event-addmarker.html'  target=_blank> http://sp2hari.com/gmap/event-addmarker.html</a><br />
In the above file, I just have one event listener for click (you can have as many as you want), and the function I&#8217;m calling after click is &#8220;addMarker&#8221;. The following code adds the event listener.<br />
<code>GEvent.addListener(map,"click", addMarker);  </code><br />
Now the function addMarker has the code to add a marker as shown below<br />
<code>    function addMarker(overlay, latlng) {<br />
    	var marker = new GMarker(latlng);<br />
    	map.addOverlay(marker);<br />
	    document.getElementById("message").innerHTML = "Marker added at latitude "+latlng.lat() + " longitude "+latlng.lng() ;<br />
    }</code></p>
<p>Another function clearAllMarkers is used to clear all the markers used in the map. Check the code for that function.<br />
<code>    function clearAllMarkers() {<br />
    	map.clearOverlays();<br />
    	document.getElementById("message").innerHTML = "All markers cleared";<br />
    }</code></p>
<p>Let&#8217;s play more with markers :)<br />
How about having a infowindow open when you click a marker?<br />
Check the following url<br />
<a href='http://sp2hari.com/gmap/event-showinfowindow.html'  target=_blank> http://sp2hari.com/gmap/event-showinfowindow.html</a><br />
In the above example, we can add markers and we also get an infowindow when we click on the marker. For this the code is very similar to the previous example with a small modification in the addMarker function.<br />
<code>    function addMarker(overlay, latlng) {<br />
    	marker[markerCount] = new GMarker(latlng);<br />
        marker[markerCount].bindInfoWindowHtml("This is Marker number "+markerCount);<br />
        map.addOverlay(marker[markerCount]);<br />
        markerCount = markerCount+1;<br />
	    document.getElementById("message").innerHTML = "Marker added at latitude "+latlng.lat() + " longitude "+latlng.lng() ;<br />
    }</code></p>
<p>As you can see, we have a global array of markers and whenever we create a new marker, we bind an infowindow to the marker using bindInfoWindowHtml method. Simple right? :)<br />
We&#8217;ll see more complex event handling sometime later. :) Feeling sleep right now :)<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://sp2hari.com/2008/07/10/forgot-the-match-again/" title="Forgot the match again?">Forgot the match again? (2)</a></li>
<li><a href="http://sp2hari.com/2007/05/23/coding-style/" title="Coding Style &#8230;">Coding Style &#8230; (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sp2hari.com/2008/01/15/google-maps/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
