<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>

<channel>
	<title>WebScepterWebScepter</title>
	<atom:link href="http://webscepter.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://webscepter.com</link>
	<description>ardy gotta do something, gotta go somewhere</description>
	<lastBuildDate>Fri, 30 Nov 2012 07:05:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>

		<copyright></copyright>
		<itunes:author></itunes:author>
		<itunes:summary>Just another WordPress weblog</itunes:summary>
		<itunes:explicit>No</itunes:explicit>
		<itunes:block>No</itunes:block>
		
		<item>
		<title>WordPress Config Setup on Multiple Environments</title>
		<link>http://webscepter.com/wordpress-config-setup-on-multiple-environments/</link>
		<comments>http://webscepter.com/wordpress-config-setup-on-multiple-environments/#comments</comments>
		<pubDate>Fri, 28 Sep 2012 05:02:49 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[config variables]]></category>
		<category><![CDATA[environment config]]></category>
		<category><![CDATA[local development]]></category>
		<category><![CDATA[php environment]]></category>
		<category><![CDATA[preview preview]]></category>
		<category><![CDATA[production environment]]></category>
		<category><![CDATA[stage preview]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-config.php]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=275</guid>
		<description><![CDATA[Let&#8217;s say, you&#8217;re working on a WordPress project where you have your local machine, staging environment (environment setup which is the same as or close to production), and production environment (deployed to the world wide web). WordPress has this config &#8230;<p class="read-more"><a href="http://webscepter.com/wordpress-config-setup-on-multiple-environments/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say, you&#8217;re working on a WordPress project where you have your local machine, staging environment (environment setup which is the same as or close to production), and production environment (deployed to the world wide web).</p>
<p>WordPress has this config file: wp-config.php. The problem with this is you have to separately configure it between different environments. For example moving from local setup to staging setup, you can sync both folders directly and set the staging config file as read-only. But the problem with this is you have to separately update both the staging and production config files.</p>
<p>Looking around, I stumbled upon <a  href="https://github.com/Abban/WordPress-Config-Bootstrap" title="WordPress-Config-Bootstrap" target="_blank">WordPress-Config-Bootstrap</a> on <a  href="https://github.com/" title="GitHub" target="_blank">GitHub</a>. It uses an array map of the environment and its domain, simple but smart:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// Define Environments</span><br />
<span style="color: #000088;">$environments</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'local'</span> &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'.local'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'development'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'.dev'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'staging'</span> &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'stage.'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'preview'</span> &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'preview.'</span><span style="color: #339933;">,</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>See the rest of the code <a  href="https://github.com/Abban/WordPress-Config-Bootstrap/blob/master/wp-config.php" title="WordPress-Config-Bootstrap" target="_blank">here</a>.</p>
<p>I <a  href="https://github.com/ardydedase/WordPress-Config-Bootstrap" title="WordPress-Config-Bootstrap" target="_blank">forked</a> it and came up with my own version where there are separate files for each environment. I think that it&#8217;s easier to maintain this way than compressing all the config variables for different environments in one file together. </p>
<p>The wp-config.php file will look like this:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// Define Environments here</span><br />
<span style="color: #666666; font-style: italic;">// Update this according to your needs</span><br />
<span style="color: #000088;">$environment_map</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'blog.yoursite.local'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'local'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'blog.yoursite.staging'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'staging'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'blog.yoursite.com'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'production'</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Get Server name</span><br />
<span style="color: #000088;">$server_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SERVER_NAME'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ENVIRONMENT'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$environment_map</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$server_name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ABSPATH'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$env_config</span> <span style="color: #339933;">=</span> ABSPATH <span style="color: #339933;">.</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-config-%s.php'</span><span style="color: #339933;">,</span> ENVIRONMENT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Terminate if file doesn't exist</span><br />
<span style="color: #666666; font-style: italic;">// if(!file_exists(($env_config)))&nbsp; exit(&quot;$env_config doesn't exist&quot;);</span><br />
<br />
<span style="color: #009933; font-style: italic;">/** Sets up WP config based on environment. */</span><br />
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$env_config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This is the part that determines which config file to use:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$env_config</span> <span style="color: #339933;">=</span> ABSPATH <span style="color: #339933;">.</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-config-%s.php'</span><span style="color: #339933;">,</span> ENVIRONMENT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>You will need to create one config file for each environment e.g. wp-config-local.php, wp-config-production.php, etc.</p>
<p>See my <a  href="https://github.com/ardydedase/WordPress-Config-Bootstrap" title="WordPress-Config-Bootstrap" target="_blank">forked version of WordPress-Config-Bootstrap</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d275').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d275" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;submitHeadline=WordPress+Config+Setup+on+Multiple+Environments&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;title=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;title=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;title=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;bm_description=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;T=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;title=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;title=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+WordPress+Config+Setup+on+Multiple+Environments+@+http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fwordpress-config-setup-on-multiple-environments%2F&amp;t=WordPress+Config+Setup+on+Multiple+Environments" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d275').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d275').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/wordpress-config-setup-on-multiple-environments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution to Apache Web Server and VirtualBox NFS Mounted File Cache Problems</title>
		<link>http://webscepter.com/solution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems/</link>
		<comments>http://webscepter.com/solution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems/#comments</comments>
		<pubDate>Sat, 18 Aug 2012 06:44:16 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[Server/Systems Engineering]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache web server]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cache problems]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[EnableMMAP]]></category>
		<category><![CDATA[EnableSendfile]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[linux setup]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[memory mapping]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[mounted]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[shared folder]]></category>
		<category><![CDATA[vbox]]></category>
		<category><![CDATA[virtual box]]></category>
		<category><![CDATA[virtual host]]></category>
		<category><![CDATA[virtual server]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[web server directory]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=267</guid>
		<description><![CDATA[I have my VirtualBox installed on my Mac OS X Lion spinning a Virtual CentOS instance where my LAMP stack is running. This idea of a virtual server environment is really neat because it gives me the luxury to develop &#8230;<p class="read-more"><a href="http://webscepter.com/solution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>I have my <a  href="https://www.virtualbox.org/" title="VirtualBox" target="_blank">VirtualBox</a> installed on my Mac OS X Lion  spinning a Virtual CentOS instance where my LAMP stack is running. This idea of a virtual server environment is really neat because it gives me the luxury to develop in a Linux environment close enough to my Linux setup in production. But I encountered a problem that seems simple but I couldn&#8217;t find an obvious solution &#8211; shared folder caching problem. </p>
<p>Every time I make changes in my JS/CSS files, it doesn&#8217;t get updated on the web page itself. I checked the file in the web server directory itself and it&#8217;s updated. But when I try to access it via its url, I couldn&#8217;t see the changes that I made. Which made me think that it has something to do with Apache and not VirtualBox. </p>
<p>After extensive googling and researching, I stumbled into these Apache directives:</p>
<ul>
<li><a  href="http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap" title="EnableMMAP" target="_blank">EnableMMAP</a></li>
<li><a  href="http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile" title="EnableSendFile" target="_blank">EnableSendfile</a></li>
</ul>
<p>The solution is to disable the above directives which are enabled by default. So basically we&#8217;re disabling memory mapping (EnableMMAP) which is not good when we&#8217;re working with NFS mounted files. We&#8217;re also disabling apache&#8217;s sendfile (EnableSendFile) support which basically reads static file from buffer or cache without reading the actual file itself.</p>
<p>Here&#8217;s how your configuration will look like:</p>
<div class="codecolorer-container apache default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">Directory</span> <span style="color: #7f007f;">&quot;/path/to/document_root/&quot;</span>&gt;<br />
<span style="color: #adadad; font-style: italic;"># Some other directives here</span><br />
<br />
<span style="color: #00007f;">EnableMMAP</span> <span style="color: #0000ff;">Off</span><br />
<span style="color: #00007f;">EnableSendfile</span> <span style="color: #0000ff;">Off</span><br />
&lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;</div></div>
<p>I hope that it works for you and saved you from spending too much time finding out the solution.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d267').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d267" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;submitHeadline=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;title=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;title=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;title=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;bm_description=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;T=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;title=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;title=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems+@+http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fsolution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems%2F&amp;t=Solution+to+Apache+Web+Server+and+VirtualBox+NFS+Mounted+File+Cache+Problems" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d267').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d267').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/solution-to-apache-web-server-and-virtualbox-nfs-mounted-file-cache-problems/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon S3&#8242;s PermanentRedirect and cURL error code 51 Problems</title>
		<link>http://webscepter.com/amazon-s3s-permanentredirect-and-curl-error-code-51-problems/</link>
		<comments>http://webscepter.com/amazon-s3s-permanentredirect-and-curl-error-code-51-problems/#comments</comments>
		<pubDate>Thu, 02 Aug 2012 08:17:31 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[amazon s3 sdk for php]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cURL error code 51]]></category>
		<category><![CDATA[exact error message]]></category>
		<category><![CDATA[haxx]]></category>
		<category><![CDATA[hostid]]></category>
		<category><![CDATA[PermanentRedirect]]></category>
		<category><![CDATA[target host]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=253</guid>
		<description><![CDATA[I&#8217;ve spent hours figuring out the cause of the errors I recently encountered in my build script. Part of my build script is to upload files to Amazon S3 using the AWS SDK for PHP 1.5.5. The tricky part was &#8230;<p class="read-more"><a href="http://webscepter.com/amazon-s3s-permanentredirect-and-curl-error-code-51-problems/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve spent hours figuring out the cause of the errors I recently encountered in my build script. Part of my build script is to upload files to Amazon S3 using the AWS SDK for PHP 1.5.5. The tricky part was that it works on Mac OSX, remote Red Hat and CentOS servers, and in our company&#8217;s intranet CentOS. But it&#8217;s having problems in my VirtualBox CentOS setup. Here are the errors:</p>
<p><strong>cURL error code</strong><br />
The exact error message:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">PHP Fatal error<span style="color: #339933;">:</span> &nbsp;Uncaught exception <span style="color: #0000ff;">'cURL_Exception'</span> with message <span style="color: #0000ff;">'cURL resource: Resource id #81; cURL error: SSL: certificate subject name '</span><span style="color: #339933;">*.</span>s3<span style="color: #339933;">.</span>amazonaws<span style="color: #339933;">.</span>com<span style="color: #0000ff;">' does not match target host name '</span>xxx<span style="color: #339933;">.</span>xxx<span style="color: #339933;">.</span>xxx<span style="color: #339933;">.</span>com<span style="color: #339933;">.</span>s3<span style="color: #339933;">.</span>amazonaws<span style="color: #339933;">.</span>com<span style="color: #0000ff;">' (cURL error code 51). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.'</span></div></div>
<p>Possible cause:<br />
SSL certificate is either too new or too old for this particular version of OpenSSL.</p>
<p>Solution:<br />
Add this line:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$s3</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path_style</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></div></div>
<p>after the instantiation of the AmazonS3 class:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$s3</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AmazonS3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$s3</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path_style</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></div></div>
<p><strong>PermanentRedirect</strong><br />
After I managed to solve the &#8216;cURL error code 51&#8242; problem. I encountered another one, here&#8217;s part of the json response I get from AmazonS3:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;body&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; object<span style="color: #009900;">&#40;</span>CFSimpleXML<span style="color: #009900;">&#41;</span><span style="color: #666666; font-style: italic;">#17 (6) {<br />
</span> &nbsp; &nbsp;<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Code&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;PermanentRedirect&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Message&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">137</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;RequestId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;xxxxxxxx&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Bucket&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">23</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;xxx.xxx.xxx.com&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HostId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">64</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;xxxxx&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Endpoint&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; &nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;xxx.xxx.xxx.com.s3.amazonaws.com&quot;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;status&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; int<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">301</span><span style="color: #009900;">&#41;</span></div></div>
<p>Possible Cause:<br />
Endpoint or location is not specified.</p>
<p>Solution:<br />
Specify the endpoint/location based your server&#8217;s current location. In my case, my VirtualBox is in Singapore.<br />
Singapore is in South East Asia, so I just need to add this line in between the instantiation and set_region call:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$s3</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_region</span><span style="color: #009900;">&#40;</span>AmazonS3<span style="color: #339933;">::</span><span style="color: #004000;">REGION_APAC_SE1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Final code will look like:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$s3</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AmazonS3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$s3</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_region</span><span style="color: #009900;">&#40;</span>AmazonS3<span style="color: #339933;">::</span><span style="color: #004000;">REGION_APAC_SE1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$s3</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path_style</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></div></div>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d253').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d253" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;submitHeadline=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;title=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;title=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;title=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;bm_description=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;T=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;title=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;title=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems+@+http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Famazon-s3s-permanentredirect-and-curl-error-code-51-problems%2F&amp;t=Amazon+S3%26%238242%3Bs+PermanentRedirect+and+cURL+error+code+51+Problems" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d253').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d253').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/amazon-s3s-permanentredirect-and-curl-error-code-51-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing modules for a specific Python version in your Mac OSX Lion</title>
		<link>http://webscepter.com/installing-modules-for-a-specific-python-version-in-your-mac-osx-lion/</link>
		<comments>http://webscepter.com/installing-modules-for-a-specific-python-version-in-your-mac-osx-lion/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 02:39:42 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[os x lion]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=248</guid>
		<description><![CDATA[Note: I am using Mac OSX 10.7.3 with XCode 4.3.2 I came across this problem lately where I need a certain module to run a script that is only compatible with Python 2.6. My default Python version is 2.7. So &#8230;<p class="read-more"><a href="http://webscepter.com/installing-modules-for-a-specific-python-version-in-your-mac-osx-lion/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p><em>Note: I am using Mac OSX 10.7.3 with XCode 4.3.2</em></p>
<p>I came across this problem lately where I need a certain module to run a script that is only compatible with Python 2.6. My default Python version is 2.7. So if I install using easy_instal, the system will install the module for Python 2.7 only. So in this case, when I run Python 2.6, I don&#8217;t have the module that I just installed. Then I found out how easy it is to do it.</p>
<p>In your mac, you have multiple versions of Python installed:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>System<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Frameworks<span style="color: #000000; font-weight: bold;">/</span>Python.framework<span style="color: #000000; font-weight: bold;">/</span>Versions<br />
$ <span style="color: #c20cb9; font-weight: bold;">ls</span><br />
$ <span style="color: #000000;">2.3</span> &nbsp; &nbsp; <span style="color: #000000;">2.5</span> &nbsp; &nbsp; <span style="color: #000000;">2.6</span> &nbsp; &nbsp; <span style="color: #000000;">2.7</span> &nbsp; &nbsp; Current</div></div>
<p>Which means that you also have multiple version of easy_install. So if you type easy_install and &#8216;double tab&#8217;. You will get:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ easy_install<br />
$ easy_install &nbsp; &nbsp; &nbsp;easy_install-<span style="color: #000000;">2.5</span> &nbsp;easy_install-<span style="color: #000000;">2.6</span> &nbsp;easy_install-<span style="color: #000000;">2.7</span></div></div>
<p>This represents easy_install for each version. </p>
<p>The obvious conclusion is:<br />
e.g. If you want to install a module for a Python 2.6:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> easy_install-<span style="color: #000000;">2.6</span> <span style="color: #000000; font-weight: bold;">&lt;</span>modulename<span style="color: #000000; font-weight: bold;">&gt;</span></div></div>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d248').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d248" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;submitHeadline=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;title=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;title=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;title=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;bm_description=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;T=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;title=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;title=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion+@+http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Finstalling-modules-for-a-specific-python-version-in-your-mac-osx-lion%2F&amp;t=Installing+modules+for+a+specific+Python+version+in+your+Mac+OSX+Lion" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d248').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d248').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/installing-modules-for-a-specific-python-version-in-your-mac-osx-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Comet Implementation Using PHP and jQuery</title>
		<link>http://webscepter.com/simple-comet-implementation-using-php-and-jquery/</link>
		<comments>http://webscepter.com/simple-comet-implementation-using-php-and-jquery/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 10:01:54 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[comet]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=216</guid>
		<description><![CDATA[I have been researching about the Comet application model recently. I stumbled upon a great article from Zeitoun.net in which their AJAX implementation example is written in PHP and ProtoType (a JavaScript Framework). I decided to modify the Classic AJAX/ProtoType Implementation &#8230;<p class="read-more"><a href="http://webscepter.com/simple-comet-implementation-using-php-and-jquery/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>I have been researching about the Comet application model recently. I stumbled upon a <a  title="How to implement COMET with PHP" href="http://www.zeitoun.net/articles/comet_and_php/start" target="_blank">great article from Zeitoun.net</a> in which their AJAX implementation example is written in <a  title="PHP" href="http://www.php.net/" target="_blank">PHP</a> and <a  title="ProtoType JS" href="http://www.prototypejs.org/" target="_blank">ProtoType</a> (a JavaScript Framework). I decided to modify the Classic AJAX/ProtoType Implementation to use  jQuery &#8211; my JavaScript framework of choice thus far. This is only the client side of the entire architecture when you&#8217;re dealing with huge databases and web services but at least this gets you started.</p>
<p>We&#8217;ll be using 3 files here:</p>
<ul>
<li>backend.php</li>
<li>data.txt</li>
<li>index.html</li>
</ul>
<p>Both backend.php and data.txt stayed the same as the original example. I only modified index.html&#8217;s JavaScript block to look  like this:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> Comet <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>data_url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">timestamp</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">url</span> <span style="color: #339933;">=</span> data_url<span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">noerror</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">connect</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><br />
<span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
<br />
$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span><br />
url <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">url</span><span style="color: #339933;">,</span><br />
dataType <span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span><br />
data <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'timestamp'</span> <span style="color: #339933;">:</span> self.<span style="color: #660066;">timestamp</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
success <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
self.<span style="color: #660066;">timestamp</span> <span style="color: #339933;">=</span> response.<span style="color: #660066;">timestamp</span><span style="color: #339933;">;</span><br />
self.<span style="color: #660066;">handleResponse</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
self.<span style="color: #660066;">noerror</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
complete <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #006600; font-style: italic;">// send a new ajax request when this request is finished</span><br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>self.<span style="color: #660066;">noerror</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #006600; font-style: italic;">// if a connection problem occurs, try to reconnect each 5 seconds</span><br />
setTimeout<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> comet.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #006600; font-style: italic;">// persistent connection</span><br />
self.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
self.<span style="color: #660066;">noerror</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">disconnect</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: #009900;">&#125;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">handleResponse</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'<br />
&lt;div&gt;'</span> <span style="color: #339933;">+</span> response.<span style="color: #660066;">msg</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/div&gt;<br />
'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">doRequest</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span><br />
url <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">url</span><span style="color: #339933;">,</span><br />
data <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'msg'</span> <span style="color: #339933;">:</span> request<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> comet <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Comet<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'./backend.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
comet.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>For more details, check out the <a  title="How to implement COMET with PHP" href="http://www.zeitoun.net/articles/comet_and_php/start" target="_blank">article</a> where I based this from. Happy hacking!</p>
<p><a  href="https://github.com/ardydedase/jquery-comet" title="jQuery Comet on GitHub">jQuery Comet on GitHub</a></p>
<p>Download:<br />
<div class="media_container media_attachment">
<a  href="http://webscepter.com/wp-content/uploads/2012/03/comet-ajax.zip" class="download_event no_icon" style="background-image: url(http://webscepter.com/wp-includes/images/crystal/archive.png);">
Comet Ajax (jQuery)
</a>
</div></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d216').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d216" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;submitHeadline=Simple+Comet+Implementation+Using+PHP+and+jQuery&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;title=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;title=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;title=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;bm_description=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;T=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;title=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;title=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Simple+Comet+Implementation+Using+PHP+and+jQuery+@+http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fsimple-comet-implementation-using-php-and-jquery%2F&amp;t=Simple+Comet+Implementation+Using+PHP+and+jQuery" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d216').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d216').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/simple-comet-implementation-using-php-and-jquery/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<enclosure url="http://webscepter.com/wp-content/uploads/2012/03/comet-ajax.zip" length="1700" type="application/zip" />
		<itunes:author>Ardy Dedase</itunes:author>
		<itunes:summary>I have been researching about the Comet application model recently. I stumbled upon a great article from Zeitoun.net&nbsp;in which their AJAX implementation example is written in PHP and ProtoType (a JavaScript Framework). I decided to modify the Classic AJAX/ProtoType Implementation &amp;hellip;Read more &amp;raquo;</itunes:summary>
		<itunes:keywords>JavaScript, jQuery, PHP, Software Engineering, comet</itunes:keywords>
		
	</item>
		<item>
		<title>Thoughts, moving on to mig33</title>
		<link>http://webscepter.com/thoughts-moving-on-to-mig33/</link>
		<comments>http://webscepter.com/thoughts-moving-on-to-mig33/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 05:07:00 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[Self Expression]]></category>
		<category><![CDATA[bugis]]></category>
		<category><![CDATA[company in singapore]]></category>
		<category><![CDATA[father time]]></category>
		<category><![CDATA[great engineers]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[living in singapore]]></category>
		<category><![CDATA[mig33]]></category>
		<category><![CDATA[muvee]]></category>
		<category><![CDATA[redis]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[yolk]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=187</guid>
		<description><![CDATA[Another chapter of my career is starting to unfold. After working at Yolk for 8 months, I&#8217;m moving on to mig33. My new job will commence on 17th October, 2011; which also roughly marks my 3rd year working and living &#8230;<p class="read-more"><a href="http://webscepter.com/thoughts-moving-on-to-mig33/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>Another chapter of my career is starting to unfold. After working at <a  href="http://yolk.com.sg/" title="Yolk, a Grey Group Company" target="_blank">Yolk</a> for 8 months, I&#8217;m moving on to <a  href="http://www.mig33.com/" title="mig33" target="_blank">mig33</a>. My new job will commence on 17th October, 2011; which also roughly marks my 3rd year working and living in Singapore. </p>
<p>Father time is indeed deceiving, how he passes by so fast without noticing him. I can vividly remember my first day at my first job in Singapore when I was looking for <a  href="http://www.muvee.com/en/" title="muvee Techonologies" target="_blank">muvee</a>&#8216;s office, getting lost, going to City Hall instead of Bugis. Until I finally found the office, I was then warmly welcomed by two great engineers/colleagues who inspired me (<a  href="http://timotheegroleau.com/" title="Timothee Groleau" target="_blank">Tim</a> and Tjerk).</p>
<p>Now I&#8217;m very excited to start a new job again. I&#8217;m gonna be working on exciting projects that has over 50 million users, which is something new for me. It&#8217;s about time to study and work on technologies like <a  href="http://hadoop.apache.org/" title="Hadoop" target="_blank">Hadoop</a>, <a  href="http://memcached.org/" title="Memcached" target="_blank">Memcached</a>, <a  href="http://redis.io/" title="Redis" target="_blank">Redis</a>, and <a  href="http://www.mongodb.org/" title="MongoDB" target="_blank">MongoDB</a>. Then get my skill levels up on Python. Also, I&#8217;ll sharpen my OOP and Design Patterns knowledge. </p>
<p>mig33 will be my 3rd company in Singapore. I feel very blessed to be able to work again with great ex-colleagues: Tim and Ali. Good luck to me. <img src='http://webscepter.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d187').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d187" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;submitHeadline=Thoughts%2C+moving+on+to+mig33&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;title=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;title=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;title=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;bm_description=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;T=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;title=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;title=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Thoughts%2C+moving+on+to+mig33+@+http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fthoughts-moving-on-to-mig33%2F&amp;t=Thoughts%2C+moving+on+to+mig33" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d187').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d187').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/thoughts-moving-on-to-mig33/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fibonacci in Python compared to C-style Languages</title>
		<link>http://webscepter.com/fibonacci-in-python-compared-to-c-style-languages/</link>
		<comments>http://webscepter.com/fibonacci-in-python-compared-to-c-style-languages/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 10:22:49 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[c style]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[fibonacci function]]></category>
		<category><![CDATA[Fibonacci series]]></category>
		<category><![CDATA[learning python]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scalable applications]]></category>
		<category><![CDATA[simultaneous variable assignment]]></category>
		<category><![CDATA[variable sum]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=168</guid>
		<description><![CDATA[I have played around with Python these past few months. Learning Python will make you realize some of the not so good things about PHP and other similar C-style Languages. But I&#8217;m not going to delve into their comparison, you &#8230;<p class="read-more"><a href="http://webscepter.com/fibonacci-in-python-compared-to-c-style-languages/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>I have played around with <a  href="http://www.python.org/" title="Python" target="_blank">Python</a> these past few months. Learning Python will make you realize some of the not so good things about <a  href="http://php.net/" title="PHP" target="_blank">PHP</a> and other similar C-style Languages. But I&#8217;m not going to delve into their comparison, you can find a good article about <a  href="http://wiki.python.org/moin/PythonVsPhp" title="Python vs PHP" target="_blank">that subject here</a>.</p>
<p>What got me intrigued is how I was able to implement the classic Fibonacci function in Python without having to use an extra variable that should be present in both PHP or Javascript implementation.</p>
<p>First I&#8217;ll show you how it is implemented in both JavaScript and PHP: </p>
<p>JavaScript: (Copy and run in your browser&#8217;s JS console to see it in action now!)</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #003366; font-weight: bold;">function</span> fib<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> b <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>b <span style="color: #339933;">&lt;</span> n<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; sum <span style="color: #339933;">=</span> a <span style="color: #339933;">+</span> b<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; a <span style="color: #339933;">=</span> b<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; b <span style="color: #339933;">=</span> sum<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
fib<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>PHP:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">function</span> fib<span style="color: #009900;">&#40;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$b</span> <span style="color: #339933;">.</span> PHP_EOL<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$sum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sum</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
fib<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>You&#8217;ll notice that both JavaScript and PHP use the following variables: <em>n, a, b,</em> and <em>sum</em>. Variable <em>n</em> will be the size or the limit of the series while <em>a, b</em> and <em>sum</em> are there to help determine what numbers to display.</p>
<p>Now it&#8217;s Python&#8217;s turn:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">def</span> fib<span style="color: black;">&#40;</span>n<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; a<span style="color: #66cc66;">,</span> b <span style="color: #66cc66;">=</span> <span style="color: #ff4500;">0</span><span style="color: #66cc66;">,</span> <span style="color: #ff4500;">1</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">while</span><span style="color: black;">&#40;</span>b <span style="color: #66cc66;">&lt;</span> n<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>b<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; a<span style="color: #66cc66;">,</span> b <span style="color: #66cc66;">=</span> b<span style="color: #66cc66;">,</span> a + b<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
fib<span style="color: black;">&#40;</span><span style="color: #ff4500;">60</span><span style="color: black;">&#41;</span></div></div>
<p>For Python, it doesn&#8217;t need to use the extra variable <em>sum</em>. This is because you can <strong><a  href="http://hhh.gavilan.edu/dvantassel/history/assignment.html#_Toc123623873" title="Simultaneous Variable Assignment in Python" target="_blank">assign variables simultaneously in Python</a></strong> just like in Ruby and Perl. </p>
<p>This is one of those little things that we might overlook when building applications. Yes, we only saved one variable in this Fibonacci function. But how much more when we build more complex applications? When we&#8217;ll need to strategically assign variables in large and scalable applications?</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d168').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d168" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;submitHeadline=Fibonacci+in+Python+compared+to+C-style+Languages&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;title=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;title=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;title=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;bm_description=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;T=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;title=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;title=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Fibonacci+in+Python+compared+to+C-style+Languages+@+http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Ffibonacci-in-python-compared-to-c-style-languages%2F&amp;t=Fibonacci+in+Python+compared+to+C-style+Languages" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d168').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d168').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/fibonacci-in-python-compared-to-c-style-languages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Implementing Inheritance for jQueryUI Dialog Boxes</title>
		<link>http://webscepter.com/implementing-inheritance-for-jqueryui-dialog-boxes/</link>
		<comments>http://webscepter.com/implementing-inheritance-for-jqueryui-dialog-boxes/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 04:21:31 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[border thickness]]></category>
		<category><![CDATA[dialog boxes]]></category>
		<category><![CDATA[dialogbox]]></category>
		<category><![CDATA[editbox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript inheritance]]></category>
		<category><![CDATA[javascript oop]]></category>
		<category><![CDATA[message dialog]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=118</guid>
		<description><![CDATA[First of all, nothing fancy here. Just want to show you a good way to implement Inheritance on jQueryUI Dialog Boxes. Here is one way to take advantage of Javascript’s Inheritance capability. We can use inheritance for jQuery UI dialog &#8230;<p class="read-more"><a href="http://webscepter.com/implementing-inheritance-for-jqueryui-dialog-boxes/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>First of all, nothing fancy here. Just want to show you a good way to implement Inheritance on jQueryUI Dialog Boxes. Here is one way to take advantage of <a  href="http://webscepter.com/implementing-inheritance-for-jqueryui-dialog-boxes/">Javascript’s Inheritance</a> capability.  We can use inheritance for <a  href="http://jqueryui.com/demos/dialog/" target="_blank">jQuery UI dialog boxes</a> &#8211; e.g. we have the parent ‘DialogBox’ which will have the basic properties like width, height, border colour,  border thickness, close box, etc. Then all these basic properties of the parent ‘DialogBox’ will be inherited by its children classes like ‘MessageBox’, ‘LoginBox’, ‘EditBox’, and ‘UploadBox’. These children classes will have its own unique properties as well. Which will make the implementation look like this:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> dbox <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> StatusMessageBox<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'message here..'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// this will initialize the message dialog box</span><br />
dbox.<span style="color: #660066;">render</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;">// this will render the message dialog box</span></div></div>
<p>Time to dissect the classes. Let&#8217;s start with the parent class &#8216;DialogBox&#8217; &#8211; this is where all the basic and common properties will be set. Please refer to the code comments for more details:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> DialogBox <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>properties<span style="color: #339933;">,</span> attr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">properties</span> <span style="color: #339933;">=</span> properties<span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">attr</span> <span style="color: #339933;">=</span> attr<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
DialogBox.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">preRender</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><br />
<span style="color: #006600; font-style: italic;">// do something before rendering the dialog box</span><br />
<span style="color: #009900;">&#125;</span><br />
DialogBox.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">postRender</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><br />
<span style="color: #006600; font-style: italic;">// do something after the redering the dialog box</span><br />
<span style="color: #009900;">&#125;</span><br />
DialogBox.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">render</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>appendElt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #006600; font-style: italic;">//this.preRender(this.dialogContent);</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> appendElt <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>appendElt<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> appendElt <span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#container'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> defaultAttr <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #3366CC;">'class'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'dialog_box'</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> defaultProperties <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #3366CC;">'title'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'Message'</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'width'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'350'</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'height'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'auto'</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'modal'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'resizable'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'buttons'</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #3366CC;">'OK'</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><br />
$<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;">dialog</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'close'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'open'</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><br />
self.<span style="color: #660066;">postRender</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
<span style="color: #3366CC;">'beforeClose'</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><br />
<span style="color: #006600; font-style: italic;">//$(this).dialog('destroy');</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// overwrite the default properties and attributes if necessary</span><br />
$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>defaultProperties<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">properties</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>defaultAttr<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// create the element</span><br />
<span style="color: #003366; font-weight: bold;">var</span> dialog <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;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span>defaultAttr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dialogContent</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>dialog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// append the box to the parent element</span><br />
dialog.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>appendElt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// apply the dialog box properties</span><br />
dialog.<span style="color: #660066;">dialog</span><span style="color: #009900;">&#40;</span>defaultProperties<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp;<span style="color: #006600; font-style: italic;">// make this accessible outside</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dialogObj</span> <span style="color: #339933;">=</span> dialog<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>As you can see, the base class is setting up the possible common properties among dialog boxes. Let&#8217;s move on to the &#8216;StatusMessageBox&#8217; class below. This type of dialog box will prompt for messages e.g. error or success messages. You can initialize its message property which will set the message to be prompted by the message box. &#8216;StatusMessageBox&#8217; is also inheriting its basic properties from its parent: &#8216;DialogBox&#8217;.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">/**<br />
* Display simple status message<br />
*<br />
*/</span><br />
<span style="color: #003366; font-weight: bold;">var</span> StatusMessageBox <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #006600; font-style: italic;">// create the dialog box content</span><br />
<span style="color: #003366; font-weight: bold;">var</span> defaultMsg <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> msg <span style="color: #339933;">:</span> <span style="color: #3366CC;">'default message'</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dialogContent</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;">'p'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>defaultMsg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #006600; font-style: italic;">/**<br />
* inherit from DialogBox<br />
*/</span><br />
StatusMessageBox.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> DialogBox<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
StatusMessageBox.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">constructor</span> <span style="color: #339933;">=</span> StatusMessageBox<span style="color: #339933;">;</span></div></div>
<p>Concept is the same with the rest of DialogBox&#8217;s children like: &#8216;LoginBox&#8217;, &#8216;EditBox&#8217;, and &#8216;UploadBox&#8217;. Please take note that &#8216;UploadBox&#8217; in the demo is dependent on uploadify and swfobject.</p>
<p>Suggestions and ideas for improvement will be greatly appreciated.</p>
<p>Time to play:</p>
<p><a  href="http://lab.webscepter.com/inheritance-dbox/js/dialogbox.js" target="_blank">The class itself</a>.<br />
<a  href="http://lab.webscepter.com/inheritance-dbox/" target="_blank">Live demo</a>.<br />
<div class="media_container media_attachment">
<a  href="http://webscepter.com/wp-content/uploads/2011/07/inheritance-dbox.rar" class="download_event no_icon" style="background-image: url(http://webscepter.com/wp-includes/images/crystal/archive.png);">
Downloadable demo
</a>
</div></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d118').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d118" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;submitHeadline=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;title=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;title=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;title=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;bm_description=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;T=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;title=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;title=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Implementing+Inheritance+for+jQueryUI+Dialog+Boxes+@+http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fimplementing-inheritance-for-jqueryui-dialog-boxes%2F&amp;t=Implementing+Inheritance+for+jQueryUI+Dialog+Boxes" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d118').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d118').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/implementing-inheritance-for-jqueryui-dialog-boxes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<enclosure url="http://webscepter.com/wp-content/uploads/2011/07/inheritance-dbox.rar" length="194837" type="application/x-rar-compressed" />
		<itunes:author>Ardy Dedase</itunes:author>
		<itunes:summary>First of all, nothing fancy here. Just want to show you a good way to implement Inheritance on jQueryUI Dialog Boxes. Here is one way to take advantage of Javascript&rsquo;s Inheritance capability. We can use inheritance for jQuery UI dialog &amp;hellip;Read more &amp;raquo;</itunes:summary>
		<itunes:keywords>jQuery, border thickness, dialog boxes, dialogbox, editbox, javascript, javascript inheritance, javascript oop, message dialog</itunes:keywords>
		
	</item>
		<item>
		<title>Fix for pinify&#8217;s createThumbbarButtons function bug</title>
		<link>http://webscepter.com/fix-for-pinifys-createthumbbarbuttons-function-bug/</link>
		<comments>http://webscepter.com/fix-for-pinifys-createthumbbarbuttons-function-bug/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 10:53:17 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[createThumbbarButtons]]></category>
		<category><![CDATA[ie9]]></category>
		<category><![CDATA[internet explorer 9]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[object doesn]]></category>
		<category><![CDATA[pinify]]></category>
		<category><![CDATA[thumbnail preview]]></category>
		<category><![CDATA[web developers]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=107</guid>
		<description><![CDATA[If you are using pinify&#8216;s createThumbbarButtons function, and you got stuck finding ways to make it work. Then this article is for you. I&#8217;m dealing with jQuery pinify version 1.2 here. First of all, they did a great job with &#8230;<p class="read-more"><a href="http://webscepter.com/fix-for-pinifys-createthumbbarbuttons-function-bug/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>If you are using <a  href="http://ie9ify.codeplex.com/" target="_blank">pinify</a>&#8216;s <strong>createThumbbarButtons</strong> function, and you got stuck finding ways to make it work. Then this article is for you. I&#8217;m dealing with jQuery pinify version 1.2 here.</p>
<p>First of all, they did a great job with pinify &#8211; it makes life easier for web developers who want or who are required to make use if IE9&#8242;s browser pinning feature. My task was to implement <a  href="http://buildmypinnedsite.com/#step_4" target="_blank">thumbnail preview controls</a> in one of the sites I&#8217;m working on.</p>
<p>After diligently following the documentation and pinify&#8217;s example, I found myself stuck in getting it to work. Until I finally decided to dissect jquery.pinify.js. I looked for the createThumbbarButtons function and I found it with a try/catch statement. With catch statement left empty, I inserted console.log(&#8216;createThumbbarButtons error: &#8216; + e.description); under the catch(e) declaration. It ended up spitting a <strong>&#8220;Object doesn&#8217;t support property or method &#8216;addEventListener&#8217;&#8221; </strong>error.</p>
<p><span style="text-decoration: line-through;">Stupid IE as usual, it&#8217;s having problems with <strong>addEventListener</strong>. This error is caused by document.addEventListener(&#8216;msthumbnailclick&#8217;, clickCurrent, false); which is only found within the createThumbbarButtons function. The solution is to replace the addEventListener statement with a good old <a  href="http://api.jquery.com/bind/" target="_blank">jQuery bind</a>:</span></p>
<p><span style="text-decoration: line-through;">$(document).bind(&#8216;msthumbnailclick&#8217;, clickCurrent);</span></p>
<p>Update: Okay, the correct solution for this is to add the following tag within your head tag:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;X-UA-Compatible&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;IE=9&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></div>
<p>This will force the browser to use IE9 compatibility mode if it is available. And this will recognize addEventListener without any errors.</p>
<p>Finally it worked. =)</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d107').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d107" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;submitHeadline=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;title=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;title=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;title=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;bm_description=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;T=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;title=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;title=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug+@+http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Ffix-for-pinifys-createthumbbarbuttons-function-bug%2F&amp;t=Fix+for+pinify%26%238217%3Bs+createThumbbarButtons+function+bug" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d107').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d107').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/fix-for-pinifys-createthumbbarbuttons-function-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A weird PHP behavior</title>
		<link>http://webscepter.com/a-weird-php-behavior/</link>
		<comments>http://webscepter.com/a-weird-php-behavior/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 15:46:42 +0000</pubDate>
		<dc:creator>Ardy Dedase</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[geeks]]></category>
		<category><![CDATA[oddity]]></category>
		<category><![CDATA[php code]]></category>

		<guid isPermaLink="false">http://webscepter.com/?p=84</guid>
		<description><![CDATA[This post about the oddity on how PHP converts float to integer. This is not new to most of the PHP geeks out there, but I just want to point this out to those who are not aware of this &#8230;<p class="read-more"><a href="http://webscepter.com/a-weird-php-behavior/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>This post about the oddity on how PHP converts float to integer. This is not new to most of the PHP geeks out there, but I just want to point this out to those who are not aware of this yet. You may or may not tackle this in the future, but it&#8217;s worth knowing about.</p>
<p>See the PHP code below:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">0.7</span> <span style="color: #339933;">+</span> <span style="color:#800080;">0.1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>At first look, what&#8217;ll come to your mind is that the output will be &#8217;8&#8242;. But that&#8217;s not the actual output. If you&#8217;ll try to run it &#8211; the output is &#8217;7&#8242;.<br />
That&#8217;s not all, try:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">0.6</span> <span style="color: #339933;">+</span> <span style="color:#800080;">0.1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp;<span style="color: #666666; font-style: italic;">//outputs 7</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">0.8</span> <span style="color: #339933;">+</span> <span style="color:#800080;">0.1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//outputs 9</span></div></div>
<p>See the result? Okay, so that sums it up. <img src='http://webscepter.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d84').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d84" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;submitHeadline=A+weird+PHP+behavior&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;title=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;title=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;title=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;bm_description=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;T=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;title=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;title=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+A+weird+PHP+behavior+@+http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwebscepter.com%2Fa-weird-php-behavior%2F&amp;t=A+weird+PHP+behavior" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://webscepter.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d84').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d84').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://webscepter.com/a-weird-php-behavior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

 Served from: webscepter.com @ 2013-05-19 03:42:08 by W3 Total Cache -->