<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ankit Jain &#187; how it works</title>
	<atom:link href="http://ankitjain.info/ankit/tag/how-it-works/feed/" rel="self" type="application/rss+xml" />
	<link>http://ankitjain.info/ankit</link>
	<description>» It’s all about Ankit and Web! «</description>
	<lastBuildDate>Thu, 02 Jun 2011 16:54:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Fun with Yahoo Media Player!</title>
		<link>http://ankitjain.info/ankit/2009/02/08/how-yahoo-media-player-poadcast-works/</link>
		<comments>http://ankitjain.info/ankit/2009/02/08/how-yahoo-media-player-poadcast-works/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 17:43:35 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Product Review]]></category>
		<category><![CDATA[Programming/Code]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[how it works]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://ankitjain.info/ankit/?p=214</guid>
		<description><![CDATA[A quick way to insert music in your site: Create hyper-links for few MP3 files Insert following script code to your page &#60;script type="text/javascript" src="http://mediaplayer.yahoo.com/js"&#62;&#60;/script&#62; You are done! Yahoo! Media Player will be loaded and it will make all media links clickable Here are few of my favorite tracks. Use the play button to listen. [...]]]></description>
			<content:encoded><![CDATA[<p>A quick way to insert music in your site:</p>
<ol>
<li>Create hyper-links for few MP3 files</li>
<li>Insert following script code to your page<br />
<code>&lt;script type="text/javascript" src="http://mediaplayer.yahoo.com/js"&gt;&lt;/script&gt;</code></li>
<li>You are done! Yahoo! Media Player will be loaded and it will make all media links clickable <img src='http://ankitjain.info/ankit/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p>Here are few of my favorite tracks. Use the play button to listen. <small>Thanks to <a href="http://www.radioreloaded.com" target="_blank">RadioReloaded.com</a></small>.</p>
<ol> <a href="http://braikhna.com/music/Tere%20Naina.mp3">Tere Naina, Chandi Chowk To China (2009)</a><br />
<a href="http://www.radioreloaded.com/audio/2k/1038_Jaane Kyun Log Pyaar Kerte Hain.mp3">Jaane Kyun Log Pyar Karte Hein, Dil Chahta Hai (2001)</a><br />
<a href="http://www.radioreloaded.com/audio/7k/6724_Akela Hoon Main.mp3">Akela hoon Mein, Raeth</a><br />
<a href="http://www.radioreloaded.com/audio/9k/8777_Gum%20Sum%20Ho%20Kyun.mp3">Gum Sum Ho Kyun, Aksar</a><br />
<a href="http://66.45.233.14/Yeh_Jo_Mohabbat_Hai_Dil_Vil_Pyar_Vyar.mp3">Ye Jo Mohabbat Hai, Dil Vil Pyar Vyar (2002)</a><br />
<a href="http://www.radioreloaded.com/audio/26k/25014_Mumma.mp3">Mumma, Dasvidaniya (2008)</a><br />
<a href="http://www.radioreloaded.com/audio/26k/25061_Tujh Mein Rab Dikhta Hai.mp3">Tujh Mein Rab Dikhta Hai, Rab Ne Bana Di Jodi (2008)</a></ol>
<p>How does it work?<br />
<span id="more-214"></span></p>
<ol>
<li>Inserting the script loads swfProxy, a flash player, from Yahoo&#8217;s server (http://l.yimg.com/us.yimg.com/i/us/mus/swf/ymwp/swfproxy-2.0.31.swf).</li>
<li>The javascript detects all hyperlinks with mp3/wav as file extension. For more details about supported types refer <a href="http://yahoomediaplayer.wikia.com/wiki/How_to_link#Playable_Links" target="_blank">wiki page</a>.</li>
<li>Then a play icon/button is inserted before each supported link. This is done using <em>em.ymp-skin</em> CSS class.</li>
<li>The Javascript then builds user interface as interactive sidebar. All images in the player are loaded by extracting small parts (using CSS) from <a href="http://l.yimg.com/us.yimg.com/i/us/mus/ymwp/mediaplayer-2.0.31.png" target="_blank">single image</a>.</li>
<li>When you click play button, the media file URL is passed to swfProxy object that actually plays the file. One thing is still wondering to me is <span style="text-decoration: underline;">how do they track mouse click event</span> on these hyperlinks?</li>
</ol>
<p>Certainly, a great idea and smart implementation!</p>
<p>- ankit<br />
<script src="http://mediaplayer.yahoo.com/js" type="text/javascript"></script><br />
[<em>Edited: 15 Feb, 09: Clarification for the fifth point under 'How it works'</em></p>
<p>JavaScript best practices suggest not to use any inline event (onClick, etc) with HTML tags. For example, following is a bad practice:</p>
<blockquote><p><code>&lt;a onclick="doSomething()" href="#"&gt;Click!&lt;/a&gt;</code></p></blockquote>
<p>Instead, you should separate out JavaScript from HTML.</p>
<blockquote><p><code>&lt;a href="backuplink.html" class="doSomething"&gt;Click!&lt;/a&gt;</code></p></blockquote>
<p>In a script block associate onClick event as following:</p>
<blockquote><p><code><br />
$('a.doSomething').click( function() {<br />
// Do something here!<br />
alert('You did something, woo hoo!');<br />
}  );<br />
...</code></p></blockquote>
<p>]</p>
]]></content:encoded>
			<wfw:commentRss>http://ankitjain.info/ankit/2009/02/08/how-yahoo-media-player-poadcast-works/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
<enclosure url="http://www.radioreloaded.com/audio/9k/8777_Gum%20Sum%20Ho%20Kyun.mp3" length="4512667" type="audio/mpeg" />
<enclosure url="http://66.45.233.14/Yeh_Jo_Mohabbat_Hai_Dil_Vil_Pyar_Vyar.mp3" length="952790" type="audio/mpeg" />
<enclosure url="http://www.radioreloaded.com/audio/26k/25014_Mumma.mp3" length="10837115" type="audio/mpeg" />
<enclosure url="http://braikhna.com/music/Tere%20Naina.mp3" length="4139133" type="audio/mpeg" />
		</item>
		<item>
		<title>Let&#8217;s Digg into Google Maps</title>
		<link>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps/</link>
		<comments>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 17:25:40 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming/Code]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[how it works]]></category>

		<guid isPermaLink="false">http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps</guid>
		<description><![CDATA[The Web would not be so simpler and interactive without Ajax. This technology makes Web applications pleasant, interactive, quick responsive and light weight. Take any of the online map applications, no matter whether it is Yahoo Maps, Google Maps or Windows Live Local, and you will find awesome precession, cutting edge technology (beyond DHTML, XML [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="text-align: justify">The Web would not be so simpler and interactive without Ajax. This technology makes Web applications pleasant, interactive, quick responsive and light weight. Take any of the online map applications, no matter whether it is Yahoo Maps, Google Maps or Windows Live Local, and you will find awesome precession, cutting edge technology (beyond DHTML, XML and JavaScript) well managed data. Being software developer, these always attract me and I want to understand the scene behind those best software architectures/implementations. Over the last few days I was studying (hacking) Google maps and wanted to see how it works? Here are my investigations.</p>
<p class="MsoNormal" style="text-align: justify"><strong>Tiles: </strong>The very first observation is &#8211; not whole map is fetched at once. Instead the entire map is divided into tiles and a series of Ajax requests are fired to retrieve some part of the actually map. As soon as a tile is fetched it is displayed at its position. Their position is <em>well calculated</em> no matter user drags the maps while requests are on the way. The benefit here is, the user interface remains responsive and it makes user eager to analyze an area of map as soon as it&#8217;s available.</p>
<p><center><a title="Pune Google Map - Slices" target="_blank" href="http://ankitjain.info/ankit/wp-content/Pune-Google-Map.jpg"> <img id="image104" alt="Pune-Google-Map.jpg" src="http://ankitjain.info/ankit/wp-content/Pune-Google-Map.thumbnail.jpg" /></a> </center> <span id="more-105"></span></p>
<p class="MsoNormal"><strong>Overlaying:</strong> The tiles can be considered basic unit of mapping applications. They are atomic and have minimal required information. The DHTML allows overlapping one tile (image) over another and makes development easier. Here is how.</p>
<p class="MsoNormal">For each type of data there exists an independent tile. The Ajax application retrieves these tiles and overlaps one above another. For example &#8211; the user requests to see map and satellite image together, and here is how the rendered image is showed.<br />
<center></p>
<table width="550" style="height: 542px">
<tr>
<td align="center"><img id="image106" alt="kh_pune.jpg" src="http://ankitjain.info/ankit/wp-content/kh_pune.jpg" /></td>
<td>+</td>
<td><img id="image107" alt="mt_pune.png" src="http://ankitjain.info/ankit/wp-content/mt_pune.png" /></td>
</tr>
<tr>
<td colspan="3">
<div align="center">||</div>
<div style="text-align: center"><img id="image108" alt="overlap_pune.JPG" src="http://ankitjain.info/ankit/wp-content/overlap_pune.JPG" /></div>
</td>
</tr>
</table>
<p></center></p>
<div align="left">
<p class="MsoNormal"><strong>Tiles are Independent:</strong> Each tile is an independent unit and its request can be customized from client browser itself. For example making a request of <a target="_blank" href="http://kh2.google.com/kh?n=415&#038;v=22&#038;hl=en&#038;t=trtssqrtqsqqtqq">http://kh2.google.com/kh?n=415&#038;v=22&#038;hl=en&#038;t=trtssqrtqsqqtqq</a>  returns -</p>
<p class="MsoNormal">
<div style="text-align: center"><img alt="kh_pune_22.jpg" id="image109" src="http://ankitjain.info/ankit/wp-content/kh_pune_22.jpg" /></div>
<p class="MsoNormal">This is a newer image. While the request for <a target="_blank" href="http://kh2.google.com/kh?n=415&#038;v=21&#038;hl=en&#038;t=trtssqrtqsqqtqq">http://kh2.google.com/kh?n=415&#038;v=21&#038;hl=en&#038;t=trtssqrtqsqqtqq</a> yields and older image for the same area.</p>
<p class="MsoNormal">
<div style="text-align: center"><img alt="kh_pune_21.jpg" id="image110" src="http://ankitjain.info/ankit/wp-content/kh_pune_21.jpg" /></div>
<p class="MsoNormal">Here the difference in the requests is of a single parameter &#8216;v&#8217; and as per my guess its &#8216;version&#8217;. The next parameter &#8216;t&#8217; seems a combination of zoom index, and the corner coordinates. For tiles of type map having some text, their language can be controlled using &#8216;hl=en&#8217;. Try using &#8216;hl=ru&#8217; and you can see difference. So, the JavaScript executing in the client&#8217;s browser has complete control over what to display.</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Ajax:</strong> Probably this needs to be the first point I should discuss. Google Maps does not use XMLHttpRequest for making Ajax calls. Instead, they have used <a href="http://ajaxpatterns.org/IFrame_Call" target="_blank" >I-FRAME (iFrame) for preloading images</a>. When you use Firebug you won&#8217;t be also to trace any XMLHttpRequest calls. I think the reason for this would be the difficulty in using and image/jpeg response from XMLHttpRequest as an image object and display it in browser.</p>
<p class="MsoNormal">- ankit</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ankitjain.info/ankit/2008/04/17/lets-hack-google-maps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

