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

<channel>
	<title>KAT CODE</title>
	<atom:link href="http://www.katcode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.katcode.com</link>
	<description>Joomla, css, javascript, php etc... tutorials and reference</description>
	<lastBuildDate>Tue, 14 May 2013 05:19:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>PHP exec() Error Codes</title>
		<link>http://www.katcode.com/php-exec-error-codes/</link>
		<comments>http://www.katcode.com/php-exec-error-codes/#comments</comments>
		<pubDate>Mon, 13 May 2013 22:43:06 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1570</guid>
		<description><![CDATA[These are what the exec() error codes mean that are returned in third parameter of exec(). 1 &#8211; Catchall for general errors. 2 &#8211; Misuse of shell builtins. 126 - Command invoked cannot execute. A permission or command not executable problem. 127 - Command not found. 128 - Invalid argument to exit. Exit takes only [...]]]></description>
			<content:encoded><![CDATA[<p>These are what the exec() error codes mean that are returned in third parameter of exec().</p>
<p>1 &#8211; Catchall for general errors.<br />
2 &#8211; Misuse of shell builtins.<br />
126	- Command invoked cannot execute. A permission or command not executable problem.<br />
127	- Command not found.<br />
128	- Invalid argument to exit. Exit takes only integer range 0 &#8211; 255.<br />
128+n &#8211; Fatal error signal &#8220;n&#8221;.<br />
130	- Script terminated by Control-C.<br />
255* &#8211; Exit status out of range. Exit takes only integer range 0 &#8211; 255</p>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/php-exec-error-codes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Sublime Text 2 for Fedora 17 and 18</title>
		<link>http://www.katcode.com/install-sublime-text-2-for-fedora-17-and-18/</link>
		<comments>http://www.katcode.com/install-sublime-text-2-for-fedora-17-and-18/#comments</comments>
		<pubDate>Fri, 10 May 2013 20:21:16 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1563</guid>
		<description><![CDATA[yum-config-manager &#8211;add-repo http://repo.cloudhike.com/sublime2/fedora/sublime2.repo yum-config-manager &#8211;enable yum install sublime-text]]></description>
			<content:encoded><![CDATA[<p>yum-config-manager &#8211;add-repo http://repo.cloudhike.com/sublime2/fedora/sublime2.repo</p>
<p>yum-config-manager &#8211;enable</p>
<p>yum install sublime-text</p>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/install-sublime-text-2-for-fedora-17-and-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configure Pidgin to Connect to Google Talk</title>
		<link>http://www.katcode.com/configure-pidgin-to-connect-to-google-talk/</link>
		<comments>http://www.katcode.com/configure-pidgin-to-connect-to-google-talk/#comments</comments>
		<pubDate>Fri, 10 May 2013 20:18:18 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1561</guid>
		<description><![CDATA[In the Modify Account dialog Basic tab settings: Protocol: XMPP Username: //is the username portion of your email Domain: gmail.com Resource: Home Advanced tab settings: Connection security: Use old-style SSL Connect port: 443 Connect server: talk.google.com File transfer proxies: proxy.eu.jabber.org]]></description>
			<content:encoded><![CDATA[<p>In the Modify Account dialog</p>
<p>Basic tab settings:</p>
<p>Protocol: XMPP<br />
Username:     //is the username portion of your email<br />
Domain: gmail.com<br />
Resource: Home</p>
<p>Advanced tab settings:</p>
<p>Connection security: Use old-style SSL<br />
Connect port: 443<br />
Connect server: talk.google.com<br />
File transfer proxies: proxy.eu.jabber.org</p>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/configure-pidgin-to-connect-to-google-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Chrome Browser in Fedora</title>
		<link>http://www.katcode.com/installing-chrome-browser-in-fedora/</link>
		<comments>http://www.katcode.com/installing-chrome-browser-in-fedora/#comments</comments>
		<pubDate>Wed, 08 May 2013 20:25:38 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1548</guid>
		<description><![CDATA[The following will install a stable chromium release. 1) Create file /etc/yum.repos.d/fedora-chromium-stable.repo with this content. Create as root. [fedora-chromium-stable] name=Builds of the "stable" tag of the Chromium Web Browser baseurl=http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-$releasever/$basearch/ enabled=1 skip_if_unavailable=1 gpgcheck=0 [fedora-chromium-stable-source] name=Builds of the "stable" tag of the Chromium Web Browser - Source baseurl=http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-$releasever/SRPMS enabled=0 skip_if_unavailable=1 gpgcheck=0 2) Install sudo yum install [...]]]></description>
			<content:encoded><![CDATA[<p>The following will install a stable chromium release. </p>
<p>1) Create file /etc/yum.repos.d/fedora-chromium-stable.repo with this content. Create as root.</p>
<pre class="prettyprint">
<code>
[fedora-chromium-stable]
name=Builds of the "stable" tag of the Chromium Web Browser
baseurl=http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-$releasever/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=0

[fedora-chromium-stable-source]
name=Builds of the "stable" tag of the Chromium Web Browser - Source
baseurl=http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=0
</code>
</pre>
<p>2) Install</p>
<p>sudo yum install chromium -y</p>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/installing-chrome-browser-in-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Sublime Text Settings</title>
		<link>http://www.katcode.com/useful-sublime-text-settings/</link>
		<comments>http://www.katcode.com/useful-sublime-text-settings/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 18:56:36 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Sublime Text]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1515</guid>
		<description><![CDATA[Go to Preferences -> Settings Default // Set to true to removing trailing white space on save &#8220;trim_trailing_white_space_on_save&#8221;: true, // Auto wrap at column 80 &#8220;wrap_width&#8221;: 80, // Show ruler at column 80 &#8220;rulers&#8221;: [80], // Set to true to insert spaces when tab is pressed &#8220;translate_tabs_to_spaces&#8221;: true, // Set line ending to unix style [...]]]></description>
			<content:encoded><![CDATA[<p>Go to Preferences -> Settings Default</p>
<p>// Set to true to removing trailing white space on save<br />
&#8220;trim_trailing_white_space_on_save&#8221;: true,</p>
<p>// Auto wrap at column 80<br />
&#8220;wrap_width&#8221;: 80,</p>
<p>// Show ruler at column 80<br />
&#8220;rulers&#8221;: [80],</p>
<p>// Set to true to insert spaces when tab is pressed<br />
&#8220;translate_tabs_to_spaces&#8221;: true,</p>
<p>// Set line ending to unix style<br />
&#8220;default_line_ending&#8221;: &#8220;LF&#8221;,</p>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/useful-sublime-text-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Url safe base64 encoding and decoding in PHP</title>
		<link>http://www.katcode.com/url-safe-base64-encoding-in-php/</link>
		<comments>http://www.katcode.com/url-safe-base64-encoding-in-php/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 22:10:56 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1395</guid>
		<description><![CDATA[Whenever passing base64 encoded strings in url should always urlencode or do the following which replaces characters that should not be in a query string value with safe characters so query string will not be malformed. When you use the encode method must also use the decode method to convert those characters back to the [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever passing base64 encoded strings in url should always urlencode or do the following which replaces characters that should not be in a query string value with safe characters so query string will not be malformed. When you use the encode method must also use the decode method to convert those characters back to the original.</p>
<pre class="prettyprint">
<code>
       /**
         * Custom base64 encoding. Replace unsafe url chars
         *
         * @param string $val
         * @return string
         */
        static function base64_url_encode($val) {

            return strtr(base64_encode($val), '+/=', '-_,');

        }

        /**
         * Custom base64 decode. Replace custom url safe values with normal
         * base64 characters before decoding.
         *
         * @param string $val
         * @return string
         */
        static function base64_url_decode($val) {

            return base64_decode(strtr($val, '-_,', '+/='));

        }
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/url-safe-base64-encoding-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Opening window into tab with window.open() in Chrome</title>
		<link>http://www.katcode.com/opening-into-tab-with-window-open/</link>
		<comments>http://www.katcode.com/opening-into-tab-with-window-open/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 01:17:36 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1387</guid>
		<description><![CDATA[Use this method when you need to open a new window into a tab and not into a popup window through javascript. This should work in most browsers if settings have not been altered. function open_in_tab(url) { var win = window.open(url, '_blank'); win.focus(); } Opening window into tab after Ajax Call window.open() will only open [...]]]></description>
			<content:encoded><![CDATA[<p>Use this method when you need to open a new window into a tab and not into a popup window through javascript. This should work in most browsers if settings have not been altered.</p>
<pre class="prettyprint">
<code>
function open_in_tab(url) {
   var win = window.open(url, '_blank');
   win.focus();
}
</code>
</pre>
<p><strong>Opening window into tab after Ajax Call</strong></p>
<p>window.open() will only open into a tab if it&#8217;s result of direct user action. Must make javascript think clicking button is the result of button click after the ajax call. Danger of running ajax synchronously is page can freeze waiting for the request. You can open a window into a tab after an AJAX call with the following:</p>
<pre class="prettyprint">
<code>
$('#btn').on("click", function(){
    $.ajax({
      type: 'POST',
      url: "ajax.php",
      data: {action: 'update'},
      dataType: 'json',
      context: document.body,
      async:false,   //Send Synchronously
      success: function(resp){
         if(resp.success) {
        	window.open('http://google.com'); //Will open into a tab
         }
      }
    });

})
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/opening-into-tab-with-window-open/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom File Upload Error Messages</title>
		<link>http://www.katcode.com/custom-file-upload-error-messages/</link>
		<comments>http://www.katcode.com/custom-file-upload-error-messages/#comments</comments>
		<pubDate>Thu, 21 Feb 2013 22:08:40 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1379</guid>
		<description><![CDATA[You can set custom error messages using the built-in php upload error constants. http://www.php.net/manual/en/features.file-upload.errors.php $upload_errors = array ( UPLOAD_ERR_OK =&#62; 'No errors.', UPLOAD_ERR_INI_SIZE =&#62; 'Larger then upload_max_filesize.', UPLOAD_ERR_FORM_SIZE =&#62; 'File size is to large!', UPLOAD_ERR_PARTIAL =&#62; 'Resume partially uploaded!', UPLOAD_ERR_NO_FILE =&#62; 'You must upload a resume!', UPLOAD_ERR_NO_TMP_DIR =&#62; 'Temporary directory does not exist!', UPLOAD_ERR_CANT_WRITE =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>You can set custom error messages using the built-in php upload error constants.</p>
<p>http://www.php.net/manual/en/features.file-upload.errors.php</p>
<pre class="prettyprint">
<code>
$upload_errors = array (
      UPLOAD_ERR_OK         =&gt; 'No errors.',
      UPLOAD_ERR_INI_SIZE   =&gt; 'Larger then upload_max_filesize.',
      UPLOAD_ERR_FORM_SIZE  =&gt; 'File size is to large!',
      UPLOAD_ERR_PARTIAL    =&gt; 'Resume partially uploaded!',
      UPLOAD_ERR_NO_FILE    =&gt; 'You must upload a resume!',
      UPLOAD_ERR_NO_TMP_DIR =&gt; 'Temporary directory does not exist!',
      UPLOAD_ERR_CANT_WRITE =&gt; "Can't write to disk!",
      UPLOAD_ERR_EXTENSION  =&gt; 'File upload stopped by extension!'
);

......

// After form post get file info
$file = $_FILES['uploaded_file'];

// If there was an error during upload then display custom message
 if ($file['error'] != 0) {
     echo $upload_errors[$file['error']]);
 }
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/custom-file-upload-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extracting Current Page Handle Using Javascript Location Object</title>
		<link>http://www.katcode.com/extracting-current-page-handle-using-javascript-location-object/</link>
		<comments>http://www.katcode.com/extracting-current-page-handle-using-javascript-location-object/#comments</comments>
		<pubDate>Tue, 05 Feb 2013 00:16:20 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1371</guid>
		<description><![CDATA[This will extract just the file name portion of the current page. //e.g. location.href = www.domain.com/example.php console_log(location.pathname.substring(1)); //displays: example.php]]></description>
			<content:encoded><![CDATA[<p>This will extract just the file name portion of the current page.</p>
<pre class="prettyprint">
<code>
//e.g. location.href = www.domain.com/example.php
console_log(location.pathname.substring(1));
//displays: example.php
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/extracting-current-page-handle-using-javascript-location-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove all whitespace (tabs, returns and space) from string in PHP</title>
		<link>http://www.katcode.com/remove-all-whitespace-tabs-returns-and-space-from-string-in-php/</link>
		<comments>http://www.katcode.com/remove-all-whitespace-tabs-returns-and-space-from-string-in-php/#comments</comments>
		<pubDate>Tue, 15 Jan 2013 17:46:13 +0000</pubDate>
		<dc:creator>Andy Nagai</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.katcode.com/?p=1367</guid>
		<description><![CDATA[$site_name = preg_replace('/\s+/', '', $profile_name);]]></description>
			<content:encoded><![CDATA[<pre class="prettyprint">
<code>
$site_name = preg_replace('/\s+/', '', $profile_name);
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.katcode.com/remove-all-whitespace-tabs-returns-and-space-from-string-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
