<?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>xk0der</title>
	<atom:link href="http://blog.xkoder.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xkoder.com</link>
	<description>therez light!</description>
	<lastBuildDate>Sat, 12 Dec 2009 13:58:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Git Tutorial Part II &#8211; Sharpen your Git-Fu with 10 more commands.</title>
		<link>http://blog.xkoder.com/2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/</link>
		<comments>http://blog.xkoder.com/2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 09:31:47 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fu]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=93</guid>
		<description><![CDATA[Some time back I had posted a simple Git tutorial that introduced you to 10 git commands, to get you started with this wonderful piece of tool. The response that I got for that post was great. I also got comments asking me for how to perform few other tasks. So here it is, the [...]]]></description>
			<content:encoded><![CDATA[<p>Some time back I had posted a simple <a title="Git Tutorial : Starting with git using just 10 commands " href="http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/">Git tutorial that introduced you to 10 git commands</a>, to get you started with this wonderful piece of tool. The response that I got for that post was great. I also got comments asking me for how to perform few other tasks. So here it is, the second installment of the git-tutorial. I hope you enjoy it as much as the first part.</p>
<p><strong>Remember</strong>, the text presented here targets a single developer setup (as the first part did). I intend to do a distributed git setup in the third installment.</p>
<p><span style="color: #999999;"><em>Note : Few commands have been broken into two or more lines to fit into the blog&#8217;s layout.<br />
</em></span></p>
<p>Let&#8217;s begin!</p>
<h3>Command 1 : Time Travel: Moving back and forth between revisions.</h3>
<p>The whole point of a version control system is to maintain revision history of your source code. And permitting you to view, how your code looked, at any point of time in the recorded history.</p>
<p>Git records your revisions in the form of commits. Every commit is assigned a unique hash to identify it. (Git uses SHA1 hashes). You can view the commit hash by issuing the <em>git-log</em> command (Check <a title="Git Tutorial : Starting with git using just 10 commands " href="http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/">part one</a>). The hash is displayed as a hexadecimal string on the line beginning with the word &#8220;commit&#8221; in the log.</p>
<p>Now that we know all this technical mumbo-jumbo, let&#8217;s use it to do some real work.</p>
<p><strong>Move to a commit in the past.</strong></p>
<p>To move to a particular commit back in time we use the command git-checkout, introduced in <a title="Git Tutorial : Starting with git using just 10 commands " href="http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/">part-I</a> for moving between branches. The syntax is similar, but instead of the branch name we use the commit hash. <strong>Always make sure you commit any changes or stash them (see next command) before you issue the checkout command; Else the changes will move across!</strong></p>
<p>here&#8217;s the syntax:</p>
<pre>$ git checkout <em>commit_hash</em></pre>
<p>Let&#8217;s see an example.</p>
<p>First I issue the git-log command to find the hash of a commit I want to switch to.</p>
<pre>$ git log
<strong><span style="color: #ffcc00;">commit 1ef801f70a99b07bb578bac4a3c2edb52b367e1d</span></strong>
Author: xk0der &lt;<span style="color: #0000ff;">amit .. AT .. xkoder .. com</span>&gt;
Date:   Fri Jun 5 12:52:16 2009 +0530

Added few comments

<strong><span style="color: #ffcc00;">commit ccbaeec43300f19dd04308b6c62a3f03f6233725</span></strong>
Author: xk0der &lt;<span style="color: #0000ff;">amit .. AT .. xkoder .. com</span>&gt;
Date:   Fri Jun 5 12:51:30 2009 +0530

Initial import</pre>
<p><em><span style="color: #c0c0c0;">(email address obfuscated for spam bots)</span></em></p>
<p>As you can see, I have just two commits here. I want to move to the commit with the log message &#8220;Initial import&#8221; i.e. my first commit. So I issue the following command.</p>
<pre>$ git checkout <strong>ccbaeec4</strong></pre>
<p>as you can see I just typed in the first 8 characters of the hash. That is the minimum that Git requires to successfully identify the commits uniquely. You may supply more than eight characters or the full hash if you wish.</p>
<p>After the checkout is complete, you can view your files to see how they looked in the past <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . If you want to modify your files and want to propagate the changes to the master&#8217;s HEAD, check <strong>command 6 </strong>below.</p>
<p><strong>Moving back to the present</strong><br />
To go back to the master&#8217;s HEAD; which is the present state of your code; issue the command:</p>
<pre>$ git checkout <strong>master</strong></pre>
<p>As I&#8217;ve said earlier, <strong>always remember</strong> to commit changes or stash them before moving between branches or commits.</p>
<h3>Command 2: git-stash &#8211; Moving without committing.</h3>
<p>This is one handy command you&#8217;ll find very useful. It lets you store your current changes to a temporary location. These <em>stashed</em> changes can then be recalled back when required. Thus alleviating the need to commit every time you need to move across branches or commits.</p>
<p><strong>Stashing changes</strong><br />
the syntax is:</p>
<p>$ git stash</p>
<p>When issued, all changes will be stashed to a temporary location and you will have a clean current HEAD. You can verify this by issuing the <em>git-status</em> command.</p>
<p>When done with your other work, you can pop back the stashed changes by issuing the following command.</p>
<p>$ git stash pop</p>
<p>Pretty cool &#8216;eh! But when to use it?</p>
<p><strong>When to use git-stash; Here is a one typical scenario</strong><br />
Suppose you are working on one of the <em>feature</em> branch and you get a mail that something is not fine with the code on your trunk, the &#8216;<em>master branch</em>&#8216;. Now one way to to fix something on the master branch is to:</p>
<ul>
<li> First commit changes on the &#8216;feature&#8217; branch.</li>
<li> Next, checkout the master branch and fix what&#8217;s required.</li>
<li> Commit changes to master.</li>
<li> Checkout the &#8216;feature&#8217; branch.</li>
</ul>
<p>But, what if, you do not want to commit the changes on the &#8216;feature&#8217; branch? Probably because you are halfway through something, or you want to test your code before you commit it. You you stash all changes as shown below.</p>
<pre>$ git stash
$ git checkout master
<span style="color: #999999;"><em>...Fix some stuff...</em></span>
$ git commit -a -m "Bug:12 fixed - thread no longer dies prematurely"
$ git checkout feature
$ git stash pop
<span style="color: #999999;"><em>...Continue working normally...</em></span></pre>
<p><strong>Multiple stashes</strong><br />
You can stash more than one set of changes, if required, by issuing the git-stash command multiple times.</p>
<p>When you use the `git-stash pop` command, the latest stash comes out first, much like a stack.</p>
<p><strong>Viewing stored stashes</strong></p>
<p>To view a list of stashed changes issue the following command</p>
<p>$ git stash list</p>
<p>There are more fancy things, that you can do with this command (checkout the man pages for git-stash). But for normal daily use the first two commands will suffice.</p>
<h3>Command 3: git-diff &#8211; some switches to differentiate better.</h3>
<p>I&#8217;ve already explained this command in the <a title="Git Tutorial : Starting with git using just 10 commands " href="http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/">first part</a>. Here I&#8217;ll discuss some command line options that you can supply, to help find the right information.</p>
<p><strong>Finding which files differ (instead of what differs inside files)<br />
</strong></p>
<p>Here&#8217;s the command:</p>
<pre>$ git diff --name-status</pre>
<p>This will list the files that have been modified(M), added(A) or deleted(D) with respect to the current HEAD and uncommitted changes, if any. You may supply commit hash(es) to find difference between those two commits.</p>
<pre>$ git diff --name-status <em>hash_1 hash_2</em></pre>
<p><strong>Using the HEAD symbol</strong></p>
<p>You can use the <em>HEAD </em>symbol to view diff&#8217;s between the current <em>HEAD </em>and previous revisions, as follows:</p>
<pre>$ git diff <strong>HEAD~1</strong></pre>
<p>This command will show you the diff between current <em>HEAD </em>and the immediate previous commit. This command is a shortcut for</p>
<pre>$ git diff commit_hash_for_HEAD
  commit_hash_just_before_HEAD</pre>
<p><strong>What is the HEAD?</strong></p>
<p>If you remember, as discussed in part one of this tutorial, <em>HEAD </em>refers to the latest commit on the current branch. <span style="color: #999999;"><em></em></span></p>
<p>You can change the number after the tilde (~) to find differences between HEAD and &#8216;that&#8217; many commits before the HEAD commit. experiment and see what you find. This is a <em>totally safe</em> command to play with <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Command 4 : git-add revisited.</h3>
<p>In part one of this tutorial we learned how to make git keep track of a file or number of files by issuing the <em>git-add</em> command. Well that is one work <em>git-add </em>does. Let&#8217;s find out what&#8217;s the other thing <em>git-add</em> is used for.</p>
<p>Before that, let&#8217;s see how we have been committing changes up till now.</p>
<pre>$ git commit -a -m "Commit Message"</pre>
<p>We know that the <strong>-m</strong> switch is to specify the commit message, what is that <strong>-a</strong> switch doing there?</p>
<p>Before I explain; The above command is (<em>almost</em>) equivalent to the following two commands, in sequence:</p>
<pre>$ git add .
$ git commit -m "Commit Message"</pre>
<p>So you see, that little <strong>-a</strong> switch is actually a shortcut to add all files. But haven&#8217;t we already added the files for git, to keep track of?</p>
<p>Yes we have but git also wants you to tell it <em>Which files to commit</em>; and this is what the first &#8216;<strong>git add .</strong>&#8216; command is doing. It is telling git to add all new, modified or deleted files to the &#8216;<em>commit stage</em>&#8216;. So after the files have be staged for committing, we actually commit i.e. register our changes, by issuing the second command (<em>git-commit</em>).</p>
<p><strong>One small but <span style="color: #ff0000;">important </span>quirk.</strong><br />
As I said the command is <em>almost</em> equivalent to the latter sequence; so what&#8217;s the catch?</p>
<p>The switch<strong> -a</strong> with <em>git-commit</em> <em>DOES NOT ADD</em> files that are <em>not</em> currently being tracked by git.<br />
<em>WHEREAS</em>; &#8216;<strong>git add .</strong>&#8216; adds files not being tracked by git for commit as well.</p>
<p>Why to use git-add this way? Read ahead.</p>
<p><strong>Committing only selected files</strong></p>
<p>Suppose you are working on, say 3 source files. You realize that you are pretty much content with the changes you have made to two of the files but the third file is still work in progress. You can commit just these two files by issuing the following commands:</p>
<pre>$ git add path/to/file1
$ git add path/to/file2
$ git commit -m "Some feature done"</pre>
<p>When you are done with the third file; You can commit changes by either issuing the following commands</p>
<pre>$ git add path/to/file3
$ git commit -m "Third feature done"</pre>
<p>OR, by issuing the following command (Since we want to commit all modified files.)</p>
<pre>$ git commit -a -m "Third feature done"</pre>
<p>You can use &#8216;*&#8217; and &#8216;?&#8217; wild-cards to stage multiple files for commit with the <em>git-add</em> command.</p>
<p>example:</p>
<pre>$ git add header/*</pre>
<p>This command will add all files inside the folder &#8220;header&#8221; to the &#8216;<em>commit stage&#8217;</em>.</p>
<p><strong><span style="color: #ff0000;">Remember</span>:</strong> <em>git-add</em> just <em>stages</em> the changes for commit (i.e tells git which files to commit), the actual commit i.e. write to the repository happens when you issue the git-commit command.</p>
<p>Also checkout the <em>git-reset</em> command listed below; to learn, how to remove files from &#8216;commit stage&#8217;.</p>
<h3>Command 5 : git-rm ; Few more things you should know.</h3>
<p><strong>The &#8211;cached switch:</strong></p>
<p>When git-rm is used with this switch the file are removed from git&#8217;s repository but are no deleted from the disk.</p>
<p>Example:</p>
<pre>$ git rm --cached
  path/to/file/or/folder</pre>
<p>The above command will remove the particular file or folder but they will continue to exist on the disk. If you issue <em>git-status</em> command the file will be shown as deleted, as well as un-tracked.</p>
<p><strong>git-rm without the &#8211;cached switch:</strong></p>
<p>When used without the <em>- -cached </em>switch <em>git-rm </em>removes the file from the repository as well as from the disk.</p>
<p><span style="text-decoration: underline;"><em>You need to commit changes</em></span> after using the <em>git-rm</em> command with or without the <em>- -cached</em> switch.</p>
<p><strong>All isn&#8217;t lost!</strong></p>
<p>Remember that the file(s) that you removed with git-rm and then commit changes, <em>only apply to that commit</em>. All your previous revisions will still have the removed file(s) or removed folder(s). So if you checkout previous revisions you can get the files or folder back.</p>
<p>You cannot alter the commit history(<span style="color: #999999;">well! see <em>git-reset</em> below</span>), as that goes against the version control system&#8217;s primary functionality; which is to preserve history of changes to the source code repository.</p>
<h3>Command 6 : Managing branches.</h3>
<p>We already know how to create, delete and move between branches. Here are a few more commands to help you manage your branches.</p>
<p><strong>Creating a branch out of some older commit.</strong></p>
<p>Suppose you want to move back to a particular commit and create a branch out of it. You can issue the following commands</p>
<pre>$ git checkout <em>commit_hash</em>
$ git branch <em>branch_name</em>
$ git checkout <em>branch_name</em></pre>
<p>A convenient shortcut for the above command-set is:</p>
<pre>$ git checkout
  -b <em>branch_name</em> <em>commit_hash</em></pre>
<p>The above command is exactly equivalent to the three commands listed before.</p>
<p>An example with the shortcut command:</p>
<pre>$ git checkout
  -b <strong>bugfix_branch</strong> <strong>HEAD~2</strong></pre>
<p>The above command will create a branch named <em>bugfix_branch</em> which will be positioned at two commits bellow the current <em>HEAD</em>.</p>
<p>You can use the <strong>gitk </strong>gui to visually checkout the branches. Try it, it&#8217;s really cool! (Checkout the <a title="Git Tutorial : Starting with git using just 10 commands " href="http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/">part one</a> of this tutorial to know more about gitk).</p>
<h3>Command 7 : git reset command</h3>
<p><strong>Clearing changes</strong><br />
You made some changes to your source code and realize you don&#8217;t need those changes. Maybe you were just testing something. What to do now?</p>
<p>Just use the following command to clear any changes and move back to the latest clean state, i.e. the last commit.</p>
<p>$ git reset &#8211;hard</p>
<p><strong>BE VERY CAUTIOUS</strong> while issuing this command as it is <strong>IRREVERSIBLE</strong>.</p>
<p>This command will clear all un-committed changes and revert back all your files to the state reflected by your last commit.</p>
<p>The above command can be quiet useful if you do a merge between branches or from other people repository and get some conflicts; and you want to restore your repository back to the clean state. Just issue this command you&#8217;ll be back to the un-merged state.</p>
<p><strong>Clearing files staged for commit</strong><br />
After adding files to the &#8216;commit stage&#8217; you realize you do not want to commit those files. You can issue the following command to un-stage them.</p>
<p>$ git reset</p>
<p>This command un-stages files staged for commits ONLY, so all your changes are still there.</p>
<p><strong>Deleting commits!</strong></p>
<p>This command is provided for those rare cases where you REALLY REALLY DO need to &#8216;alter&#8217; the history. Or for those occasional cases where you did some bad commits.</p>
<p>Issue the following command to delete a commit forever and ever.</p>
<p>$ git reset &#8211;hard HEAD~2</p>
<p>This command gets rid of the last two commits; kind of rewinds back to the third last commit.</p>
<p><em>If you have shared your repository, you are strongly discouraged to use this command.</em> But as a single developer you can use it if really required.</p>
<h3>Command 8: Garbage collection; Compress your repo and get some free space.</h3>
<p>I&#8217;ve saved the simplest command for the end! Smile now <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Issue the following command to make git compress your repository and clean it up.</p>
<pre>$ git gc</pre>
<p>This operation might take some time, a couple of minutes or so.</p>
<p>When finished, you&#8217;ll probably have more disk space <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You should gc once is a while.</p>
<p><em>gc = garbage collection.</em></p>
<p>Yeah, that&#8217;s it! Just eight commands, but I&#8217;ve got two more things to make life easier for git users. So it adds up to ten right! <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Extra 1 : Ignore some files; .gitignore explained.</h3>
<p>Not all files inside your project folder are required to be tracked by git. Some example include: object files, swap files etc.</p>
<p>Create a file name &#8216;<strong>.gitignore</strong>&#8216; in the base folder of your git repository and put in the name of files inside &#8216;<strong>.gitignore</strong>&#8216; as explained below, to make git ignore them.</p>
<p><strong>Simple wild-cards are recognized</strong>.<br />
&#8216;<strong>*</strong>&#8216; and &#8216;<strong>?</strong>&#8216; wild-cards plus regular expression&#8217;s square bracket `<strong>[ ]</strong>&#8216; notation is recognized.</p>
<p>So, for example, if you want to ignore all files ending with the extension &#8216;<em>bak</em>&#8216; you can specify the following in your .gitignore file.</p>
<pre>*.bak</pre>
<p>The above line, if present, in your .gitignore files will ignore all files ending with &#8216;.bak&#8217; anywhere inside the project folders.</p>
<p><strong>Ignoring a particular file or folder using absolute path notation.</strong></p>
<p>Suppose you have the following directory structure for your project, where &#8220;<strong>Project</strong>&#8221; is the base directory of your project&#8217;s repository.</p>
<pre>Project
    |-- .gitignore
    |
    |-- .git
    |
    +-- Folder_1
    |
    +-- Folder_2
    |       |
    |       \--- Folder_3
    |
    \-- Folder_4
            |
            +--- File_1
            +--- File_2
            +--- File_3</pre>
<p>Now suppose you want to ignore the folder `<em>Folder_3</em>&#8216; put following in your .gitignore file:</p>
<pre>/folder_2/folder_3/</pre>
<p>Notice the forward slashes at the beginning and at the end:</p>
<ul>
<li> If you remove the preceding forward slash, git will ignore all folders named &#8216;<em>folder_3</em>&#8216; inside any folder named <em>folder_2</em>.</li>
<li> Removing the forward slash at the end will make git treat the name &#8216;<em>folder_3</em>&#8216; as a file name instead of a folder. So in case if we had a file named &#8216;<em>folder_3</em>&#8216; inside <em>folder_2</em>, that would be ignored.</li>
</ul>
<p>Now, if you wanted to ignore the file <em>File_2</em> as shown in the diagram above, you place the following in your .gitignore file:</p>
<pre>/folder_4/file_2</pre>
<p>Notice we did not put a forward slash at the end, if we had, git will treat the name &#8216;<em>file_2</em>&#8216; as a folder name.</p>
<p>So here are the rules, re-iterated.</p>
<ol>
<li> Absolute paths begin with a forward slash &#8216;/&#8217;.</li>
<li> Folders names should always be suffixed with a forward slash &#8216;/&#8217;.</li>
<li> File names should NEVER be suffixed with a forward slash &#8216;/&#8217;.</li>
</ol>
<p>The use of square brackets as shown in the example below. They work very much like regular expression notation.</p>
<p><strong>An example .gitignore file.</strong></p>
<pre><span style="color: #999999;"># git ignore file
# comments start with hash</span>

<span style="color: #999999;"># ignore all object files, all
# files ending either with '.o' or '.a'</span>
*.[oa]

<span style="color: #999999;"># Ignore all files with
# the extension *.swp</span>
*.swp

<span style="color: #999999;"># Ignore a single file</span>
/folderA/folderB/build.info

<span style="color: #999999;"># Ignore a folder named
# temporary in the base folder.</span>
/temporary/

<span style="color: #999999;"># Ignore folders named _object
#  anywhere inside the project.</span>
_object/</pre>
<p><strong>What&#8217;s the use of .gitignore, after all?</strong></p>
<p>Well, if still haven&#8217;t figured out let&#8217;s look at a typical coding scenario.</p>
<p>You have your project, added all files to your .git repository, and did and initial commit. Now you start editing some files, your favorite editor creates some backup files ending with &#8216;.bak&#8217; extension.</p>
<p>Now you do git-status to check what all files changed, git tell you which files have been changed but also lists a the &#8216;.bak&#8217; files as being untracked.</p>
<p>After few days, the list of untracked files becomes so long, that doing git-status scrolls past your screen. Not pretty right! <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also, you cannot do &#8216;git add .&#8217; to stage files for commit, as this command will add the &#8216;.bak&#8217; files to be committed as well, unnecessary bloating your repository.</p>
<p>What&#8217;s the solution? Just create a .gitignore file inside your project&#8217;s base directory and place a line containing &#8216;*.bak&#8217; in it. Now do git-status; wow! neat &#8216;eh. <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Extra 2 : Throw in some colors and introduces yourself to git.</h3>
<p><strong>Your name and email address in commits</strong><br />
Edit the file .git/config inside your base folder (project folder) and enter the following lines.</p>
<pre>[user]
    name = Your Name
    email = your email Id</pre>
<p>example:</p>
<pre>[user]
    name = xk0der
    email = amit@xkoder.com</pre>
<p>After placing these details in your file, the next time you commit any changes, your name and email id will be registered as the author of that commit.</p>
<p><strong>Colorizing git&#8217;s output.</strong></p>
<p>Gary has a small and simple post on how to get color&#8217;s in git&#8217;s output here:</p>
<p><a title="Colors in git" href="http://scie.nti.st/2007/5/2/colors-in-git">http://scie.nti.st/2007/5/2/colors-in-git</a></p>
<h3>That&#8217;s it! Go do some Git-fu.</h3>
<p>In the next installment I intend to cover distributed git setup and few more commands. Till then enjoy! <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Ads : Under Testing :)</title>
		<link>http://blog.xkoder.com/2008/08/29/google-ads-under-testing/</link>
		<comments>http://blog.xkoder.com/2008/08/29/google-ads-under-testing/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 22:42:09 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Funny / Weird]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=30</guid>
		<description><![CDATA[While testing my mail server, by sending a mail to my GMail account, I noticed something peculiar at GMail. I sent a mail using Thunderbird to my GMail account, then checked the mail on the GMail’s web interface and found a rather amusing ad under the “sponsered links” section. Click on the image below for [...]]]></description>
			<content:encoded><![CDATA[<p>While testing my mail server, by sending a mail to my GMail account, I noticed something peculiar at GMail. I sent a mail using Thunderbird to my GMail account, then checked the mail on the GMail’s web interface and found a rather amusing ad under the “sponsered links” section. Click on the image below for full size. The ad is marked with a red circle (ellipse? <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> )</p>
<p style="text-align: center;"><a href="http://blog.xkoder.com/wp-content/uploads/2008/08/gmail-xkoder.png"><img class="aligncenter size-medium wp-image-134" title="Google testing their ad engine." src="http://blog.xkoder.com/wp-content/uploads/2008/08/gmail-xkoder-300x225.png" alt="" width="300" height="225" /></a></p>
<p>Apparently the Google engineers were (are) testing their ad engine or something related when I happen to view my “Test” mail with GMail’s web interface. The Mail I sent had the subject set to “Test” and the body contained just one word “Again”. Probably the subject line triggered their test ad to appear.</p>
<p>The URL displayed in the browser’s status bar is the <a title="Google's test ad." href="http://pagead2.googlesyndication.com/pagead/iclk?sa=l&amp;ai=BEL-5M7S3SKmEE4vAvQPC5ujmA9uyoXGv_ImJC8CNtwHw1xwQARgBIIaPgAIoBTgAUO_F-bIDYOXK5YO0DqABgZXJ-QOyAQlnbWFpbC5jb23IAQHaATBodHRwOi8vZ21haWwuY29tL2VscmZyaXFrOTR1aWJ2N200MGtjMXloang3bjVzcGOAAgGoAwHoA_UC6AOqAQ&amp;num=1&amp;adurl=http://www.google.com">link</a> to the google’s test ad. Clicking on it takes you to a page at google.com throwing an error “This page does not exist”.</p>
<p>No big deal! I just found this to be amusing, that’s it <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/08/29/google-ads-under-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Tutorial : Starting with git using just 10 commands</title>
		<link>http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/</link>
		<comments>http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 21:25:24 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=8</guid>
		<description><![CDATA[Part &#8211; II of this tutorial is now available here. Git is marvellous piece of tool every programmer must have. Git is a distributed version control system developed by Linus and others. Yes you guessed it, it is used heavily by the Linux (kernel) developers apart from many other projects. How will Git help you [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Git Tutorial Part II - Sharpen you Git-Fu with 10 more commands." href="http://blog.xkoder.com/2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/">Part &#8211; II of this tutorial is now available here</a>.</p>
<p><a title="Git - Project page" href="http://git.or.cz/">Git</a> is marvellous piece of tool every programmer must have. Git is a distributed version control system developed by Linus and others. Yes you guessed it, it is used heavily by the Linux (kernel) developers apart from many other projects.</p>
<p><strong>How will Git help you and what this post covers.</strong></p>
<p><span style="text-decoration: underline;">Scope of this post</span> : This post will deal with the usage of Git by an individual developer only<span style="text-decoration: underline;">.</span></p>
<p><span style="text-decoration: underline;">Why use version control</span> : Version control gives you a great deal of flexibility while coding. You can make changes without having to worry about breaking things, as you can always move back to previous version(s) of your code. Version control also allows you to compare changes as you move ahead, helping in bug-fixing apart from other benefits.</p>
<p><span style="text-decoration: underline;">Why use Git</span> : There are a number of other version control systems available, some centralized systems some distributed systems. Amongst them, Git is one of the fastest version control system, very simple and easy to use, and has lot of helpful features packed in very a small package. Check my <a title="Why we picked Git and Trac" href="../2008/06/26/git-and-trac-a-love-story/">other post</a> to know more reasons.</p>
<h2>Prerequisite</h2>
<p>1) You need a computer <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> with preferably Linux (any flavor) installed on it. (This post does not deal with <a title="Git for windows" href="http://code.google.com/p/msysgit/">Windows</a>, though you may use the commands given here without any modifications (probably!)).</p>
<p>2) You need Git.</p>
<p>on Fedora distribution, you may install git using the following command</p>
<pre>$ sudo yum install git</pre>
<p>On Ubuntu distribution, you may install git using the following command</p>
<pre><span style="text-decoration: line-through;">$ sudo apt-get install git</span>
$ sudo apt-get install git-core</pre>
<p><em>(Edit: 21/Oct/2008 &#8211; Thanks to <a title="Robo47's blog" href="http://www.robo47.net/">robo47</a> for pointing out the mistake)</em></p>
<p>For other methods and building from source check out <a title="Git dowloads" href="http://git.or.cz/#download">this page</a>.</p>
<p>3) You need some project which you are developing (or would be developing) <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> . The project’s language could be anything .. C, C++, D, Python, Perl, HTML, JavaScript, plain text files … you got the idea right? <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<h2>Let the show begin</h2>
<h3>Command 1 : Initializing an empty git repository.</h3>
<p>Befor you can start using the power of git you need to create an empty repository and tell git which files to track. The first command that I’m presenting initializes an empty git repository.</p>
<p>Before executing the command you need to be at base folder of you project. For example if you have all the source code for you project stored here <strong>/home/xk0der/SourceCode/myProject</strong>, (We’ll call this folder as the <strong>base folder </strong>for ease of discussion), move there first. Now execute the following command once you are in the base folder.</p>
<pre>$ git init</pre>
<p>This will create an empty repository in the current directory (the base folder).</p>
<p>For every project that you want to track using git, go to its base folder and issue this command first and then the next 2 commands presented below.</p>
<h3>Command 2 : Adding files to git repository.</h3>
<p>The next step is to add files to your git repository, essentially telling git that these are the files we want to keep track of. Execute the following command from the base folder.</p>
<pre>$ git add .</pre>
<p>This will add all the files from the current folder and sub-folders recursively to the git repository.</p>
<h3>Command 3 : The commit command.</h3>
<p>This is one command you’ll be using quite often.</p>
<p>the above command adds the files but does not commit the changes to the git repository. So you need to issue the following command to make the changes final.</p>
<pre>$ git commit -a</pre>
<p>This will open a text editor (probably vi) where you can add some comments about this commit. If you prefer not to use the text editor, you can specify the commit message from the command line it self, just use the following format instead of the above one.</p>
<pre>$ git commit -a -m "Initial import"</pre>
<p>The -m switch is used to specify the commit message. In our case the commit message is “Initial import”. You can put anything between the quotes for your message.</p>
<h2>You are ‘all’ ready!</h2>
<p>Now open your favorite text editor and start coding. When you feel you have accomplished something or you just want to save the current state of your source code issue the git-commit command as described above. The commit command will create a new checkpoint and save the current status of your source code.</p>
<p>Git (like any other version control system) saves all the commits you have done to your source code repository. This enables you to go back and forth between commits and inspect the changes.</p>
<p>Now let’s move forward and learn a few more commands.</p>
<h3>Command 4 : Viewing the commit log.</h3>
<p>You can view all the commits you have done till now using the following command</p>
<pre>$ git log</pre>
<p>This command shows the commit history with the</p>
<p>1) Unique commit hash<br />
2) Name and email of the person who performed the commit<br />
3) Date and time of commit<br />
4) The commit message</p>
<p>Of all these, the first item, the unique commit identifier, the SHA1 hash is of importance to us. This hash will be used with some of the commands listed next, and is used with a plethora of other git commands, not listed here <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<h3>Command 5 : Checking the current status.</h3>
<p>While coding, you may want to see what all files have changed, before you do a commit to store them in the git repository. This command helps you achieve that.</p>
<pre>$ git status</pre>
<p>The above command will list all files that have changed since your last commit.</p>
<h3>Command 6 : Finding the difference between commits.</h3>
<p>Apart from just viewing files that have changed, you may be interested in viewing the actual differences in the source code.</p>
<pre>$ git diff</pre>
<p>The above command will show a difference ( a diff ) with respect to your last commit and current changes.</p>
<p>The diff command can actually be used to compare difference between any commits</p>
<p><strong>To view difference between a previous commit  and current changes.</strong></p>
<pre>$ git diff <em>commit_hash</em></pre>
<p>here the <em>commit_hash</em> is the first eight characters (hex digits) of commit hash as shown in the commit log by the git-log command. Yes! you need not specify the full hash, just the first eight digits are good enough.</p>
<p><strong>To view differences between two previous commits.</strong></p>
<pre>$ git diff <em>commit_hash_1</em> <em>commit_hash_2</em></pre>
<p>This command will display differences between the two commits identified by the <em>commit_hash_1</em> and <em>commit_hash_2.</em></p>
<h3>Command 7 : Creating branches!</h3>
<p>Don’t be scared by the word “branching”, specially if you never dealt with them. Branches are easy to play with and are very useful.</p>
<p>Before I show you the command a bit more discussion about branches.</p>
<ul>
<li>You can view branches as being diversion from the main linear commit tree.</li>
<li>All branches stem out from the <strong>master branch</strong>, the name given to the main trunk.</li>
<li>Every branch has it’s own commit log.</li>
<li>You can have different code in same files across difference branches. (This is the main feature of branching). Actually git goes even further and allows you to have not only different content in files across branches but even different sets of files across different branches.</li>
<li>At one point of time, you can be sitting only on one branch. What this means is that, the source code from the current branch will be the effective one, the one to which you would be making changes.</li>
</ul>
<p><strong>Why use branches?</strong></p>
<p>Suppose you have an almost stable source code and you are to release the product in a month or in a week or two. You also have plans to include another great feature into your code, but are afraid it might break your code and your release plans may go hay-wire.</p>
<p>This is where branches come into picture. Just create an experimental branch from you main stable trunk ( the one you’ve been working on up till now is the main trunk, the <strong>master</strong> branch). After you have created the experimental branch, you can continue fixing bugs and polishing the code on the main, i.e. the master branch. Meanwhile you can also continue working on the experimental branch without affecting a line of code on the master branch.</p>
<p>In the end, if you find that the experimental feature is working good enough, merge it into the master branch and release your product. If the experimental feature didn’t quite work out, you can still release the product from the master branch. The experimental branch is still there so you can continue working on it till it gets stable.</p>
<p>This is one scenario (and the most often reason, though not the only one), to create branches.</p>
<p>Okay now, back to commands . Issue the following command when you want to create a branch.</p>
<p><strong>Creating a branch</strong></p>
<pre>$ git branch <em>branch_name</em></pre>
<p><em>branch_name </em>could be anything that you wish, for example:</p>
<pre>$ git branch <strong>experimental_feature

</strong></pre>
<p><strong>Branching a branch or “I want more branches”.<br />
</strong></p>
<p>You can create as many branches from inside any branch you want, creating a very dense tree if you like.</p>
<p>Just move inside (check-out that branch, see command 8 below) and issue the branch creation command.</p>
<h3>Command 8 : Moving to a branch and listing all branches</h3>
<p>Once you have created the branch move to it by issuing the command listed below. <strong>Always</strong> Make sure you do a commit before you issue this command or else changes will move across branches. <em>Make this a habit! </em>(<span style="text-decoration: underline;">OR</span> have a look at git-stash command, discussed in <a title="Git Tutorial Part II - Sharpen you Git-Fu with 10 more commands." href="http://blog.xkoder.com/2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/">part II</a> of this tutorial.)</p>
<pre>$ git checkout branch_name</pre>
<p>Here the branch name is the branch where you want to move. Once checked-out, you can view staus, log, diff etc, using the commands presented earlier.</p>
<p>To go back to the <strong>master</strong> branch (the main trunk) issue the following command. (Again make sure you had issued the commit command)</p>
<pre>$ git checkout master</pre>
<p><strong>Listing all branches</strong></p>
<p>Issue the following command to see all available branches in the current repository.</p>
<pre>$ git branch</pre>
<h3>Command 9 : Merging two branches</h3>
<p>Move to (checkout) the branch with which you want the merge to happen and issue the following command.</p>
<pre>$ git merge branch_name</pre>
<p>This will merge the branch branch_name with the current branch.</p>
<p>For example if you want to merger the “experimental_feature” branch with the master branch, issue the following commands</p>
<pre>$ git checkout master
$ git merge experimental_feature</pre>
<p>Git will notify you with any conflicts it cannot resolve automatically (if any). You can then resolve the conflicts manually.</p>
<p><strong>Deleting a branch</strong></p>
<p>After the merge is done you can delete the experimental branch if you wish by issuing the command</p>
<pre>$ git branch -d experimental_branch</pre>
<p>The above command will only delete the branch if it is fully merged with the current branch’s HEAD. HEAD is the current position in your branch, the latest commit.</p>
<h3>Command 10 : Deleting stuff from the repository.</h3>
<p>Issue the following command if you do not want git to keep track of a file or folder and (this is the opposite of the git-add command). The file stays in the working directory, on the disk.</p>
<pre>$ git rm --cached path/to/the/folder_or_file</pre>
<p>The <em>git-rm</em> command removes the files from the repository for current HEAD <em>only</em>; previous revisions/commits will still have the file.</p>
<h2>That’s it, you’re done!</h2>
<p>Before I leave you <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> a few more command/features that may interest you, but are not totally necessary as of now.</p>
<h3>A graphical repository viewer</h3>
<p>To invoke a graphical repository viewer, invoke the following command</p>
<pre>$ gitk</pre>
<h3>Git &#8211; Graphical user interface</h3>
<p>For those who prefer GUI, you can install a graphical front end to git.</p>
<p><strong>On Fedora</strong></p>
<pre>$ yum install git-gui</pre>
<p><strong>On Ubuntu</strong></p>
<pre>$ apt-get install git-gui</pre>
<p>Run the gui by issuing the following command</p>
<pre>$ git-gui</pre>
<h2>Yup, totally done now! <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></h2>
<p>That’s all folks. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> I hope this post will help you in getting started with one of the most powerful version control system available around.</p>
<p>When you are done playing with these commands, you may want to read the second installement of this turotial here: <a title="Permalink for : Git Tutorial Part II - Sharpen you Git-Fu with 10 more commands." href="../2009/06/06/git-tutorial-part-ii-sharpen-you-git-fu-with-10-more-commands/">Git Tutorial Part II &#8211; Sharpen you Git-Fu with 10 more commands.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>JavaScript Associative Arrays Demystified</title>
		<link>http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/</link>
		<comments>http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 21:19:37 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[associative]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=4</guid>
		<description><![CDATA[Javascript hides a lot of arsenal beneath its simplicity. In this post I’ve tried to explain normal javascript arrays and associative arrays starting with absolute basics and then presenting the advance concepts that are often overlooked but are simple to understand and are very handy. I’m not a Javascript guru . This post is more [...]]]></description>
			<content:encoded><![CDATA[<p>Javascript hides a lot of arsenal beneath its simplicity. In this post I’ve tried to explain <strong>normal javascript arrays</strong> and <strong>associative arrays</strong> starting with absolute basics and then presenting the <em>advance concepts</em> that are often overlooked but are simple to understand and are very handy. I’m not a Javascript guru <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> . This post is more about what I’ve discovered overtime while coding in Javascript. Hope it helps and saves your time.</p>
<p><em><span style="text-decoration: underline;">Please Note</span>: A single line in the code snippet may wrap or may have been split to fit it into the blog’s page layout. </em><em>All code snippets are provided for illustration purpose. Though they should work (execute) fine without any modification, I’ve not tested all the snippets presented here.</em></p>
<h2>Normal indexed arrays</h2>
<p>I’ll start the discussion with normal indexed arrays. Most of the text in this section would be known to many, but might be useful for Javascript newbies.</p>
<p>In Javascript you can create and use normal arrays as follows:</p>
<pre>var myArray = new Array();</pre>
<p>Normal arrays uses positive integers numbers (including <em>zero</em>) as index. To store elements to this array. you can use the following syntax.</p>
<pre>myArray[0] = 200;
myArray[1] = 300;</pre>
<p>Where <em>200</em> and<em> 300</em> are the values stored at the <em>first</em> and the <em>second</em> location in the array, respectively ( <em>index 0</em> is the <em>first location</em>).</p>
<p>Another way to assign elements is to use the <em>array constructor</em> as follows.</p>
<pre>var myArray = new Array(200, 300);</pre>
<p>The above code has the same effect as the previous one, storing 200 at the first location (index 0) and 300 at the second location (index 1)</p>
<p><strong>Tip 1 : The array.length property </strong><br />
If you want to add an element at the end of a normal, number indexed array (the one we used above). use the following code.</p>
<pre>myArray[myArray.length] = someValue;</pre>
<p>For example:</p>
<pre>var myArray = new Array();

myArray[myArray.length] = 200;
myArray[myArray.length] = 300;</pre>
<p>For the first assignment,<em> myArray.length</em> would be 0, so 200 is stored at the first location (index 0). after the assignment the <em>array</em> <em>length</em> becomes 1 hence 300 is stored at the second location (index 1). At the end if you try to check the length property of myArray, it will contain the value 2. As you would have guessed, you can always find the number of elements in an array by using it <em>length</em> property, as follows</p>
<pre>arrayObject.length</pre>
<p><strong>Tip 2 : Quick array creation.</strong><br />
You can use the square bracket operator to quickly create an array. This is specially useful when you need to pass array arguments to functions. An example follows.</p>
<pre>var myArray = [200, 300];

alert(myArray); // outputs: 200,300
alert(myArray.length); // outputs: 2</pre>
<p>The first line in the code, is equivalen to:</p>
<pre>var myArray = new Array(200, 300);</pre>
<p>Here’s how you can use this trick while passing argument to functions:</p>
<pre>function sumAll( arrayArg )
{
    var sum = 0;
    for ( i = 0 ; i &lt; arrayArg.length; i++)
    {
        sum = sum + arrayArg[i];
    }
     alert("Sum is:" + sum);
}

sumAll([100,200,300,400]);
// the alert in sumAll() function should
// display - Sum is: 1000</pre>
<p><strong>Tip 3 : Javascript array elements can be heterogeneous </strong><br />
I’m only storing numbers in all the above examples but Javascript arrays can store a string, an object and for that matter another array itself (as an array is nothing but an object). And one important thing to remember is that unlike many other programming language, all elements need not be of the same type. You can store numbers and strings in an array at the same time as illustrated below.</p>
<pre>var mixArray = new Array();

mixArray[0] = "Hello World";
mixArray[1] = 100;

var anotherMixArray = new Array(200,
                                300,
                                "Hello Again",
                                500);

var moreMixArray = new Array();

moreMixArray[0] = 600;
moreMixArray[1] = mixArray;

moreMixArray[2] = new Array(700,
                            anotherMixArray);

moreMixArray[3] = "Incredible!";</pre>
<p>The above code may look like madness at first glance, but is perfectly valid and provides a great bit of flexibility to the programmer. if you cannot figure out what’s going in that piece of code, draw it out and things will make sense, look at the figure below. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<div id="attachment_115" class="wp-caption aligncenter" style="width: 470px;"><a href="http://blog.xkoder.com/wp-content/uploads/2008/07/array_madness.png"><img class="size-full wp-image-115" src="http://blog.xkoder.com/wp-content/uploads/2008/07/array_madness.png" alt="Array Madness Explained" width="460" height="485" /></a></p>
<p class="wp-caption-text">Array Madness Explained</p>
</div>
<p><strong>Sparsely populated Array</strong></p>
<p>In Javascript arrays can be sparsely populated, that is, you need not fill-up each and every location in an array. Consider the following example.</p>
<pre>var myArray = new Array();

myArray[0] = 200;
myArray[5] = 300;

alert(myArray);

// the alert dialog box shows 200.
alert(myArray[0]);

// 300 will be shown in the alert box.
alert(myArray[5]);

// this shows 'undefined'
alert(myArray[2]);

// this will show '6' in the alert box.
alert(myArray.length);</pre>
<p>The above code creates a sparsely populated array, courtesy the statement myArray[5] = 300; All intermediate locations from index 1 to index 2 are created but nothing is stored there, essentially they are not-defined. <strong>Note</strong> that though the number of elements stored is two the array length is shown as 6. This is because, though the elements may be empty (technically undefined) they are part of the array.</p>
<p><strong>An examples that uses the techniques shown above.</strong></p>
<pre>// Store Fibonacci series in an array

// Disclaimer: the code snippet here
// just serves the purpose of
// illustrating usage of array and by
// no means is an efficient or
// elegant solution (even if it is one <img class="wp-smiley" src="../wp-includes/images/smilies/icon_wink.gif" alt=";)" /> )
// to calculate or find Fibonacci series/numbers.

var myArray = new Array;
var maxNum = 100;

var a = 0;
var b = 0;
var c = 1;

while(c &lt; maxNum)
{
    myArray[myArray.length] = c;
    a = b;
    b = c;
    c = a + b;
}

// displays
// Fibonacci Series : 1,1,2,3,5,8,13,21,34,55,89
alert("Fibonacci Series :" +  myArray);

// display - Array Length : 11
alert("Array Length :" + myArray.length);</pre>
<h2>Associative Arrays or something else!</h2>
<p>Before we explain the “something else!” part in the heading, some definitions and examples.</p>
<p><strong>Associative Array:</strong> In simple words associative arrays use Strings instead of Integer numbers as index. So we can have something like,</p>
<pre>new myArray = new Array();

myArray["abc"] = 200;
myArray["xyz"] = 300;</pre>
<p>Here the indexes “abc” and “xyz” are called keys and these keys are mapped to the values 200 and 300. So we say that the key “abc” maps to ‘200′ and similarly the key “xyz” maps to ‘200′. It’s that simple!</p>
<p><strong>Where to use associative arrays?</strong><br />
I’m presenting few example here, where associative arrays may be helpful.</p>
<p><strong>Databases:</strong> Consider a table with following columns and types, in the format COLUMN_NAME as TYPE</p>
<p>NAME as TEXT, MARKS as NUMBER, DOB as DATE.</p>
<p>In your code if you were to find the type of a column, you can create an associative array as follows:</p>
<pre>var studentTypes = new Array();

studentTypes["NAME"] = "TEXT";
studentTypes["MARKS"] = "NUMBER";
studentTypes["DOB"] = "DATE";

alert("Type of MARKS is :" +
      studentTypes["MARKS"] );</pre>
<p>As with normal arrays we need not remember the index number. Using the column names as keys we can directly get the types from the mapping.</p>
<p>This is a very trivial example, but the associative array concept can greatly simply coding for similar scenarios.</p>
<p><em>“But what about the ’something else!’ part”</em>, I hear you saying <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> read ahead to know the truth about Javascript associative arrays.</p>
<p><strong>Magic and mystery continued…</strong></p>
<p>Try the following code snippet.</p>
<pre>var myArray = new Array();

myArray["a"] = 100;
myArray["c"] = 200;

// the alert box will contain nothing,
// it'll be empty!!
alert(myArray);</pre>
<p><em>“What happened here? why did the alert box print nothing? why didn’t it output 100,200?”</em>, don’t be too startled, more mysterious things are about to happen…</p>
<p>Try another piece of code.</p>
<pre>var myArray = new Array();

myArray["a"] = 100;
myArray["c"] = 200;

alert(myArray.length); // output: 0</pre>
<p><em>“What? ZERO!”</em> … yes zero, because my friend there is NO such things as associative arrays in Javascript. <em>“WHAT!”</em>, you say, but you read it correct. Read ahead to know what these <em>“key” to “value”</em> mappings are.</p>
<p><strong>Object and Properties and Not Associative Arrays</strong></p>
<p>Javascript allows you to add properties to objects by using the following syntax:</p>
<pre>Object.yourProperty = value;</pre>
<p>An alternate syntax for the same is:</p>
<pre>Object["yourProperty"] = value;</pre>
<p>Shoosh!… If you are not getting what’s going on, you may skip to the next section, and I promise, it won’t hurt your usage of the so called associative arrays in Javascript.</p>
<p>Well, back to the discussion. In the code where we say <em>myArray["a"] = 100;</em> What we really are doing is creating a property named “a” for the “myArray” object and storing the value 100 in the property.</p>
<p>try the following code, to make things clearer,</p>
<pre>var myArray = new Array();

myArray["a"] = 100;

myArray.b = 200;

alert(myArray.a);
alert(myArray["b"]);</pre>
<p><strong>Remember:</strong> These are not alternate ways to assign values to an associative arrays, these are alternate ways to assign properties to an object.</p>
<p>The object “myArray” is of the type Array() in our example, courtesy the statement <em>“var myArray = new Array();”</em>. But in theory and in practice you can use <em>any Class’s</em> object to simulate the associative array. Try the following code and you’ll get what I mean by <em>using any Class’s object</em>.</p>
<pre>var myArray = new Date();

myArray["a"] = 100;
myArray["b"] = 200;

alert(myArray["b"]); // output: 200.</pre>
<p>Got the point? Good! <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , but<span style="text-decoration: line-through;"> I suggest you use the Array class (for simulating the associative array behavior), as it makes the code more obvious (when read)</span>. As pointed by <a title="Why not to use Array class" href="http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/#4264">Nelson</a>, using an Array class comes with extra baggage, like the functions push(), pop() and sort() and the property .length, which are of no use with the data we are storing. So as suggested by Nelson, we can use the plain Object class or the curly bracket notation to simulate the associative array behavior.</p>
<p>Now that the mystery is solved, just to avoid confusion, let’s use the term “associative arrays” for the Object-Property assignment behavior.</p>
<p><strong>Tip 4 &#8211; Quick associative array creation</strong></p>
<p>We cannot use the Array() constructor to assign elements to associative arrays as we did with normal (proper) arrays. But we can use the Javascript’s object notation to simulate the square bracket effect. (<em>see tip 2</em>).</p>
<p>Check out the code first:</p>
<pre>var myArray = { "abc":200, "xyz": 300};

alert(myArray["abc"]); // output: 200</pre>
<p>The curly braces is a quick way to define an object, specifically and unnamed object or an object with no class. Normally we have been creating objects using the new operator, which expects a class name to be present.</p>
<p>The colon separates the property name and the value associated with it. The property name goes to the left of the colon and the value goes to the right. Multiple properties are separated using a comma.</p>
<p><em>The quotation marks enclosing the property names is optional, but is required if you are going to use property names with spaces.</em></p>
<p>In the associative array terminology, just replace the term <em>property</em> from the above paragraph with <em>key</em>.</p>
<p><strong>Tip 5 &#8211; using for(in)  to iterate through an Associative array</strong></p>
<p>You can iterate through an associative array using the for..in loop construct as follows.</p>
<pre>var myArray = {abc: 200, "x y z": 300};

for(key in myArray)
{
   alert("key " + key
         + " has value "
         + myArray[key]);
}</pre>
<p>The above code snippet will display two alert boxes with the following text “key abc has value 200″ and “key x y z has value 300″ respectively.</p>
<p><em>Some explanation:</em><br />
The for loop here iterates through all the properties of the object “myArray”. The variable “key” will contain the property name inside the for block, which can be used with the object to retrieve the property’s value.</p>
<p>In terms of associative array, you can think of the <em>for..in</em> construct to be iterating through all the “keys” in the array one by one, assigning the key’s name to the variable “key”.</p>
<h3>Epilogue</h3>
<p>I’ve not gone into much details about the Javascript object notation and neither have I dealt too extensively with the associative array concept, but nevertheless I’ve tried to present the concept of associative arrays in as simple a manner possible. I hope the post will help the newcomers to Javascript and experienced programmers alike.</p>
<p>Thank you for reading. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>x86 Emulator in Java &#8211; Cool!</title>
		<link>http://blog.xkoder.com/2008/06/26/x86-emulator-in-java-cool/</link>
		<comments>http://blog.xkoder.com/2008/06/26/x86-emulator-in-java-cool/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 23:01:15 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=44</guid>
		<description><![CDATA[Before I write anything about it, here’s the link to the JPC project http://www-jpc.physics.ox.ac.uk/index.html It’s a nice feat these guys have achieved by creating an emulator for Intel x86 architecture in Java. I’m not sure how useful this project would be, but it’s a cool peice of software . Hats off to the JPC developers. [...]]]></description>
			<content:encoded><![CDATA[<p>Before I write anything about it, here’s the link to the JPC project</p>
<p><a title="Java x86 Emulator" href="http://www-jpc.physics.ox.ac.uk/index.html">http://www-jpc.physics.ox.ac.uk/index.html</a></p>
<p>It’s a nice feat these guys have achieved by creating an emulator for Intel x86 architecture in Java. I’m not sure how useful this project would be, but it’s a cool peice of software <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> . Hats off to the JPC developers.</p>
<p>Some of the demos with DOS games are nice. Got nostalgic playing the <em>old DOS</em> games; Prince, mario, keen, invaders <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /><br />
What more, it can run Linux! .. I’m yet to try their Linux demo though, but the DOS one’s were very fast.</p>
<p>And to top it all, they have release the source code, I’ve just downloaded it and ‘am going to have a look at how they have done it. Meanwhile you can visit their demo pages and enjoy some of the good ol’ DOS games.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/06/26/x86-emulator-in-java-cool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git and Trac &#8211; A Love Story.</title>
		<link>http://blog.xkoder.com/2008/06/26/git-and-trac-a-love-story/</link>
		<comments>http://blog.xkoder.com/2008/06/26/git-and-trac-a-love-story/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 22:58:10 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=40</guid>
		<description><![CDATA[This is a post I’ve written at my Company blog. Here’s a small excerpt and the link to the complete post. Git and Trac &#8211; A Love Story Git and Trac, both got married very recently (at our setup ), and the newlywed couple are quite a charm to work with. It all started with [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post I’ve written at my <a title="Hidden Reflex" href="http://hiddenreflex.com/">Company</a> <a title="HiddenReflex Blog" href="http://hiddenreflex.com/blog">blog.</a> Here’s a small excerpt and the link to the complete post.</p>
<p><a title="Full blog post." href="http://hiddenreflex.com/main/?p=28">Git and Trac &#8211; A Love Story</a></p>
<blockquote><p><a title="Git - The groom" href="http://git.or.cz/">Git</a> and <a title="Trac - The bride" href="http://trac.edgewall.org/">Trac,</a> both got married very recently (at our setup <img class="wp-smiley" src="http://hiddenreflex.com/main/wp-includes/images/smilies/icon_smile.gif" alt=")" /> ), and the newlywed couple are quite a charm to work with. It all started with the search for a <a title="Version Control - Wikipedia entry." href="http://en.wikipedia.org/wiki/Revision_control">version control tool</a> which could be used <em>now</em>, with just four of us using it, and that would scale beautifully to hundreds and thousands of users. The version control system would be the groom. Meanwhile we were also in search for a perfect partner (the bride), an <a title="Issue Tracking - Wikipedia entry." href="http://en.wikipedia.org/wiki/Issue_tracking_system">issue tracking system</a>, that would gel with our choice of version control seamlessly.</p>
<p>To begin with, we all (at Hidden Reflex) were leaning towards a <em>central repository</em> setup ….. <a title="Read the complete post." href="http://hiddenreflex.com/main/?p=28"><em>more</em></a></p></blockquote>
<p><em><br />
</em><span id="sharethis_1"><a class="stbutton stico_rotate" title="ShareThis via email, AIM, social bookmarking and networking sites, etc." href="javascript:void(0)"></a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/06/26/git-and-trac-a-love-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Linksys WiFi router with Airtel Broadband</title>
		<link>http://blog.xkoder.com/2008/06/04/setting-up-linksys-wifi-router-with-airtel-broadband/</link>
		<comments>http://blog.xkoder.com/2008/06/04/setting-up-linksys-wifi-router-with-airtel-broadband/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 22:38:51 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[airtel]]></category>
		<category><![CDATA[india]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/2008/06/04/setting-up-linksys-wifi-router-with-airtel-broadband/</guid>
		<description><![CDATA[I bought a Linksys WiFi router last weekend. I had a little bit of trouble configuring it, although the problem was trivial, it took me some time to figure it out. I’m jotting down some notes here about what I did to resolve the problem. ( I’ve have some tips at the end of this [...]]]></description>
			<content:encoded><![CDATA[<p>I bought a Linksys WiFi router last weekend. I had a little bit of trouble configuring it, although the problem was trivial, it took me some time to figure it out. I’m jotting down some notes here about what I did to resolve the problem. <span style="color: #800000;">( I’ve have some <em>tips</em> at the end of this post which you may find usefull for use with linksys (and probably other) routers and with most DSL modems.)</span></p>
<p><strong>The Problem</strong><br />
The beetel DSL modem installed by Airtel has the <em>IP address</em> set to 192.168.1.1. The Linksys router (and probably other routers as well) use the <em>same IP address</em> (192.168.1.1) as their <em>default IP address</em> for accessing their configuration page. This causes an IP address conflict and hence the router wouldn’t be able to forward IP packets to the modem.</p>
<p><strong>The Solution</strong><br />
<strong> 1)</strong> Insert the installation CD/DVD provided with the wifi router and follow the instruction for installing the router. During the installation (Probably at the final step) the router will fail to detect Internet connectivity. That’s fine, as this is the problem we are resolving. Leave the setup window open and proceed to next step.<br />
<strong> 2)</strong> Open your favourite web-browser and enter the following address in the URL bar : <strong>192.168.1.1</strong><br />
<strong> 3)</strong> The above step should open the Linksys configuration page. If you are prompted for a <em>username</em> and <em>password,</em> enter <strong>admin</strong> for both the fields. If you had set a router password in <em>step 1</em> enter <em>username</em> as <strong>admin</strong> and the <em>password</em> you had set in <em>step 1</em>. Before the <em>username</em> and <em>password</em> is asked you might be displayed a page with 3~4 icons, labeled WAN, LAN etc. select the WAN Icon, enter the <em>username</em> and <em>password</em> as described above, if prompted for.<br />
<strong> 4)</strong> On the page displayed select <strong>Setup tab</strong> (most likely the first tab) and under that select <strong>Basic setup</strong> (The exact name/text might vary but would most probably be something similar). Scroll down and locate the field <strong>Local IP address</strong>. The default value for this field would be <em>192.168.1.1</em>, change it to <strong>192.168.0.1</strong>.<br />
<strong> 5)</strong> Scroll further down the page and click on <strong>Save Settings</strong>. Reset your router and DSL modem (Power them OFF, wait for 10~15 seconds and power back ON). Wait for around 1~2 minutes (So that the Router and DSL modem have properly rebooted).<br />
<strong> 6)</strong> Complete Installation of the router (Click ‘Try Again/Re-try’ in the setup window we left open in <em>step 1</em>)</p>
<p>You should now be able to browser Internet properly on the wired (directly connected) computer. Setup your Laptop and Desktops with WiFi Ethernet card/adaptors to connect to the WiFi router. After that you should be able to access Internet through them.</p>
<p><strong>Tips</strong></p>
<ul>
<li><strong>Always</strong> setup a <em>WPA/WEP key</em> (pass-phrase) for your WiFi router for thwarting unauthorized WiFi piggybacking.</li>
<li>For most users <em>WPA Personal</em> (with default settings) should work good enough. You can set/change the pass-key for <em>WPA Personal</em> by logging to the web-based router configuration pages. Select <strong>Wireless tab</strong> in the configuration page and under that select <strong>Wireless security</strong>. Select <em>WPA Personal</em> for security Mode field and Change the field labeled <em>WPA Shared Key</em>. This is the key you will enter when connecting to your WiFi router form you laptop or other computers with Wireless Ethernet cards.</li>
<li>Do not buy the WiFi router provided by Airtel <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /> , it is expensive (around Rs.500~Rs.1000 more than other similar quality routers) and from their own company Beetel (Yup, Beetel is owned by Bharati group). And I haven’t heard/read good reviews about Beetel WiFi routers.</li>
<li><strong>Remember</strong>: to access the Router configuration pages you need to enter the IP address you entered in step 4 (<strong>192.168.0.1</strong>), the address <em>192.168.1.1</em> will take you to DSL modem’s configuration page.</li>
<li>Default <em>username</em> and <em>password</em> for DSL modem is <strong>admin</strong> and <strong>password</strong> respectively.</li>
<li>You may remove the directly connected computer after your WiFi router is setup properly. You need a directly connected computer for fist time installation and configuration of the WiFi router.</li>
</ul>
<p>I hope this post was of some help to all the Bharti-Airtel broadband users. Thanks for reading. <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/06/04/setting-up-linksys-wifi-router-with-airtel-broadband/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Problems with Yahoo Mail</title>
		<link>http://blog.xkoder.com/2008/06/03/problems-with-yahoo-mail/</link>
		<comments>http://blog.xkoder.com/2008/06/03/problems-with-yahoo-mail/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 22:57:14 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=38</guid>
		<description><![CDATA[For the past 3~4 days I’ve been experiencing problems with Yahoo! Mail. I’ve asked few of my friends and relatives and they all seem to be having the same problems. The problem is affecting both Yahoo Mail classic and the new ajaxian Yahoo mail. Symptoms observed 1) Yahoo! Mail rejects your login credential straight away. [...]]]></description>
			<content:encoded><![CDATA[<p>For the past 3~4 days I’ve been experiencing problems with Yahoo! Mail. I’ve asked few of my friends and relatives and they all seem to be having the same problems. The problem is affecting both Yahoo Mail classic and the new <em>ajaxian </em>Yahoo mail.</p>
<p><strong>Symptoms observed</strong><br />
<strong> 1)</strong> Yahoo! Mail rejects your login credential straight away. You are not able to login, either using just your yahoo ID or the (recently added mechanism) your full yahoo mail address (yourid@yahoo.com).<br />
<strong> 2)</strong> You are able to login, but the page is <em>not</em> rendered properly. Yahoo mail classic displays your mails but clicking on them wouldn’t open them (only mail subject is show, the body is missing). New Yahoo Mail would render only partially, contents of folders (Inbox etc.) are not listed.</p>
<p>I’ve tested the problem on Linux (Fedora, Ubuntu) and Windows XP with variety of browsers. Here’s the complete list of browsers</p>
<p><strong>Windows XP:</strong> IE7, Opera, Firefox 2<br />
<strong>Linux (Ubuntu):</strong> Opera 9.27, Firefox 2, Firefox 3 beta, Epiphany<br />
<strong>Linux (Fedora):</strong> Opera, Firefox 2, Firefox 3</p>
<p>On Epiphany, Yahoo Mail tends to behave properly <em>most</em> of the times, but on all other browsers it mis-behaves 100% of times. (This is my observation).</p>
<p>I dunno what the guys at Yahoo are doing but this is really p*ss*ng off their users. I am, for sure, really irritated. I use Yahoo Mail heavily and this is causing real inconvenience to me. It is not just a few minutes glitch, its been consistently happening for a long time now. Are there any other people experiencing the same?</p>
<p><strong>Update: 4th June 2008</strong><br />
It seems Yahoo is finally aware of the problem(2) <a title="Yahoo Mail - Inconsistent rendering of page" href="http://www.ymailblog.com/blog/2008/06/external-accounts/">http://www.ymailblog.com/blog/2008/06/external-accounts/</a></p>
<p><em>Quoting from the Yahoo Mail Blog</em></p>
<blockquote><p>We are still evaluating the reports of inconsistent html rendering, but I do have an update regarding reported issues with the retrieving of POP email from external accounts.</p>
<p>Our engineers have reviewed the issue, identified the root cause, and are already underway rolling out the fix. Some users should see improved performance immediately, while others may not notice it for a few days (as it hits each farm).</p>
<p>We are very sorry for any frustration you guys have experienced, and for not getting updates out to you sooner.</p></blockquote>
<p>As for the problem (1) I guess it has been resolved. At least I haven’t faced any problems today logging into Yahoo mail.</p>
<p><strong>Update: 10th June 2008</strong><br />
I guess the problems described in this post have been resolved by Yahoo, I haven’t had any problems for more than 24 hours now. A <em>big thanks</em> to Yahoo! team. Hopefully things wouldn’t break down again, and if they do, would be resolved quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/06/03/problems-with-yahoo-mail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cyber Wars : Revision3 vs MediaDefender</title>
		<link>http://blog.xkoder.com/2008/05/30/cyber-wars-revision3-vs-mediadefender/</link>
		<comments>http://blog.xkoder.com/2008/05/30/cyber-wars-revision3-vs-mediadefender/#comments</comments>
		<pubDate>Thu, 29 May 2008 22:55:58 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[Random Musings]]></category>
		<category><![CDATA[cyber]]></category>
		<category><![CDATA[media defender]]></category>
		<category><![CDATA[revision3]]></category>
		<category><![CDATA[war]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=36</guid>
		<description><![CDATA[A popular Internet Television network named Revision3 was brought to knees by a cyber attack from a company named MediaDefender, offering services to prevent copyright infringement using P2P distribution method. You can read the complete story here: Revision3 CEO: Blackout caused by MediaDefender attack. The story seems to be straight out from a Scifi movie. [...]]]></description>
			<content:encoded><![CDATA[<p>A popular Internet Television network named <a title="Revision3 Wikipedia entry." href="http://en.wikipedia.org/wiki/Revision3">Revision3</a> was brought to knees by a <em>cyber attack</em> from a company named <a title="MediaDefender Wikipedia entry." href="http://www.nytimes.com/2008/05/30/science/space/30mars.html?_r=1&amp;ref=science&amp;oref=slogin">MediaDefender</a>, offering services to prevent copyright infringement using P2P distribution method. You can read the complete story here: <a title="The complete story." href="http://arstechnica.com/news.ars/post/20080529-revision3-ceo-blackout-caused-by-mediadefender-attack.html">Revision3 CEO: Blackout caused by MediaDefender attack</a>.</p>
<p>The story seems to be straight out from a Scifi movie. An interesting read, but what’s more interesting are the tactics used by MediaDefender to achieve their goal. The tactics used could well be described as <a title="Wikipedia entry." href="http://en.wikipedia.org/wiki/Guerilla_warfare"><em>Guerrilla Warfare</em></a>.</p>
<p>One of their primary tactics is to contaminate the P2P networks with fake and broken files. They create multiple sources for these <em>decoy files</em> and rate them high, so that they show up at the top of a search result, in a P2P client. Other commonly used method is Denial Of Service (DoS) attack.</p>
<p>Apart from this, MediaDefender has been accused of creating multimedia sharing websites to lure people into uploading copyrighted content. MiiVi is(was?) one such website. MiiVi was advertised as a place where you could get full length movies for downloads. MediaDefender, initially denied its involvement with MiiVi, but a major <a title="Hundreds of MB of MediaDefender E-Mails leaked." href="http://arstechnica.com/news.ars/post/20070916-leaked-media-defender-e-mails-reveal-secret-government-project.html">E-Mail leak</a> found MediaDefender guilty. Wikipedia entry for MediaDefender provides more <em>evidence</em> (facts/stories), linking MiiVi to the MediaDefender company.</p>
<p>As the <em>ars technica</em> news entry points out, P2P is also being heavily used for legitimate file sharing. To give an example many of the Linux Distros are available for download over bit-torrent. I once used P2P to transfer (to my project mate) big documents and source-code and related-files of my college project, when you could only send like 1~2 MB of files as e-mail attachment.</p>
<p>Apart from this, what happened to Revision3  could happened to any other business. So where are we heading towards? A <em>supposedly</em> legitimate business is attacking other legitimate business. Crackers/Terror outfits are already using MediaDefender like tactics to attack governments/organisations across the globe. Virtual warfare is gaining momentum. Interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/05/30/cyber-wars-revision3-vs-mediadefender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dying Democracy?</title>
		<link>http://blog.xkoder.com/2008/04/10/dying-democracy/</link>
		<comments>http://blog.xkoder.com/2008/04/10/dying-democracy/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 22:52:24 +0000</pubDate>
		<dc:creator>xk0der</dc:creator>
				<category><![CDATA[In My Opinion]]></category>
		<category><![CDATA[Random Musings]]></category>
		<category><![CDATA[democracy]]></category>
		<category><![CDATA[india]]></category>

		<guid isPermaLink="false">http://blog.xkoder.com/?p=32</guid>
		<description><![CDATA[I do not know what to make out of the ruling by Supreme Court (SC) of India with respect to the quota for Other Backward Classes (OBCs) in “IITs, IIMs and other Central educational institutions” the ruling adds that the SC “excluded the creamy layer from the benefit”. Here is the full coverage of the [...]]]></description>
			<content:encoded><![CDATA[<p>I do not know what to make out of the ruling by Supreme Court (SC) of India with respect to the quota for Other Backward Classes (OBCs) in “IITs, IIMs and other Central educational institutions” the ruling adds that the SC “excluded the creamy layer from the benefit”. Here is the full coverage of the verdict at rediff.com:</p>
<p><a href="http://www.rediff.com/news/2008/apr/10quota.htm">http://www.rediff.com/news/2008/apr/10quota.htm<br />
</a></p>
<p>Who decides who belongs to the creamy layer of OBCs? How do they decide who belongs to the creamy layer? and why the hell do we need reservations based on castes/creed/religion/sects and the like?</p>
<p>Quoting from the article: “All judges favoured periodic revision on the implementation of the 27 percent quota.”, remember when the original constitution was drafted and the reservations were to last just for 10 years? What year is it now? 2008!</p>
<p>It is but clear, why after every five years the reservations policy is extended to yet another five year term. And every now and then <span style="font-style: italic;">new categories</span> are added to the beneficiary list.</p>
<p>When will this vote politics end? Never!</p>
<p>What to do about it? Think beyond caste, think beyond they-me, think beyond their state-my region, Think beyond India, think Global, think Humanity!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xkoder.com/2008/04/10/dying-democracy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
