<?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>Think Lamp</title>
	<atom:link href="http://www.think-lamp.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.think-lamp.com</link>
	<description>Everything Linux Apache Php Mysql</description>
	<lastBuildDate>Tue, 28 Feb 2012 21:41:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>SE Optimized search URL for opencart search</title>
		<link>http://www.think-lamp.com/2012/02/se-optimized-search-url-for-opencart-search/</link>
		<comments>http://www.think-lamp.com/2012/02/se-optimized-search-url-for-opencart-search/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 21:41:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[opencart]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=246</guid>
		<description><![CDATA[This snippet will change the search URL and make it more Search Engine and user friendly It changes the URL from http://demo.opencart.com/index.php?route=product/search&#038;filter_name=samsung tv to http://demo.opencart.com/search/samsung tv Under catalog/view/javascript/common.js change in two places: url = 'index.php?route=product/search'; to url = 'search'; also, change in two places url += '&#38;filter_name=' + encodeURIComponent(filter_name); to url +=' /' + encodeURIComponent(filter_name); <a href='http://www.think-lamp.com/2012/02/se-optimized-search-url-for-opencart-search/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This snippet will change the search URL and make it more Search Engine and user friendly<br />
It changes the URL from<br />
<strong>http://demo.opencart.com/index.php?route=product/search&#038;filter_name=samsung tv<br />
to<br />
http://demo.opencart.com/search/samsung tv</strong><br />
<span id="more-246"></span><br />
Under <strong>catalog/view/javascript/common.js</strong><br />
change in two places:</p>
<pre class="brush: jscript;">url = 'index.php?route=product/search';</pre>
<p>to</p>
<pre class="brush: jscript;">url = 'search';</pre>
<p>also, change in two places</p>
<pre class="brush: jscript;">url += '&amp;filter_name=' + encodeURIComponent(filter_name);</pre>
<p>to</p>
<pre class="brush: jscript;">url +=' /' + encodeURIComponent(filter_name);</pre>
<p>Under <strong>catlog/controller/common/seo_url.php </strong>[add lines 11 to 18 and line 58]</p>
<pre class="brush: php; highlight: [11,12,13,14,15,16,17,18,58]; html-script: true">
	public function index() {
		// Add rewrite to url class
		if ($this->config->get('config_seo_url')) {
			$this->url->addRewrite($this);
		}

		// Decode URL
		if (isset($this->request->get['_route_'])) {
			$parts = explode('/', $this->request->get['_route_']);

			if($parts[0] =='search')
			{
				$this->request->get['route'] = 'product/search';
				$this->request->get['filter_name'] = $parts[1];
				$this->request->get['filter_description'] = TRUE;
			}
			else
			{
				foreach ($parts as $part) {
					$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");

					if ($query->num_rows) {
						$url = explode('=', $query->row['query']);

						if ($url[0] == 'product_id') {
							$this->request->get['product_id'] = $url[1];
						}

						if ($url[0] == 'category_id') {
							if (!isset($this->request->get['path'])) {
								$this->request->get['path'] = $url[1];
							} else {
								$this->request->get['path'] .= '_' . $url[1];
							}
						}	

						if ($url[0] == 'manufacturer_id') {
							$this->request->get['manufacturer_id'] = $url[1];
						}

						if ($url[0] == 'information_id') {
							$this->request->get['information_id'] = $url[1];
						}
					} else {
						$this->request->get['route'] = 'error/not_found';
					}
				}

				if (isset($this->request->get['product_id'])) {
					$this->request->get['route'] = 'product/product';
				} elseif (isset($this->request->get['path'])) {
					$this->request->get['route'] = 'product/category';
				} elseif (isset($this->request->get['manufacturer_id'])) {
					$this->request->get['route'] = 'product/manufacturer/product';
				} elseif (isset($this->request->get['information_id'])) {
					$this->request->get['route'] = 'information/information';
				}
			}
			if (isset($this->request->get['route'])) {
				return $this->forward($this->request->get['route']);
			}
		}
	}
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2012%2F02%2Fse-optimized-search-url-for-opencart-search%2F&amp;linkname=SE%20Optimized%20search%20URL%20for%20opencart%20search"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2012/02/se-optimized-search-url-for-opencart-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allow HTML formatting in comments in Bug Genie</title>
		<link>http://www.think-lamp.com/2010/10/allow-html-formatting-in-comments-in-bug-genie-2/</link>
		<comments>http://www.think-lamp.com/2010/10/allow-html-formatting-in-comments-in-bug-genie-2/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 21:39:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[bug genie]]></category>
		<category><![CDATA[html formatting]]></category>
		<category><![CDATA[htmlentities]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=222</guid>
		<description><![CDATA[Bug Genie strips out HTML formatting in comments. I had a hard time with that as clients who were using this were copy pasting from third party and the formatting was lost. Initially I though that it stripped down HTML during POST and fixing that will fix my future comments. But, after few mins of <a href='http://www.think-lamp.com/2010/10/allow-html-formatting-in-comments-in-bug-genie-2/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Bug Genie strips out HTML formatting in comments. I had a hard time with that as clients who were using this were copy pasting from third party and the formatting was lost. Initially I though that it stripped down HTML during POST and fixing that will fix my future comments. But, after few mins of fondling around I made the &#8220;awesome&#8221; discovery that, Bug Genie doesn&#8217;t convert htmlentities during post, but during printing out. This would mean, all my past comments, which have HTML will work !!<br />
<span id="more-222"></span></p>
<p>Without further delay..</p>
<p>go to file</p>
<pre class="brush: plain;">./include/common_functions.inc.php</pre>
<p>find the function:</p>
<pre class="brush: php;"> function bugs_BBDecode($text, $formatting = true) </pre>
<p>comment out the first line in the function:</p>
<pre class="brush: php;">$text = bugs_sanitize_string($text); </pre>
<p>I haven&#8217;t tested this with other language packs /localization settings. This works fine with English Language.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2010%2F10%2Fallow-html-formatting-in-comments-in-bug-genie-2%2F&amp;linkname=Allow%20HTML%20formatting%20in%20comments%20in%20Bug%20Genie"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2010/10/allow-html-formatting-in-comments-in-bug-genie-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery, Accessing Iframe data and the shortcomings of $(document).ready</title>
		<link>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/</link>
		<comments>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 00:28:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[corss-domain]]></category>
		<category><![CDATA[crossdomain]]></category>
		<category><![CDATA[document.ready]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[window.onload]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=206</guid>
		<description><![CDATA[Have an iFrame inside a document and you need to access the iframe data and make decisions based on that data&#8230; Few problems Same Origin Policy Frame Load incomplete. No. 1 is easy, if the two Top Level Domain aren&#8217;t the same, you cannot read the iframe data. Even for the same domain and different <a href='http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Have an iFrame inside a document and you need to access the iframe data and make decisions based on that data&#8230;<br />
Few problems</p>
<ol>
<li> <a href="http://en.wikipedia.org/wiki/Same_origin_policy" target="_blank">Same Origin Policy </a></li>
<li>Frame Load incomplete.</li>
</ol>
<p><span id="more-206"></span></p>
<p>No. 1 is easy, if the two Top Level Domain aren&#8217;t the same, you cannot read the iframe data. Even for the same domain and different subdomains, one needs to write the following on the top of both client and the server:</p>
<pre class="brush: jscript;"> document.domain = &quot;mytopleveldomain.com&quot; </pre>
<p>No. 2</p>
<p>How to determine that the iframe has loaded completely in order to scan data off it ?<br />
Well,</p>
<pre class="brush: jscript;"> &lt;code&gt;$(document).ready(function()&lt;/code&gt;</pre>
<p>will surely tell you if the page has loaded, but it won&#8217;t wait for the iframe(s) inside the parent document to finish loading, before returning true.</p>
<p>One may think, this might work:</p>
<pre class="brush: jscript;">
$(document).ready(function() {

     $('#myIframe').ready(function() {
                // ALL CODE GOES HERE
     });
});
</pre>
<p>BUT, it doesn&#8217;t. The above code will tell you ONLY that the iframe loading has started, but won&#8217;t<br />
tell you if its done.</p>
<p>Solution:<br />
Well, the OLD window.onload to the rescue:</p>
<pre class="brush: jscript;">
window.onload = function () {
    $('#myIframe').ready(function() {
                // ALL CODE GOES HERE
     });
};
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2010%2F09%2Fjquery-accessing-iframe-data-and-the-shortcomings-of-document-ready%2F&amp;linkname=jQuery%2C%20Accessing%20Iframe%20data%20and%20the%20shortcomings%20of%20%24%28document%29.ready"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2010/09/jquery-accessing-iframe-data-and-the-shortcomings-of-document-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image with same path doesn&#8217;t show up due to cache in browsers</title>
		<link>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/</link>
		<comments>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 15:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=191</guid>
		<description><![CDATA[Browsers are designed to think that Images with same name don&#8217;t change rapidly so regularly.  This creates a problem in some cases where you have to reuse a  specific name Or a specific location for a system. One such case can be a social network which is designed in a way where the profile images <a href='http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Browsers are designed to think that Images with same name don&#8217;t change rapidly so regularly.  This creates a problem in some cases where you have to reuse a  specific name Or a specific location for a system.<br />
<span id="more-191"></span><br />
One such case can be a social network which is designed in a way where the profile images are always:</p>
<p><strong>http://www.mysite.com/users/images/user123/profile.jpg</strong></p>
<p>Now, on changing this image, sometimes browsers don&#8217;t clear cache and thus show the last image. In Order to solve this, use a random number at the end of the image location and you will be able to see that image. as browsers will not cache it.</p>
<p><strong>http://www.mysite.com/users/images/user123/profile.jpg?123</strong></p>
<p>One method that I used is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stamp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imageLocation</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.mysite.com/users/images/user123/profile.jpg?'</span><span style="color: #339933;">.</span><span style="color: #000088;">$stamp</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$imageLocation</span></pre></div></div>

<p>This should work.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2009%2F09%2Fimage-with-same-path-doesnt-show-up-due-to-cache-in-browsers%2F&amp;linkname=Image%20with%20same%20path%20doesn%26%238217%3Bt%20show%20up%20due%20to%20cache%20in%20browsers"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2009/09/image-with-same-path-doesnt-show-up-due-to-cache-in-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fastest Insertion Sort in PHP</title>
		<link>http://www.think-lamp.com/2009/08/fastest-insertion-sort-in-php/</link>
		<comments>http://www.think-lamp.com/2009/08/fastest-insertion-sort-in-php/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 20:20:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[analysis of algorithms]]></category>
		<category><![CDATA[insertion sort]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://www.think-lamp.com/?p=189</guid>
		<description><![CDATA[$numbers = array(2,3,4,5,1,8,11,0); $count = count($numbers); for($i=1;$i&#60;$count;$i++){ $j=$i-1; $key = $numbers[$i]; while($j&#62;=0 &#38;&#38; $numbers[$j] &#62; $key){ $numbers[$j+1] = $numbers[$j]; $numbers[$j]= $key; $j= $j-1; } } print_r($numbers);]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
$numbers = array(2,3,4,5,1,8,11,0);
$count = count($numbers);

for($i=1;$i&lt;$count;$i++){
	$j=$i-1;
	$key = $numbers[$i];
	while($j&gt;=0 &amp;&amp; $numbers[$j] &gt;  $key){
		$numbers[$j+1] = $numbers[$j];
		$numbers[$j]= $key;
		$j= $j-1;
	}
}
print_r($numbers);
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.think-lamp.com%2F2009%2F08%2Ffastest-insertion-sort-in-php%2F&amp;linkname=Fastest%20Insertion%20Sort%20in%20PHP"><img src="http://www.think-lamp.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.think-lamp.com/2009/08/fastest-insertion-sort-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

