<?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>The Unheralded Perspective &#187; Open Source</title>
	<atom:link href="http://blog.sidkalra.com/category/opensource/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sidkalra.com</link>
	<description></description>
	<lastBuildDate>Sat, 19 Nov 2011 18:46:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting up a Linux environment, Why so Arduous?</title>
		<link>http://blog.sidkalra.com/2010/09/setting-up-a-linux-environment-why-so-arduous/</link>
		<comments>http://blog.sidkalra.com/2010/09/setting-up-a-linux-environment-why-so-arduous/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 01:09:05 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Environment Setup]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[setuptools]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Trac]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=572</guid>
		<description><![CDATA[So lately I&#8217;ve been trying to setup a linux environment on a shared hosting web server. Let me just begin by saying that it has not been easy, in fact it has been quite frustrating. The following are some of the technologies that I&#8217;ve tried to install: Python 2.7 Django Trac SVN Hg setuptools libtool [...]]]></description>
			<content:encoded><![CDATA[<p>So lately I&#8217;ve been trying to setup a linux environment on a shared hosting web server. Let me just begin by saying that it has not been easy, in fact it has been quite frustrating. The following are some of the technologies that I&#8217;ve tried to install:</p>
<ul>
<li><a href="http://python.org/" target="_blank">Python</a> 2.7</li>
<li>Django</li>
<li>Trac</li>
<li>SVN</li>
<li>Hg</li>
<li>setuptools</li>
<li>libtool</li>
<li>autoconf</li>
<li>apr</li>
<li>apr-util</li>
<li>m4</li>
</ul>
<p>The documentation has been lacking in every sense of the word. Most <a href="http://www.linux.org/" target="_blank">Linux</a> technologies are compiled and built with the usual configure, make and make install show, but dealing with all the dependencies that these technologies employ is the biggest headache. For example when trying to setup <a href="http://subversion.apache.org/" target="_blank">svn</a> many of the required dependencies were missing and I had to hunt them down and get them working before I could even start installing the tool itself. Dependencies themselves are fine. However, not notifying the user about them in advance is not. The way I found out about the dependencies for <a href="http://subversion.apache.org/" target="_blank">svn</a> was via the errors I received when I tried to build it.</p>
<p>It would be much easier to install a module or package if all the required dependencies came packaged with the software. I mean, problems like these reduce your potential user base. I&#8217;m sure for a Linux guru these issues would be trivial. But it takes years of work to reach such a position of knowledge. The common man is going to give up after a few hours.</p>
<p>I like what python has done with <a href="http://pypi.python.org/pypi/setuptools" target="_blank">setuptools</a>. This tool literally does all the work for you. It downloads, compiles, builds and installs any python module that you request. It doesn&#8217;t get simpler then that. Once the module is installed then the user can get down to what they really want to do.</p>
<p>Maybe it&#8217;s time for <a href="http://www.linux.org/" target="_blank">Linux</a> packages to move to a more user friendly installation experience. Ideally, a user wants to be presented with a list of options which he can then choose one. If he is unable to choose then the default option is selected. Basically, I&#8217;m thinking of a scenario where the <a href="http://www.microsoft.com/en/us/default.aspx" target="_blank">Microsoft</a> step by step GUI installation process is replicated in a command line environment. This would involve extra work but in the end usability matters, even when dealing with development tools. The extra effort must be applied to stay competitive, otherwise users will certainly migrate to other products.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2010/09/setting-up-a-linux-environment-why-so-arduous/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>v1.0 Release Complete</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-complete/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-complete/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 15:20:08 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[filesTouched]]></category>
		<category><![CDATA[merges]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=562</guid>
		<description><![CDATA[Well this is it guys. My last release for the open source course is finished! It has come at the right time too as this is my 100th blog post. So for this release I ended up doing quite a bit more than I originally planned to. It all kind of became hectic in the [...]]]></description>
			<content:encoded><![CDATA[<p>Well this is it guys. My last release for the <a href="http://zenit.senecac.on.ca/wiki/index.php/DPS911" target="_blank">open source course</a> is finished! It has come at the right time too as this is my 100th blog post. So for this release I ended up doing quite a bit more than I <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">originally planned</a> to. It all kind of became hectic in the end because ted suddenly reviewed my <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">OnScroll patch</a> yesterday, which meant that I immediately had to fix the changes he outlined.</p>
<p>First of all I tackled the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=448707" target="_blank">files touched patch</a>. Jorendorff has mentioned a few times that it is important to show information in an unobtrusive manner. Now, this <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/filestouched.png" target="_blank">wasn&#8217;t being accomplished earlier</a> and so I decided to put <a href="http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-for-the-files-touched-patch/" target="_blank">expand/collapse functionality</a> for the files touched.</p>
<p>Next I tackled a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=486939" target="_blank">new bug</a> where I only wanted  &gt;5 merges to get expand/collapse functionality. Anything less than that should be left as it is. <a href="http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-functionality-only-for-merges-with-5-pushes/" target="_blank">I&#8217;ve got that working now</a>.</p>
<p>As I mentioned earlier, I also tackled the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">OnScroll patch</a>. Over the course of these last eight months this has been the patch that I&#8217;ve worked on the most. In this release I&#8217;ve done a major rehaul. The client-side code looks very different now as I had to change it to work with the new <a href="http://hg.mozilla.org/hg_templates/annotate/0ecbdfad931d/gitweb_mozilla/pushlog.tmpl" target="_blank">hg_templates/pushlog.tmpl</a>. Also, I&#8217;ve <a href="http://blog.sidkalra.com/2009/04/v10-release-fixing-the-onscroll-patch-to-work-with-the-new-version-of-hg_templates/" target="_blank">used a lot of jquery to make the code shorter and simpler</a>. Furthermore, I&#8217;ve <a href="http://blog.sidkalra.com/2009/04/v10-release-further-improving-bug-functionality-for-the-onscroll-patch/" target="_blank">improved bug functionality</a> even further and got the <a href="http://blog.sidkalra.com/2009/04/v10-release-getting-the-localize-dates-link-working-with-the-new-entries-loaded-on-scroll/" target="_blank">&#8220;To Local&#8221; link to work with the new entries</a> that load on scroll. These were the goals that I had originally set out to meet and I&#8217;ve accomplished them</p>
<p>Now, as I said earlier ted, djc and Pike all gave me some feedback yesterday regarding my OnScroll patch. Thus, I had to make some last minute changes to my release. First of all I tackled a problem with the server side code that handles merges. Previously I was using a long string delimited by a random separator. Now, I&#8217;ve <a href="http://blog.sidkalra.com/2009/04/v10-release-changing-the-data-structure-that-handles-merges-for-the-onscroll-patch/" target="_blank">replaced that with a nice and simple dictionary data structure</a>. This took a bit of time as I had to rehaul major parts of my client-side implementation so that it could properly read the data that was now being stored in dictionaries.</p>
<p>Furthermore, I <a href="http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/" target="_blank">moved all my JavaScript code to an external file</a> since the amount of code was just getting to be too much to handle in script tags. I also changed how I deal with the <a href="http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/" target="_blank">parity counter</a> and how I <a href="http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/" target="_blank">retrieve the maximum number of entries</a> in the database. Lastly, I made a change in <a href="http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/" target="_blank">regards to pushlog queries</a>. Beforehand, my code was causing more entries to load even when a user executed a query. That should not have been happening and now I&#8217;ve managed to fix that problem.</p>
<p>The following are the important links from this release:</p>
<ul>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">Goals</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-for-the-files-touched-patch/" target="_blank">Expand/collapse for files touched</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-functionality-only-for-merges-with-5-pushes/" target="_blank">Expand/collapse only for &gt;5 pushes in a merge</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-fixing-the-onscroll-patch-to-work-with-the-new-version-of-hg_templates/" target="_blank">Fixing OnScroll to work with the new version of hg_templates and using more jquery functionality</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-getting-the-localize-dates-link-working-with-the-new-entries-loaded-on-scroll/" target="_blank">Getting the Localize Dates Link Working with the New Entries Loaded On Scroll</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-further-improving-bug-functionality-for-the-onscroll-patch/" target="_blank">Further Improving Bug Functionality for the OnScroll Patch</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-changing-the-data-structure-that-handles-merges-for-the-onscroll-patch/" target="_blank">Changing the Data Structure that Handles Merges for the OnScroll Patch</a></li>
<li><a href="http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/">Moving to an external Js file, the parity counter, retrieving max entries and dealing with pushlog queries</a></li>
</ul>
<p>Finally, the release is done! All the patches have been posted to their respective bug pages. Please view the <a href="http://zenit.senecac.on.ca/wiki/index.php/Mercurial_history_browsing" target="_blank">project page</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Various Changes to Improve the OnScroll Patch</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 13:26:51 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=560</guid>
		<description><![CDATA[Yesterday, ted reviewed my onScroll patch and and he outlined some changes that I should look to make. Lets dive in right away and have a look at what I have changed according to his recommendations: Move javascript to an external file ted recommended that I move all my JavaScript to an external file since [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, ted reviewed my <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">onScroll patch</a> and and he outlined some changes that I should look to make. Lets dive in right away and have a look at what I have changed according to his recommendations:</p>
<p><strong>Move javascript to an external file</strong></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727#c33" target="_blank">ted recommended</a> that I move all my JavaScript to an external file since the amount of lines was just too much. Having all that code in the script tags is not ideal. Thus, I&#8217;ve now moved all my JavaScript code to an external file leaving only the following in hg_templates/pushlog.tmpl:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> start <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">top</span>.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
  fillPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>max<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>start <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      loadEntries<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Change the parity counter</strong></p>
<p>I&#8217;ve also changed how I deal with the parity counter which is responsible for setting up the class of each row. In the <a href="http://hg.mozilla.org/mozilla-central/" target="_blank">pushlog</a> the class value of the rows alternates between &#8216;parity0&#8242; and &#8216;parity1&#8242;. Beforehand I was using an if/else block to replicate this functionality for the new entries loaded on scroll. However, this has now been changed to the following which is a better implementation:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> row <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
row.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'parity'</span> <span style="color: #339933;">+</span> counter <span style="color: #339933;">%</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
counter<span style="color: #339933;">++;</span></pre></div></div>

<p>So basically if the counter is an odd value counter % 2 will return 1, otherwise it will return 0. For each row I increment the counter by 1, which means that it alternates between an even and odd value.</p>
<p><strong>Change how max entries is retrieved</strong></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727#c33" target="_blank">ted was wondering</a> why I was doing the following to retrieve the total amount of entries in the database:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_header&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_header&quot;</span> maxentries<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#max#&quot;</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">start <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#page_header&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;maxentries&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span></pre></div></div>

<p>I know that the above implementation was a very round about way of doing this. In my earlier implementations I had tried doing what he recommended, which is to just declare var start = {max} but for some odd reason that didn&#8217;t work for me initially. I tried this again today and now somehow it works. This had me very confused and frustrated. I thought a bit harder about this oddity and realized that what I had probably tried beforehand was this: var start =&#8217;{max}&#8217; which sets start to an empty string. Anyways, I&#8217;ve rectified the situation and now I do the following to set the value of the &#8216;start&#8217; variable:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">fillPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>max<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> fillPage<span style="color: #009900;">&#40;</span>max<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  start <span style="color: #339933;">=</span> max <span style="color: #339933;">-</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> vHeight <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">documentElement</span><span style="color: #009900;">&#41;</span>
    vHeight <span style="color: #339933;">=</span> document.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">clientHeight</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">else</span>
    vHeight <span style="color: #339933;">=</span> document.<span style="color: #660066;">body</span>.<span style="color: #660066;">clientHeight</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span>.<span style="color: #660066;">offsetHeight</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> vHeight<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> count <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> offSetHeight <span style="color: #339933;">=</span> document.<span style="color: #660066;">body</span>.<span style="color: #660066;">offsetHeight</span><span style="color: #339933;">;</span> offSetHeight <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> vHeight<span style="color: #339933;">;</span> count<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
      offSetHeight <span style="color: #339933;">+=</span> <span style="color: #CC0000;">180</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>count <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
      loadEntries<span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>OnScroll should not work with any pushlog queries</strong></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727#c33" target="_blank">ted brought up a very good point in one of his comments</a> on the bug page. He asked what would happen if a user ran a query? Would the pushlog try to load more entries even though the user just wants to see his query data? Well, for my previous implementation the answer was yes. The function fillPage() would get called when the query is loaded and it would try to load more entries. I needed to fix this situation and I did so by adding the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">top</span>.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
    fillPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>max<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>window.top.location.search.substring(1) will return an empty string if no query has been executed. Thus I can just perform a simple if statement to check whether the pushlog is being loaded normally or is a query being executed. If it happens to be the former then fillPage() is called, otherwise it isn&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-various-changes-to-improve-the-onscroll-patch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Changing the Data Structure that Handles Merges for the OnScroll Patch</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-changing-the-data-structure-that-handles-merges-for-the-onscroll-patch/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-changing-the-data-structure-that-handles-merges-for-the-onscroll-patch/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 05:28:41 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[dictionaries]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=549</guid>
		<description><![CDATA[Today ted unexpectedly reviewed my onScroll patch. Now, suddenly I have a ton of changes that I have to make and my release is due tomorrow (technically today since the clock just hit midnight). One of the problems that ted focused on was how I passed merge changesets from the server-side to the client-side. I [...]]]></description>
			<content:encoded><![CDATA[<p>Today ted unexpectedly reviewed my <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">onScroll patch</a>. Now, suddenly I have a ton of changes that I have to make and my release is due tomorrow (technically today since the clock just hit midnight).</p>
<p>One of the problems that ted focused on was how I passed merge changesets from the server-side to the client-side. I was using a weird and ugly string which is delimited by a random separator. I&#8217;ve known all along that this was a very ugly solution. When I had come up with this implementation I didn&#8217;t know <a href="http://www.python.org/" target="_blank">python</a> very well and thus did not use the dictionary data structure, which is an integral part of the language. I don&#8217;t know why I haven&#8217;t changed this implementation until now. I guess I decided to give other things more priority because although the solution was ugly, it worked.</p>
<p>Nonetheless, I have made the appropriate changes and the following is what my server-side solution looks like now:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> getMergeData<span style="color: black;">&#40;</span>ctx, mergeData<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">for</span> cs <span style="color: #ff7700;font-weight:bold;">in</span> ctx.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        mergeData.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">'node'</span>: ctx.<span style="color: #008000;">hex</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'user'</span>: clean<span style="color: black;">&#40;</span>person<span style="color: black;">&#40;</span>cs.<span style="color: #dc143c;">user</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'desc'</span>: clean<span style="color: black;">&#40;</span>cs.<span style="color: black;">description</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>cs.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">1</span>:
            getMergeData<span style="color: black;">&#40;</span>cs, mergeData<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>The client side implementation:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> loadEntries<span style="color: #009900;">&#40;</span>iterations<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> t <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> t <span style="color: #339933;">&lt;</span> iterations<span style="color: #339933;">;</span> t<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> end <span style="color: #339933;">=</span> start<span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;static/ajax-loader.gif&quot; align=&quot;right&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    start <span style="color: #339933;">-=</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
    $.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/json-pushes?startID='</span> <span style="color: #339933;">+</span> start <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;endID='</span> <span style="color: #339933;">+</span> end<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>responseText<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> pushData <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>responseText<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> end<span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;</span> start<span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> row <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        row.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'parity'</span> <span style="color: #339933;">+</span> counter <span style="color: #339933;">%</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        counter<span style="color: #339933;">++;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// user column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">user</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;&lt;span class=&quot;date&quot;&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">formattedDate</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/span&gt;&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">184</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        <span style="color: #006600; font-style: italic;">// rev column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> createRevTd<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">individualChangeset</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// author and description column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;strong&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">author</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' &amp;mdash '</span> <span style="color: #339933;">+</span> createBuglink<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">desc</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.titlePush'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">//Check whether it is a merge changeset or not</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span> <span style="color: #339933;">!=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #003366; font-weight: bold;">var</span> node <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'node'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
              <span style="color: #003366; font-weight: bold;">var</span> user <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
              <span style="color: #003366; font-weight: bold;">var</span> desc <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
              createMergeRows<span style="color: #009900;">&#40;</span>node<span style="color: #339933;">,</span> user<span style="color: #339933;">,</span> desc<span style="color: #339933;">,</span> row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
              <span style="color: #006600; font-style: italic;">// nested lists</span>
              <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #000066; font-weight: bold;">instanceof</span> Array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> k <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  node <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'node'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  user <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  desc <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'desc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
                  createMergeRows<span style="color: #009900;">&#40;</span>node<span style="color: #339933;">,</span> user<span style="color: #339933;">,</span> desc<span style="color: #339933;">,</span> row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
              <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>    
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>So, as you can see now I&#8217;m using a list that holds a bunch of dictionaries. Each dictionary has 3 keys: node, user and desc. I pass the the list, mergeData over the to the client side via JSON. Then on the client side I go through the list and retrieve the values of each key (lines 29-32)</p>
<p>However, you must have noticed that the client-side implementation has a nested for loop (line 38). <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727#c32" target="_blank">Ted was wondering why it takes a maze of nested loops to display merges</a> (although now it is down to only one nested loop). The reason I have to do it this way is because sometimes <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/nestedLists.png">mergeData can contain nested lists</a>. Especially when dealing with large merges that tracemonkey usually has.</p>
<p>So there you have it. I&#8217;ve replaced the long and ugly string that previously held merge information with a nice and beautiful dictionary.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-changing-the-data-structure-that-handles-merges-for-the-onscroll-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Further Improving Bug Functionality for the OnScroll Patch</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-further-improving-bug-functionality-for-the-onscroll-patch/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-further-improving-bug-functionality-for-the-onscroll-patch/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 03:55:45 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[bug functionality]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=545</guid>
		<description><![CDATA[In my earlier blog post I outlined that I wanted to further improve bug functionality for the OnScroll patch. Bugs that were only 5 digits long were not being converted into proper links. For example bug 12345 or b#12345 or 12345. I was only covering bugs that were 6 digits in length. The following is [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">earlier blog post</a> I outlined that I wanted to further improve bug functionality for the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">OnScroll patch</a>. Bugs that were only 5 digits long were not being converted into proper links. For example bug 12345 or b#12345 or 12345. I was only covering bugs that were 6 digits in length. The following is my old bug regexps:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">re <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;[bB][uU][gG]<span style="color: #000099; font-weight: bold;">\s</span><span style="color: #000099; font-weight: bold;">\d</span>{6}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
re2 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;b=<span style="color: #000099; font-weight: bold;">\d</span>{6}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
re3 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\d</span>{6}<span style="color: #000099; font-weight: bold;">\W</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now have a look at my new bug regexes:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">re <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'[bB][uU][gG]sd{5,}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
re2 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'b=d{5,}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
re3 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'d{5,}W'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>As you can see the regexp implementation hasn&#8217;t changed very much. The only change was that &#8217;6&#8242; became &#8217;5,&#8217; and now the 5 digit bugs are <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/bug5numberslink.png" target="_blank">converted into bug links properly</a>. Basically &#8217;5,&#8217; specifies that anything &gt;=5 digits should be converted into bug links. Furthermore, 7 digit bugs will start to appear eventually (if they haven&#8217;t already, not sure). This implementation automatically takes care of that situation.</p>
<p>Another thing you will notice in my new implementation is that the regexps no longer use double quotes. Instead, I&#8217;m now using single quotes which means that I don&#8217;t need to use the double backward slash as an escape character.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-further-improving-bug-functionality-for-the-onscroll-patch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Getting the Localize Dates Link Working with the New Entries Loaded On Scroll</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-getting-the-localize-dates-link-working-with-the-new-entries-loaded-on-scroll/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-getting-the-localize-dates-link-working-with-the-new-entries-loaded-on-scroll/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 23:19:07 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[ToLocal]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=533</guid>
		<description><![CDATA[One of my goals for this release was getting the localize dates link working with the new entries loaded on scroll. This wasn&#8217;t happening beforehand. Only the entries that were displayed with the initial page load worked with the localize dates link. I examined why this was happening by looking at how the dates are [...]]]></description>
			<content:encoded><![CDATA[<p>One of my <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">goals for this release</a> was getting the localize dates link working with the new entries loaded on scroll. This wasn&#8217;t happening beforehand. Only the entries that <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/tolocalbefore.png" target="_blank">were displayed with the initial page load worked with the localize dates link</a>.</p>
<p>I examined why this was happening by looking at how the dates are localized. The following is the code for this functionality:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// add click handler to the localize dates link</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#localize'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.date'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLocaleString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>As you can see above when the localize date link is clicked the function goes through each element that has a class called &#8216;date&#8217; and transforms the text within the element to a local date string via toLocalString(). Now my problem was that none of the new entries loaded on scroll have any elements that contain a class called &#8216;date&#8217;. Thus, none of the dates for the new entries got translated into their local versions.</p>
<p>In order to rectify this situation I decided to make the following change within loadEntries():</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>77
78
79
80
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// user column</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">user</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;&lt;span class=&quot;date&quot;&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">formattedDate</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/span&gt;&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">184</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>So basically now I put the date text within a a span. This span has a class called &#8216;date&#8217; thus when the To Local link is clicked it will go through all the elements that have the class date, which now includes the new entries. There we have it, <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/tolocalafter.png" target="_blank">problem fixed</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-getting-the-localize-dates-link-working-with-the-new-entries-loaded-on-scroll/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Fixing the OnScroll Patch to Work with the New Version of hg_templates</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-fixing-the-onscroll-patch-to-work-with-the-new-version-of-hg_templates/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-fixing-the-onscroll-patch-to-work-with-the-new-version-of-hg_templates/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 15:56:39 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[hg_templates]]></category>
		<category><![CDATA[OnScroll]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=527</guid>
		<description><![CDATA[In my earlier blog post I outlined my plan to update my OnScroll patch to work with the new version of hg_templates, which was updated recently. Now, it has access to the jquery library, which can be used to do more fun stuff. I was using jquery beforehand too but now I&#8217;ve decided to take [...]]]></description>
			<content:encoded><![CDATA[<p>In my earlier <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">blog post</a> I outlined my plan to update my <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">OnScroll patch</a> to work with the new version of <a href="http://hg.mozilla.org/hg_templates" target="_blank">hg_templates</a>, which was updated recently. Now, it has access to the <a href="http://docs.jquery.com/" target="_blank">jquery</a> library, which can be used to do more fun stuff. I was using jquery beforehand too but now I&#8217;ve decided to take it a step further and take advantage of jquery even more. I believe by doing this I can significantly reduce the number of lines of code and still retain the same functionality.</p>
<p><strong>The Old Code</strong></p>
<p>For comparisons purposes I&#8217;ve posted the old code below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> loadEntries<span style="color: #009900;">&#40;</span>iterations<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> t <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> t <span style="color: #339933;">&lt;</span> iterations<span style="color: #339933;">;</span> t<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> loader <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loader&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> end <span style="color: #339933;">=</span> start<span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> req <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    loader.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;img src=&quot;{url}static/ajax-loader.gif&quot; align=&quot;right&quot; /&gt;'</span><span style="color: #339933;">;</span>
    start <span style="color: #339933;">=</span> start <span style="color: #339933;">-</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
    req.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'GET'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'/json-pushes?startID='</span> <span style="color: #339933;">+</span> start <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;endID='</span> <span style="color: #339933;">+</span> end<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    req.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>req.<span style="color: #000066;">status</span> <span style="color: #339933;">!=</span> <span style="color: #CC0000;">404</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #003366; font-weight: bold;">var</span> pushData <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
          <span style="color: #006600; font-style: italic;">//var counter = 0;</span>
          <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> end<span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;</span> start<span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> row <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>counter <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              row.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;parity0&quot;</span><span style="color: #339933;">;</span> 
              counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                row.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;parity1&quot;</span><span style="color: #339933;">;</span>
                counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>  
            <span style="color: #003366; font-weight: bold;">var</span> userCol <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> revCol <span style="color: #339933;">=</span> createRevTd<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">individualChangeset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> bugLink <span style="color: #339933;">=</span> createBuglink<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">desc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> authDescCol <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            userCol.<span style="color: #660066;">width</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;184px&quot;</span><span style="color: #339933;">;</span>
            userCol.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">user</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">formattedDate</span><span style="color: #339933;">;</span>
            authDescCol.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&lt;strong&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">author</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' &amp;mdash '</span> <span style="color: #339933;">+</span> bugLink <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;'</span><span style="color: #339933;">;</span>
            row.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>userCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            row.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>revCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            row.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>authDescCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            loader.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;titlePush&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #006600; font-style: italic;">//Check whether it is a merge changeset or not</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">MergeData</span> <span style="color: #339933;">!=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeStr <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> k <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #000066; font-weight: bold;">instanceof</span> Array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> actualMergeStr <span style="color: #339933;">=</span> mergeStr<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'|-|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeRev <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeUser <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeDesc <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> actualMergeStr <span style="color: #339933;">=</span> mergeStr.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'|-|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeRev <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeUser <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeDesc <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                      k <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>mergeDesc <span style="color: #339933;">!=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">desc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeRow <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeUserCol <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeRevCol <span style="color: #339933;">=</span> createRevTd<span style="color: #009900;">&#40;</span>mergeRev<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> merge_bugLink <span style="color: #339933;">=</span> createBuglink<span style="color: #009900;">&#40;</span>mergeDesc<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      <span style="color: #003366; font-weight: bold;">var</span> mergeAuthDescCol <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                      mergeRow.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> row.<span style="color: #660066;">className</span><span style="color: #339933;">;</span>
                      mergeUserCol.<span style="color: #660066;">width</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;184px&quot;</span><span style="color: #339933;">;</span>
                      mergeAuthDescCol.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&lt;strong&gt;'</span> <span style="color: #339933;">+</span> mergeUser <span style="color: #339933;">+</span> <span style="color: #3366CC;">' &amp;mdash '</span> <span style="color: #339933;">+</span> merge_bugLink <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;'</span><span style="color: #339933;">;</span>
                      mergeRow.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>mergeUserCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      mergeRow.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>mergeRevCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      mergeRow.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>mergeAuthDescCol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                      document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;titlePush&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>mergeRow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                  <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
              <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>    
        <span style="color: #009900;">&#125;</span>  
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    req.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> createRevTd<span style="color: #009900;">&#40;</span>rev<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> td <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  td.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+=</span>
    <span style="color: #3366CC;">'&lt;a href=&quot;/rev/'</span> <span style="color: #339933;">+</span>
    rev.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> 
    <span style="color: #3366CC;">'&quot;&gt;'</span> <span style="color: #339933;">+</span> 
    rev.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
    <span style="color: #3366CC;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span> 
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> td<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>The New Code</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> loadEntries<span style="color: #009900;">&#40;</span>iterations<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> t <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> t <span style="color: #339933;">&lt;</span> iterations<span style="color: #339933;">;</span> t<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> end <span style="color: #339933;">=</span> start<span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;{url}static/ajax-loader.gif&quot; align=&quot;right&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    start <span style="color: #339933;">-=</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
    $.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/json-pushes?startID='</span> <span style="color: #339933;">+</span> start <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;endID='</span> <span style="color: #339933;">+</span> end<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>responseText<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> pushData <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>responseText<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> end<span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;</span> start<span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> row <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>counter <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          row.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'parity0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> 
        <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
          row.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'parity1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          counter <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">// user column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">user</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;&lt;span class=&quot;date&quot;&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">formattedDate</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/span&gt;&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">184</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        <span style="color: #006600; font-style: italic;">// rev column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> createRevTd<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">individualChangeset</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// author and description column</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;strong&gt;'</span> <span style="color: #339933;">+</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">author</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' &amp;mdash '</span> <span style="color: #339933;">+</span> createBuglink<span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">desc</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.titlePush'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">//Check whether it is a merge changeset or not</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">MergeData</span> <span style="color: #339933;">!=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #003366; font-weight: bold;">var</span> mergeStr <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
              <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> k <span style="color: #339933;">&lt;</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #000066; font-weight: bold;">instanceof</span> Array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> actualMergeStr <span style="color: #339933;">=</span> mergeStr<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'|-|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeRev <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeUser <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeDesc <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> actualMergeStr <span style="color: #339933;">=</span> mergeStr.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'|-|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeRev <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeUser <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeDesc <span style="color: #339933;">=</span> actualMergeStr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                  k <span style="color: #339933;">=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">mergeData</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>mergeDesc <span style="color: #339933;">!=</span> pushData<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">desc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #003366; font-weight: bold;">var</span> mergeRow <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span>row.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'class'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'td'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>mergeRow<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">184</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> createRevTd<span style="color: #009900;">&#40;</span>mergeRev<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>mergeRow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;td&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;strong&gt;'</span> <span style="color: #339933;">+</span> mergeUser <span style="color: #339933;">+</span> <span style="color: #3366CC;">' &amp;mdash '</span> <span style="color: #339933;">+</span> createBuglink<span style="color: #009900;">&#40;</span>mergeDesc<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/td&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>mergeRow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.titlePush'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>mergeRow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
              <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>    
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> createRevTd<span style="color: #009900;">&#40;</span>rev<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'&lt;a href=&quot;/rev/'</span> <span style="color: #339933;">+</span>
    rev.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> 
    <span style="color: #3366CC;">'&quot;&gt;'</span> <span style="color: #339933;">+</span> 
    rev.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
    <span style="color: #3366CC;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>As you can see above is the new code. Lots of changes to look at it. First of all the JavaScript code has been shifted within <a href="http://www.learningjquery.com/2006/09/introducing-document-ready" target="_blank">$document.ready()</a>. The major changes have occurred in loadEntries(). The jquery library makes it extremely simple to retrieve an object by its class or id name. Instead of having to use document.getElementbyId() I can use $(&#8216;&lt;class_name&gt;&#8217;). I&#8217;ve used this way extensively throughout my new implementation. Furthermore, I don&#8217;t need to use document.createElement() anymore either. I can just use the  $(&#8216;&lt;html&gt;&#8217;) syntax to create an element (e.g. line 84). Another great little change is how jquery creates an xmlHttpRequest(). The syntax is so much simpler. Only a simple $.get(url, function(responseText) {} ) is needed (line 65). Another little quirk that makes jquery awesome can be seen on lines 78-80. I can create the new element, append it to another element and change its attributes all in one go.</p>
<p>One important thing to note, however, is that some things didn&#8217;t change much at all. Such as the string manipulation functionality found at lines 88-107. All in all the end result of all these changes is that I have manged to reduce the total number of lines by 19. On top of that I have also added 2 extra pieces of functionality (I&#8217;ll be discussing them in future posts) without having to add any additional lines of code. A very good result, in my opinion.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-fixing-the-onscroll-patch-to-work-with-the-new-version-of-hg_templates/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Expand/Collapse Functionality only for Merges with &gt;5 Pushes</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-functionality-only-for-merges-with-5-pushes/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-functionality-only-for-merges-with-5-pushes/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 00:17:25 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[expand/collapse]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=524</guid>
		<description><![CDATA[In my goals post I outlined that I wanted to take on a new bug. This bug outlines that only merges that have &#62;5 pushes should be given expand/collapse functionality. Any merge that contains &#60;5 pushes should be shown normally. I guess, when the original expand/collapse bug was fixed we all forgot about this little [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">goals post</a> I outlined that I wanted to take on a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=486939" target="_blank">new bug</a>. This bug outlines that only merges that have &gt;5 pushes should be given expand/collapse functionality. Any merge that contains &lt;5 pushes should be shown normally. I guess, when the original <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=445560" target="_blank">expand/collapse bug</a> was fixed we all forgot about this little feature. No big deal though because I&#8217;m gonna fix it now.</p>
<p>The following is the current server-side code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">id</span> <span style="color: #66cc66;">!</span>= lastid:
  lastid = <span style="color: #008000;">id</span>
  p = parity.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;push&quot;</span><span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;user&quot;</span>: <span style="color: #dc143c;">user</span>,
                  <span style="color: #483d8b;">&quot;date&quot;</span>: localdate<span style="color: black;">&#40;</span>date<span style="color: black;">&#41;</span><span style="color: black;">&#125;</span><span style="color: black;">&#93;</span>
  <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>c <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> ctx.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> c.<span style="color: black;">node</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= nullid<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">1</span>:
    mergehidden = <span style="color: #483d8b;">&quot;hidden&quot;</span>
    entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;mergerollup&quot;</span><span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;count&quot;</span>: <span style="color: #ff4500;">0</span><span style="color: black;">&#125;</span><span style="color: black;">&#93;</span>
  <span style="color: #ff7700;font-weight:bold;">else</span>:
    mergehidden = <span style="color: #483d8b;">&quot;&quot;</span>
  currentpush = entry
<span style="color: #ff7700;font-weight:bold;">else</span>:
  entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;hidden&quot;</span><span style="color: black;">&#93;</span> = mergehidden
  <span style="color: #ff7700;font-weight:bold;">if</span> mergehidden:
    currentpush<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;mergerollup&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;count&quot;</span><span style="color: black;">&#93;</span> += <span style="color: #ff4500;">1</span>
entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;parity&quot;</span><span style="color: black;">&#93;</span> = p
l.<span style="color: black;">append</span><span style="color: black;">&#40;</span>entry<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>This is where the change will have to be made. Lets have a look here. On line 401 there&#8217;s an if statement that executes to true if the changeset has more than one parent, which means that it is a merge changeset. Then, the following lines setup the expand/collapse functionality. It is line 401 where I will make the change to implement this functionality.</p>
<p>A merge changset should have 2 parents. So, in order to find out how many pushes there are in the merge I just do a simple substraction between the rev number of parent 0 and the rev number of parent 1. The result will tell me how many pushes that merge contains. Only implement expand/collapse functionality for the merge if the result is greater than 5.</p>
<p>The new code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">id</span> <span style="color: #66cc66;">!</span>= lastid:
  lastid = <span style="color: #008000;">id</span>
  p = parity.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;push&quot;</span><span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;user&quot;</span>: <span style="color: #dc143c;">user</span>,
                  <span style="color: #483d8b;">&quot;date&quot;</span>: localdate<span style="color: black;">&#40;</span>date<span style="color: black;">&#41;</span><span style="color: black;">&#125;</span><span style="color: black;">&#93;</span>
  <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>c <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> ctx.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> c.<span style="color: black;">node</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= nullid<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">1</span> <span style="color: #ff7700;font-weight:bold;">and</span> ctx.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">rev</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - ctx.<span style="color: black;">parents</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">rev</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">5</span>:
    mergehidden = <span style="color: #483d8b;">&quot;hidden&quot;</span>
    entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;mergerollup&quot;</span><span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;count&quot;</span>: <span style="color: #ff4500;">0</span><span style="color: black;">&#125;</span><span style="color: black;">&#93;</span>
  <span style="color: #ff7700;font-weight:bold;">else</span>:
    mergehidden = <span style="color: #483d8b;">&quot;&quot;</span>
  currentpush = entry
<span style="color: #ff7700;font-weight:bold;">else</span>:
  entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;hidden&quot;</span><span style="color: black;">&#93;</span> = mergehidden
  <span style="color: #ff7700;font-weight:bold;">if</span> mergehidden:
    currentpush<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;mergerollup&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;count&quot;</span><span style="color: black;">&#93;</span> += <span style="color: #ff4500;">1</span>
entry<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;parity&quot;</span><span style="color: black;">&#93;</span> = p
l.<span style="color: black;">append</span><span style="color: black;">&#40;</span>entry<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>As you can see above I only needed to change line 401 to implement this change. It&#8217;s always great to be able to <a href="http://sidkalra.com/files/mercurial/dps911/screenshots/expand_collapse_greaterthan5.png">add new functionality</a> without needing additional lines of code. A win win!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-functionality-only-for-merges-with-5-pushes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>v1.0 Release &#8211; Expand/Collapse for the Files Touched Patch</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-for-the-files-touched-patch/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-for-the-files-touched-patch/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 19:47:08 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[filesTouched]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=513</guid>
		<description><![CDATA[In my goals blog post I stated that I wanted to add expand/collapse functionality to the files touched patch. Why you ask? Well the whole goal is to get the pushlog to show more information but in an unobtrusive manner. Right now this isn&#8217;t happening. Adding expand/collapse functionality will allow the user to decide when [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.sidkalra.com/2009/04/v10-release-goals/" target="_blank">goals blog post</a> I stated that I wanted to add expand/collapse functionality to the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=448707" target="_blank">files touched patch</a>. Why you ask? Well the whole goal is to get the <a href="http://hg.mozilla.org/mozilla-central/pushloghtml" target="_blank">pushlog</a> to show more information but in an unobtrusive manner. Right now this isn&#8217;t happening. Adding expand/collapse functionality will allow the user to decide when he wants to see the files and when he doesn&#8217;t.</p>
<p>I recently wrote a white paper on the <a href="http://www.iea.cc/browse.php?contID=what_is_ergonomics" target="_blank">ergonomics</a> of touch screens. One thing that I learnt from that exercise is that it is the application&#8217;s job to adapt to the user and not the other way around. The application will not succeed if the user is forced to adapt to the application. I think this concept applies to this situation where the pushlog provides the user the ability to hide or show the files touched instead of always showing them, which forces the user to adapt to the new look of the pushlog.</p>
<p><strong>The Implementation</strong></p>
<p>The map file</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">pushlogentry = '<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;parity#parity# #hidden# id#id#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>#push%pushinfo#<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;age&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{url}rev/#node|short#{sessionvars%urlparameter}&quot;</span>&gt;</span>#node|short#<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;filerow&quot;</span>&gt;</span>#author|person# <span style="color: #ddbb00;">&amp;mdash;</span> #desc|strip|escape|buglink#<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;filetouch fileid#id#&quot;</span>&gt;</span>{filesTouched}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;logtags&quot;</span>&gt;</span>{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>#mergerollup%mergehidden#<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>n'</pre></div></div>

<p>pushlog.tmpl</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #006600; font-style: italic;">// hide files touched</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.filetouch'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// Add expand/collapse link</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.filerow'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> pushid <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/fileidd+/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;br/&gt;&lt;span class=&quot;</span>filelink<span style="color: #3366CC;">&quot;&gt;hidden files &lt;a class=&quot;</span>expandfile fileid<span style="color: #3366CC;">&quot; + pushid + &quot;</span><span style="color: #3366CC;">&quot; href=&quot;</span>#<span style="color: #3366CC;">&quot;&gt;[Expand]&lt;/a&gt;&lt;/span&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// add click handler to unhide hidden things</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.expandfile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;[Expand]&quot;</span><span style="color: #009900;">&#41;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;[Collapse]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;[Expand]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> pushid <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pushid <span style="color: #339933;">=</span> <span style="color: #3366CC;">'.'</span> <span style="color: #339933;">+</span> pushid.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/fileidd+/</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span>pushid<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The above pushlog.tmpl code is placed inside <a href="http://www.learningjquery.com/2006/09/introducing-document-ready">$(document).ready()</a>. As you can see I basically hide all the files touched data on line 40. Then, I go through each files touched span and create the appropriate expand/collapse link on line 42. Lastly, I have the click handler that is responsible for displaying or hiding the files touched span. One important thing to note is that I must have a unique id (&#8220;fileid&#8221; in this case) for each expand/collapse link so that I know which files touched span to toggle. Without this unique id clicking on any one link would cause all links to expand/collapse, which we obviously don&#8217;t want. </p>
<p><img src="http://sidkalra.com/files/mercurial/dps911/screenshots/expandcollapsefilesTouch.png"/></p>
<p>There we have it, a nice and easy solution to this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-expandcollapse-for-the-files-touched-patch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>v1.0 Release Goals</title>
		<link>http://blog.sidkalra.com/2009/04/v10-release-goals/</link>
		<comments>http://blog.sidkalra.com/2009/04/v10-release-goals/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 20:44:28 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[DPS911]]></category>
		<category><![CDATA[Mercurial Project]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[goals]]></category>
		<category><![CDATA[v1.0]]></category>

		<guid isPermaLink="false">http://blog.sidkalra.com/?p=510</guid>
		<description><![CDATA[It&#8217;s that time now, time for my last release for the open source course at Seneca. I can&#8217;t believe how fast time has gone by. It just feels like yesterday that I had started out in the first version of the course and now it&#8217;s all almost over. Anyway, I&#8217;ll leave the reminiscing for later. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s that time now, time for my last release for the <a href="http://zenit.senecac.on.ca/wiki/index.php/DPS911" target="_blank">open source course</a> at <a href="http://www.senecac.on.ca/" target="_blank">Seneca</a>. I can&#8217;t believe how fast time has gone by. It just feels like yesterday that I had started out in the <a href="http://zenit.senecac.on.ca/wiki/index.php/DPS909" target="_blank">first version of the course</a> and now it&#8217;s all almost over. Anyway, I&#8217;ll leave the reminiscing for later. Lets take a look at what my plans are for this release.</p>
<p>I will be revisiting one of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=459727" target="_blank">my larger bugs</a>. I&#8217;ll look to re-write the client-side code to make it compatible with the current version of <a href="http://hg.mozilla.org/hg_templates" target="_blank">hg_templates</a>. Furthermore, I want to change the current code to take advantage of <a href="http://docs.jquery.com/" target="_blank">jquery</a> and make the localize dates link work with the new entries loaded onScroll.  Also, I want to improve the bug link functionality so that bugs that only have 5 digits in them are properly converted into links. Next, I&#8217;ll look to add expand/collapse functionality to the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=448707" target="_blank">files touched bug</a> and take on a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=486939" target="_blank">new bug</a>. All in all quite a lot to do. The following are my goals for this release:</p>
<ul>
<li><strong>Load more entries on scroll</strong> &#8211; Make onScroll functionality work with the new <a href="http://hg.mozilla.org/hg_templates/annotate/0ecbdfad931d/gitweb_mozilla/pushlog.tmpl" target="_blank">hg_templates/pushlog.tmpl</a>, re-write code to use jquery, make the localize dates link work with all new entries loaded on scroll and Improve bug functionality</li>
<li><strong>Add expand/collapse to files touched</strong></li>
<li><strong>Fix expand/collapse functionality for merges (new bug)</strong> &#8211; Expand/collapse functionality should only be added to merges that contain &gt;5 pushes</li>
</ul>
<p>Well, there&#8217;s some hard work ahead and I need to work fast because I have exams next week as well so my work will have to be efficient. However, I&#8217;m sure that I will be able to manage this situation. Only one more week to go and then my time at Seneca will come to an end. Four years gone in the blink of an eye, amazing!</p>
<p>Please navigate to the <a href="http://zenit.senecac.on.ca/wiki/index.php/Mercurial_history_browsing" target="_blank">project page</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sidkalra.com/2009/04/v10-release-goals/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

