<?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>spechal.com &#187; PHP</title>
	<atom:link href="http://spechal.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://spechal.com</link>
	<description>[spesh-uhl]</description>
	<lastBuildDate>Sat, 24 Dec 2011 03:41:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Installing php-ffmpeg on CentOS 5.x</title>
		<link>http://spechal.com/2011/07/25/installing-php-ffmpeg-on-centos-5-x/</link>
		<comments>http://spechal.com/2011/07/25/installing-php-ffmpeg-on-centos-5-x/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 16:24:58 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[phpize]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=305</guid>
		<description><![CDATA[This can be a pain due to a bug in the ffpmeg_frame.c file &#8230; here are the commands to get up and going yum -y install ffmpeg ffmpeg-devel wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download tar jxvf ffmpeg-php-0.6.0.tbz2 sed -i 's/PIX_FMT_RGBA32/PIX_FMT_RGBA/g' ffmpeg-php-0.6.0/ffmpeg_frame.c cd ffmpeg-php-0.6.0 &#038;&#038; &#8230; <a href="http://spechal.com/2011/07/25/installing-php-ffmpeg-on-centos-5-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This can be a pain due to a bug in the ffpmeg_frame.c file &#8230; here are the commands to get up and going</p>
<pre>yum -y install ffmpeg ffmpeg-devel
wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download
tar jxvf ffmpeg-php-0.6.0.tbz2
sed -i 's/PIX_FMT_RGBA32/PIX_FMT_RGBA/g' ffmpeg-php-0.6.0/ffmpeg_frame.c
cd ffmpeg-php-0.6.0 &#038;&#038; phpize
./configure &#038;&#038; make &#038;&#038; make install
echo 'extension=ffmpeg.so' > /etc/php.d/ffmpeg.ini &#038;&#038; /etc/init.d/httpd restart
php -v &#038;&#038; php -m | grep ffmpeg
</pre>
<p>In this process you:<br />
use yum to install ffmpeg and the ffmpeg development files<br />
download php-ffmepg from sourceforge and extract it<br />
apply the bug fix to the ffmpeg_frace.c file<br />
change directories to the php-ffmpeg directory and phpize the module<br />
configure, make and install the shared object (extension)<br />
add the extension to the loaded php extensions<br />
restart apache and verify no errors are shown on php startup and that ffmepg is loaded</p>
<p>If all is well, you should see your version of PHP with the copyrights on 3 lines and the last line showing ffmpeg</p>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2011/07/25/installing-php-ffmpeg-on-centos-5-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery wdCalendar Plugin: Expected ajax return</title>
		<link>http://spechal.com/2011/03/09/jquery-wdcalendar-plugin-expected-ajax-return/</link>
		<comments>http://spechal.com/2011/03/09/jquery-wdcalendar-plugin-expected-ajax-return/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 00:56:42 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=195</guid>
		<description><![CDATA[This plugin isn&#8217;t documented very well, so I figured I would post the bits and pieces I had issues with and hopefully help someone out. First thing I needed to do was move all the functions into a class and &#8230; <a href="http://spechal.com/2011/03/09/jquery-wdcalendar-plugin-expected-ajax-return/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This plugin isn&#8217;t documented very well, so I figured I would post the bits and pieces I had issues with and hopefully help someone out.</p>
<p>First thing I needed to do was move all the functions into a class and refactor them, but first I wanted the data to still load in the calendar.</p>
<p>The data expected to be returned from the page listing the events is not defined on the <a title="wdCalendar jQuery Calendar Plugin" href="http://www.web-delicious.com/jquery-plugins-demo/wdCalendar/docs/index.htm" target="_blank">wdCalendar</a> project page, so here it is &#8230; in PHP.<br />
<code></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'events'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ret</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'events'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'123456'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// cal id</span>
			  <span style="color: #0000ff;">'Title'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// event title</span>
			  <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'m/d/Y H:i'</span><span style="color: #339933;">,</span> 
                                 <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'March 8 2011 12:00:00'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//start</span>
			  <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'m/d/Y H:i'</span><span style="color: #339933;">,</span> 
                                 <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'March 8 2011 16:00:00'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// end</span>
			  <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// all day event</span>
			  <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// more than one day</span>
			  <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// recurring</span>
			  <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// color</span>
			  <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// draggable</span>
			  <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// editabble</span>
			  <span style="color: #0000ff;">'Address'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// address</span>
			  <span style="color: #cc66cc;">0</span> <span style="color: #666666; font-style: italic;">// mark as attending</span>
			<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2011/03/09/jquery-wdcalendar-plugin-expected-ajax-return/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>phpize not found</title>
		<link>http://spechal.com/2009/12/06/phpize-not-found/</link>
		<comments>http://spechal.com/2009/12/06/phpize-not-found/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 02:12:57 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[phpize]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=106</guid>
		<description><![CDATA[This error is typically generated when you don&#8217;t have the PHP development libraries installed. Installing the libraries via repository is the easiest and quickest fix. For Fedora/Red Hat: yum install php5-dev For Ubuntu/Debian: apt-get install php5-dev]]></description>
			<content:encoded><![CDATA[<p>This error is typically generated when you don&#8217;t have the PHP development libraries installed.</p>
<p>Installing the libraries via repository is the easiest and quickest fix.</p>
<p>For Fedora/Red Hat:<br />
yum install php5-dev</p>
<p>For Ubuntu/Debian:<br />
apt-get install php5-dev</p>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/12/06/phpize-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python MySQL Associative Array</title>
		<link>http://spechal.com/2009/11/27/python-mysql-associative-array/</link>
		<comments>http://spechal.com/2009/11/27/python-mysql-associative-array/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:26:04 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=87</guid>
		<description><![CDATA[By default, the MySQLdb module to access a MySQL database returns the data as an integer indexed array. Sometimes this is not desirable and an associative array is preferred, such as the mysql_fetch_assoc function in PHP. In addition, we will &#8230; <a href="http://spechal.com/2009/11/27/python-mysql-associative-array/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>By default, the MySQLdb module to access a MySQL database returns the data as an integer indexed array.  Sometimes this is not desirable and an associative array is preferred, such as the mysql_fetch_assoc function in PHP.  In addition, we will be using the pprint module which is similar PHP&#8217;s print_r</p>
<p>Here is the Python equivalent:</p>
<pre class="python" name="code">
import MySQLdb
import pprint
# connect to the database here
db = MySQLdb.connect(...)
c = db.cursor(cursorclass=MySQLdb.cursors.DictCursor)
query = "SELECT `name`, `address` FROM `table`"
c.execute(query)
rows = c.fetchall()
c.close()
pprint.pprint(rows) # i.e. print_r($rows)
</pre>
<p>Hope that helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/27/python-mysql-associative-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP function to validate MySQL UUID or GUID</title>
		<link>http://spechal.com/2009/11/15/php-function-to-validate-mysql-uuid-or-guid/</link>
		<comments>http://spechal.com/2009/11/15/php-function-to-validate-mysql-uuid-or-guid/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:59:51 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=30</guid>
		<description><![CDATA[/** * Function to validate a generated GUID / UUID * @param string $guid GUID * @return bool */ function validGUID($guid){ return preg_match('#^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$#', $guid); }]]></description>
			<content:encoded><![CDATA[<pre class="php">/**
   *  Function to validate a generated GUID / UUID
   *  @param string $guid GUID
   *  @return bool
   */
  function validGUID($guid){
    return preg_match('#^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$#', $guid);
  }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/15/php-function-to-validate-mysql-uuid-or-guid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP function to emulate MySQL UUID</title>
		<link>http://spechal.com/2009/11/15/php-function-to-emulate-mysql-uuid/</link>
		<comments>http://spechal.com/2009/11/15/php-function-to-emulate-mysql-uuid/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:58:15 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=28</guid>
		<description><![CDATA[/** * uuid * * uuid() simply replicates MySQL's UUID function, which returns a 36 * character &#34;random&#34; hash (32 alphanumeric, 4 dashes). * @return string */ function uuid(){ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) &#124; &#8230; <a href="http://spechal.com/2009/11/15/php-function-to-emulate-mysql-uuid/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre class="php" name="code">
/**
   *  uuid
   *
   *  uuid() simply replicates MySQL's UUID function, which returns a 36
   *  character &quot;random&quot; hash (32 alphanumeric, 4 dashes).
   *  @return string
   */
  function uuid(){
    return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
      mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
      mt_rand(0, 0x0fff) | 0x4000,
      mt_rand(0, 0x3fff) | 0x8000,
      mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
  }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/15/php-function-to-emulate-mysql-uuid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP function to emulate Excel NormSInv</title>
		<link>http://spechal.com/2009/11/15/php-function-to-emulate-excel-normsinv/</link>
		<comments>http://spechal.com/2009/11/15/php-function-to-emulate-excel-normsinv/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 15:58:56 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[emulator]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=14</guid>
		<description><![CDATA[&#60;?php function NormSInv($p){ $a1 = -39.6968302866538; $a2 = 220.946098424521; $a3 = -275.928510446969; $a4 = 138.357751867269; $a5 = -30.6647980661472; $a6 = 2.50662827745924; $b1 = -54.4760987982241; $b2 = 161.585836858041; $b3 = -155.698979859887; $b4 = 66.8013118877197; $b5 = -13.2806815528857; $c1 = -7.78489400243029E-03; $c2 &#8230; <a href="http://spechal.com/2009/11/15/php-function-to-emulate-excel-normsinv/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre class="php">&lt;?php

function NormSInv($p){
   $a1 = -39.6968302866538; $a2 = 220.946098424521; $a3 = -275.928510446969;
   $a4 = 138.357751867269; $a5 = -30.6647980661472; $a6 = 2.50662827745924;
   $b1 = -54.4760987982241; $b2 = 161.585836858041; $b3 = -155.698979859887;
   $b4 = 66.8013118877197; $b5 = -13.2806815528857; $c1 = -7.78489400243029E-03;
   $c2 = -0.322396458041136; $c3 = -2.40075827716184, $c4 = -2.54973253934373;
   $c5 = 4.37466414146497; $c6 = 2.93816398269878; $d1 = 7.78469570904146E-03
   $d2 = 0.32246712907004; $d3 = 2.445134137143; $d4 = 3.75440866190742;
   $p_low = 0.02425; $p_high = 1 - $p_low;
   $q = 0.0; $r = 0.0;
   if($p &lt; 0 || $p &gt; 1){
      throw new Exception("NormSInv: Argument out of range.");
   } else if($p &lt; $p_low){
      $q = pow(-2 * log($p), 2);
      $NormSInv = ((((($c1 * $q + $c2) * $q + $c3) * $q + $c4) * $q + $c5) * $q + $c6) /
         (((($d1 * $q + $d2) * $q + $d3) * $q + $d4) * $q + 1);
    } else if($p &lt;= $p_high){
      $q = $p - 0.5; $r = $q * $q;
      $NormSInv = ((((($a1 * $r + $a2) * $r + $a3) * $r + $a4) * $r + $a5) * $r + $a6) * $q /
         ((((($b1 * $r + $b2) * $r + $b3) * $r + $b4) * $r + $b5) * $r + 1);
    } else {
      $q = pow(-2 * log(1 - $p), 2);
      $NormSInv = -((((($c1 * $q + $c2) * $q + $c3) * $q + $c4) * $q + $c5) * $q + $c6) /
         (((($d1 * $q + $d2) * $q + $d3) * $q + $d4) * $q + 1);
    }
    return $NormSInv;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/15/php-function-to-emulate-excel-normsinv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

