<?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>HyperHawk &#187; PHP</title>
	<atom:link href="http://notes.hyperhawk.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://notes.hyperhawk.com</link>
	<description>Development Notes</description>
	<lastBuildDate>Thu, 27 May 2010 19:08:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP.ini Timezone</title>
		<link>http://notes.hyperhawk.com/php/php-ini-timezone-420.htm</link>
		<comments>http://notes.hyperhawk.com/php/php-ini-timezone-420.htm#comments</comments>
		<pubDate>Thu, 27 May 2010 19:08:22 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=420</guid>
		<description><![CDATA[EST Example:
date.timezone = "America/New_York"
]]></description>
			<content:encoded><![CDATA[<p>EST Example:<br />
<code>date.timezone = "America/New_York"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/php-ini-timezone-420.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing APC and eAccelerator for PHP</title>
		<link>http://notes.hyperhawk.com/php/installing-apc-and-eaccelerator-for-php-410.htm</link>
		<comments>http://notes.hyperhawk.com/php/installing-apc-and-eaccelerator-for-php-410.htm#comments</comments>
		<pubDate>Thu, 20 May 2010 21:43:15 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=410</guid>
		<description><![CDATA[Examples done on Ubuntu 9.04
Installing and Configuring APC:

#apt-get update
#apt-get install php5-dev
#apt-get install php-pear
#apt-get install apache2-threaded-dev
#apt-get install make
#pecl install APC
Add to php.ini:
extension=apc.so
may need to disable zend optimizer (or install as zend optimizer extension)
;zend_extension=/dir/ZendOptimizer.so
Usage:
apc_store("my_key",$obj,3600);
$cached_obj=apc_fetch("my_key");
Installing and Configuring eAccelerator
#cd /tmp/
#wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
#tar xvjf eaccelerator-0.9.5.3.tar.bz2
#cd eaccelerator-0.9.5.3
#phpize
#./configure --with-eaccelerator-shared-memory
#make
#make install
#mkdir /var/cache/eaccelerator
#chmod 777 /var/cache/eaccelerator
add to php.ini:

;eAccelerator configuration
extension="eaccelerator.so"
eaccelerator.shm_size        [...]]]></description>
			<content:encoded><![CDATA[<p>Examples done on Ubuntu 9.04</p>
<p><b>Installing and Configuring APC:</b><br />
<code><br />
#apt-get update<br />
#apt-get install php5-dev<br />
#apt-get install php-pear<br />
#apt-get install apache2-threaded-dev<br />
#apt-get install make<br />
#pecl install APC</code><br />
Add to php.ini:<br />
<code>extension=apc.so</code><br />
may need to disable zend optimizer (or install as zend optimizer extension)<br />
<code>;zend_extension=/dir/ZendOptimizer.so</code><br />
Usage:<br />
<code>apc_store("my_key",$obj,3600);<br />
$cached_obj=apc_fetch("my_key");</code></p>
<p><b>Installing and Configuring eAccelerator</b><br />
<code>#cd /tmp/<br />
#wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2<br />
#tar xvjf eaccelerator-0.9.5.3.tar.bz2<br />
#cd eaccelerator-0.9.5.3<br />
#phpize<br />
#./configure --with-eaccelerator-shared-memory<br />
#make<br />
#make install<br />
#mkdir /var/cache/eaccelerator<br />
#chmod 777 /var/cache/eaccelerator</code><br />
add to php.ini:<br />
<code><br />
;eAccelerator configuration<br />
extension="eaccelerator.so"<br />
eaccelerator.shm_size           = "16"<br />
eaccelerator.cache_dir          = "/var/cache/eaccelerator"<br />
eaccelerator.enable             = "1"<br />
eaccelerator.optimizer          = "1"<br />
eaccelerator.check_mtime        = "1"<br />
eaccelerator.debug              = "0"<br />
eaccelerator.filter             = ""<br />
eaccelerator.shm_max            = "0"<br />
eaccelerator.shm_ttl            = "0"<br />
eaccelerator.shm_prune_period   = "0"<br />
eaccelerator.shm_only           = "0"<br />
eaccelerator.compress           = "1"<br />
eaccelerator.compress_level     = "9"</code></p>
<p>Usage:<br />
<code>eaccelerator_put("my_key",serialize($obj),3600);<br />
$cached_obj=unserialize(eaccelerator_get("my_key"));</code></p>
<p>Restart apache2</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/installing-apc-and-eaccelerator-for-php-410.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Extend Session Timeout</title>
		<link>http://notes.hyperhawk.com/php/php-extend-session-timeout-385.htm</link>
		<comments>http://notes.hyperhawk.com/php/php-extend-session-timeout-385.htm#comments</comments>
		<pubDate>Mon, 10 May 2010 20:57:53 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=385</guid>
		<description><![CDATA[Edit session.gc_maxlifetime param in php.ini file:
session.gc_maxlifetime = 1440
]]></description>
			<content:encoded><![CDATA[<p>Edit session.gc_maxlifetime param in php.ini file:<br />
<code>session.gc_maxlifetime = 1440</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/php-extend-session-timeout-385.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unicode data in a Unicode-only collation</title>
		<link>http://notes.hyperhawk.com/php/unicode-data-in-a-unicode-only-collation-342.htm</link>
		<comments>http://notes.hyperhawk.com/php/unicode-data-in-a-unicode-only-collation-342.htm#comments</comments>
		<pubDate>Thu, 15 Apr 2010 17:50:48 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=342</guid>
		<description><![CDATA[PHP Error on MSSQL query:
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library
Edit /etc/freetds/freetds.conf (Ubuntu)
uncomment line:
;tds version = 4.2
and change to:
tds version = 8.0
]]></description>
			<content:encoded><![CDATA[<p>PHP Error on MSSQL query:<br />
<b>Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library</b></p>
<p>Edit /etc/freetds/freetds.conf (Ubuntu)<br />
uncomment line:<br />
<code>;tds version = 4.2</code><br />
and change to:<br />
<code>tds version = 8.0</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/unicode-data-in-a-unicode-only-collation-342.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generic Object</title>
		<link>http://notes.hyperhawk.com/php/generic-object-107.htm</link>
		<comments>http://notes.hyperhawk.com/php/generic-object-107.htm#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:52:58 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=107</guid>
		<description><![CDATA[class GenericObj {
function __call($method, $args) {
$var = strtolower(substr($method, 4, 1)) . substr($method, 5);
switch (substr($method, 0, 4)) {
case "pull": return $this->{$var}; break;
case "push": $this->{$var} = $args[0]; break;
} // switch
} // call
} // GenericObj
]]></description>
			<content:encoded><![CDATA[<p><code>class GenericObj {<br />
function __call($method, $args) {<br />
$var = strtolower(substr($method, 4, 1)) . substr($method, 5);<br />
switch (substr($method, 0, 4)) {<br />
case "pull": return $this->{$var}; break;<br />
case "push": $this->{$var} = $args[0]; break;<br />
} // switch<br />
} // call<br />
} // GenericObj</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/generic-object-107.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Truncate Function</title>
		<link>http://notes.hyperhawk.com/php/truncate-function-98.htm</link>
		<comments>http://notes.hyperhawk.com/php/truncate-function-98.htm#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:45:13 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=98</guid>
		<description><![CDATA[public function truncate($str, $limit, $break = " ", $pad = "...") {
                                if(strlen($str) > $limit) {
         [...]]]></description>
			<content:encoded><![CDATA[<p><code>public function truncate($str, $limit, $break = " ", $pad = "...") {<br />
                                if(strlen($str) > $limit) {<br />
                                                $str = substr($str, 0, $limit);<br />
                                                if(false !== ($breakpoint = strrpos($str, $break))) {<br />
                                                                $str = substr($str, 0, $breakpoint);<br />
                                                } // if<br />
                                                $str = $str . $pad;<br />
                                } // if<br />
                                return($str);<br />
                } // truncate</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/truncate-function-98.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Time Zone</title>
		<link>http://notes.hyperhawk.com/php/php-time-zone-3.htm</link>
		<comments>http://notes.hyperhawk.com/php/php-time-zone-3.htm#comments</comments>
		<pubDate>Fri, 02 Oct 2009 00:30:28 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=3</guid>
		<description><![CDATA[Set PHP time zone:
date_default_timezone_set('America/New_York');
]]></description>
			<content:encoded><![CDATA[<p>Set PHP time zone:</p>
<p><code>date_default_timezone_set('America/New_York');</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/php-time-zone-3.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replace Image Color</title>
		<link>http://notes.hyperhawk.com/php/replace-image-color-63.htm</link>
		<comments>http://notes.hyperhawk.com/php/replace-image-color-63.htm#comments</comments>
		<pubDate>Sun, 16 Aug 2009 20:17:27 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=63</guid>
		<description><![CDATA[$imgname = "img.gif";
$im = imagecreatefromgif ($imgname);
$index = imagecolorclosest ( $im, 2,2,254 ); // get White COlor
imagecolorset($im,$index,255,255,255); // SET NEW COLOR
$imgname2 = "result.gif";
imagegif($im, $imgname); // save image as gifimagedestroy($im);
echo("origin image: &#60;img src="\"".$imgname."\" /&#62;");
echo("new image: &#60;img src="\"".$imgname2."\" /&#62;");

]]></description>
			<content:encoded><![CDATA[<p><code>$imgname = "img.gif";<br />
$im = imagecreatefromgif ($imgname);<br />
$index = imagecolorclosest ( $im, 2,2,254 ); // get White COlor<br />
imagecolorset($im,$index,255,255,255); // SET NEW COLOR<br />
$imgname2 = "result.gif";<br />
imagegif($im, $imgname); // save image as gifimagedestroy($im);<br />
echo("origin image: &lt;img src="\"".$imgname."\" /&gt;");<br />
echo("new image: &lt;img src="\"".$imgname2."\" /&gt;");<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/replace-image-color-63.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replace Email</title>
		<link>http://notes.hyperhawk.com/php/replace-email-71.htm</link>
		<comments>http://notes.hyperhawk.com/php/replace-email-71.htm#comments</comments>
		<pubDate>Mon, 10 Aug 2009 20:23:33 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=71</guid>
		<description><![CDATA[$pattern='&#124;(\S+)\@(.*)\.(\S+)&#124;is';
$msg=preg_replace($pattern, '< a href="mailto:$1@$2.$3">$1@$2.$3< /a >', $msg);
]]></description>
			<content:encoded><![CDATA[<p><code>$pattern='|(\S+)\@(.*)\.(\S+)|is';<br />
$msg=preg_replace($pattern, '< a href="mailto:$1@$2.$3">$1@$2.$3< /a >', $msg);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/replace-email-71.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replace URL</title>
		<link>http://notes.hyperhawk.com/php/replace-url-67.htm</link>
		<comments>http://notes.hyperhawk.com/php/replace-url-67.htm#comments</comments>
		<pubDate>Mon, 10 Aug 2009 20:22:06 +0000</pubDate>
		<dc:creator>HyperHawk</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://notes.hyperhawk.com/?p=67</guid>
		<description><![CDATA[$pattern='&#124;http://(\S+)&#124;is';
$msg=preg_replace($pattern, '< a href="http://$1" target="_blank">http://$1< /a >', $msg);
]]></description>
			<content:encoded><![CDATA[<p><code>$pattern='|http://(\S+)|is';<br />
$msg=preg_replace($pattern, '< a href="http://$1" target="_blank">http://$1< /a >', $msg);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.hyperhawk.com/php/replace-url-67.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

